code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public int getTabIndex(final WComponent content) {
List<WTab> tabs = getTabs();
final int count = tabs.size();
for (int i = 0; i < count; i++) {
WTab tab = tabs.get(i);
if (content == tab.getContent()) {
return i;
}
}
return -1;
} | java |
private int clientIndexToTabIndex(final int clientIndex) {
int childCount = getTotalTabs();
int serverIndex = clientIndex;
for (int i = 0; i <= serverIndex && i < childCount; i++) {
if (!isTabVisible(i)) {
serverIndex++;
}
}
return serverIndex;
} | java |
public String getGroupName() {
if (TabSetType.ACCORDION.equals(getType())) {
CollapsibleGroup group = getComponentModel().group;
return (group == null ? null : group.getGroupName());
}
return null;
} | java |
private WMenu buildColumnMenu(final WText selectedMenuText) {
WMenu menu = new WMenu(WMenu.MenuType.COLUMN);
menu.setSelectMode(SelectMode.SINGLE);
menu.setRows(8);
StringTreeNode root = getOrgHierarchyTree();
mapColumnHierarchy(menu, root, selectedMenuText);
// Demonstrate different menu modes
getSubMe... | java |
private StringTreeNode getOrgHierarchyTree() {
// Hierarchical data in a flat format.
// If an Object array contains 1 String element, it is a leaf node.
// Else an Object array contains 1 String element + object arrays and is a branch node.
Object[] data = new Object[]{
"Australia",
new Object[]{"ACT"},
... | java |
private StringTreeNode buildOrgHierarchyTree(final Object[] data) {
StringTreeNode childNode = new StringTreeNode((String) data[0]);
if (data.length > 1) {
for (int i = 1; i < data.length; i++) {
childNode.add(buildOrgHierarchyTree((Object[]) data[i]));
}
}
return childNode;
} | java |
private WSubMenu getSubMenuByText(final String text, final WComponent node) {
if (node instanceof WSubMenu) {
WSubMenu subMenu = (WSubMenu) node;
if (text.equals(subMenu.getText())) {
return subMenu;
}
for (MenuItem item : subMenu.getMenuItems()) {
WSubMenu result = getSubMenuByText(text, item);
... | java |
@Deprecated
public static Size intToSize(final int convert) {
// NOTE: no zero size margin in the old versions.
if (convert <= 0) {
return null;
}
if (convert <= MAX_SMALL) {
return Size.SMALL;
}
if (convert <= MAX_MED) {
return Size.MEDIUM;
}
if (convert <= MAX_LARGE) {
return Size.LARGE;
... | java |
@Deprecated
public static int sizeToInt(final Size size) {
if (size == null) {
return -1;
}
switch (size) {
case ZERO:
return 0;
case SMALL:
return MAX_SMALL;
case MEDIUM:
return MAX_MED;
case LARGE:
return MAX_LARGE;
default:
return COMMON_XL;
}
} | java |
public void removeTag(Reference reference, String tag) {
getResourceFactory()
.getApiResource("/tag/" + reference.toURLFragment())
.queryParam("text", tag).delete();
} | java |
public List<TagReference> getTagsOnAppWithText(int appId, String text) {
return getResourceFactory()
.getApiResource("/tag/app/" + appId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | java |
public List<TagReference> getTagsOnOrgWithText(int orgId, String text) {
return getResourceFactory()
.getApiResource("/tag/org/" + orgId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | java |
public List<TagReference> getTagsOnSpaceWithText(int spaceId, String text) {
return getResourceFactory()
.getApiResource("/tag/space/" + spaceId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | java |
public void addTab(final WComponent card, final String name) {
WContainer titledCard = new WContainer();
WText title = new WText("<b>[" + name + "]:</b><br/>");
title.setEncodeText(false);
titledCard.add(title);
titledCard.add(card);
deck.add(titledCard);
final TabButton button = new TabButton(name, tit... | java |
public static void main(final String[] args) throws Exception {
// Set the logger to use the text area logger
System.setProperty("org.apache.commons.logging.Log",
"com.github.bordertech.wcomponents.lde.StandaloneLauncher$TextAreaLogger");
// Set the port number to a random port
Configuration internalWCompo... | java |
private void readFields() {
plain.setText(tf1.getText());
mandatory.setText(tf2.getText());
readOnly.setText(tf3.getText());
disabled.setText(tf4.getText());
width.setText(tf5.getText());
} | java |
public void setSource(final String sourceText) {
String formattedSource;
if (sourceText == null) {
formattedSource = "";
} else {
formattedSource = WebUtilities.encode(sourceText); // XML escape content
}
source.setText(formattedSource);
} | java |
public static void main(final String[] args)
throws Exception {
// Use jetty to run the servlet.
Server server = new Server();
SocketConnector connector = new SocketConnector();
connector.setMaxIdleTime(0);
connector.setPort(8080);
server.addConnector(connector);
WebAppContext context = new WebAppCon... | java |
@Override
public boolean isDisabled() {
if (isFlagSet(ComponentModel.DISABLED_FLAG)) {
return true;
}
MenuContainer container = WebUtilities.getAncestorOfClass(MenuContainer.class, this);
if (container instanceof Disableable && ((Disableable) container).isDisabled()) {
return true;
}
return false;
... | java |
@Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
// If current ajax trigger, process menu for current selections
if (AjaxHelper.isCurrentAjaxTrigger(this)) {... | java |
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
String targetId = getContent().getId();
String contentId = getId() + "-content";
switch (getComponentModel().mode) {
case LAZY: {
getContent().setVisible(isOpen());
AjaxHelper.registerCont... | java |
@Override
public String getValueAsString() {
String result = null;
String[] inputs = getValue();
if (inputs != null && inputs.length > 0) {
StringBuffer stringValues = new StringBuffer();
for (int i = 0; i < inputs.length; i++) {
if (i > 0) {
stringValues.append(", ");
}
stringValues.a... | java |
@Override
public void serviceRequest(final Request request) {
// Get window id off the request
windowId = request.getParameter(WWindow.WWINDOW_REQUEST_PARAM_KEY);
if (windowId == null) {
super.serviceRequest(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.get... | java |
@Override
public void preparePaint(final Request request) {
if (windowId == null) {
super.preparePaint(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for... | java |
@Override
public void paint(final RenderContext renderContext) {
if (windowId == null) {
super.paint(renderContext);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component... | java |
private void paintPaginationDetails(final WTable table, final XmlStringBuilder xml) {
TableModel model = table.getTableModel();
xml.appendTagOpen("ui:pagination");
xml.appendAttribute("rows", model.getRowCount());
xml.appendOptionalAttribute("rowsPerPage", table.getRowsPerPage() > 0, table.
getRowsPerPage... | java |
private void paintSortDetails(final WTable table, final XmlStringBuilder xml) {
int col = table.getSortColumnIndex();
boolean ascending = table.isSortAscending();
xml.appendTagOpen("ui:sort");
if (col >= 0) {
// Allow for column order
int[] cols = table.getColumnOrder();
if (cols != null) {
for (... | java |
private void paintTableActions(final WTable table, final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
List<WButton> tableActions = table.getActions();
if (!tableActions.isEmpty()) {
boolean hasActions = false;
for (WButton button : tableActions) {
if (!button.... | java |
private void paintColumnHeading(final WTableColumn col, final boolean sortable,
final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
int width = col.getWidth();
Alignment align = col.getAlign();
xml.appendTagOpen("ui:th");
xml.appendOptionalAttribute("width", width ... | java |
public void updateUI() {
if (!Util.empty(panelContent.getText())) {
panelContentRO.setData(panelContent.getData());
} else {
panelContentRO.setText(SAMPLE_CONTENT);
}
panel.setType((WPanel.Type) panelType.getSelected());
String headingText = tfHeading.getText();
if (!Util.empty(tfHeading.getText()))... | java |
private void buildUI() {
buildTargetPanel();
buildConfigOptions();
add(new WHorizontalRule());
add(panel);
add(new WHorizontalRule());
// We need this reflection of the selected menu item just so we can reuse the menu from the
// MenuBarExample. It serves no purpose in this example so I am going to hide ... | java |
private void buildConfigOptions() {
WFieldLayout layout = new WFieldLayout(WFieldLayout.LAYOUT_STACKED);
layout.setMargin(new Margin(null, null, Size.LARGE, null));
layout.addField("Select a WPanel Type", panelType);
contentField = layout.addField("Panel content", panelContent);
headingField = layout.addField... | java |
private void buildTargetPanel() {
setUpUtilBar();
panel.add(utilBar);
panel.add(heading);
panel.add(panelContentRO);
panel.add(menu);
} | java |
private void setUpUtilBar() {
utilBar.setLayout(new ListLayout(ListLayout.Type.FLAT, ListLayout.Alignment.RIGHT, ListLayout.Separator.NONE, false));
WTextField selectOther = new WTextField();
selectOther.setToolTip("Enter text.");
utilBar.add(selectOther);
utilBar.add(new WButton("Go"));
utilBar.add(new WBu... | java |
@Override
public void serviceRequest(final Request request) {
// Get trigger id
String triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME);
if (triggerId == null) {
throw new SystemException("No AJAX trigger id to on request");
}
// Find the Component for this trigger
ComponentWithConte... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDecoratedLabel label = (WDecoratedLabel) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent head = label.getHead();
WComponent body = label.getBody();
WComponent tail = label.getTail();... | java |
public List<Comment> getComments(Reference reference) {
return getResourceFactory().getApiResource(
"/comment/" + reference.getType() + "/" + reference.getId())
.get(new GenericType<List<Comment>>() {
});
} | java |
public int addComment(Reference reference, CommentCreate comment,
boolean silent, boolean hook) {
return getResourceFactory()
.getApiResource(
"/comment/" + reference.getType() + "/"
+ reference.getId())
.queryParam("silent", silent ? "1" : "0")
.queryParam("hook", hook ? "1" : "0")
.... | java |
public void updateComment(int commentId, CommentUpdate comment) {
getResourceFactory().getApiResource("/comment/" + commentId)
.entity(comment, MediaType.APPLICATION_JSON_TYPE).put();
} | java |
@Override
public void render(final WComponent component, final RenderContext context) {
PrintWriter out = ((WebXmlRenderContext) context).getWriter();
// If we are debugging the layout, write markers so that the html
// designer can see where templates start and end.
boolean debugLayout = ConfigurationPropert... | java |
public void paintXml(final WComponent component, final Writer writer) {
if (LOG.isDebugEnabled()) {
LOG.debug("paintXml called for component class " + component.getClass());
}
String templateText = null;
if (component instanceof AbstractWComponent) {
AbstractWComponent abstractComp = ((AbstractWComponen... | java |
private void fillContext(final WComponent component,
final VelocityContext context, final Map<String, WComponent> componentsByKey) {
// Also make the component available under the "this" key.
context.put("this", component);
// Make the UIContext available under the "uicontext" key.
UIContext uic = UIContext... | java |
@Deprecated
protected void noTemplatePaintHtml(final WComponent component, final Writer writer) {
try {
writer.write("<!-- Start " + url + " not found -->\n");
new VelocityRenderer(NO_TEMPLATE_LAYOUT).paintXml(component, writer);
writer.write("<!-- End " + url + " (template not found) -->\n");
} catch (IO... | java |
private Template getTemplate(final WComponent component) {
String templateUrl = url;
if (templateUrl == null && component instanceof AbstractWComponent) {
templateUrl = ((AbstractWComponent) component).getTemplate();
}
if (templateUrl != null) {
try {
return VelocityEngineFactory.getVelocityEngine()... | java |
public List<StreamObject> getGlobalStream(Integer limit, Integer offset,
DateTime dateFrom, DateTime dateTo) {
return getStream("/stream/", limit, offset, dateFrom, dateTo);
} | java |
public List<StreamObjectV2> getGlobalStreamV2(Integer limit,
Integer offset, DateTime dateFrom, DateTime dateTo) {
return getStreamV2("/stream/v2/", limit, offset, dateFrom, dateTo);
} | java |
public List<StreamObjectV2> getAppStream(int appId, Integer limit,
Integer offset) {
return getStreamV2("/stream/app/" + appId + "/", limit, offset, null,
null);
} | java |
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request); //To change body of generated methods, choose Tools | Templates.
if (!isInitialised()) {
setInitialised(true);
setupVideo();
}
} | java |
private void setupVideo() {
video.setAutoplay(cbAutoPlay.isSelected());
video.setLoop(cbLoop.isSelected());
video.setMuted(!cbMute.isDisabled() && cbMute.isSelected());
video.setControls(cbControls.isSelected() ? WVideo.Controls.PLAY_PAUSE : WVideo.Controls.NATIVE);
video.setDisabled(cbControls.isSelected() &... | java |
@Override
public List<String> getHeadLines(final String type) {
ArrayList<String> lines = headers.get(type);
return lines == null ? null : Collections.unmodifiableList(lines);
} | java |
public void append(final Object text) {
if (text instanceof Message) {
append(translate(text), true);
} else if (text != null) {
append(text.toString(), true);
}
} | java |
public void append(final String string, final boolean encode) {
if (encode) {
appendOptional(WebUtilities.encode(string));
} else {
// unescaped content still has to be XML compliant.
write(HtmlToXMLUtil.unescapeToXML(string));
}
} | java |
private String translate(final Object messageObject) {
if (messageObject instanceof Message) {
Message message = (Message) messageObject;
return I18nUtilities.format(locale, message.getMessage(), (Object[]) message.getArgs());
} else if (messageObject != null) {
return I18nUtilities.format(locale, messageO... | java |
public static void addFileItem(final Map<String, FileItem[]> files, final String name, final FileItem item) {
if (files.containsKey(name)) {
// This field contains multiple values, append the new value to the existing values.
FileItem[] oldValues = files.get(name);
FileItem[] newValues = new FileItem[oldValu... | java |
public static void addParameter(final Map<String, String[]> parameters, final String name, final String value) {
if (parameters.containsKey(name)) {
// This field contains multiple values, append the new value to the existing values.
String[] oldValues = parameters.get(name);
String[] newValues = new String[... | java |
protected static void renderTagOpen(final WImage imageComponent, final XmlStringBuilder xml) {
// Check for alternative text on the image
String alternativeText = imageComponent.getAlternativeText();
if (alternativeText == null) {
alternativeText = "";
} else {
alternativeText = I18nUtilities.format(null... | java |
public static void issue(final WComponent comp, final String message) {
String debugMessage = message + ' ' + comp;
if (ConfigurationProperties.getIntegrityErrorMode()) {
throw new IntegrityException(debugMessage);
} else {
LogFactory.getLog(Integrity.class).warn(debugMessage);
}
} | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
AbstractWFieldIndicator fieldIndicator = (AbstractWFieldIndicator) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent validationTarget = fieldIndicator.getTargetComponent();
// no need t... | java |
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
// Check project versions for Wcomponents-examples and WComponents match
String egVersion = Config.getInstance().getString("wcomponents-examples.version");
String wcVersio... | java |
public void setInputWidth(final int inputWidth) {
if (inputWidth > 100) {
throw new IllegalArgumentException(
"inputWidth (" + inputWidth + ") cannot be greater than 100 percent.");
}
getOrCreateComponentModel().inputWidth = Math.max(0, inputWidth);
} | java |
private void setUp() {
addExamples("AJAX", ExampleData.AJAX_EXAMPLES);
addExamples("Form controls", ExampleData.FORM_CONTROLS);
addExamples("Feedback and indicators", ExampleData.FEEDBACK_AND_INDICATORS);
addExamples("Layout", ExampleData.LAYOUT_EXAMPLES);
addExamples("Menus", ExampleData.MENU_EXAMPLES);
ad... | java |
public void addExamples(final String groupName, final ExampleData[] entries) {
data.add(new ExampleMenuList(groupName, entries));
} | java |
public final ExampleData getSelectedExampleData() {
Set<String> allSelectedItems = getSelectedRows();
if (allSelectedItems == null || allSelectedItems.isEmpty()) {
return null;
}
for (String selectedItem : allSelectedItems) {
// Only interested in the first selected item as it is a single select list.
... | java |
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
setInitialised(true);
setTreeModel(new MenuTreeModel(data));
}
} | java |
private WPanel createPanelWithText(final String title, final String text) {
WPanel panel = new WPanel(WPanel.Type.CHROME);
panel.setTitleText(title);
WText textComponent = new WText(text);
textComponent.setEncodeText(false);
panel.add(textComponent);
return panel;
} | java |
public void setErrors(final List<Diagnostic> errors) {
if (errors != null) {
ValidationErrorsModel model = getOrCreateComponentModel();
for (Diagnostic error : errors) {
if (error.getSeverity() == Diagnostic.ERROR) {
model.errors.add(error);
}
}
}
} | java |
public List<GroupedDiagnositcs> getGroupedErrors() {
List<GroupedDiagnositcs> grouped = new ArrayList<>();
Diagnostic previousError = null;
GroupedDiagnositcs group = null;
for (Diagnostic theError : getErrors()) {
boolean isNewField = ((previousError == null) || (previousError.getContext() != theError.
... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDateField dateField = (WDateField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = dateField.isReadOnly();
Date date = dateField.getDate();
xml.appendTagOpen("ui:datefield"... | java |
public void updateUser(UserUpdate update) {
getResourceFactory().getApiResource("/user/")
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | java |
public <T, R> List<T> getProfileField(ProfileField<T, R> field) {
List<R> values = getResourceFactory().getApiResource(
"/user/profile/" + field.getName()).get(
new GenericType<List<R>>() {
});
List<T> formatted = new ArrayList<T>();
for (R value : values) {
formatted.add(field.parse(value));
}
... | java |
public void updateProfile(ProfileUpdate profile) {
getResourceFactory().getApiResource("/user/profile/")
.entity(profile, MediaType.APPLICATION_JSON_TYPE).put();
} | java |
public void updateProfile(ProfileFieldValues values) {
getResourceFactory().getApiResource("/user/profile/")
.entity(values, MediaType.APPLICATION_JSON_TYPE).put();
} | java |
public void setProperty(String key, boolean value) {
getResourceFactory()
.getApiResource("/user/property/" + key)
.entity(new PropertyValue(value),
MediaType.APPLICATION_JSON_TYPE).put();
} | java |
@Override
public final TableTreeNode getNodeAtLine(final int row) {
TableTreeNode node = root.next(); // the root node is never used
for (int index = 0; node != null && index < row; index++) {
node = node.next();
}
return node;
} | java |
@Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isPresent(request)) {
List<MenuItemSelectable> selectedItems = new ArrayList<>();
// Unfortunately, we need to recurse through all the... | java |
private void findSelections(final Request request, final MenuSelectContainer selectContainer,
final List<MenuItemSelectable> selections) {
// Don't bother checking disabled or invisible containers
if (!selectContainer.isVisible()
|| (selectContainer instanceof Disableable && ((Disableable) selectContainer).... | java |
private List<MenuItemSelectable> getSelectableItems(final MenuSelectContainer selectContainer) {
List<MenuItemSelectable> result = new ArrayList<>(selectContainer.getMenuItems().size());
SelectionMode selectionMode = selectContainer.getSelectionMode();
for (MenuItem item : selectContainer.getMenuItems()) {
i... | java |
private boolean isSelectable(final MenuItem item, final SelectionMode selectionMode) {
if (!(item instanceof MenuItemSelectable) || !item.isVisible()
|| (item instanceof Disableable && ((Disableable) item).isDisabled())) {
return false;
}
// SubMenus are only selectable in a column menu type
if (item i... | java |
@SafeVarargs
public final R in(T... values) {
expr().in(_name, (Object[]) values);
return _root;
} | java |
@Override
public void write(final char[] cbuf, final int off, final int len) throws IOException {
if (buffer == null) {
// Nothing to replace, just pass the data through
backing.write(cbuf, off, len);
} else {
for (int i = off; i < off + len; i++) {
buffer[bufferLen++] = cbuf[i];
if (bufferLen ==... | java |
private void writeBuf(final int endPos) throws IOException {
// If the stream is not closed, we only process half the buffer at once.
String searchTerm;
int pos = 0;
int lastWritePos = 0;
while (pos < endPos) {
searchTerm = findSearchStrings(pos);
if (searchTerm != null) {
if (lastWritePos != pos)... | java |
private String findSearchStrings(final int start) {
String longestMatch = null;
// Loop for each string
for (int i = 0; i < search.length; i++) {
// No point checking a String that's too long
if (start + search[i].length() > bufferLen) {
continue;
}
boolean found = true;
// Loop for each cha... | java |
public int createStatus(int spaceId, StatusCreate status) {
return getResourceFactory()
.getApiResource("/status/space/" + spaceId + "/")
.entity(status, MediaType.APPLICATION_JSON_TYPE)
.post(StatusCreateResponse.class).getId();
} | java |
public void updateStatus(int statusId, StatusUpdate update) {
getResourceFactory().getApiResource("/status/" + statusId)
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | java |
@Override
public synchronized void register(final String key, final WComponent ui) {
if (isRegistered(key)) {
throw new SystemException("Cannot re-register a component. Key = " + key);
}
registry.put(key, ui);
} | java |
private static Object loadUI(final String key) {
String classname = key.trim();
try {
Class<?> clas = Class.forName(classname);
if (WComponent.class.isAssignableFrom(clas)) {
Object instance = clas.newInstance();
LOG.debug("WComponent successfully loaded with class name \"" + classname + "\".");
... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WComponentGroup group = (WComponentGroup) component;
XmlStringBuilder xml = renderContext.getWriter();
List<WComponent> components = group.getComponents();
if (components != null && !components.isEmpty()) {
... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WSection section = (WSection) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean renderChildren = isRenderContent(section);
xml.appendTagOpen("ui:section");
xml.appendAttribute("id", comp... | java |
@Override
public void remove(final WComponent aChild) {
super.remove(aChild);
PanelModel model = getOrCreateComponentModel();
if (model.layoutConstraints == null) {
Map<WComponent, Serializable> defaultConstraints = ((PanelModel) getDefaultModel()).layoutConstraints;
if (defaultConstraints != null) {
... | java |
public Serializable getLayoutConstraints(final WComponent child) {
PanelModel model = getComponentModel();
if (model.layoutConstraints != null) {
return model.layoutConstraints.get(child);
}
return null;
} | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDefinitionList list = (WDefinitionList) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:definitionlist");
xml.appendAttribute("id", component.getId());
xml.appendOptional... | java |
private void addAlignedExample() {
add(new WHeading(HeadingLevel.H2, "WRow / WCol with column alignment"));
WRow alignedColsRow = new WRow();
add(alignedColsRow);
WColumn alignedCol = new WColumn();
alignedCol.setAlignment(WColumn.Alignment.LEFT);
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
... | java |
private WRow createRow(final int hgap, final int[] colWidths) {
WRow row = new WRow(hgap);
for (int i = 0; i < colWidths.length; i++) {
WColumn col = new WColumn(colWidths[i]);
WPanel box = new WPanel(WPanel.Type.BOX);
box.add(new WText(colWidths[i] + "%"));
col.add(box);
row.add(col);
}
return... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTextField textField = (WTextField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = textField.isReadOnly();
xml.appendTagOpen("ui:textfield");
xml.appendAttribute("id", compo... | java |
private String getTag(final BorderLayoutConstraint constraint) {
switch (constraint) {
case EAST:
return "ui:east";
case NORTH:
return "ui:north";
case SOUTH:
return "ui:south";
case WEST:
return "ui:west";
case CENTER:
default:
return "ui:center";
}
} | java |
private void paintChildrenWithConstraint(
final List<Duplet<WComponent, BorderLayoutConstraint>> children,
final WebXmlRenderContext renderContext, final BorderLayoutConstraint constraint) {
String containingTag = null;
XmlStringBuilder xml = renderContext.getWriter();
final int size = children.size();
... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTextArea textArea = (WTextArea) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = textArea.isReadOnly();
xml.appendTagOpen("ui:textarea");
xml.appendAttribute("id", component.g... | java |
private StringBuilder extractJavaDoc(final String source) {
int docStart = source.indexOf("/**");
int docEnd = source.indexOf("*/", docStart);
int classStart = source.indexOf("public class");
int author = source.indexOf("@author");
int since = source.indexOf("@since");
if (classStart == -1) {
classStart... | java |
private void stripAsterisk(final StringBuilder javaDoc) {
int index = javaDoc.indexOf("*");
while (index != -1) {
javaDoc.replace(index, index + 1, "");
index = javaDoc.indexOf("*");
}
} | java |
private String parseLink(final String link) {
String[] tokens = link.substring(7, link.length() - 1).split("\\s");
if (tokens.length == 1) {
return tokens[0];
}
StringBuilder result = new StringBuilder();
boolean parametersSeen = false;
boolean inParameters = false;
for (int index = 0; index < tokens... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.