id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
139,400 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/autocomplete/AutocompleteUtil.java | AutocompleteUtil.getCombinedForSection | public static String getCombinedForSection(final String sectionName, final String... args) {
return getCombinedAutocomplete(getNamedSection(sectionName), args);
} | java | public static String getCombinedForSection(final String sectionName, final String... args) {
return getCombinedAutocomplete(getNamedSection(sectionName), args);
} | [
"public",
"static",
"String",
"getCombinedForSection",
"(",
"final",
"String",
"sectionName",
",",
"final",
"String",
"...",
"args",
")",
"{",
"return",
"getCombinedAutocomplete",
"(",
"getNamedSection",
"(",
"sectionName",
")",
",",
"args",
")",
";",
"}"
] | Combine autocomplete values into a single String suitable to apply to a named auto-fill section.
@param sectionName the name of the autocomplete section
@param args any other valid autocomplete values
@return a single attribute value useful to apply an autocomplete helper to a named section | [
"Combine",
"autocomplete",
"values",
"into",
"a",
"single",
"String",
"suitable",
"to",
"apply",
"to",
"a",
"named",
"auto",
"-",
"fill",
"section",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/autocomplete/AutocompleteUtil.java#L116-L118 |
139,401 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WComponentGroup.java | WComponentGroup.addToGroup | public void addToGroup(final T component) {
ComponentGroupModel model = getOrCreateComponentModel();
model.components.add(component);
MemoryUtil.checkSize(model.components.size(), this.getClass().getSimpleName());
} | java | public void addToGroup(final T component) {
ComponentGroupModel model = getOrCreateComponentModel();
model.components.add(component);
MemoryUtil.checkSize(model.components.size(), this.getClass().getSimpleName());
} | [
"public",
"void",
"addToGroup",
"(",
"final",
"T",
"component",
")",
"{",
"ComponentGroupModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"model",
".",
"components",
".",
"add",
"(",
"component",
")",
";",
"MemoryUtil",
".",
"checkSize",
"(",
"model",
".",
"components",
".",
"size",
"(",
")",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}"
] | Add a component to this group.
@param component the component to add. | [
"Add",
"a",
"component",
"to",
"this",
"group",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WComponentGroup.java#L25-L29 |
139,402 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/registry/UIRegistryAmicableImpl.java | UIRegistryAmicableImpl.loadUI | private static WComponent loadUI(final String key) {
String classname = key.trim();
try {
Class<?> clas = Class.forName(classname);
if (WComponent.class.isAssignableFrom(clas)) {
WComponent instance = (WComponent) clas.newInstance();
LOG.debug("WComponent successfully loaded with class name \"" + classname + "\".");
return instance;
} else {
throw new SystemException(
"The resource with the name \"" + classname + "\" is not a WComponent.");
}
} catch (Exception ex) {
LOG.error("Unable to load a WComponent using the resource name \"" + classname + "\"",
ex);
// Are we in developer friendly error mode?
boolean friendly = ConfigurationProperties.getDeveloperErrorHandling();
FatalErrorPageFactory factory = Factory.newInstance(FatalErrorPageFactory.class);
WComponent errorPage = factory.createErrorPage(friendly, ex);
return errorPage;
}
} | java | private static WComponent loadUI(final String key) {
String classname = key.trim();
try {
Class<?> clas = Class.forName(classname);
if (WComponent.class.isAssignableFrom(clas)) {
WComponent instance = (WComponent) clas.newInstance();
LOG.debug("WComponent successfully loaded with class name \"" + classname + "\".");
return instance;
} else {
throw new SystemException(
"The resource with the name \"" + classname + "\" is not a WComponent.");
}
} catch (Exception ex) {
LOG.error("Unable to load a WComponent using the resource name \"" + classname + "\"",
ex);
// Are we in developer friendly error mode?
boolean friendly = ConfigurationProperties.getDeveloperErrorHandling();
FatalErrorPageFactory factory = Factory.newInstance(FatalErrorPageFactory.class);
WComponent errorPage = factory.createErrorPage(friendly, ex);
return errorPage;
}
} | [
"private",
"static",
"WComponent",
"loadUI",
"(",
"final",
"String",
"key",
")",
"{",
"String",
"classname",
"=",
"key",
".",
"trim",
"(",
")",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"clas",
"=",
"Class",
".",
"forName",
"(",
"classname",
")",
";",
"if",
"(",
"WComponent",
".",
"class",
".",
"isAssignableFrom",
"(",
"clas",
")",
")",
"{",
"WComponent",
"instance",
"=",
"(",
"WComponent",
")",
"clas",
".",
"newInstance",
"(",
")",
";",
"LOG",
".",
"debug",
"(",
"\"WComponent successfully loaded with class name \\\"\"",
"+",
"classname",
"+",
"\"\\\".\"",
")",
";",
"return",
"instance",
";",
"}",
"else",
"{",
"throw",
"new",
"SystemException",
"(",
"\"The resource with the name \\\"\"",
"+",
"classname",
"+",
"\"\\\" is not a WComponent.\"",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Unable to load a WComponent using the resource name \\\"\"",
"+",
"classname",
"+",
"\"\\\"\"",
",",
"ex",
")",
";",
"// Are we in developer friendly error mode?",
"boolean",
"friendly",
"=",
"ConfigurationProperties",
".",
"getDeveloperErrorHandling",
"(",
")",
";",
"FatalErrorPageFactory",
"factory",
"=",
"Factory",
".",
"newInstance",
"(",
"FatalErrorPageFactory",
".",
"class",
")",
";",
"WComponent",
"errorPage",
"=",
"factory",
".",
"createErrorPage",
"(",
"friendly",
",",
"ex",
")",
";",
"return",
"errorPage",
";",
"}",
"}"
] | Attempts to load a UI using the key as a class name.
@param key The registration key.
@return A WComponent if one could be loaded from the classpath, else an ErrorPage WComponent containing the
problem. | [
"Attempts",
"to",
"load",
"a",
"UI",
"using",
"the",
"key",
"as",
"a",
"class",
"name",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/registry/UIRegistryAmicableImpl.java#L107-L133 |
139,403 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WListExample.java | WListExample.addList | private void addList(final WList.Type type, final WList.Separator separator,
final boolean renderBorder, final WComponent renderer) {
WList list = new WList(type);
if (separator != null) {
list.setSeparator(separator);
}
list.setRenderBorder(renderBorder);
list.setRepeatedComponent(renderer);
add(list);
lists.add(list);
} | java | private void addList(final WList.Type type, final WList.Separator separator,
final boolean renderBorder, final WComponent renderer) {
WList list = new WList(type);
if (separator != null) {
list.setSeparator(separator);
}
list.setRenderBorder(renderBorder);
list.setRepeatedComponent(renderer);
add(list);
lists.add(list);
} | [
"private",
"void",
"addList",
"(",
"final",
"WList",
".",
"Type",
"type",
",",
"final",
"WList",
".",
"Separator",
"separator",
",",
"final",
"boolean",
"renderBorder",
",",
"final",
"WComponent",
"renderer",
")",
"{",
"WList",
"list",
"=",
"new",
"WList",
"(",
"type",
")",
";",
"if",
"(",
"separator",
"!=",
"null",
")",
"{",
"list",
".",
"setSeparator",
"(",
"separator",
")",
";",
"}",
"list",
".",
"setRenderBorder",
"(",
"renderBorder",
")",
";",
"list",
".",
"setRepeatedComponent",
"(",
"renderer",
")",
";",
"add",
"(",
"list",
")",
";",
"lists",
".",
"add",
"(",
"list",
")",
";",
"}"
] | Adds a list to the example.
@param type the list type.
@param separator the list item separator.
@param renderBorder true to render a border around the list, false otherwise.
@param renderer the component to use to render items in the list. | [
"Adds",
"a",
"list",
"to",
"the",
"example",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WListExample.java#L60-L73 |
139,404 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMenuRenderer.java | WMenuRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WMenu menu = (WMenu) component;
XmlStringBuilder xml = renderContext.getWriter();
int rows = menu.getRows();
xml.appendTagOpen("ui:menu");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (menu.getType()) {
case BAR:
xml.appendAttribute("type", "bar");
break;
case FLYOUT:
xml.appendAttribute("type", "flyout");
break;
case TREE:
xml.appendAttribute("type", "tree");
break;
case COLUMN:
xml.appendAttribute("type", "column");
break;
default:
throw new IllegalStateException("Invalid menu type: " + menu.getType());
}
xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true");
xml.appendOptionalAttribute("hidden", menu.isHidden(), "true");
xml.appendOptionalAttribute("rows", rows > 0, rows);
switch (menu.getSelectionMode()) {
case NONE:
break;
case SINGLE:
xml.appendAttribute("selectMode", "single");
break;
case MULTIPLE:
xml.appendAttribute("selectMode", "multiple");
break;
default:
throw new IllegalStateException("Invalid select mode: " + menu.getSelectMode());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(menu, renderContext);
paintChildren(menu, renderContext);
xml.appendEndTag("ui:menu");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WMenu menu = (WMenu) component;
XmlStringBuilder xml = renderContext.getWriter();
int rows = menu.getRows();
xml.appendTagOpen("ui:menu");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (menu.getType()) {
case BAR:
xml.appendAttribute("type", "bar");
break;
case FLYOUT:
xml.appendAttribute("type", "flyout");
break;
case TREE:
xml.appendAttribute("type", "tree");
break;
case COLUMN:
xml.appendAttribute("type", "column");
break;
default:
throw new IllegalStateException("Invalid menu type: " + menu.getType());
}
xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true");
xml.appendOptionalAttribute("hidden", menu.isHidden(), "true");
xml.appendOptionalAttribute("rows", rows > 0, rows);
switch (menu.getSelectionMode()) {
case NONE:
break;
case SINGLE:
xml.appendAttribute("selectMode", "single");
break;
case MULTIPLE:
xml.appendAttribute("selectMode", "multiple");
break;
default:
throw new IllegalStateException("Invalid select mode: " + menu.getSelectMode());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(menu, renderContext);
paintChildren(menu, renderContext);
xml.appendEndTag("ui:menu");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WMenu",
"menu",
"=",
"(",
"WMenu",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"int",
"rows",
"=",
"menu",
".",
"getRows",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:menu\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"switch",
"(",
"menu",
".",
"getType",
"(",
")",
")",
"{",
"case",
"BAR",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"bar\"",
")",
";",
"break",
";",
"case",
"FLYOUT",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"flyout\"",
")",
";",
"break",
";",
"case",
"TREE",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"tree\"",
")",
";",
"break",
";",
"case",
"COLUMN",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"column\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalStateException",
"(",
"\"Invalid menu type: \"",
"+",
"menu",
".",
"getType",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"disabled\"",
",",
"menu",
".",
"isDisabled",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"menu",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"rows\"",
",",
"rows",
">",
"0",
",",
"rows",
")",
";",
"switch",
"(",
"menu",
".",
"getSelectionMode",
"(",
")",
")",
"{",
"case",
"NONE",
":",
"break",
";",
"case",
"SINGLE",
":",
"xml",
".",
"appendAttribute",
"(",
"\"selectMode\"",
",",
"\"single\"",
")",
";",
"break",
";",
"case",
"MULTIPLE",
":",
"xml",
".",
"appendAttribute",
"(",
"\"selectMode\"",
",",
"\"multiple\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalStateException",
"(",
"\"Invalid select mode: \"",
"+",
"menu",
".",
"getSelectMode",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"// Render margin",
"MarginRendererUtil",
".",
"renderMargin",
"(",
"menu",
",",
"renderContext",
")",
";",
"paintChildren",
"(",
"menu",
",",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:menu\"",
")",
";",
"}"
] | Paints the given WMenu.
@param component the WMenu to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WMenu",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMenuRenderer.java#L22-L82 |
139,405 | podio/podio-java | src/main/java/com/podio/search/SearchAPI.java | SearchAPI.searchInApp | public SearchInAppResponse searchInApp(int appId, String query, Boolean counts,
Boolean highlights, Integer limit, Integer offset, ReferenceTypeSearchInApp refType,
String searchFields) {
WebResource resource = getResourceFactory().getApiResource("/search/app/" + appId + "/v2");
resource = resource.queryParam("query", query);
if (counts != null) {
resource = resource.queryParam("counts", counts ? "1" : "0");
}
if (highlights != null) {
resource = resource.queryParam("highlights", highlights ? "1" : "0");
}
if (limit != null) {
resource = resource.queryParam("limit", limit.toString());
}
if (offset != null) {
resource = resource.queryParam("offset", offset.toString());
}
if (refType != null) {
resource = resource.queryParam("ref_type", refType.toString());
}
if (searchFields != null && !searchFields.equals("")) {
resource = resource.queryParam("search_fields", searchFields);
}
return resource.get(SearchInAppResponse.class);
} | java | public SearchInAppResponse searchInApp(int appId, String query, Boolean counts,
Boolean highlights, Integer limit, Integer offset, ReferenceTypeSearchInApp refType,
String searchFields) {
WebResource resource = getResourceFactory().getApiResource("/search/app/" + appId + "/v2");
resource = resource.queryParam("query", query);
if (counts != null) {
resource = resource.queryParam("counts", counts ? "1" : "0");
}
if (highlights != null) {
resource = resource.queryParam("highlights", highlights ? "1" : "0");
}
if (limit != null) {
resource = resource.queryParam("limit", limit.toString());
}
if (offset != null) {
resource = resource.queryParam("offset", offset.toString());
}
if (refType != null) {
resource = resource.queryParam("ref_type", refType.toString());
}
if (searchFields != null && !searchFields.equals("")) {
resource = resource.queryParam("search_fields", searchFields);
}
return resource.get(SearchInAppResponse.class);
} | [
"public",
"SearchInAppResponse",
"searchInApp",
"(",
"int",
"appId",
",",
"String",
"query",
",",
"Boolean",
"counts",
",",
"Boolean",
"highlights",
",",
"Integer",
"limit",
",",
"Integer",
"offset",
",",
"ReferenceTypeSearchInApp",
"refType",
",",
"String",
"searchFields",
")",
"{",
"WebResource",
"resource",
"=",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/search/app/\"",
"+",
"appId",
"+",
"\"/v2\"",
")",
";",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"query\"",
",",
"query",
")",
";",
"if",
"(",
"counts",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"counts\"",
",",
"counts",
"?",
"\"1\"",
":",
"\"0\"",
")",
";",
"}",
"if",
"(",
"highlights",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"highlights\"",
",",
"highlights",
"?",
"\"1\"",
":",
"\"0\"",
")",
";",
"}",
"if",
"(",
"limit",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"limit\"",
",",
"limit",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"offset",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"offset\"",
",",
"offset",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"refType",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"ref_type\"",
",",
"refType",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"searchFields",
"!=",
"null",
"&&",
"!",
"searchFields",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"search_fields\"",
",",
"searchFields",
")",
";",
"}",
"return",
"resource",
".",
"get",
"(",
"SearchInAppResponse",
".",
"class",
")",
";",
"}"
] | Searches in all items, files, and tasks in the application. The objects
will be returned sorted descending by the time the object had any update.
@param appId
The id of the app to be searched in
@param query
The text to search for
@param limit
The number of results to return; up to 20 results are returned in one call.
@param offset
The rank of the first search result to return (default=0)
@param refType
The type of objects to search for
@param counts
True if the total counts should be returned
@param highlights
True if the highlights for each result should be returned, false otherwise.
@param searchFields
The list of fields to search in. Can f.ex. be used to limit the search to the "title" field.
@return All items | [
"Searches",
"in",
"all",
"items",
"files",
"and",
"tasks",
"in",
"the",
"application",
".",
"The",
"objects",
"will",
"be",
"returned",
"sorted",
"descending",
"by",
"the",
"time",
"the",
"object",
"had",
"any",
"update",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/search/SearchAPI.java#L38-L62 |
139,406 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMultiSelectRenderer.java | WMultiSelectRenderer.renderOption | private void renderOption(final WMultiSelect listBox, final Object option,
final int optionIndex, final XmlStringBuilder html,
final List<?> selections, final boolean renderSelectionsOnly) {
boolean selected = selections.contains(option);
if (selected || !renderSelectionsOnly) {
// Get Code and Desc
String code = listBox.getCode(option, optionIndex);
String desc = listBox.getDesc(option, optionIndex);
// Render Option
html.appendTagOpen("ui:option");
html.appendAttribute("value", code);
html.appendOptionalAttribute("selected", selected, "true");
html.appendClose();
html.appendEscaped(desc);
html.appendEndTag("ui:option");
}
} | java | private void renderOption(final WMultiSelect listBox, final Object option,
final int optionIndex, final XmlStringBuilder html,
final List<?> selections, final boolean renderSelectionsOnly) {
boolean selected = selections.contains(option);
if (selected || !renderSelectionsOnly) {
// Get Code and Desc
String code = listBox.getCode(option, optionIndex);
String desc = listBox.getDesc(option, optionIndex);
// Render Option
html.appendTagOpen("ui:option");
html.appendAttribute("value", code);
html.appendOptionalAttribute("selected", selected, "true");
html.appendClose();
html.appendEscaped(desc);
html.appendEndTag("ui:option");
}
} | [
"private",
"void",
"renderOption",
"(",
"final",
"WMultiSelect",
"listBox",
",",
"final",
"Object",
"option",
",",
"final",
"int",
"optionIndex",
",",
"final",
"XmlStringBuilder",
"html",
",",
"final",
"List",
"<",
"?",
">",
"selections",
",",
"final",
"boolean",
"renderSelectionsOnly",
")",
"{",
"boolean",
"selected",
"=",
"selections",
".",
"contains",
"(",
"option",
")",
";",
"if",
"(",
"selected",
"||",
"!",
"renderSelectionsOnly",
")",
"{",
"// Get Code and Desc",
"String",
"code",
"=",
"listBox",
".",
"getCode",
"(",
"option",
",",
"optionIndex",
")",
";",
"String",
"desc",
"=",
"listBox",
".",
"getDesc",
"(",
"option",
",",
"optionIndex",
")",
";",
"// Render Option",
"html",
".",
"appendTagOpen",
"(",
"\"ui:option\"",
")",
";",
"html",
".",
"appendAttribute",
"(",
"\"value\"",
",",
"code",
")",
";",
"html",
".",
"appendOptionalAttribute",
"(",
"\"selected\"",
",",
"selected",
",",
"\"true\"",
")",
";",
"html",
".",
"appendClose",
"(",
")",
";",
"html",
".",
"appendEscaped",
"(",
"desc",
")",
";",
"html",
".",
"appendEndTag",
"(",
"\"ui:option\"",
")",
";",
"}",
"}"
] | Renders a single option within the list box.
@param listBox the list box being rendered.
@param option the option to render.
@param optionIndex the index of the option. OptionGroups are not counted.
@param html the XmlStringBuilder to paint to.
@param selections the list of selected options.
@param renderSelectionsOnly true to only render selected options, false to render all options. | [
"Renders",
"a",
"single",
"option",
"within",
"the",
"list",
"box",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMultiSelectRenderer.java#L96-L113 |
139,407 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DebugStructureInterceptor.java | DebugStructureInterceptor.paint | @Override
public void paint(final RenderContext renderContext) {
super.paint(renderContext);
if (!DebugUtil.isDebugFeaturesEnabled() || !(renderContext instanceof WebXmlRenderContext)) {
return;
}
XmlStringBuilder xml = ((WebXmlRenderContext) renderContext).getWriter();
xml.appendTag("ui:debug");
writeDebugInfo(getUI(), xml);
xml.appendEndTag("ui:debug");
} | java | @Override
public void paint(final RenderContext renderContext) {
super.paint(renderContext);
if (!DebugUtil.isDebugFeaturesEnabled() || !(renderContext instanceof WebXmlRenderContext)) {
return;
}
XmlStringBuilder xml = ((WebXmlRenderContext) renderContext).getWriter();
xml.appendTag("ui:debug");
writeDebugInfo(getUI(), xml);
xml.appendEndTag("ui:debug");
} | [
"@",
"Override",
"public",
"void",
"paint",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"super",
".",
"paint",
"(",
"renderContext",
")",
";",
"if",
"(",
"!",
"DebugUtil",
".",
"isDebugFeaturesEnabled",
"(",
")",
"||",
"!",
"(",
"renderContext",
"instanceof",
"WebXmlRenderContext",
")",
")",
"{",
"return",
";",
"}",
"XmlStringBuilder",
"xml",
"=",
"(",
"(",
"WebXmlRenderContext",
")",
"renderContext",
")",
".",
"getWriter",
"(",
")",
";",
"xml",
".",
"appendTag",
"(",
"\"ui:debug\"",
")",
";",
"writeDebugInfo",
"(",
"getUI",
"(",
")",
",",
"xml",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:debug\"",
")",
";",
"}"
] | Override paint to render additional information for debugging purposes.
@param renderContext the renderContext to send the output to. | [
"Override",
"paint",
"to",
"render",
"additional",
"information",
"for",
"debugging",
"purposes",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DebugStructureInterceptor.java#L30-L43 |
139,408 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DebugStructureInterceptor.java | DebugStructureInterceptor.writeDebugInfo | protected void writeDebugInfo(final WComponent component, final XmlStringBuilder xml) {
if (component != null && (component.isVisible() || component instanceof WInvisibleContainer)) {
xml.appendTagOpen("ui:debugInfo");
xml.appendAttribute("for", component.getId());
xml.appendAttribute("class", component.getClass().getName());
xml.appendOptionalAttribute("type", getType(component));
xml.appendClose();
xml.appendTagOpen("ui:debugDetail");
xml.appendAttribute("key", "defaultState");
xml.appendAttribute("value", component.isDefaultState());
xml.appendEnd();
xml.appendEndTag("ui:debugInfo");
if (component instanceof WRepeater) {
// special case for WRepeaters - we must paint the info for each row.
WRepeater repeater = (WRepeater) component;
List<UIContext> contexts = repeater.getRowContexts();
for (int i = 0; i < contexts.size(); i++) {
UIContextHolder.pushContext(contexts.get(i));
try {
writeDebugInfo(repeater.getRepeatedComponent(i), xml);
} finally {
UIContextHolder.popContext();
}
}
} else if (component instanceof WCardManager) {
writeDebugInfo(((WCardManager) component).getVisible(), xml);
} else if (component instanceof Container) {
final int size = ((Container) component).getChildCount();
for (int i = 0; i < size; i++) {
writeDebugInfo(((Container) component).getChildAt(i), xml);
}
}
}
} | java | protected void writeDebugInfo(final WComponent component, final XmlStringBuilder xml) {
if (component != null && (component.isVisible() || component instanceof WInvisibleContainer)) {
xml.appendTagOpen("ui:debugInfo");
xml.appendAttribute("for", component.getId());
xml.appendAttribute("class", component.getClass().getName());
xml.appendOptionalAttribute("type", getType(component));
xml.appendClose();
xml.appendTagOpen("ui:debugDetail");
xml.appendAttribute("key", "defaultState");
xml.appendAttribute("value", component.isDefaultState());
xml.appendEnd();
xml.appendEndTag("ui:debugInfo");
if (component instanceof WRepeater) {
// special case for WRepeaters - we must paint the info for each row.
WRepeater repeater = (WRepeater) component;
List<UIContext> contexts = repeater.getRowContexts();
for (int i = 0; i < contexts.size(); i++) {
UIContextHolder.pushContext(contexts.get(i));
try {
writeDebugInfo(repeater.getRepeatedComponent(i), xml);
} finally {
UIContextHolder.popContext();
}
}
} else if (component instanceof WCardManager) {
writeDebugInfo(((WCardManager) component).getVisible(), xml);
} else if (component instanceof Container) {
final int size = ((Container) component).getChildCount();
for (int i = 0; i < size; i++) {
writeDebugInfo(((Container) component).getChildAt(i), xml);
}
}
}
} | [
"protected",
"void",
"writeDebugInfo",
"(",
"final",
"WComponent",
"component",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"if",
"(",
"component",
"!=",
"null",
"&&",
"(",
"component",
".",
"isVisible",
"(",
")",
"||",
"component",
"instanceof",
"WInvisibleContainer",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:debugInfo\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"for\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"type\"",
",",
"getType",
"(",
"component",
")",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:debugDetail\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"key\"",
",",
"\"defaultState\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"value\"",
",",
"component",
".",
"isDefaultState",
"(",
")",
")",
";",
"xml",
".",
"appendEnd",
"(",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:debugInfo\"",
")",
";",
"if",
"(",
"component",
"instanceof",
"WRepeater",
")",
"{",
"// special case for WRepeaters - we must paint the info for each row.",
"WRepeater",
"repeater",
"=",
"(",
"WRepeater",
")",
"component",
";",
"List",
"<",
"UIContext",
">",
"contexts",
"=",
"repeater",
".",
"getRowContexts",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"contexts",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"UIContextHolder",
".",
"pushContext",
"(",
"contexts",
".",
"get",
"(",
"i",
")",
")",
";",
"try",
"{",
"writeDebugInfo",
"(",
"repeater",
".",
"getRepeatedComponent",
"(",
"i",
")",
",",
"xml",
")",
";",
"}",
"finally",
"{",
"UIContextHolder",
".",
"popContext",
"(",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"component",
"instanceof",
"WCardManager",
")",
"{",
"writeDebugInfo",
"(",
"(",
"(",
"WCardManager",
")",
"component",
")",
".",
"getVisible",
"(",
")",
",",
"xml",
")",
";",
"}",
"else",
"if",
"(",
"component",
"instanceof",
"Container",
")",
"{",
"final",
"int",
"size",
"=",
"(",
"(",
"Container",
")",
"component",
")",
".",
"getChildCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"writeDebugInfo",
"(",
"(",
"(",
"Container",
")",
"component",
")",
".",
"getChildAt",
"(",
"i",
")",
",",
"xml",
")",
";",
"}",
"}",
"}",
"}"
] | Writes debugging information for the given component.
@param component the component to write debugging information for.
@param xml the writer to send the debug output to. | [
"Writes",
"debugging",
"information",
"for",
"the",
"given",
"component",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DebugStructureInterceptor.java#L51-L91 |
139,409 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DebugStructureInterceptor.java | DebugStructureInterceptor.getType | private String getType(final WComponent component) {
for (Class<?> clazz = component.getClass(); clazz != null && WComponent.class.
isAssignableFrom(clazz); clazz = clazz.getSuperclass()) {
if ("com.github.bordertech.wcomponents".equals(clazz.getPackage().getName())) {
return clazz.getName();
}
}
return null;
} | java | private String getType(final WComponent component) {
for (Class<?> clazz = component.getClass(); clazz != null && WComponent.class.
isAssignableFrom(clazz); clazz = clazz.getSuperclass()) {
if ("com.github.bordertech.wcomponents".equals(clazz.getPackage().getName())) {
return clazz.getName();
}
}
return null;
} | [
"private",
"String",
"getType",
"(",
"final",
"WComponent",
"component",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"clazz",
"=",
"component",
".",
"getClass",
"(",
")",
";",
"clazz",
"!=",
"null",
"&&",
"WComponent",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
";",
"clazz",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
")",
"{",
"if",
"(",
"\"com.github.bordertech.wcomponents\"",
".",
"equals",
"(",
"clazz",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"clazz",
".",
"getName",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Tries to return the type of component.
@param component the component to determine the type of.
@return the component type, or null if the given component is not a core component. | [
"Tries",
"to",
"return",
"the",
"type",
"of",
"component",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DebugStructureInterceptor.java#L99-L108 |
139,410 | BorderTech/wcomponents | wcomponents-lde/src/main/java/com/github/bordertech/wcomponents/lde/LdeSessionUtil.java | LdeSessionUtil.deserializeSessionAttributes | public static void deserializeSessionAttributes(final HttpSession session) {
File file = new File(SERIALIZE_SESSION_NAME);
FileInputStream fis = null;
ObjectInputStream ois = null;
if (file.canRead()) {
try {
fis = new FileInputStream(file);
ois = new ObjectInputStream(fis);
List data = (List) ois.readObject();
for (Iterator i = data.iterator(); i.hasNext();) {
String key = (String) i.next();
Object value = i.next();
session.setAttribute(key, value);
}
} catch (Exception e) {
LOG.error("Failed to read serialized session from " + file, e);
} finally {
if (ois != null) {
StreamUtil.safeClose(ois);
} else {
StreamUtil.safeClose(fis);
}
}
} else {
LOG.warn("Unable to read serialized session from " + file);
}
} | java | public static void deserializeSessionAttributes(final HttpSession session) {
File file = new File(SERIALIZE_SESSION_NAME);
FileInputStream fis = null;
ObjectInputStream ois = null;
if (file.canRead()) {
try {
fis = new FileInputStream(file);
ois = new ObjectInputStream(fis);
List data = (List) ois.readObject();
for (Iterator i = data.iterator(); i.hasNext();) {
String key = (String) i.next();
Object value = i.next();
session.setAttribute(key, value);
}
} catch (Exception e) {
LOG.error("Failed to read serialized session from " + file, e);
} finally {
if (ois != null) {
StreamUtil.safeClose(ois);
} else {
StreamUtil.safeClose(fis);
}
}
} else {
LOG.warn("Unable to read serialized session from " + file);
}
} | [
"public",
"static",
"void",
"deserializeSessionAttributes",
"(",
"final",
"HttpSession",
"session",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"SERIALIZE_SESSION_NAME",
")",
";",
"FileInputStream",
"fis",
"=",
"null",
";",
"ObjectInputStream",
"ois",
"=",
"null",
";",
"if",
"(",
"file",
".",
"canRead",
"(",
")",
")",
"{",
"try",
"{",
"fis",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"ois",
"=",
"new",
"ObjectInputStream",
"(",
"fis",
")",
";",
"List",
"data",
"=",
"(",
"List",
")",
"ois",
".",
"readObject",
"(",
")",
";",
"for",
"(",
"Iterator",
"i",
"=",
"data",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"String",
"key",
"=",
"(",
"String",
")",
"i",
".",
"next",
"(",
")",
";",
"Object",
"value",
"=",
"i",
".",
"next",
"(",
")",
";",
"session",
".",
"setAttribute",
"(",
"key",
",",
"value",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to read serialized session from \"",
"+",
"file",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"ois",
"!=",
"null",
")",
"{",
"StreamUtil",
".",
"safeClose",
"(",
"ois",
")",
";",
"}",
"else",
"{",
"StreamUtil",
".",
"safeClose",
"(",
"fis",
")",
";",
"}",
"}",
"}",
"else",
"{",
"LOG",
".",
"warn",
"(",
"\"Unable to read serialized session from \"",
"+",
"file",
")",
";",
"}",
"}"
] | Attempts to deserialize the persisted session attributes into the given session.
@param session the session to restore the attributes to. | [
"Attempts",
"to",
"deserialize",
"the",
"persisted",
"session",
"attributes",
"into",
"the",
"given",
"session",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-lde/src/main/java/com/github/bordertech/wcomponents/lde/LdeSessionUtil.java#L48-L77 |
139,411 | BorderTech/wcomponents | wcomponents-lde/src/main/java/com/github/bordertech/wcomponents/lde/LdeSessionUtil.java | LdeSessionUtil.serializeSessionAttributes | public static synchronized void serializeSessionAttributes(final HttpSession session) {
if (session != null) {
File file = new File(SERIALIZE_SESSION_NAME);
if (!file.exists() || file.canWrite()) {
// Retrieve the session attributes
List data = new ArrayList();
for (Enumeration keyEnum = session.getAttributeNames();
keyEnum.hasMoreElements();) {
String attributeName = (String) keyEnum.nextElement();
Object attributeValue = session.getAttribute(attributeName);
if (attributeValue instanceof Serializable) {
data.add(attributeName);
data.add(attributeValue);
} else {
LOG.error(
"Skipping attribute \"" + attributeName
+ "\" as it is not Serializable");
}
}
// Write them to the file
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = new FileOutputStream(file);
oos = new ObjectOutputStream(fos);
oos.writeObject(data);
} catch (Exception e) {
LOG.error("Failed to write serialized session to " + file, e);
} finally {
if (oos != null) {
StreamUtil.safeClose(oos);
} else {
StreamUtil.safeClose(fos);
}
}
} else {
LOG.warn("Unable to write serialized session to " + file);
}
}
} | java | public static synchronized void serializeSessionAttributes(final HttpSession session) {
if (session != null) {
File file = new File(SERIALIZE_SESSION_NAME);
if (!file.exists() || file.canWrite()) {
// Retrieve the session attributes
List data = new ArrayList();
for (Enumeration keyEnum = session.getAttributeNames();
keyEnum.hasMoreElements();) {
String attributeName = (String) keyEnum.nextElement();
Object attributeValue = session.getAttribute(attributeName);
if (attributeValue instanceof Serializable) {
data.add(attributeName);
data.add(attributeValue);
} else {
LOG.error(
"Skipping attribute \"" + attributeName
+ "\" as it is not Serializable");
}
}
// Write them to the file
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = new FileOutputStream(file);
oos = new ObjectOutputStream(fos);
oos.writeObject(data);
} catch (Exception e) {
LOG.error("Failed to write serialized session to " + file, e);
} finally {
if (oos != null) {
StreamUtil.safeClose(oos);
} else {
StreamUtil.safeClose(fos);
}
}
} else {
LOG.warn("Unable to write serialized session to " + file);
}
}
} | [
"public",
"static",
"synchronized",
"void",
"serializeSessionAttributes",
"(",
"final",
"HttpSession",
"session",
")",
"{",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"SERIALIZE_SESSION_NAME",
")",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
"||",
"file",
".",
"canWrite",
"(",
")",
")",
"{",
"// Retrieve the session attributes",
"List",
"data",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"Enumeration",
"keyEnum",
"=",
"session",
".",
"getAttributeNames",
"(",
")",
";",
"keyEnum",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"String",
"attributeName",
"=",
"(",
"String",
")",
"keyEnum",
".",
"nextElement",
"(",
")",
";",
"Object",
"attributeValue",
"=",
"session",
".",
"getAttribute",
"(",
"attributeName",
")",
";",
"if",
"(",
"attributeValue",
"instanceof",
"Serializable",
")",
"{",
"data",
".",
"add",
"(",
"attributeName",
")",
";",
"data",
".",
"add",
"(",
"attributeValue",
")",
";",
"}",
"else",
"{",
"LOG",
".",
"error",
"(",
"\"Skipping attribute \\\"\"",
"+",
"attributeName",
"+",
"\"\\\" as it is not Serializable\"",
")",
";",
"}",
"}",
"// Write them to the file",
"FileOutputStream",
"fos",
"=",
"null",
";",
"ObjectOutputStream",
"oos",
"=",
"null",
";",
"try",
"{",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"oos",
"=",
"new",
"ObjectOutputStream",
"(",
"fos",
")",
";",
"oos",
".",
"writeObject",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to write serialized session to \"",
"+",
"file",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"oos",
"!=",
"null",
")",
"{",
"StreamUtil",
".",
"safeClose",
"(",
"oos",
")",
";",
"}",
"else",
"{",
"StreamUtil",
".",
"safeClose",
"(",
"fos",
")",
";",
"}",
"}",
"}",
"else",
"{",
"LOG",
".",
"warn",
"(",
"\"Unable to write serialized session to \"",
"+",
"file",
")",
";",
"}",
"}",
"}"
] | Serializes the session attributes of the given session.
@param session the session to persist. | [
"Serializes",
"the",
"session",
"attributes",
"of",
"the",
"given",
"session",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-lde/src/main/java/com/github/bordertech/wcomponents/lde/LdeSessionUtil.java#L84-L129 |
139,412 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StepCountUtil.java | StepCountUtil.incrementSessionStep | public static void incrementSessionStep(final UIContext uic) {
int step = uic.getEnvironment().getStep();
uic.getEnvironment().setStep(step + 1);
} | java | public static void incrementSessionStep(final UIContext uic) {
int step = uic.getEnvironment().getStep();
uic.getEnvironment().setStep(step + 1);
} | [
"public",
"static",
"void",
"incrementSessionStep",
"(",
"final",
"UIContext",
"uic",
")",
"{",
"int",
"step",
"=",
"uic",
".",
"getEnvironment",
"(",
")",
".",
"getStep",
"(",
")",
";",
"uic",
".",
"getEnvironment",
"(",
")",
".",
"setStep",
"(",
"step",
"+",
"1",
")",
";",
"}"
] | Increments the step that is recorded in session.
@param uic the current user's session | [
"Increments",
"the",
"step",
"that",
"is",
"recorded",
"in",
"session",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StepCountUtil.java#L48-L51 |
139,413 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StepCountUtil.java | StepCountUtil.getRequestStep | public static int getRequestStep(final Request request) {
String val = request.getParameter(Environment.STEP_VARIABLE);
if (val == null) {
return 0;
}
try {
return Integer.parseInt(val);
} catch (NumberFormatException ex) {
return -1;
}
} | java | public static int getRequestStep(final Request request) {
String val = request.getParameter(Environment.STEP_VARIABLE);
if (val == null) {
return 0;
}
try {
return Integer.parseInt(val);
} catch (NumberFormatException ex) {
return -1;
}
} | [
"public",
"static",
"int",
"getRequestStep",
"(",
"final",
"Request",
"request",
")",
"{",
"String",
"val",
"=",
"request",
".",
"getParameter",
"(",
"Environment",
".",
"STEP_VARIABLE",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"val",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"return",
"-",
"1",
";",
"}",
"}"
] | Retrieves the value of the step variable from the given request.
@param request the request being responded to.
@return the request step present in the request, or -1 on error. | [
"Retrieves",
"the",
"value",
"of",
"the",
"step",
"variable",
"from",
"the",
"given",
"request",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StepCountUtil.java#L59-L70 |
139,414 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StepCountUtil.java | StepCountUtil.isStepOnRequest | public static boolean isStepOnRequest(final Request request) {
String val = request.getParameter(Environment.STEP_VARIABLE);
return val != null;
} | java | public static boolean isStepOnRequest(final Request request) {
String val = request.getParameter(Environment.STEP_VARIABLE);
return val != null;
} | [
"public",
"static",
"boolean",
"isStepOnRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"String",
"val",
"=",
"request",
".",
"getParameter",
"(",
"Environment",
".",
"STEP_VARIABLE",
")",
";",
"return",
"val",
"!=",
"null",
";",
"}"
] | Checks if the step count is on the request.
@param request the request being responded to.
@return true if the step count is on the request | [
"Checks",
"if",
"the",
"step",
"count",
"is",
"on",
"the",
"request",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StepCountUtil.java#L78-L81 |
139,415 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StepCountUtil.java | StepCountUtil.isCachedContentRequest | public static boolean isCachedContentRequest(final Request request) {
// Get target id on request
String targetId = request.getParameter(Environment.TARGET_ID);
if (targetId == null) {
return false;
}
// Get target
ComponentWithContext targetWithContext = WebUtilities.getComponentById(targetId, true);
if (targetWithContext == null) {
return false;
}
// Check for caching key
WComponent target = targetWithContext.getComponent();
UIContextHolder.pushContext(targetWithContext.getContext());
try {
// TODO Look at implementing CacheableTarget interface
String key = null;
if (target instanceof WContent) {
key = ((WContent) target).getCacheKey();
} else if (target instanceof WImage) {
key = ((WImage) target).getCacheKey();
} else if (target instanceof WVideo) {
key = ((WVideo) target).getCacheKey();
} else if (target instanceof WAudio) {
key = ((WAudio) target).getCacheKey();
}
return !Util.empty(key);
} finally {
UIContextHolder.popContext();
}
} | java | public static boolean isCachedContentRequest(final Request request) {
// Get target id on request
String targetId = request.getParameter(Environment.TARGET_ID);
if (targetId == null) {
return false;
}
// Get target
ComponentWithContext targetWithContext = WebUtilities.getComponentById(targetId, true);
if (targetWithContext == null) {
return false;
}
// Check for caching key
WComponent target = targetWithContext.getComponent();
UIContextHolder.pushContext(targetWithContext.getContext());
try {
// TODO Look at implementing CacheableTarget interface
String key = null;
if (target instanceof WContent) {
key = ((WContent) target).getCacheKey();
} else if (target instanceof WImage) {
key = ((WImage) target).getCacheKey();
} else if (target instanceof WVideo) {
key = ((WVideo) target).getCacheKey();
} else if (target instanceof WAudio) {
key = ((WAudio) target).getCacheKey();
}
return !Util.empty(key);
} finally {
UIContextHolder.popContext();
}
} | [
"public",
"static",
"boolean",
"isCachedContentRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"// Get target id on request",
"String",
"targetId",
"=",
"request",
".",
"getParameter",
"(",
"Environment",
".",
"TARGET_ID",
")",
";",
"if",
"(",
"targetId",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"// Get target",
"ComponentWithContext",
"targetWithContext",
"=",
"WebUtilities",
".",
"getComponentById",
"(",
"targetId",
",",
"true",
")",
";",
"if",
"(",
"targetWithContext",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"// Check for caching key",
"WComponent",
"target",
"=",
"targetWithContext",
".",
"getComponent",
"(",
")",
";",
"UIContextHolder",
".",
"pushContext",
"(",
"targetWithContext",
".",
"getContext",
"(",
")",
")",
";",
"try",
"{",
"// TODO Look at implementing CacheableTarget interface",
"String",
"key",
"=",
"null",
";",
"if",
"(",
"target",
"instanceof",
"WContent",
")",
"{",
"key",
"=",
"(",
"(",
"WContent",
")",
"target",
")",
".",
"getCacheKey",
"(",
")",
";",
"}",
"else",
"if",
"(",
"target",
"instanceof",
"WImage",
")",
"{",
"key",
"=",
"(",
"(",
"WImage",
")",
"target",
")",
".",
"getCacheKey",
"(",
")",
";",
"}",
"else",
"if",
"(",
"target",
"instanceof",
"WVideo",
")",
"{",
"key",
"=",
"(",
"(",
"WVideo",
")",
"target",
")",
".",
"getCacheKey",
"(",
")",
";",
"}",
"else",
"if",
"(",
"target",
"instanceof",
"WAudio",
")",
"{",
"key",
"=",
"(",
"(",
"WAudio",
")",
"target",
")",
".",
"getCacheKey",
"(",
")",
";",
"}",
"return",
"!",
"Util",
".",
"empty",
"(",
"key",
")",
";",
"}",
"finally",
"{",
"UIContextHolder",
".",
"popContext",
"(",
")",
";",
"}",
"}"
] | Check if the request is for cached content.
@param request the request being processed
@return true if content is cached, otherwise false | [
"Check",
"if",
"the",
"request",
"is",
"for",
"cached",
"content",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/StepCountUtil.java#L89-L123 |
139,416 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/SubSessionHttpServletRequestWrapper.java | SubSessionHttpServletRequestWrapper.getSubSession | private synchronized HttpSubSession getSubSession() {
HttpSession backingSession = super.getSession();
Map<Integer, HttpSubSession> subsessions = (Map<Integer, HttpSubSession>) backingSession
.getAttribute(SESSION_MAP_KEY);
HttpSubSession subsession = subsessions.get(sessionId);
subsession.setLastAccessedTime(System.currentTimeMillis());
return subsession;
} | java | private synchronized HttpSubSession getSubSession() {
HttpSession backingSession = super.getSession();
Map<Integer, HttpSubSession> subsessions = (Map<Integer, HttpSubSession>) backingSession
.getAttribute(SESSION_MAP_KEY);
HttpSubSession subsession = subsessions.get(sessionId);
subsession.setLastAccessedTime(System.currentTimeMillis());
return subsession;
} | [
"private",
"synchronized",
"HttpSubSession",
"getSubSession",
"(",
")",
"{",
"HttpSession",
"backingSession",
"=",
"super",
".",
"getSession",
"(",
")",
";",
"Map",
"<",
"Integer",
",",
"HttpSubSession",
">",
"subsessions",
"=",
"(",
"Map",
"<",
"Integer",
",",
"HttpSubSession",
">",
")",
"backingSession",
".",
"getAttribute",
"(",
"SESSION_MAP_KEY",
")",
";",
"HttpSubSession",
"subsession",
"=",
"subsessions",
".",
"get",
"(",
"sessionId",
")",
";",
"subsession",
".",
"setLastAccessedTime",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"return",
"subsession",
";",
"}"
] | Retrieves the subsession for this request. If there is no existing subsession, a new one is created.
@return the subsession for this request. | [
"Retrieves",
"the",
"subsession",
"for",
"this",
"request",
".",
"If",
"there",
"is",
"no",
"existing",
"subsession",
"a",
"new",
"one",
"is",
"created",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/SubSessionHttpServletRequestWrapper.java#L99-L108 |
139,417 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/InputBeanBindingExample.java | InputBeanBindingExample.addSubordinate | private void addSubordinate() {
// Set up subordinate (to make mandatory/optional)
WComponentGroup<SubordinateTarget> inputs = new WComponentGroup<>();
add(inputs);
inputs.addToGroup(checkBoxSelect);
inputs.addToGroup(multiDropdown);
inputs.addToGroup(multiSelect);
inputs.addToGroup(multiSelectPair);
inputs.addToGroup(dropdown);
inputs.addToGroup(radioButtonSelect);
inputs.addToGroup(singleSelect);
inputs.addToGroup(checkBox);
inputs.addToGroup(dateField);
inputs.addToGroup(emailField);
inputs.addToGroup(fileWidget);
inputs.addToGroup(multiFileWidget);
inputs.addToGroup(multiTextField);
inputs.addToGroup(numberField);
inputs.addToGroup(partialDateField);
inputs.addToGroup(phoneNumberField);
inputs.addToGroup(radioButton);
inputs.addToGroup(shuffler);
inputs.addToGroup(textField);
inputs.addToGroup(textArea);
inputs.addToGroup(radioButton1);
inputs.addToGroup(radioButton2);
inputs.addToGroup(radioButton3);
WSubordinateControl control = new WSubordinateControl();
add(control);
// Mandatory
Rule rule = new Rule();
rule.setCondition(new Equal(mandatory, "true"));
rule.addActionOnTrue(new Mandatory(inputs));
rule.addActionOnFalse(new Optional(inputs));
control.addRule(rule);
// Disabled
rule = new Rule();
rule.setCondition(new Equal(disabled, "true"));
rule.addActionOnTrue(new Disable(inputs));
rule.addActionOnFalse(new Enable(inputs));
control.addRule(rule);
} | java | private void addSubordinate() {
// Set up subordinate (to make mandatory/optional)
WComponentGroup<SubordinateTarget> inputs = new WComponentGroup<>();
add(inputs);
inputs.addToGroup(checkBoxSelect);
inputs.addToGroup(multiDropdown);
inputs.addToGroup(multiSelect);
inputs.addToGroup(multiSelectPair);
inputs.addToGroup(dropdown);
inputs.addToGroup(radioButtonSelect);
inputs.addToGroup(singleSelect);
inputs.addToGroup(checkBox);
inputs.addToGroup(dateField);
inputs.addToGroup(emailField);
inputs.addToGroup(fileWidget);
inputs.addToGroup(multiFileWidget);
inputs.addToGroup(multiTextField);
inputs.addToGroup(numberField);
inputs.addToGroup(partialDateField);
inputs.addToGroup(phoneNumberField);
inputs.addToGroup(radioButton);
inputs.addToGroup(shuffler);
inputs.addToGroup(textField);
inputs.addToGroup(textArea);
inputs.addToGroup(radioButton1);
inputs.addToGroup(radioButton2);
inputs.addToGroup(radioButton3);
WSubordinateControl control = new WSubordinateControl();
add(control);
// Mandatory
Rule rule = new Rule();
rule.setCondition(new Equal(mandatory, "true"));
rule.addActionOnTrue(new Mandatory(inputs));
rule.addActionOnFalse(new Optional(inputs));
control.addRule(rule);
// Disabled
rule = new Rule();
rule.setCondition(new Equal(disabled, "true"));
rule.addActionOnTrue(new Disable(inputs));
rule.addActionOnFalse(new Enable(inputs));
control.addRule(rule);
} | [
"private",
"void",
"addSubordinate",
"(",
")",
"{",
"// Set up subordinate (to make mandatory/optional)",
"WComponentGroup",
"<",
"SubordinateTarget",
">",
"inputs",
"=",
"new",
"WComponentGroup",
"<>",
"(",
")",
";",
"add",
"(",
"inputs",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"checkBoxSelect",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"multiDropdown",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"multiSelect",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"multiSelectPair",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"dropdown",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"radioButtonSelect",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"singleSelect",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"checkBox",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"dateField",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"emailField",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"fileWidget",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"multiFileWidget",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"multiTextField",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"numberField",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"partialDateField",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"phoneNumberField",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"radioButton",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"shuffler",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"textField",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"textArea",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"radioButton1",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"radioButton2",
")",
";",
"inputs",
".",
"addToGroup",
"(",
"radioButton3",
")",
";",
"WSubordinateControl",
"control",
"=",
"new",
"WSubordinateControl",
"(",
")",
";",
"add",
"(",
"control",
")",
";",
"// Mandatory",
"Rule",
"rule",
"=",
"new",
"Rule",
"(",
")",
";",
"rule",
".",
"setCondition",
"(",
"new",
"Equal",
"(",
"mandatory",
",",
"\"true\"",
")",
")",
";",
"rule",
".",
"addActionOnTrue",
"(",
"new",
"Mandatory",
"(",
"inputs",
")",
")",
";",
"rule",
".",
"addActionOnFalse",
"(",
"new",
"Optional",
"(",
"inputs",
")",
")",
";",
"control",
".",
"addRule",
"(",
"rule",
")",
";",
"// Disabled",
"rule",
"=",
"new",
"Rule",
"(",
")",
";",
"rule",
".",
"setCondition",
"(",
"new",
"Equal",
"(",
"disabled",
",",
"\"true\"",
")",
")",
";",
"rule",
".",
"addActionOnTrue",
"(",
"new",
"Disable",
"(",
"inputs",
")",
")",
";",
"rule",
".",
"addActionOnFalse",
"(",
"new",
"Enable",
"(",
"inputs",
")",
")",
";",
"control",
".",
"addRule",
"(",
"rule",
")",
";",
"}"
] | Setup the subordinate control. | [
"Setup",
"the",
"subordinate",
"control",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/InputBeanBindingExample.java#L356-L400 |
139,418 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/InputBeanBindingExample.java | InputBeanBindingExample.addButtons | private void addButtons() {
// Validation Button
WButton buttonValidate = new WButton("Validate and Update Bean");
add(buttonValidate);
buttonValidate.setAction(new ValidatingAction(messages.getValidationErrors(), layout) {
@Override
public void executeOnValid(final ActionEvent event) {
WebUtilities.updateBeanValue(layout);
messages.success("OK");
}
});
// Update Bean
WButton buttonUpdate = new WButton("Update Bean");
add(buttonUpdate);
buttonUpdate.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
WebUtilities.updateBeanValue(layout);
}
});
// Reset Inputs
WButton buttonReset = new WButton("Reset Inputs");
add(buttonReset);
buttonReset.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
layout.reset();
}
});
// Reset Bean
WButton buttonBean = new WButton("Reset Bean");
add(buttonBean);
buttonBean.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
InputBeanBindingExample.this.setBean(new MyDemoBean());
}
});
add(new WButton("submit"));
} | java | private void addButtons() {
// Validation Button
WButton buttonValidate = new WButton("Validate and Update Bean");
add(buttonValidate);
buttonValidate.setAction(new ValidatingAction(messages.getValidationErrors(), layout) {
@Override
public void executeOnValid(final ActionEvent event) {
WebUtilities.updateBeanValue(layout);
messages.success("OK");
}
});
// Update Bean
WButton buttonUpdate = new WButton("Update Bean");
add(buttonUpdate);
buttonUpdate.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
WebUtilities.updateBeanValue(layout);
}
});
// Reset Inputs
WButton buttonReset = new WButton("Reset Inputs");
add(buttonReset);
buttonReset.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
layout.reset();
}
});
// Reset Bean
WButton buttonBean = new WButton("Reset Bean");
add(buttonBean);
buttonBean.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
InputBeanBindingExample.this.setBean(new MyDemoBean());
}
});
add(new WButton("submit"));
} | [
"private",
"void",
"addButtons",
"(",
")",
"{",
"// Validation Button",
"WButton",
"buttonValidate",
"=",
"new",
"WButton",
"(",
"\"Validate and Update Bean\"",
")",
";",
"add",
"(",
"buttonValidate",
")",
";",
"buttonValidate",
".",
"setAction",
"(",
"new",
"ValidatingAction",
"(",
"messages",
".",
"getValidationErrors",
"(",
")",
",",
"layout",
")",
"{",
"@",
"Override",
"public",
"void",
"executeOnValid",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"WebUtilities",
".",
"updateBeanValue",
"(",
"layout",
")",
";",
"messages",
".",
"success",
"(",
"\"OK\"",
")",
";",
"}",
"}",
")",
";",
"// Update Bean",
"WButton",
"buttonUpdate",
"=",
"new",
"WButton",
"(",
"\"Update Bean\"",
")",
";",
"add",
"(",
"buttonUpdate",
")",
";",
"buttonUpdate",
".",
"setAction",
"(",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"WebUtilities",
".",
"updateBeanValue",
"(",
"layout",
")",
";",
"}",
"}",
")",
";",
"// Reset Inputs",
"WButton",
"buttonReset",
"=",
"new",
"WButton",
"(",
"\"Reset Inputs\"",
")",
";",
"add",
"(",
"buttonReset",
")",
";",
"buttonReset",
".",
"setAction",
"(",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"layout",
".",
"reset",
"(",
")",
";",
"}",
"}",
")",
";",
"// Reset Bean",
"WButton",
"buttonBean",
"=",
"new",
"WButton",
"(",
"\"Reset Bean\"",
")",
";",
"add",
"(",
"buttonBean",
")",
";",
"buttonBean",
".",
"setAction",
"(",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"InputBeanBindingExample",
".",
"this",
".",
"setBean",
"(",
"new",
"MyDemoBean",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"add",
"(",
"new",
"WButton",
"(",
"\"submit\"",
")",
")",
";",
"}"
] | Setup the action buttons. | [
"Setup",
"the",
"action",
"buttons",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/InputBeanBindingExample.java#L405-L449 |
139,419 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractEnvironment.java | AbstractEnvironment.getWServletPath | @Override
public String getWServletPath() {
final String configValue = ConfigurationProperties.getServletSupportPath();
return configValue == null ? getPostPath() : getServletPath(configValue);
} | java | @Override
public String getWServletPath() {
final String configValue = ConfigurationProperties.getServletSupportPath();
return configValue == null ? getPostPath() : getServletPath(configValue);
} | [
"@",
"Override",
"public",
"String",
"getWServletPath",
"(",
")",
"{",
"final",
"String",
"configValue",
"=",
"ConfigurationProperties",
".",
"getServletSupportPath",
"(",
")",
";",
"return",
"configValue",
"==",
"null",
"?",
"getPostPath",
"(",
")",
":",
"getServletPath",
"(",
"configValue",
")",
";",
"}"
] | Construct the path to the support servlet. Web components that need to construct a URL to target this servlet
will use this method.
@return the path to the AJAX servlet. | [
"Construct",
"the",
"path",
"to",
"the",
"support",
"servlet",
".",
"Web",
"components",
"that",
"need",
"to",
"construct",
"a",
"URL",
"to",
"target",
"this",
"servlet",
"will",
"use",
"this",
"method",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractEnvironment.java#L81-L87 |
139,420 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractEnvironment.java | AbstractEnvironment.getServletPath | private String getServletPath(final String relativePath) {
if (relativePath == null) {
LOG.error("relativePath must not be null");
}
String context = getHostFreeBaseUrl();
if (!Util.empty(context)) {
return context + relativePath;
}
return relativePath;
} | java | private String getServletPath(final String relativePath) {
if (relativePath == null) {
LOG.error("relativePath must not be null");
}
String context = getHostFreeBaseUrl();
if (!Util.empty(context)) {
return context + relativePath;
}
return relativePath;
} | [
"private",
"String",
"getServletPath",
"(",
"final",
"String",
"relativePath",
")",
"{",
"if",
"(",
"relativePath",
"==",
"null",
")",
"{",
"LOG",
".",
"error",
"(",
"\"relativePath must not be null\"",
")",
";",
"}",
"String",
"context",
"=",
"getHostFreeBaseUrl",
"(",
")",
";",
"if",
"(",
"!",
"Util",
".",
"empty",
"(",
"context",
")",
")",
"{",
"return",
"context",
"+",
"relativePath",
";",
"}",
"return",
"relativePath",
";",
"}"
] | Constructs the path to one of the various helper servlets. This is used by the more specific getXXXPath methods.
@param relativePath the relative servlet path.
@return the path to the servlet corresponding to the given parameter name. | [
"Constructs",
"the",
"path",
"to",
"one",
"of",
"the",
"various",
"helper",
"servlets",
".",
"This",
"is",
"used",
"by",
"the",
"more",
"specific",
"getXXXPath",
"methods",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractEnvironment.java#L95-L108 |
139,421 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/subordinate/SubordinateControlMandatoryExample.java | SubordinateControlMandatoryExample.build | private static WComponent build() {
WContainer root = new WContainer();
WSubordinateControl control = new WSubordinateControl();
root.add(control);
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(25);
layout.setMargin(new com.github.bordertech.wcomponents.Margin(0, 0, 12, 0));
WCheckBox checkBox = new WCheckBox();
layout.addField("Set Mandatory", checkBox);
WTextField text = new WTextField();
layout.addField("Might need this field", text);
WTextField mandatoryField = new WTextField();
layout.addField("Another field always mandatory", mandatoryField);
mandatoryField.setMandatory(true);
final WRadioButtonSelect rbSelect = new WRadioButtonSelect("australian_state");
layout.addField("Select a state", rbSelect);
root.add(layout);
Rule rule = new Rule();
rule.setCondition(new Equal(checkBox, Boolean.TRUE.toString()));
rule.addActionOnTrue(new Mandatory(text));
rule.addActionOnFalse(new Optional(text));
rule.addActionOnTrue(new Mandatory(rbSelect));
rule.addActionOnFalse(new Optional(rbSelect));
control.addRule(rule);
return root;
} | java | private static WComponent build() {
WContainer root = new WContainer();
WSubordinateControl control = new WSubordinateControl();
root.add(control);
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(25);
layout.setMargin(new com.github.bordertech.wcomponents.Margin(0, 0, 12, 0));
WCheckBox checkBox = new WCheckBox();
layout.addField("Set Mandatory", checkBox);
WTextField text = new WTextField();
layout.addField("Might need this field", text);
WTextField mandatoryField = new WTextField();
layout.addField("Another field always mandatory", mandatoryField);
mandatoryField.setMandatory(true);
final WRadioButtonSelect rbSelect = new WRadioButtonSelect("australian_state");
layout.addField("Select a state", rbSelect);
root.add(layout);
Rule rule = new Rule();
rule.setCondition(new Equal(checkBox, Boolean.TRUE.toString()));
rule.addActionOnTrue(new Mandatory(text));
rule.addActionOnFalse(new Optional(text));
rule.addActionOnTrue(new Mandatory(rbSelect));
rule.addActionOnFalse(new Optional(rbSelect));
control.addRule(rule);
return root;
} | [
"private",
"static",
"WComponent",
"build",
"(",
")",
"{",
"WContainer",
"root",
"=",
"new",
"WContainer",
"(",
")",
";",
"WSubordinateControl",
"control",
"=",
"new",
"WSubordinateControl",
"(",
")",
";",
"root",
".",
"add",
"(",
"control",
")",
";",
"WFieldLayout",
"layout",
"=",
"new",
"WFieldLayout",
"(",
")",
";",
"layout",
".",
"setLabelWidth",
"(",
"25",
")",
";",
"layout",
".",
"setMargin",
"(",
"new",
"com",
".",
"github",
".",
"bordertech",
".",
"wcomponents",
".",
"Margin",
"(",
"0",
",",
"0",
",",
"12",
",",
"0",
")",
")",
";",
"WCheckBox",
"checkBox",
"=",
"new",
"WCheckBox",
"(",
")",
";",
"layout",
".",
"addField",
"(",
"\"Set Mandatory\"",
",",
"checkBox",
")",
";",
"WTextField",
"text",
"=",
"new",
"WTextField",
"(",
")",
";",
"layout",
".",
"addField",
"(",
"\"Might need this field\"",
",",
"text",
")",
";",
"WTextField",
"mandatoryField",
"=",
"new",
"WTextField",
"(",
")",
";",
"layout",
".",
"addField",
"(",
"\"Another field always mandatory\"",
",",
"mandatoryField",
")",
";",
"mandatoryField",
".",
"setMandatory",
"(",
"true",
")",
";",
"final",
"WRadioButtonSelect",
"rbSelect",
"=",
"new",
"WRadioButtonSelect",
"(",
"\"australian_state\"",
")",
";",
"layout",
".",
"addField",
"(",
"\"Select a state\"",
",",
"rbSelect",
")",
";",
"root",
".",
"add",
"(",
"layout",
")",
";",
"Rule",
"rule",
"=",
"new",
"Rule",
"(",
")",
";",
"rule",
".",
"setCondition",
"(",
"new",
"Equal",
"(",
"checkBox",
",",
"Boolean",
".",
"TRUE",
".",
"toString",
"(",
")",
")",
")",
";",
"rule",
".",
"addActionOnTrue",
"(",
"new",
"Mandatory",
"(",
"text",
")",
")",
";",
"rule",
".",
"addActionOnFalse",
"(",
"new",
"Optional",
"(",
"text",
")",
")",
";",
"rule",
".",
"addActionOnTrue",
"(",
"new",
"Mandatory",
"(",
"rbSelect",
")",
")",
";",
"rule",
".",
"addActionOnFalse",
"(",
"new",
"Optional",
"(",
"rbSelect",
")",
")",
";",
"control",
".",
"addRule",
"(",
"rule",
")",
";",
"return",
"root",
";",
"}"
] | Creates the component to be added to the validation container. This is doen in a static method because the
component is passed into the superclass constructor.
@return the component to be added to the validation container. | [
"Creates",
"the",
"component",
"to",
"be",
"added",
"to",
"the",
"validation",
"container",
".",
"This",
"is",
"doen",
"in",
"a",
"static",
"method",
"because",
"the",
"component",
"is",
"passed",
"into",
"the",
"superclass",
"constructor",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/subordinate/SubordinateControlMandatoryExample.java#L37-L71 |
139,422 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/ValidateXMLInterceptor.java | ValidateXMLInterceptor.paint | @Override
public void paint(final RenderContext renderContext) {
// Check interceptor is enabled
if (!DebugValidateXML.isEnabled()) {
super.paint(renderContext);
return;
}
if (!(renderContext instanceof WebXmlRenderContext)) {
LOG.warn("Unable to validate against a " + renderContext);
super.paint(renderContext);
return;
}
LOG.debug("Validate XML Interceptor: Start");
WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
PrintWriter writer = webRenderContext.getWriter();
// Generate XML
StringWriter tempBuffer = new StringWriter();
PrintWriter tempWriter = new PrintWriter(tempBuffer);
WebXmlRenderContext tempContext = new WebXmlRenderContext(tempWriter, UIContextHolder.
getCurrent().getLocale());
super.paint(tempContext);
String xml = tempBuffer.toString();
// If no errors, check against the schema
String error = DebugValidateXML.validateXMLAgainstSchema(xml);
if (error != null) {
// XML is NOT valid, so Report Errors and Wrap the original XML
LOG.debug("Validate XML Interceptor: XML Has Errors");
writer.println("<div>");
writer.println("<div>");
writer.println("Invalid XML");
writer.println("<ul><li>" + WebUtilities.encode(error) + "</li></ul>");
writer.println("<br/>");
writer.println("</div>");
// If a schema error detected, Wrap XML so line numbers reported in validation message are correct
String testXML = DebugValidateXML.wrapXMLInRootElement(xml);
paintOriginalXML(testXML, writer);
writer.println("</div>");
} else {
// XML is valid
writer.write(xml);
}
LOG.debug("Validate XML Interceptor: Finished");
} | java | @Override
public void paint(final RenderContext renderContext) {
// Check interceptor is enabled
if (!DebugValidateXML.isEnabled()) {
super.paint(renderContext);
return;
}
if (!(renderContext instanceof WebXmlRenderContext)) {
LOG.warn("Unable to validate against a " + renderContext);
super.paint(renderContext);
return;
}
LOG.debug("Validate XML Interceptor: Start");
WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
PrintWriter writer = webRenderContext.getWriter();
// Generate XML
StringWriter tempBuffer = new StringWriter();
PrintWriter tempWriter = new PrintWriter(tempBuffer);
WebXmlRenderContext tempContext = new WebXmlRenderContext(tempWriter, UIContextHolder.
getCurrent().getLocale());
super.paint(tempContext);
String xml = tempBuffer.toString();
// If no errors, check against the schema
String error = DebugValidateXML.validateXMLAgainstSchema(xml);
if (error != null) {
// XML is NOT valid, so Report Errors and Wrap the original XML
LOG.debug("Validate XML Interceptor: XML Has Errors");
writer.println("<div>");
writer.println("<div>");
writer.println("Invalid XML");
writer.println("<ul><li>" + WebUtilities.encode(error) + "</li></ul>");
writer.println("<br/>");
writer.println("</div>");
// If a schema error detected, Wrap XML so line numbers reported in validation message are correct
String testXML = DebugValidateXML.wrapXMLInRootElement(xml);
paintOriginalXML(testXML, writer);
writer.println("</div>");
} else {
// XML is valid
writer.write(xml);
}
LOG.debug("Validate XML Interceptor: Finished");
} | [
"@",
"Override",
"public",
"void",
"paint",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"// Check interceptor is enabled",
"if",
"(",
"!",
"DebugValidateXML",
".",
"isEnabled",
"(",
")",
")",
"{",
"super",
".",
"paint",
"(",
"renderContext",
")",
";",
"return",
";",
"}",
"if",
"(",
"!",
"(",
"renderContext",
"instanceof",
"WebXmlRenderContext",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Unable to validate against a \"",
"+",
"renderContext",
")",
";",
"super",
".",
"paint",
"(",
"renderContext",
")",
";",
"return",
";",
"}",
"LOG",
".",
"debug",
"(",
"\"Validate XML Interceptor: Start\"",
")",
";",
"WebXmlRenderContext",
"webRenderContext",
"=",
"(",
"WebXmlRenderContext",
")",
"renderContext",
";",
"PrintWriter",
"writer",
"=",
"webRenderContext",
".",
"getWriter",
"(",
")",
";",
"// Generate XML",
"StringWriter",
"tempBuffer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"tempWriter",
"=",
"new",
"PrintWriter",
"(",
"tempBuffer",
")",
";",
"WebXmlRenderContext",
"tempContext",
"=",
"new",
"WebXmlRenderContext",
"(",
"tempWriter",
",",
"UIContextHolder",
".",
"getCurrent",
"(",
")",
".",
"getLocale",
"(",
")",
")",
";",
"super",
".",
"paint",
"(",
"tempContext",
")",
";",
"String",
"xml",
"=",
"tempBuffer",
".",
"toString",
"(",
")",
";",
"// If no errors, check against the schema",
"String",
"error",
"=",
"DebugValidateXML",
".",
"validateXMLAgainstSchema",
"(",
"xml",
")",
";",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
"// XML is NOT valid, so Report Errors and Wrap the original XML",
"LOG",
".",
"debug",
"(",
"\"Validate XML Interceptor: XML Has Errors\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<div>\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<div>\"",
")",
";",
"writer",
".",
"println",
"(",
"\"Invalid XML\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<ul><li>\"",
"+",
"WebUtilities",
".",
"encode",
"(",
"error",
")",
"+",
"\"</li></ul>\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<br/>\"",
")",
";",
"writer",
".",
"println",
"(",
"\"</div>\"",
")",
";",
"// If a schema error detected, Wrap XML so line numbers reported in validation message are correct",
"String",
"testXML",
"=",
"DebugValidateXML",
".",
"wrapXMLInRootElement",
"(",
"xml",
")",
";",
"paintOriginalXML",
"(",
"testXML",
",",
"writer",
")",
";",
"writer",
".",
"println",
"(",
"\"</div>\"",
")",
";",
"}",
"else",
"{",
"// XML is valid",
"writer",
".",
"write",
"(",
"xml",
")",
";",
"}",
"LOG",
".",
"debug",
"(",
"\"Validate XML Interceptor: Finished\"",
")",
";",
"}"
] | Override paint to include XML Validation.
@param renderContext the renderContext to send the output to. | [
"Override",
"paint",
"to",
"include",
"XML",
"Validation",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/ValidateXMLInterceptor.java#L43-L96 |
139,423 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/ValidateXMLInterceptor.java | ValidateXMLInterceptor.paintOriginalXML | private void paintOriginalXML(final String originalXML, final PrintWriter writer) {
// Replace any CDATA Sections embedded in XML
String xml = originalXML.replaceAll("<!\\[CDATA\\[", "CDATASTART");
xml = xml.replaceAll("\\]\\]>", "CDATAFINISH");
// Paint Output
writer.println("<div>");
writer.println("<!-- VALIDATE XML ERROR - START XML -->");
writer.println("<![CDATA[");
writer.println(xml);
writer.println("]]>");
writer.println("<!-- VALIDATE XML ERROR - END XML -->");
writer.println("</div>");
} | java | private void paintOriginalXML(final String originalXML, final PrintWriter writer) {
// Replace any CDATA Sections embedded in XML
String xml = originalXML.replaceAll("<!\\[CDATA\\[", "CDATASTART");
xml = xml.replaceAll("\\]\\]>", "CDATAFINISH");
// Paint Output
writer.println("<div>");
writer.println("<!-- VALIDATE XML ERROR - START XML -->");
writer.println("<![CDATA[");
writer.println(xml);
writer.println("]]>");
writer.println("<!-- VALIDATE XML ERROR - END XML -->");
writer.println("</div>");
} | [
"private",
"void",
"paintOriginalXML",
"(",
"final",
"String",
"originalXML",
",",
"final",
"PrintWriter",
"writer",
")",
"{",
"// Replace any CDATA Sections embedded in XML",
"String",
"xml",
"=",
"originalXML",
".",
"replaceAll",
"(",
"\"<!\\\\[CDATA\\\\[\"",
",",
"\"CDATASTART\"",
")",
";",
"xml",
"=",
"xml",
".",
"replaceAll",
"(",
"\"\\\\]\\\\]>\"",
",",
"\"CDATAFINISH\"",
")",
";",
"// Paint Output",
"writer",
".",
"println",
"(",
"\"<div>\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<!-- VALIDATE XML ERROR - START XML -->\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<![CDATA[\"",
")",
";",
"writer",
".",
"println",
"(",
"xml",
")",
";",
"writer",
".",
"println",
"(",
"\"]]>\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<!-- VALIDATE XML ERROR - END XML -->\"",
")",
";",
"writer",
".",
"println",
"(",
"\"</div>\"",
")",
";",
"}"
] | Paint the original XML wrapped in a CDATA Section.
@param originalXML the original XML
@param writer the output writer | [
"Paint",
"the",
"original",
"XML",
"wrapped",
"in",
"a",
"CDATA",
"Section",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/ValidateXMLInterceptor.java#L104-L117 |
139,424 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java | SimplePicker.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!this.isInitialised()) {
List recent = loadRecentList();
if (recent != null && !recent.isEmpty()) {
String selection = (String) recent.get(0);
displaySelection(selection);
}
this.setInitialised(true);
}
updateTitle();
} | java | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!this.isInitialised()) {
List recent = loadRecentList();
if (recent != null && !recent.isEmpty()) {
String selection = (String) recent.get(0);
displaySelection(selection);
}
this.setInitialised(true);
}
updateTitle();
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"preparePaintComponent",
"(",
"request",
")",
";",
"if",
"(",
"!",
"this",
".",
"isInitialised",
"(",
")",
")",
"{",
"List",
"recent",
"=",
"loadRecentList",
"(",
")",
";",
"if",
"(",
"recent",
"!=",
"null",
"&&",
"!",
"recent",
".",
"isEmpty",
"(",
")",
")",
"{",
"String",
"selection",
"=",
"(",
"String",
")",
"recent",
".",
"get",
"(",
"0",
")",
";",
"displaySelection",
"(",
"selection",
")",
";",
"}",
"this",
".",
"setInitialised",
"(",
"true",
")",
";",
"}",
"updateTitle",
"(",
")",
";",
"}"
] | When the example picker starts up, we want to display the last selection the user made in their previous session.
We can do this because the list of recent selections is stored in a file on the file system.
@param request the request being responded to. | [
"When",
"the",
"example",
"picker",
"starts",
"up",
"we",
"want",
"to",
"display",
"the",
"last",
"selection",
"the",
"user",
"made",
"in",
"their",
"previous",
"session",
".",
"We",
"can",
"do",
"this",
"because",
"the",
"list",
"of",
"recent",
"selections",
"is",
"stored",
"in",
"a",
"file",
"on",
"the",
"file",
"system",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java#L227-L243 |
139,425 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java | SimplePicker.updateTitle | private void updateTitle() {
String title;
if (this.getCurrentComponent() == null) {
title = "Example Picker";
} else {
title = this.getCurrentComponent().getClass().getName();
}
WApplication app = WebUtilities.getAncestorOfClass(WApplication.class, this);
if (app != null) {
app.setTitle(title);
}
} | java | private void updateTitle() {
String title;
if (this.getCurrentComponent() == null) {
title = "Example Picker";
} else {
title = this.getCurrentComponent().getClass().getName();
}
WApplication app = WebUtilities.getAncestorOfClass(WApplication.class, this);
if (app != null) {
app.setTitle(title);
}
} | [
"private",
"void",
"updateTitle",
"(",
")",
"{",
"String",
"title",
";",
"if",
"(",
"this",
".",
"getCurrentComponent",
"(",
")",
"==",
"null",
")",
"{",
"title",
"=",
"\"Example Picker\"",
";",
"}",
"else",
"{",
"title",
"=",
"this",
".",
"getCurrentComponent",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"WApplication",
"app",
"=",
"WebUtilities",
".",
"getAncestorOfClass",
"(",
"WApplication",
".",
"class",
",",
"this",
")",
";",
"if",
"(",
"app",
"!=",
"null",
")",
"{",
"app",
".",
"setTitle",
"(",
"title",
")",
";",
"}",
"}"
] | Updates the title, based on the selected example. | [
"Updates",
"the",
"title",
"based",
"on",
"the",
"selected",
"example",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java#L248-L262 |
139,426 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java | SimplePicker.afterPaint | @Override
protected void afterPaint(final RenderContext renderContext) {
super.afterPaint(renderContext);
if (profileBtn.isPressed()) {
// UIC serialization stats
UicStats stats = new UicStats(UIContextHolder.getCurrent());
WComponent currentComp = this.getCurrentComponent();
if (currentComp != null) {
stats.analyseWC(currentComp);
}
if (renderContext instanceof WebXmlRenderContext) {
PrintWriter writer = ((WebXmlRenderContext) renderContext).getWriter();
writer.println("<hr />");
writer.println("<h2>Serialization Profile of UIC</h2>");
UicStatsAsHtml.write(writer, stats);
if (currentComp != null) {
writer.println("<hr />");
writer.println("<h2>ObjectProfiler - " + currentComp + "</h2>");
writer.println("<pre>");
try {
writer.println(ObjectGraphDump.dump(currentComp).toFlatSummary());
} catch (Exception e) {
LOG.error("Failed to dump component", e);
}
writer.println("</pre>");
}
}
}
} | java | @Override
protected void afterPaint(final RenderContext renderContext) {
super.afterPaint(renderContext);
if (profileBtn.isPressed()) {
// UIC serialization stats
UicStats stats = new UicStats(UIContextHolder.getCurrent());
WComponent currentComp = this.getCurrentComponent();
if (currentComp != null) {
stats.analyseWC(currentComp);
}
if (renderContext instanceof WebXmlRenderContext) {
PrintWriter writer = ((WebXmlRenderContext) renderContext).getWriter();
writer.println("<hr />");
writer.println("<h2>Serialization Profile of UIC</h2>");
UicStatsAsHtml.write(writer, stats);
if (currentComp != null) {
writer.println("<hr />");
writer.println("<h2>ObjectProfiler - " + currentComp + "</h2>");
writer.println("<pre>");
try {
writer.println(ObjectGraphDump.dump(currentComp).toFlatSummary());
} catch (Exception e) {
LOG.error("Failed to dump component", e);
}
writer.println("</pre>");
}
}
}
} | [
"@",
"Override",
"protected",
"void",
"afterPaint",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"super",
".",
"afterPaint",
"(",
"renderContext",
")",
";",
"if",
"(",
"profileBtn",
".",
"isPressed",
"(",
")",
")",
"{",
"// UIC serialization stats",
"UicStats",
"stats",
"=",
"new",
"UicStats",
"(",
"UIContextHolder",
".",
"getCurrent",
"(",
")",
")",
";",
"WComponent",
"currentComp",
"=",
"this",
".",
"getCurrentComponent",
"(",
")",
";",
"if",
"(",
"currentComp",
"!=",
"null",
")",
"{",
"stats",
".",
"analyseWC",
"(",
"currentComp",
")",
";",
"}",
"if",
"(",
"renderContext",
"instanceof",
"WebXmlRenderContext",
")",
"{",
"PrintWriter",
"writer",
"=",
"(",
"(",
"WebXmlRenderContext",
")",
"renderContext",
")",
".",
"getWriter",
"(",
")",
";",
"writer",
".",
"println",
"(",
"\"<hr />\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<h2>Serialization Profile of UIC</h2>\"",
")",
";",
"UicStatsAsHtml",
".",
"write",
"(",
"writer",
",",
"stats",
")",
";",
"if",
"(",
"currentComp",
"!=",
"null",
")",
"{",
"writer",
".",
"println",
"(",
"\"<hr />\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<h2>ObjectProfiler - \"",
"+",
"currentComp",
"+",
"\"</h2>\"",
")",
";",
"writer",
".",
"println",
"(",
"\"<pre>\"",
")",
";",
"try",
"{",
"writer",
".",
"println",
"(",
"ObjectGraphDump",
".",
"dump",
"(",
"currentComp",
")",
".",
"toFlatSummary",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to dump component\"",
",",
"e",
")",
";",
"}",
"writer",
".",
"println",
"(",
"\"</pre>\"",
")",
";",
"}",
"}",
"}",
"}"
] | Override afterPaint in order to paint the UIContext serialization statistics if the profile button has been
pressed.
@param renderContext the renderContext to send output to. | [
"Override",
"afterPaint",
"in",
"order",
"to",
"paint",
"the",
"UIContext",
"serialization",
"statistics",
"if",
"the",
"profile",
"button",
"has",
"been",
"pressed",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java#L270-L306 |
139,427 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java | SimplePicker.loadRecentList | private List loadRecentList() {
try {
InputStream in = new BufferedInputStream(new FileInputStream(
RECENT_FILE_NAME));
XMLDecoder d = new XMLDecoder(in);
Object result = d.readObject();
d.close();
return (List) result;
} catch (FileNotFoundException ex) {
// This is ok, it's probably the first time the picker has been used.
return new ArrayList();
}
} | java | private List loadRecentList() {
try {
InputStream in = new BufferedInputStream(new FileInputStream(
RECENT_FILE_NAME));
XMLDecoder d = new XMLDecoder(in);
Object result = d.readObject();
d.close();
return (List) result;
} catch (FileNotFoundException ex) {
// This is ok, it's probably the first time the picker has been used.
return new ArrayList();
}
} | [
"private",
"List",
"loadRecentList",
"(",
")",
"{",
"try",
"{",
"InputStream",
"in",
"=",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"RECENT_FILE_NAME",
")",
")",
";",
"XMLDecoder",
"d",
"=",
"new",
"XMLDecoder",
"(",
"in",
")",
";",
"Object",
"result",
"=",
"d",
".",
"readObject",
"(",
")",
";",
"d",
".",
"close",
"(",
")",
";",
"return",
"(",
"List",
")",
"result",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"ex",
")",
"{",
"// This is ok, it's probably the first time the picker has been used.",
"return",
"new",
"ArrayList",
"(",
")",
";",
"}",
"}"
] | Retrieves the list of recently selected examples from a file on the file system.
@return the list of recently used examples. | [
"Retrieves",
"the",
"list",
"of",
"recently",
"selected",
"examples",
"from",
"a",
"file",
"on",
"the",
"file",
"system",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java#L321-L335 |
139,428 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java | SimplePicker.getCurrentComponent | public Container getCurrentComponent() {
Container currentComponent = null;
if (((Container) (container.getChildAt(0))).getChildCount() > 0) {
currentComponent = (Container) container.getChildAt(0);
}
return currentComponent;
} | java | public Container getCurrentComponent() {
Container currentComponent = null;
if (((Container) (container.getChildAt(0))).getChildCount() > 0) {
currentComponent = (Container) container.getChildAt(0);
}
return currentComponent;
} | [
"public",
"Container",
"getCurrentComponent",
"(",
")",
"{",
"Container",
"currentComponent",
"=",
"null",
";",
"if",
"(",
"(",
"(",
"Container",
")",
"(",
"container",
".",
"getChildAt",
"(",
"0",
")",
")",
")",
".",
"getChildCount",
"(",
")",
">",
"0",
")",
"{",
"currentComponent",
"=",
"(",
"Container",
")",
"container",
".",
"getChildAt",
"(",
"0",
")",
";",
"}",
"return",
"currentComponent",
";",
"}"
] | Retrieves the component that is currently being displayed by the example picker.
@return the current example. | [
"Retrieves",
"the",
"component",
"that",
"is",
"currently",
"being",
"displayed",
"by",
"the",
"example",
"picker",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java#L342-L350 |
139,429 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java | SimplePicker.displaySelection | public void displaySelection(final String selection) {
WComponent selectedComponent = UIRegistry.getInstance().getUI(selection);
if (selectedComponent == null) {
// Can't load selected component.
WMessages.getInstance(this).error(
"Unable to load example: " + selection + ", see log for details.");
return;
}
displaySelection(selectedComponent);
} | java | public void displaySelection(final String selection) {
WComponent selectedComponent = UIRegistry.getInstance().getUI(selection);
if (selectedComponent == null) {
// Can't load selected component.
WMessages.getInstance(this).error(
"Unable to load example: " + selection + ", see log for details.");
return;
}
displaySelection(selectedComponent);
} | [
"public",
"void",
"displaySelection",
"(",
"final",
"String",
"selection",
")",
"{",
"WComponent",
"selectedComponent",
"=",
"UIRegistry",
".",
"getInstance",
"(",
")",
".",
"getUI",
"(",
"selection",
")",
";",
"if",
"(",
"selectedComponent",
"==",
"null",
")",
"{",
"// Can't load selected component.",
"WMessages",
".",
"getInstance",
"(",
"this",
")",
".",
"error",
"(",
"\"Unable to load example: \"",
"+",
"selection",
"+",
"\", see log for details.\"",
")",
";",
"return",
";",
"}",
"displaySelection",
"(",
"selectedComponent",
")",
";",
"}"
] | Get the example picker to display the given selection.
@param selection the class name of the wcomponent to be loaded and displayed. | [
"Get",
"the",
"example",
"picker",
"to",
"display",
"the",
"given",
"selection",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java#L357-L368 |
139,430 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java | SimplePicker.displaySelection | public void displaySelection(final WComponent selectedComponent) {
WComponent currentComponent = getCurrentComponent();
if (selectedComponent == currentComponent) {
// We are already displaying this component, so nothing to do.
return;
}
// We have a new selection so display it.
container.removeAll();
container.add(selectedComponent);
} | java | public void displaySelection(final WComponent selectedComponent) {
WComponent currentComponent = getCurrentComponent();
if (selectedComponent == currentComponent) {
// We are already displaying this component, so nothing to do.
return;
}
// We have a new selection so display it.
container.removeAll();
container.add(selectedComponent);
} | [
"public",
"void",
"displaySelection",
"(",
"final",
"WComponent",
"selectedComponent",
")",
"{",
"WComponent",
"currentComponent",
"=",
"getCurrentComponent",
"(",
")",
";",
"if",
"(",
"selectedComponent",
"==",
"currentComponent",
")",
"{",
"// We are already displaying this component, so nothing to do.",
"return",
";",
"}",
"// We have a new selection so display it.",
"container",
".",
"removeAll",
"(",
")",
";",
"container",
".",
"add",
"(",
"selectedComponent",
")",
";",
"}"
] | Get the example picker to display the given selected component.
@param selectedComponent the wcomponent to be displayed. | [
"Get",
"the",
"example",
"picker",
"to",
"display",
"the",
"given",
"selected",
"component",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java#L375-L386 |
139,431 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java | SimplePicker.storeRecentList | private void storeRecentList(final List recent) {
try {
if (recent == null) {
return;
}
// Only keep the last 8 entries.
while (recent.size() > 8) {
recent.remove(recent.size() - 1);
}
OutputStream out = new BufferedOutputStream(new FileOutputStream(
RECENT_FILE_NAME));
XMLEncoder e = new XMLEncoder(out);
e.writeObject(recent);
e.close();
} catch (IOException ex) {
LOG.error("Unable to save recent list", ex);
}
} | java | private void storeRecentList(final List recent) {
try {
if (recent == null) {
return;
}
// Only keep the last 8 entries.
while (recent.size() > 8) {
recent.remove(recent.size() - 1);
}
OutputStream out = new BufferedOutputStream(new FileOutputStream(
RECENT_FILE_NAME));
XMLEncoder e = new XMLEncoder(out);
e.writeObject(recent);
e.close();
} catch (IOException ex) {
LOG.error("Unable to save recent list", ex);
}
} | [
"private",
"void",
"storeRecentList",
"(",
"final",
"List",
"recent",
")",
"{",
"try",
"{",
"if",
"(",
"recent",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// Only keep the last 8 entries.",
"while",
"(",
"recent",
".",
"size",
"(",
")",
">",
"8",
")",
"{",
"recent",
".",
"remove",
"(",
"recent",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}",
"OutputStream",
"out",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"RECENT_FILE_NAME",
")",
")",
";",
"XMLEncoder",
"e",
"=",
"new",
"XMLEncoder",
"(",
"out",
")",
";",
"e",
".",
"writeObject",
"(",
"recent",
")",
";",
"e",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Unable to save recent list\"",
",",
"ex",
")",
";",
"}",
"}"
] | Store the list of recent selections to a file on the file system.
@param recent the recent selections | [
"Store",
"the",
"list",
"of",
"recent",
"selections",
"to",
"a",
"file",
"on",
"the",
"file",
"system",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SimplePicker.java#L393-L412 |
139,432 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java | AjaxHelper.setCurrentOperationDetails | public static void setCurrentOperationDetails(final AjaxOperation operation, final ComponentWithContext trigger) {
if (operation == null) {
THREAD_LOCAL_OPERATION.remove();
} else {
THREAD_LOCAL_OPERATION.set(operation);
}
if (trigger == null) {
THREAD_LOCAL_COMPONENT_WITH_CONTEXT.remove();
} else {
THREAD_LOCAL_COMPONENT_WITH_CONTEXT.set(trigger);
}
} | java | public static void setCurrentOperationDetails(final AjaxOperation operation, final ComponentWithContext trigger) {
if (operation == null) {
THREAD_LOCAL_OPERATION.remove();
} else {
THREAD_LOCAL_OPERATION.set(operation);
}
if (trigger == null) {
THREAD_LOCAL_COMPONENT_WITH_CONTEXT.remove();
} else {
THREAD_LOCAL_COMPONENT_WITH_CONTEXT.set(trigger);
}
} | [
"public",
"static",
"void",
"setCurrentOperationDetails",
"(",
"final",
"AjaxOperation",
"operation",
",",
"final",
"ComponentWithContext",
"trigger",
")",
"{",
"if",
"(",
"operation",
"==",
"null",
")",
"{",
"THREAD_LOCAL_OPERATION",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"THREAD_LOCAL_OPERATION",
".",
"set",
"(",
"operation",
")",
";",
"}",
"if",
"(",
"trigger",
"==",
"null",
")",
"{",
"THREAD_LOCAL_COMPONENT_WITH_CONTEXT",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"THREAD_LOCAL_COMPONENT_WITH_CONTEXT",
".",
"set",
"(",
"trigger",
")",
";",
"}",
"}"
] | Sets the current AJAX operation details.
@param operation the current AJAX operation.
@param trigger the current AJAX operation trigger and its context. | [
"Sets",
"the",
"current",
"AJAX",
"operation",
"details",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L57-L69 |
139,433 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java | AjaxHelper.registerComponents | public static AjaxOperation registerComponents(final List<String> targetIds, final String triggerId) {
AjaxOperation operation = new AjaxOperation(triggerId, targetIds);
registerAjaxOperation(operation);
return operation;
} | java | public static AjaxOperation registerComponents(final List<String> targetIds, final String triggerId) {
AjaxOperation operation = new AjaxOperation(triggerId, targetIds);
registerAjaxOperation(operation);
return operation;
} | [
"public",
"static",
"AjaxOperation",
"registerComponents",
"(",
"final",
"List",
"<",
"String",
">",
"targetIds",
",",
"final",
"String",
"triggerId",
")",
"{",
"AjaxOperation",
"operation",
"=",
"new",
"AjaxOperation",
"(",
"triggerId",
",",
"targetIds",
")",
";",
"registerAjaxOperation",
"(",
"operation",
")",
";",
"return",
"operation",
";",
"}"
] | Registers one or more components as being AJAX capable.
@param targetIds the components to register. Each component will be re-painted when the trigger occurs.
@param triggerId the id of the trigger that will cause the components to be painted.
@return the AjaxOperation control configuration object. | [
"Registers",
"one",
"or",
"more",
"components",
"as",
"being",
"AJAX",
"capable",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L100-L104 |
139,434 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java | AjaxHelper.registerComponent | public static AjaxOperation registerComponent(final String targetId, final String triggerId) {
AjaxOperation operation = new AjaxOperation(triggerId, targetId);
registerAjaxOperation(operation);
return operation;
} | java | public static AjaxOperation registerComponent(final String targetId, final String triggerId) {
AjaxOperation operation = new AjaxOperation(triggerId, targetId);
registerAjaxOperation(operation);
return operation;
} | [
"public",
"static",
"AjaxOperation",
"registerComponent",
"(",
"final",
"String",
"targetId",
",",
"final",
"String",
"triggerId",
")",
"{",
"AjaxOperation",
"operation",
"=",
"new",
"AjaxOperation",
"(",
"triggerId",
",",
"targetId",
")",
";",
"registerAjaxOperation",
"(",
"operation",
")",
";",
"return",
"operation",
";",
"}"
] | Registers a single component as being AJAX capable.
@param targetId the component to register. The component will be re-painted when the trigger occurs.
@param triggerId the id of the trigger that will cause the component to be painted.
@return the AjaxOperation control configuration object. | [
"Registers",
"a",
"single",
"component",
"as",
"being",
"AJAX",
"capable",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L113-L117 |
139,435 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java | AjaxHelper.getAjaxOperation | public static AjaxOperation getAjaxOperation(final String triggerId) {
Map<String, AjaxOperation> operations = getRegisteredOperations();
return operations == null ? null : operations.get(triggerId);
} | java | public static AjaxOperation getAjaxOperation(final String triggerId) {
Map<String, AjaxOperation> operations = getRegisteredOperations();
return operations == null ? null : operations.get(triggerId);
} | [
"public",
"static",
"AjaxOperation",
"getAjaxOperation",
"(",
"final",
"String",
"triggerId",
")",
"{",
"Map",
"<",
"String",
",",
"AjaxOperation",
">",
"operations",
"=",
"getRegisteredOperations",
"(",
")",
";",
"return",
"operations",
"==",
"null",
"?",
"null",
":",
"operations",
".",
"get",
"(",
"triggerId",
")",
";",
"}"
] | Retrieves the AjaxOperation that has been registered for the given trigger. This method will return null if there
is no corresponding operation registered.
@param triggerId the trigger id.
@return the AjaxOperation corresponding to the trigger id. | [
"Retrieves",
"the",
"AjaxOperation",
"that",
"has",
"been",
"registered",
"for",
"the",
"given",
"trigger",
".",
"This",
"method",
"will",
"return",
"null",
"if",
"there",
"is",
"no",
"corresponding",
"operation",
"registered",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L162-L165 |
139,436 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java | AjaxHelper.clearAllRegisteredOperations | public static void clearAllRegisteredOperations() {
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
if (uic != null) {
uic.setFwkAttribute(AJAX_OPERATIONS_SESSION_KEY, null);
}
} | java | public static void clearAllRegisteredOperations() {
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
if (uic != null) {
uic.setFwkAttribute(AJAX_OPERATIONS_SESSION_KEY, null);
}
} | [
"public",
"static",
"void",
"clearAllRegisteredOperations",
"(",
")",
"{",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrentPrimaryUIContext",
"(",
")",
";",
"if",
"(",
"uic",
"!=",
"null",
")",
"{",
"uic",
".",
"setFwkAttribute",
"(",
"AJAX_OPERATIONS_SESSION_KEY",
",",
"null",
")",
";",
"}",
"}"
] | Clear the registered AJAX operations for this user context. | [
"Clear",
"the",
"registered",
"AJAX",
"operations",
"for",
"this",
"user",
"context",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L170-L175 |
139,437 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java | AjaxHelper.registerAjaxOperation | private static void registerAjaxOperation(final AjaxOperation operation) {
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
if (uic == null) {
throw new SystemException("No User Context Available to Register AJAX Operations.");
}
Map<String, AjaxOperation> operations = (Map<String, AjaxOperation>) uic.getFwkAttribute(AJAX_OPERATIONS_SESSION_KEY);
if (operations == null) {
operations = new HashMap<>();
uic.setFwkAttribute(AJAX_OPERATIONS_SESSION_KEY, operations);
}
operations.put(operation.getTriggerId(), operation);
} | java | private static void registerAjaxOperation(final AjaxOperation operation) {
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
if (uic == null) {
throw new SystemException("No User Context Available to Register AJAX Operations.");
}
Map<String, AjaxOperation> operations = (Map<String, AjaxOperation>) uic.getFwkAttribute(AJAX_OPERATIONS_SESSION_KEY);
if (operations == null) {
operations = new HashMap<>();
uic.setFwkAttribute(AJAX_OPERATIONS_SESSION_KEY, operations);
}
operations.put(operation.getTriggerId(), operation);
} | [
"private",
"static",
"void",
"registerAjaxOperation",
"(",
"final",
"AjaxOperation",
"operation",
")",
"{",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrentPrimaryUIContext",
"(",
")",
";",
"if",
"(",
"uic",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No User Context Available to Register AJAX Operations.\"",
")",
";",
"}",
"Map",
"<",
"String",
",",
"AjaxOperation",
">",
"operations",
"=",
"(",
"Map",
"<",
"String",
",",
"AjaxOperation",
">",
")",
"uic",
".",
"getFwkAttribute",
"(",
"AJAX_OPERATIONS_SESSION_KEY",
")",
";",
"if",
"(",
"operations",
"==",
"null",
")",
"{",
"operations",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"uic",
".",
"setFwkAttribute",
"(",
"AJAX_OPERATIONS_SESSION_KEY",
",",
"operations",
")",
";",
"}",
"operations",
".",
"put",
"(",
"operation",
".",
"getTriggerId",
"(",
")",
",",
"operation",
")",
";",
"}"
] | The Ajax servlet needs access to the AjaxOperation Store the operation in the user context using the trigger Id,
as this will be present in the Servlet HttpRequest. agreed key. The ajax id is passed in the url to the servlet
so it can then access the context.
@param operation the operation to register. | [
"The",
"Ajax",
"servlet",
"needs",
"access",
"to",
"the",
"AjaxOperation",
"Store",
"the",
"operation",
"in",
"the",
"user",
"context",
"using",
"the",
"trigger",
"Id",
"as",
"this",
"will",
"be",
"present",
"in",
"the",
"Servlet",
"HttpRequest",
".",
"agreed",
"key",
".",
"The",
"ajax",
"id",
"is",
"passed",
"in",
"the",
"url",
"to",
"the",
"servlet",
"so",
"it",
"can",
"then",
"access",
"the",
"context",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L193-L204 |
139,438 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCheckBoxSelectRenderer.java | WCheckBoxSelectRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WCheckBoxSelect select = (WCheckBoxSelect) component;
XmlStringBuilder xml = renderContext.getWriter();
int cols = select.getButtonColumns();
boolean readOnly = select.isReadOnly();
xml.appendTagOpen("ui:checkboxselect");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", select.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
int min = select.getMinSelect();
int max = select.getMaxSelect();
xml.appendOptionalAttribute("disabled", select.isDisabled(), "true");
xml.appendOptionalAttribute("required", select.isMandatory(), "true");
xml.appendOptionalAttribute("submitOnChange", select.isSubmitOnChange(), "true");
xml.appendOptionalAttribute("toolTip", component.getToolTip());
xml.appendOptionalAttribute("accessibleText", component.getAccessibleText());
xml.appendOptionalAttribute("min", min > 0, min);
xml.appendOptionalAttribute("max", max > 0, max);
}
xml.appendOptionalAttribute("frameless", select.isFrameless(), "true");
switch (select.getButtonLayout()) {
case COLUMNS:
xml.appendAttribute("layout", "column");
xml.appendOptionalAttribute("layoutColumnCount", cols > 0, cols);
break;
case FLAT:
xml.appendAttribute("layout", "flat");
break;
case STACKED:
xml.appendAttribute("layout", "stacked");
break;
default:
throw new SystemException("Unknown layout type: " + select.getButtonLayout());
}
xml.appendClose();
// Options
List<?> options = select.getOptions();
boolean renderSelectionsOnly = readOnly;
if (options != null) {
int optionIndex = 0;
List<?> selections = select.getSelected();
for (Object option : options) {
if (option instanceof OptionGroup) {
throw new SystemException("Option groups not supported in WCheckBoxSelect.");
} else {
renderOption(select, option, optionIndex++, xml, selections,
renderSelectionsOnly);
}
}
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(select, renderContext);
}
xml.appendEndTag("ui:checkboxselect");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WCheckBoxSelect select = (WCheckBoxSelect) component;
XmlStringBuilder xml = renderContext.getWriter();
int cols = select.getButtonColumns();
boolean readOnly = select.isReadOnly();
xml.appendTagOpen("ui:checkboxselect");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", select.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
int min = select.getMinSelect();
int max = select.getMaxSelect();
xml.appendOptionalAttribute("disabled", select.isDisabled(), "true");
xml.appendOptionalAttribute("required", select.isMandatory(), "true");
xml.appendOptionalAttribute("submitOnChange", select.isSubmitOnChange(), "true");
xml.appendOptionalAttribute("toolTip", component.getToolTip());
xml.appendOptionalAttribute("accessibleText", component.getAccessibleText());
xml.appendOptionalAttribute("min", min > 0, min);
xml.appendOptionalAttribute("max", max > 0, max);
}
xml.appendOptionalAttribute("frameless", select.isFrameless(), "true");
switch (select.getButtonLayout()) {
case COLUMNS:
xml.appendAttribute("layout", "column");
xml.appendOptionalAttribute("layoutColumnCount", cols > 0, cols);
break;
case FLAT:
xml.appendAttribute("layout", "flat");
break;
case STACKED:
xml.appendAttribute("layout", "stacked");
break;
default:
throw new SystemException("Unknown layout type: " + select.getButtonLayout());
}
xml.appendClose();
// Options
List<?> options = select.getOptions();
boolean renderSelectionsOnly = readOnly;
if (options != null) {
int optionIndex = 0;
List<?> selections = select.getSelected();
for (Object option : options) {
if (option instanceof OptionGroup) {
throw new SystemException("Option groups not supported in WCheckBoxSelect.");
} else {
renderOption(select, option, optionIndex++, xml, selections,
renderSelectionsOnly);
}
}
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(select, renderContext);
}
xml.appendEndTag("ui:checkboxselect");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WCheckBoxSelect",
"select",
"=",
"(",
"WCheckBoxSelect",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"int",
"cols",
"=",
"select",
".",
"getButtonColumns",
"(",
")",
";",
"boolean",
"readOnly",
"=",
"select",
".",
"isReadOnly",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:checkboxselect\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"select",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"if",
"(",
"readOnly",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"readOnly\"",
",",
"\"true\"",
")",
";",
"}",
"else",
"{",
"int",
"min",
"=",
"select",
".",
"getMinSelect",
"(",
")",
";",
"int",
"max",
"=",
"select",
".",
"getMaxSelect",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"disabled\"",
",",
"select",
".",
"isDisabled",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"required\"",
",",
"select",
".",
"isMandatory",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"submitOnChange\"",
",",
"select",
".",
"isSubmitOnChange",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"toolTip\"",
",",
"component",
".",
"getToolTip",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"accessibleText\"",
",",
"component",
".",
"getAccessibleText",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"min\"",
",",
"min",
">",
"0",
",",
"min",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"max\"",
",",
"max",
">",
"0",
",",
"max",
")",
";",
"}",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"frameless\"",
",",
"select",
".",
"isFrameless",
"(",
")",
",",
"\"true\"",
")",
";",
"switch",
"(",
"select",
".",
"getButtonLayout",
"(",
")",
")",
"{",
"case",
"COLUMNS",
":",
"xml",
".",
"appendAttribute",
"(",
"\"layout\"",
",",
"\"column\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"layoutColumnCount\"",
",",
"cols",
">",
"0",
",",
"cols",
")",
";",
"break",
";",
"case",
"FLAT",
":",
"xml",
".",
"appendAttribute",
"(",
"\"layout\"",
",",
"\"flat\"",
")",
";",
"break",
";",
"case",
"STACKED",
":",
"xml",
".",
"appendAttribute",
"(",
"\"layout\"",
",",
"\"stacked\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown layout type: \"",
"+",
"select",
".",
"getButtonLayout",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"// Options",
"List",
"<",
"?",
">",
"options",
"=",
"select",
".",
"getOptions",
"(",
")",
";",
"boolean",
"renderSelectionsOnly",
"=",
"readOnly",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"int",
"optionIndex",
"=",
"0",
";",
"List",
"<",
"?",
">",
"selections",
"=",
"select",
".",
"getSelected",
"(",
")",
";",
"for",
"(",
"Object",
"option",
":",
"options",
")",
"{",
"if",
"(",
"option",
"instanceof",
"OptionGroup",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"Option groups not supported in WCheckBoxSelect.\"",
")",
";",
"}",
"else",
"{",
"renderOption",
"(",
"select",
",",
"option",
",",
"optionIndex",
"++",
",",
"xml",
",",
"selections",
",",
"renderSelectionsOnly",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"readOnly",
")",
"{",
"DiagnosticRenderUtil",
".",
"renderDiagnostics",
"(",
"select",
",",
"renderContext",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:checkboxselect\"",
")",
";",
"}"
] | Paints the given WCheckBoxSelect.
@param component the WCheckBoxSelect to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WCheckBoxSelect",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCheckBoxSelectRenderer.java#L26-L92 |
139,439 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/builder/SubordinateBuilder.java | SubordinateBuilder.build | public WSubordinateControl build() {
if (!condition().validate()) {
throw new SystemException("Invalid condition: " + condition);
}
if (getActionsWhenTrue().isEmpty() && getActionsWhenFalse().isEmpty()) {
throw new SystemException("No actions to execute");
}
WSubordinateControl subordinate = new WSubordinateControl();
Rule rule = new Rule();
BooleanExpression expression = getCondition();
rule.setCondition(expression.build());
for (Action action : getActionsWhenTrue()) {
rule.addActionOnTrue(action.build());
}
for (Action action : getActionsWhenFalse()) {
rule.addActionOnFalse(action.build());
}
subordinate.addRule(rule);
return subordinate;
} | java | public WSubordinateControl build() {
if (!condition().validate()) {
throw new SystemException("Invalid condition: " + condition);
}
if (getActionsWhenTrue().isEmpty() && getActionsWhenFalse().isEmpty()) {
throw new SystemException("No actions to execute");
}
WSubordinateControl subordinate = new WSubordinateControl();
Rule rule = new Rule();
BooleanExpression expression = getCondition();
rule.setCondition(expression.build());
for (Action action : getActionsWhenTrue()) {
rule.addActionOnTrue(action.build());
}
for (Action action : getActionsWhenFalse()) {
rule.addActionOnFalse(action.build());
}
subordinate.addRule(rule);
return subordinate;
} | [
"public",
"WSubordinateControl",
"build",
"(",
")",
"{",
"if",
"(",
"!",
"condition",
"(",
")",
".",
"validate",
"(",
")",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"Invalid condition: \"",
"+",
"condition",
")",
";",
"}",
"if",
"(",
"getActionsWhenTrue",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"getActionsWhenFalse",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No actions to execute\"",
")",
";",
"}",
"WSubordinateControl",
"subordinate",
"=",
"new",
"WSubordinateControl",
"(",
")",
";",
"Rule",
"rule",
"=",
"new",
"Rule",
"(",
")",
";",
"BooleanExpression",
"expression",
"=",
"getCondition",
"(",
")",
";",
"rule",
".",
"setCondition",
"(",
"expression",
".",
"build",
"(",
")",
")",
";",
"for",
"(",
"Action",
"action",
":",
"getActionsWhenTrue",
"(",
")",
")",
"{",
"rule",
".",
"addActionOnTrue",
"(",
"action",
".",
"build",
"(",
")",
")",
";",
"}",
"for",
"(",
"Action",
"action",
":",
"getActionsWhenFalse",
"(",
")",
")",
"{",
"rule",
".",
"addActionOnFalse",
"(",
"action",
".",
"build",
"(",
")",
")",
";",
"}",
"subordinate",
".",
"addRule",
"(",
"rule",
")",
";",
"return",
"subordinate",
";",
"}"
] | This builds the SubordinateControl. This method will throw a SystemException if the condition is invalid, or
there are no actions specified.
@return a SubordinateControl built using this builder. | [
"This",
"builds",
"the",
"SubordinateControl",
".",
"This",
"method",
"will",
"throw",
"a",
"SystemException",
"if",
"the",
"condition",
"is",
"invalid",
"or",
"there",
"are",
"no",
"actions",
"specified",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/builder/SubordinateBuilder.java#L138-L163 |
139,440 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageShellInterceptor.java | PageShellInterceptor.preparePaint | @Override
public void preparePaint(final Request request) {
Headers headers = this.getUI().getHeaders();
headers.reset();
headers.setContentType(WebUtilities.CONTENT_TYPE_XML);
super.preparePaint(request);
} | java | @Override
public void preparePaint(final Request request) {
Headers headers = this.getUI().getHeaders();
headers.reset();
headers.setContentType(WebUtilities.CONTENT_TYPE_XML);
super.preparePaint(request);
} | [
"@",
"Override",
"public",
"void",
"preparePaint",
"(",
"final",
"Request",
"request",
")",
"{",
"Headers",
"headers",
"=",
"this",
".",
"getUI",
"(",
")",
".",
"getHeaders",
"(",
")",
";",
"headers",
".",
"reset",
"(",
")",
";",
"headers",
".",
"setContentType",
"(",
"WebUtilities",
".",
"CONTENT_TYPE_XML",
")",
";",
"super",
".",
"preparePaint",
"(",
"request",
")",
";",
"}"
] | Override preparePaint in order to prepare the headers.
@param request the request being responded to. | [
"Override",
"preparePaint",
"in",
"order",
"to",
"prepare",
"the",
"headers",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageShellInterceptor.java#L25-L33 |
139,441 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageShellInterceptor.java | PageShellInterceptor.paint | @Override
public void paint(final RenderContext renderContext) {
WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
PrintWriter writer = webRenderContext.getWriter();
beforePaint(writer);
getBackingComponent().paint(renderContext);
afterPaint(writer);
} | java | @Override
public void paint(final RenderContext renderContext) {
WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
PrintWriter writer = webRenderContext.getWriter();
beforePaint(writer);
getBackingComponent().paint(renderContext);
afterPaint(writer);
} | [
"@",
"Override",
"public",
"void",
"paint",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"WebXmlRenderContext",
"webRenderContext",
"=",
"(",
"WebXmlRenderContext",
")",
"renderContext",
";",
"PrintWriter",
"writer",
"=",
"webRenderContext",
".",
"getWriter",
"(",
")",
";",
"beforePaint",
"(",
"writer",
")",
";",
"getBackingComponent",
"(",
")",
".",
"paint",
"(",
"renderContext",
")",
";",
"afterPaint",
"(",
"writer",
")",
";",
"}"
] | Produce the html output.
@param renderContext the renderContext to send the output to. | [
"Produce",
"the",
"html",
"output",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageShellInterceptor.java#L40-L48 |
139,442 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageShellInterceptor.java | PageShellInterceptor.beforePaint | protected void beforePaint(final PrintWriter writer) {
PageShell pageShell = Factory.newInstance(PageShell.class);
pageShell.openDoc(writer);
pageShell.writeHeader(writer);
} | java | protected void beforePaint(final PrintWriter writer) {
PageShell pageShell = Factory.newInstance(PageShell.class);
pageShell.openDoc(writer);
pageShell.writeHeader(writer);
} | [
"protected",
"void",
"beforePaint",
"(",
"final",
"PrintWriter",
"writer",
")",
"{",
"PageShell",
"pageShell",
"=",
"Factory",
".",
"newInstance",
"(",
"PageShell",
".",
"class",
")",
";",
"pageShell",
".",
"openDoc",
"(",
"writer",
")",
";",
"pageShell",
".",
"writeHeader",
"(",
"writer",
")",
";",
"}"
] | Renders the content before the backing component.
@param writer the writer to write to. | [
"Renders",
"the",
"content",
"before",
"the",
"backing",
"component",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageShellInterceptor.java#L55-L60 |
139,443 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageShellInterceptor.java | PageShellInterceptor.afterPaint | protected void afterPaint(final PrintWriter writer) {
PageShell pageShell = Factory.newInstance(PageShell.class);
pageShell.writeFooter(writer);
pageShell.closeDoc(writer);
} | java | protected void afterPaint(final PrintWriter writer) {
PageShell pageShell = Factory.newInstance(PageShell.class);
pageShell.writeFooter(writer);
pageShell.closeDoc(writer);
} | [
"protected",
"void",
"afterPaint",
"(",
"final",
"PrintWriter",
"writer",
")",
"{",
"PageShell",
"pageShell",
"=",
"Factory",
".",
"newInstance",
"(",
"PageShell",
".",
"class",
")",
";",
"pageShell",
".",
"writeFooter",
"(",
"writer",
")",
";",
"pageShell",
".",
"closeDoc",
"(",
"writer",
")",
";",
"}"
] | Renders the content after the backing component.
@param writer the writer to write to. | [
"Renders",
"the",
"content",
"after",
"the",
"backing",
"component",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageShellInterceptor.java#L67-L72 |
139,444 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java | WButton.handleRequest | @Override
public void handleRequest(final Request request) {
// Clear pressed
clearPressed();
String requestValue = request.getParameter(getId());
boolean pressed = "x".equals(requestValue);
// Only process on a POST
if (pressed && !"POST".equals(request.getMethod())) {
LOG.warn("Button pressed on a request that is not a POST. Will be ignored.");
return;
}
setPressed(pressed, request);
} | java | @Override
public void handleRequest(final Request request) {
// Clear pressed
clearPressed();
String requestValue = request.getParameter(getId());
boolean pressed = "x".equals(requestValue);
// Only process on a POST
if (pressed && !"POST".equals(request.getMethod())) {
LOG.warn("Button pressed on a request that is not a POST. Will be ignored.");
return;
}
setPressed(pressed, request);
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"// Clear pressed",
"clearPressed",
"(",
")",
";",
"String",
"requestValue",
"=",
"request",
".",
"getParameter",
"(",
"getId",
"(",
")",
")",
";",
"boolean",
"pressed",
"=",
"\"x\"",
".",
"equals",
"(",
"requestValue",
")",
";",
"// Only process on a POST",
"if",
"(",
"pressed",
"&&",
"!",
"\"POST\"",
".",
"equals",
"(",
"request",
".",
"getMethod",
"(",
")",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Button pressed on a request that is not a POST. Will be ignored.\"",
")",
";",
"return",
";",
"}",
"setPressed",
"(",
"pressed",
",",
"request",
")",
";",
"}"
] | Override handleRequest in order to perform processing for this component. This implementation checks whether the
button has been pressed in the request.
@param request the request being responded to. | [
"Override",
"handleRequest",
"in",
"order",
"to",
"perform",
"processing",
"for",
"this",
"component",
".",
"This",
"implementation",
"checks",
"whether",
"the",
"button",
"has",
"been",
"pressed",
"in",
"the",
"request",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java#L134-L149 |
139,445 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java | WButton.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
UIContext uic = UIContextHolder.getCurrent();
if (isAjax() && uic.getUI() != null) {
AjaxTarget target = getAjaxTarget();
AjaxHelper.registerComponent(target.getId(), getId());
}
} | java | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
UIContext uic = UIContextHolder.getCurrent();
if (isAjax() && uic.getUI() != null) {
AjaxTarget target = getAjaxTarget();
AjaxHelper.registerComponent(target.getId(), getId());
}
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"preparePaintComponent",
"(",
"request",
")",
";",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrent",
"(",
")",
";",
"if",
"(",
"isAjax",
"(",
")",
"&&",
"uic",
".",
"getUI",
"(",
")",
"!=",
"null",
")",
"{",
"AjaxTarget",
"target",
"=",
"getAjaxTarget",
"(",
")",
";",
"AjaxHelper",
".",
"registerComponent",
"(",
"target",
".",
"getId",
"(",
")",
",",
"getId",
"(",
")",
")",
";",
"}",
"}"
] | Override preparePaintComponent to register an AJAX operation if this button is AJAX enabled.
@param request the request being responded to | [
"Override",
"preparePaintComponent",
"to",
"register",
"an",
"AJAX",
"operation",
"if",
"this",
"button",
"is",
"AJAX",
"enabled",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java#L156-L166 |
139,446 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java | WButton.getValue | public String getValue() {
Object value = getData();
if (value != null) {
return value.toString();
}
String text = getText();
return text == null ? NO_VALUE : text;
} | java | public String getValue() {
Object value = getData();
if (value != null) {
return value.toString();
}
String text = getText();
return text == null ? NO_VALUE : text;
} | [
"public",
"String",
"getValue",
"(",
")",
"{",
"Object",
"value",
"=",
"getData",
"(",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
".",
"toString",
"(",
")",
";",
"}",
"String",
"text",
"=",
"getText",
"(",
")",
";",
"return",
"text",
"==",
"null",
"?",
"NO_VALUE",
":",
"text",
";",
"}"
] | Return the button value. By default the value is the same as the text placed on the button.
@return the button value | [
"Return",
"the",
"button",
"value",
".",
"By",
"default",
"the",
"value",
"is",
"the",
"same",
"as",
"the",
"text",
"placed",
"on",
"the",
"button",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java#L350-L358 |
139,447 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java | WButton.setImage | public void setImage(final Image image) {
ButtonModel model = getOrCreateComponentModel();
model.image = image;
model.imageUrl = null;
} | java | public void setImage(final Image image) {
ButtonModel model = getOrCreateComponentModel();
model.image = image;
model.imageUrl = null;
} | [
"public",
"void",
"setImage",
"(",
"final",
"Image",
"image",
")",
"{",
"ButtonModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"model",
".",
"image",
"=",
"image",
";",
"model",
".",
"imageUrl",
"=",
"null",
";",
"}"
] | Sets the image to display on the button. The text alternative for the image is generated from the button text.
@param image the image, or null for no image | [
"Sets",
"the",
"image",
"to",
"display",
"on",
"the",
"button",
".",
"The",
"text",
"alternative",
"for",
"the",
"image",
"is",
"generated",
"from",
"the",
"button",
"text",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java#L423-L427 |
139,448 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/ajax/AjaxWRadioButtonSelectExample.java | AjaxWRadioButtonSelectExample.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
if (OPTION_CONTENT1.equals(rbSelect.getSelected())) {
content.setText("This is content 1");
} else if (OPTION_CONTENT2.equals(rbSelect.getSelected())) {
content.setText("This is content 2");
} else if (OPTION_CONTENT3.equals(rbSelect.getSelected())) {
content.setText("This is content 3");
} else {
content.setText(null);
}
} | java | @Override
protected void preparePaintComponent(final Request request) {
if (OPTION_CONTENT1.equals(rbSelect.getSelected())) {
content.setText("This is content 1");
} else if (OPTION_CONTENT2.equals(rbSelect.getSelected())) {
content.setText("This is content 2");
} else if (OPTION_CONTENT3.equals(rbSelect.getSelected())) {
content.setText("This is content 3");
} else {
content.setText(null);
}
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"OPTION_CONTENT1",
".",
"equals",
"(",
"rbSelect",
".",
"getSelected",
"(",
")",
")",
")",
"{",
"content",
".",
"setText",
"(",
"\"This is content 1\"",
")",
";",
"}",
"else",
"if",
"(",
"OPTION_CONTENT2",
".",
"equals",
"(",
"rbSelect",
".",
"getSelected",
"(",
")",
")",
")",
"{",
"content",
".",
"setText",
"(",
"\"This is content 2\"",
")",
";",
"}",
"else",
"if",
"(",
"OPTION_CONTENT3",
".",
"equals",
"(",
"rbSelect",
".",
"getSelected",
"(",
")",
")",
")",
"{",
"content",
".",
"setText",
"(",
"\"This is content 3\"",
")",
";",
"}",
"else",
"{",
"content",
".",
"setText",
"(",
"null",
")",
";",
"}",
"}"
] | Set the content of the text field depending on the selected option in the radio button select.
@param request the request being processed | [
"Set",
"the",
"content",
"of",
"the",
"text",
"field",
"depending",
"on",
"the",
"selected",
"option",
"in",
"the",
"radio",
"button",
"select",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/ajax/AjaxWRadioButtonSelectExample.java#L77-L88 |
139,449 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/Rule.java | Rule.execute | public void execute() {
if (condition == null) {
throw new SystemException("Rule cannot be executed as it has no condition");
}
if (condition.isTrue()) {
for (Action action : onTrue) {
action.execute();
}
} else {
for (Action action : onFalse) {
action.execute();
}
}
} | java | public void execute() {
if (condition == null) {
throw new SystemException("Rule cannot be executed as it has no condition");
}
if (condition.isTrue()) {
for (Action action : onTrue) {
action.execute();
}
} else {
for (Action action : onFalse) {
action.execute();
}
}
} | [
"public",
"void",
"execute",
"(",
")",
"{",
"if",
"(",
"condition",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"Rule cannot be executed as it has no condition\"",
")",
";",
"}",
"if",
"(",
"condition",
".",
"isTrue",
"(",
")",
")",
"{",
"for",
"(",
"Action",
"action",
":",
"onTrue",
")",
"{",
"action",
".",
"execute",
"(",
")",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"Action",
"action",
":",
"onFalse",
")",
"{",
"action",
".",
"execute",
"(",
")",
";",
"}",
"}",
"}"
] | Executes the rule. | [
"Executes",
"the",
"rule",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/Rule.java#L119-L133 |
139,450 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/SubordinateControlHelper.java | SubordinateControlHelper.applyRegisteredControls | public static void applyRegisteredControls(final Request request, final boolean useRequestValues) {
Set<String> controls = getRegisteredSubordinateControls();
if (controls == null) {
return;
}
// Process Controls
for (String controlId : controls) {
// Find the Component for this ID
ComponentWithContext controlWithContext = WebUtilities.getComponentById(controlId,
true);
if (controlWithContext == null) {
LOG.warn(
"Subordinate control for id " + controlId + " is no longer in the tree.");
continue;
}
if (!(controlWithContext.getComponent() instanceof WSubordinateControl)) {
LOG.warn("Component for id " + controlId + " is not a subordinate control.");
continue;
}
WSubordinateControl control = (WSubordinateControl) controlWithContext.getComponent();
UIContext uic = controlWithContext.getContext();
UIContextHolder.pushContext(uic);
try {
if (useRequestValues) {
control.applyTheControls(request);
} else {
control.applyTheControls();
}
} finally {
UIContextHolder.popContext();
}
}
} | java | public static void applyRegisteredControls(final Request request, final boolean useRequestValues) {
Set<String> controls = getRegisteredSubordinateControls();
if (controls == null) {
return;
}
// Process Controls
for (String controlId : controls) {
// Find the Component for this ID
ComponentWithContext controlWithContext = WebUtilities.getComponentById(controlId,
true);
if (controlWithContext == null) {
LOG.warn(
"Subordinate control for id " + controlId + " is no longer in the tree.");
continue;
}
if (!(controlWithContext.getComponent() instanceof WSubordinateControl)) {
LOG.warn("Component for id " + controlId + " is not a subordinate control.");
continue;
}
WSubordinateControl control = (WSubordinateControl) controlWithContext.getComponent();
UIContext uic = controlWithContext.getContext();
UIContextHolder.pushContext(uic);
try {
if (useRequestValues) {
control.applyTheControls(request);
} else {
control.applyTheControls();
}
} finally {
UIContextHolder.popContext();
}
}
} | [
"public",
"static",
"void",
"applyRegisteredControls",
"(",
"final",
"Request",
"request",
",",
"final",
"boolean",
"useRequestValues",
")",
"{",
"Set",
"<",
"String",
">",
"controls",
"=",
"getRegisteredSubordinateControls",
"(",
")",
";",
"if",
"(",
"controls",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// Process Controls",
"for",
"(",
"String",
"controlId",
":",
"controls",
")",
"{",
"// Find the Component for this ID",
"ComponentWithContext",
"controlWithContext",
"=",
"WebUtilities",
".",
"getComponentById",
"(",
"controlId",
",",
"true",
")",
";",
"if",
"(",
"controlWithContext",
"==",
"null",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Subordinate control for id \"",
"+",
"controlId",
"+",
"\" is no longer in the tree.\"",
")",
";",
"continue",
";",
"}",
"if",
"(",
"!",
"(",
"controlWithContext",
".",
"getComponent",
"(",
")",
"instanceof",
"WSubordinateControl",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Component for id \"",
"+",
"controlId",
"+",
"\" is not a subordinate control.\"",
")",
";",
"continue",
";",
"}",
"WSubordinateControl",
"control",
"=",
"(",
"WSubordinateControl",
")",
"controlWithContext",
".",
"getComponent",
"(",
")",
";",
"UIContext",
"uic",
"=",
"controlWithContext",
".",
"getContext",
"(",
")",
";",
"UIContextHolder",
".",
"pushContext",
"(",
"uic",
")",
";",
"try",
"{",
"if",
"(",
"useRequestValues",
")",
"{",
"control",
".",
"applyTheControls",
"(",
"request",
")",
";",
"}",
"else",
"{",
"control",
".",
"applyTheControls",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"UIContextHolder",
".",
"popContext",
"(",
")",
";",
"}",
"}",
"}"
] | Apply the registered Subordinate Controls.
@param request the request being processed.
@param useRequestValues the flag to indicate the controls should use values from the request. | [
"Apply",
"the",
"registered",
"Subordinate",
"Controls",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/SubordinateControlHelper.java#L73-L111 |
139,451 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/SubordinateControlHelper.java | SubordinateControlHelper.clearAllRegisteredControls | public static void clearAllRegisteredControls() {
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
if (uic != null) {
uic.setFwkAttribute(SUBORDINATE_CONTROL_SESSION_KEY, null);
}
} | java | public static void clearAllRegisteredControls() {
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
if (uic != null) {
uic.setFwkAttribute(SUBORDINATE_CONTROL_SESSION_KEY, null);
}
} | [
"public",
"static",
"void",
"clearAllRegisteredControls",
"(",
")",
"{",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrentPrimaryUIContext",
"(",
")",
";",
"if",
"(",
"uic",
"!=",
"null",
")",
"{",
"uic",
".",
"setFwkAttribute",
"(",
"SUBORDINATE_CONTROL_SESSION_KEY",
",",
"null",
")",
";",
"}",
"}"
] | Clear all registered Subordinate Controls on the session. | [
"Clear",
"all",
"registered",
"Subordinate",
"Controls",
"on",
"the",
"session",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/SubordinateControlHelper.java#L116-L121 |
139,452 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java | WDialog.setContent | public void setContent(final WComponent content) {
getOrCreateComponentModel().content = content;
// There should only be one content.
holder.removeAll();
holder.add(content);
} | java | public void setContent(final WComponent content) {
getOrCreateComponentModel().content = content;
// There should only be one content.
holder.removeAll();
holder.add(content);
} | [
"public",
"void",
"setContent",
"(",
"final",
"WComponent",
"content",
")",
"{",
"getOrCreateComponentModel",
"(",
")",
".",
"content",
"=",
"content",
";",
"// There should only be one content.",
"holder",
".",
"removeAll",
"(",
")",
";",
"holder",
".",
"add",
"(",
"content",
")",
";",
"}"
] | Set the WComponent which will handle the content for this dialog.
@param content the dialog content. | [
"Set",
"the",
"WComponent",
"which",
"will",
"handle",
"the",
"content",
"for",
"this",
"dialog",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java#L155-L161 |
139,453 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java | WDialog.setTitle | public void setTitle(final String title, final Serializable... args) {
getOrCreateComponentModel().title = I18nUtilities.asMessage(title, args);
} | java | public void setTitle(final String title, final Serializable... args) {
getOrCreateComponentModel().title = I18nUtilities.asMessage(title, args);
} | [
"public",
"void",
"setTitle",
"(",
"final",
"String",
"title",
",",
"final",
"Serializable",
"...",
"args",
")",
"{",
"getOrCreateComponentModel",
"(",
")",
".",
"title",
"=",
"I18nUtilities",
".",
"asMessage",
"(",
"title",
",",
"args",
")",
";",
"}"
] | Sets the dialog title.
@param title the title to set, using {@link MessageFormat} syntax.
@param args optional arguments for the message format string. | [
"Sets",
"the",
"dialog",
"title",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java#L264-L266 |
139,454 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java | WDialog.setTrigger | public void setTrigger(final DialogOpenTrigger trigger) {
// pre-1.2.3 compatibilty only:
if (this.hasLegacyTriggerButton()) {
DialogOpenTrigger theTrigger = getTrigger();
if (theTrigger instanceof WButton) {
remove(theTrigger);
}
setLegacyTriggerButton(false);
}
// end of backwards compatibility code.
getOrCreateComponentModel().trigger = trigger;
} | java | public void setTrigger(final DialogOpenTrigger trigger) {
// pre-1.2.3 compatibilty only:
if (this.hasLegacyTriggerButton()) {
DialogOpenTrigger theTrigger = getTrigger();
if (theTrigger instanceof WButton) {
remove(theTrigger);
}
setLegacyTriggerButton(false);
}
// end of backwards compatibility code.
getOrCreateComponentModel().trigger = trigger;
} | [
"public",
"void",
"setTrigger",
"(",
"final",
"DialogOpenTrigger",
"trigger",
")",
"{",
"// pre-1.2.3 compatibilty only:",
"if",
"(",
"this",
".",
"hasLegacyTriggerButton",
"(",
")",
")",
"{",
"DialogOpenTrigger",
"theTrigger",
"=",
"getTrigger",
"(",
")",
";",
"if",
"(",
"theTrigger",
"instanceof",
"WButton",
")",
"{",
"remove",
"(",
"theTrigger",
")",
";",
"}",
"setLegacyTriggerButton",
"(",
"false",
")",
";",
"}",
"// end of backwards compatibility code.",
"getOrCreateComponentModel",
"(",
")",
".",
"trigger",
"=",
"trigger",
";",
"}"
] | Set the component which will open the WDialog.
@param trigger the WComponent which will open the dialog on click/change | [
"Set",
"the",
"component",
"which",
"will",
"open",
"the",
"WDialog",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java#L273-L284 |
139,455 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java | WDialog.handleTriggerOpenAction | protected void handleTriggerOpenAction(final Request request) {
// Run the action (if set)
final Action action = getTriggerOpenAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, OPEN_DIALOG_ACTION);
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
} | java | protected void handleTriggerOpenAction(final Request request) {
// Run the action (if set)
final Action action = getTriggerOpenAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, OPEN_DIALOG_ACTION);
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
} | [
"protected",
"void",
"handleTriggerOpenAction",
"(",
"final",
"Request",
"request",
")",
"{",
"// Run the action (if set)",
"final",
"Action",
"action",
"=",
"getTriggerOpenAction",
"(",
")",
";",
"if",
"(",
"action",
"!=",
"null",
")",
"{",
"final",
"ActionEvent",
"event",
"=",
"new",
"ActionEvent",
"(",
"this",
",",
"OPEN_DIALOG_ACTION",
")",
";",
"Runnable",
"later",
"=",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"action",
".",
"execute",
"(",
"event",
")",
";",
"}",
"}",
";",
"invokeLater",
"(",
"later",
")",
";",
"}",
"}"
] | Run the trigger open action.
@param request the request being processed | [
"Run",
"the",
"trigger",
"open",
"action",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java#L337-L350 |
139,456 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java | WDialog.isAjaxTargeted | public final boolean isAjaxTargeted() {
// If the AJAX target is within the dialog, it should be visible.
AjaxOperation operation = AjaxHelper.getCurrentOperation();
if (operation == null) {
return false;
}
String dialogId = getId();
String containerId = operation.getTargetContainerId();
if (containerId != null && containerId.startsWith(dialogId)) {
// target is the dialog, or somewhere within the dialog
return true;
}
if (operation.getTargets() != null && UIContextHolder.getCurrent() != null) {
for (String targetId : operation.getTargets()) {
if (targetId.startsWith(dialogId)) {
return true;
}
}
}
return false;
} | java | public final boolean isAjaxTargeted() {
// If the AJAX target is within the dialog, it should be visible.
AjaxOperation operation = AjaxHelper.getCurrentOperation();
if (operation == null) {
return false;
}
String dialogId = getId();
String containerId = operation.getTargetContainerId();
if (containerId != null && containerId.startsWith(dialogId)) {
// target is the dialog, or somewhere within the dialog
return true;
}
if (operation.getTargets() != null && UIContextHolder.getCurrent() != null) {
for (String targetId : operation.getTargets()) {
if (targetId.startsWith(dialogId)) {
return true;
}
}
}
return false;
} | [
"public",
"final",
"boolean",
"isAjaxTargeted",
"(",
")",
"{",
"// If the AJAX target is within the dialog, it should be visible.",
"AjaxOperation",
"operation",
"=",
"AjaxHelper",
".",
"getCurrentOperation",
"(",
")",
";",
"if",
"(",
"operation",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"dialogId",
"=",
"getId",
"(",
")",
";",
"String",
"containerId",
"=",
"operation",
".",
"getTargetContainerId",
"(",
")",
";",
"if",
"(",
"containerId",
"!=",
"null",
"&&",
"containerId",
".",
"startsWith",
"(",
"dialogId",
")",
")",
"{",
"// target is the dialog, or somewhere within the dialog",
"return",
"true",
";",
"}",
"if",
"(",
"operation",
".",
"getTargets",
"(",
")",
"!=",
"null",
"&&",
"UIContextHolder",
".",
"getCurrent",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"targetId",
":",
"operation",
".",
"getTargets",
"(",
")",
")",
"{",
"if",
"(",
"targetId",
".",
"startsWith",
"(",
"dialogId",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Indicates whether the dialog is currently the target of an AJAX operation.
@return true if the dialog is currently AJAX targeted, otherwise false. | [
"Indicates",
"whether",
"the",
"dialog",
"is",
"currently",
"the",
"target",
"of",
"an",
"AJAX",
"operation",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java#L376-L399 |
139,457 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.getAppsOnSpace | public List<Application> getAppsOnSpace(int spaceId) {
return getResourceFactory().getApiResource(
"/app/space/" + spaceId + "/").get(
new GenericType<List<Application>>() {
});
} | java | public List<Application> getAppsOnSpace(int spaceId) {
return getResourceFactory().getApiResource(
"/app/space/" + spaceId + "/").get(
new GenericType<List<Application>>() {
});
} | [
"public",
"List",
"<",
"Application",
">",
"getAppsOnSpace",
"(",
"int",
"spaceId",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/space/\"",
"+",
"spaceId",
"+",
"\"/\"",
")",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"Application",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Returns all the apps on the space that are visible. The apps are sorted
by any custom ordering and else by name.
@param spaceId
The id of the space
@return The list of apps on the given space | [
"Returns",
"all",
"the",
"apps",
"on",
"the",
"space",
"that",
"are",
"visible",
".",
"The",
"apps",
"are",
"sorted",
"by",
"any",
"custom",
"ordering",
"and",
"else",
"by",
"name",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L45-L50 |
139,458 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.getTopApps | public List<Application> getTopApps(Integer limit) {
WebResource resource = getResourceFactory().getApiResource("/app/top/");
if (limit != null) {
resource = resource.queryParam("limit", limit.toString());
}
return resource.get(new GenericType<List<Application>>() {
});
} | java | public List<Application> getTopApps(Integer limit) {
WebResource resource = getResourceFactory().getApiResource("/app/top/");
if (limit != null) {
resource = resource.queryParam("limit", limit.toString());
}
return resource.get(new GenericType<List<Application>>() {
});
} | [
"public",
"List",
"<",
"Application",
">",
"getTopApps",
"(",
"Integer",
"limit",
")",
"{",
"WebResource",
"resource",
"=",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/top/\"",
")",
";",
"if",
"(",
"limit",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"limit\"",
",",
"limit",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"resource",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"Application",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Returns the top apps for the active user. This is the apps that the user
have interacted with the most.
@param limit
The maximum number of apps to return, defaults to 4.
@return The top apps for the active user | [
"Returns",
"the",
"top",
"apps",
"for",
"the",
"active",
"user",
".",
"This",
"is",
"the",
"apps",
"that",
"the",
"user",
"have",
"interacted",
"with",
"the",
"most",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L60-L67 |
139,459 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.addApp | public int addApp(ApplicationCreate app) {
return getResourceFactory().getApiResource("/app/")
.entity(app, MediaType.APPLICATION_JSON_TYPE)
.post(ApplicationCreateResponse.class).getId();
} | java | public int addApp(ApplicationCreate app) {
return getResourceFactory().getApiResource("/app/")
.entity(app, MediaType.APPLICATION_JSON_TYPE)
.post(ApplicationCreateResponse.class).getId();
} | [
"public",
"int",
"addApp",
"(",
"ApplicationCreate",
"app",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/\"",
")",
".",
"entity",
"(",
"app",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"post",
"(",
"ApplicationCreateResponse",
".",
"class",
")",
".",
"getId",
"(",
")",
";",
"}"
] | Creates a new app on a space.
@param app
The definition for the new app
@return The id of the newly created app | [
"Creates",
"a",
"new",
"app",
"on",
"a",
"space",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L76-L80 |
139,460 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.updateApp | public void updateApp(int appId, ApplicationUpdate app) {
getResourceFactory().getApiResource("/app/" + appId)
.entity(app, MediaType.APPLICATION_JSON).put();
} | java | public void updateApp(int appId, ApplicationUpdate app) {
getResourceFactory().getApiResource("/app/" + appId)
.entity(app, MediaType.APPLICATION_JSON).put();
} | [
"public",
"void",
"updateApp",
"(",
"int",
"appId",
",",
"ApplicationUpdate",
"app",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/\"",
"+",
"appId",
")",
".",
"entity",
"(",
"app",
",",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"put",
"(",
")",
";",
"}"
] | Updates an app. The update can contain an new configuration for the app,
addition of new fields as well as updates to the configuration of
existing fields. Fields not included will not be deleted. To delete a
field use the "delete field" operation.
When adding/updating/deleting apps and fields, it can be simpler to only
update the app config here and add/update/remove fields using the
field/{field_id} sub resource.
@param appId
The id of the app to be updated
@param app
The updated app definition | [
"Updates",
"an",
"app",
".",
"The",
"update",
"can",
"contain",
"an",
"new",
"configuration",
"for",
"the",
"app",
"addition",
"of",
"new",
"fields",
"as",
"well",
"as",
"updates",
"to",
"the",
"configuration",
"of",
"existing",
"fields",
".",
"Fields",
"not",
"included",
"will",
"not",
"be",
"deleted",
".",
"To",
"delete",
"a",
"field",
"use",
"the",
"delete",
"field",
"operation",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L97-L100 |
139,461 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.addField | public int addField(int appId, ApplicationFieldCreate field) {
return getResourceFactory().getApiResource("/app/" + appId + "/field/")
.entity(field, MediaType.APPLICATION_JSON_TYPE)
.post(ApplicationFieldCreateResponse.class).getId();
} | java | public int addField(int appId, ApplicationFieldCreate field) {
return getResourceFactory().getApiResource("/app/" + appId + "/field/")
.entity(field, MediaType.APPLICATION_JSON_TYPE)
.post(ApplicationFieldCreateResponse.class).getId();
} | [
"public",
"int",
"addField",
"(",
"int",
"appId",
",",
"ApplicationFieldCreate",
"field",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/\"",
"+",
"appId",
"+",
"\"/field/\"",
")",
".",
"entity",
"(",
"field",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"post",
"(",
"ApplicationFieldCreateResponse",
".",
"class",
")",
".",
"getId",
"(",
")",
";",
"}"
] | Adds a new field to an app
@param appId
The id of the the field should be added to
@param field
The definition of the new field
@return The id of the newly created field | [
"Adds",
"a",
"new",
"field",
"to",
"an",
"app"
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L111-L115 |
139,462 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.updateField | public void updateField(int appId, int fieldId,
ApplicationFieldConfiguration configuration) {
getResourceFactory()
.getApiResource("/app/" + appId + "/field/" + fieldId)
.entity(configuration, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateField(int appId, int fieldId,
ApplicationFieldConfiguration configuration) {
getResourceFactory()
.getApiResource("/app/" + appId + "/field/" + fieldId)
.entity(configuration, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateField",
"(",
"int",
"appId",
",",
"int",
"fieldId",
",",
"ApplicationFieldConfiguration",
"configuration",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/\"",
"+",
"appId",
"+",
"\"/field/\"",
"+",
"fieldId",
")",
".",
"entity",
"(",
"configuration",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | Updates the configuration of an app field. The type of the field cannot
be updated, only the configuration.
@param appId
The id of the app the field is one
@param fieldId
The id of the field to be updated
@param configuration
The new configuration of the field | [
"Updates",
"the",
"configuration",
"of",
"an",
"app",
"field",
".",
"The",
"type",
"of",
"the",
"field",
"cannot",
"be",
"updated",
"only",
"the",
"configuration",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L128-L133 |
139,463 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.install | public int install(int appId, int spaceId) {
return getResourceFactory()
.getApiResource("/app/" + appId + "/install")
.entity(new ApplicationInstall(spaceId),
MediaType.APPLICATION_JSON_TYPE)
.post(ApplicationCreateResponse.class).getId();
} | java | public int install(int appId, int spaceId) {
return getResourceFactory()
.getApiResource("/app/" + appId + "/install")
.entity(new ApplicationInstall(spaceId),
MediaType.APPLICATION_JSON_TYPE)
.post(ApplicationCreateResponse.class).getId();
} | [
"public",
"int",
"install",
"(",
"int",
"appId",
",",
"int",
"spaceId",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/\"",
"+",
"appId",
"+",
"\"/install\"",
")",
".",
"entity",
"(",
"new",
"ApplicationInstall",
"(",
"spaceId",
")",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"post",
"(",
"ApplicationCreateResponse",
".",
"class",
")",
".",
"getId",
"(",
")",
";",
"}"
] | Installs the app with the given id on the space.
@param appId
The id of the app to be installed
@param spaceId
The id of the space the app should be installed o n
@return The id of the newly installed app | [
"Installs",
"the",
"app",
"with",
"the",
"given",
"id",
"on",
"the",
"space",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L189-L195 |
139,464 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.updateOrder | public void updateOrder(int spaceId, List<Integer> appIds) {
getResourceFactory().getApiResource("/app/space/" + spaceId + "/order")
.entity(appIds, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateOrder(int spaceId, List<Integer> appIds) {
getResourceFactory().getApiResource("/app/space/" + spaceId + "/order")
.entity(appIds, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateOrder",
"(",
"int",
"spaceId",
",",
"List",
"<",
"Integer",
">",
"appIds",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/space/\"",
"+",
"spaceId",
"+",
"\"/order\"",
")",
".",
"entity",
"(",
"appIds",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | Updates the order of the apps on the space. It should post all the apps
from the space in the order required.
@param spaceId
The id of the space the apps are on
@param appIds
The ids of the apps in the new order | [
"Updates",
"the",
"order",
"of",
"the",
"apps",
"on",
"the",
"space",
".",
"It",
"should",
"post",
"all",
"the",
"apps",
"from",
"the",
"space",
"in",
"the",
"order",
"required",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L206-L209 |
139,465 | podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.deactivateApp | public void deactivateApp(int appId) {
getResourceFactory().getApiResource("/app/" + appId + "/deactivate")
.entity(new Empty(), MediaType.APPLICATION_JSON_TYPE).post();
} | java | public void deactivateApp(int appId) {
getResourceFactory().getApiResource("/app/" + appId + "/deactivate")
.entity(new Empty(), MediaType.APPLICATION_JSON_TYPE).post();
} | [
"public",
"void",
"deactivateApp",
"(",
"int",
"appId",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/\"",
"+",
"appId",
"+",
"\"/deactivate\"",
")",
".",
"entity",
"(",
"new",
"Empty",
"(",
")",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"post",
"(",
")",
";",
"}"
] | Deactivates the app with the given id. This removes the app from the app
navigator, and disables insertion of new items.
@param appId
The id of the app to deactivate | [
"Deactivates",
"the",
"app",
"with",
"the",
"given",
"id",
".",
"This",
"removes",
"the",
"app",
"from",
"the",
"app",
"navigator",
"and",
"disables",
"insertion",
"of",
"new",
"items",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L241-L244 |
139,466 | podio/podio-java | src/main/java/com/podio/file/FileAPI.java | FileAPI.downloadFile | public void downloadFile(int fileId, java.io.File target, FileSize size)
throws IOException {
WebResource builder = getResourceFactory()
.getFileResource("/" + fileId);
if (size != null) {
builder = builder.path("/" + size.name().toLowerCase());
}
byte[] data = builder.get(byte[].class);
FileUtils.writeByteArrayToFile(target, data);
} | java | public void downloadFile(int fileId, java.io.File target, FileSize size)
throws IOException {
WebResource builder = getResourceFactory()
.getFileResource("/" + fileId);
if (size != null) {
builder = builder.path("/" + size.name().toLowerCase());
}
byte[] data = builder.get(byte[].class);
FileUtils.writeByteArrayToFile(target, data);
} | [
"public",
"void",
"downloadFile",
"(",
"int",
"fileId",
",",
"java",
".",
"io",
".",
"File",
"target",
",",
"FileSize",
"size",
")",
"throws",
"IOException",
"{",
"WebResource",
"builder",
"=",
"getResourceFactory",
"(",
")",
".",
"getFileResource",
"(",
"\"/\"",
"+",
"fileId",
")",
";",
"if",
"(",
"size",
"!=",
"null",
")",
"{",
"builder",
"=",
"builder",
".",
"path",
"(",
"\"/\"",
"+",
"size",
".",
"name",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"}",
"byte",
"[",
"]",
"data",
"=",
"builder",
".",
"get",
"(",
"byte",
"[",
"]",
".",
"class",
")",
";",
"FileUtils",
".",
"writeByteArrayToFile",
"(",
"target",
",",
"data",
")",
";",
"}"
] | Downloads the file and saves it to given file
@param fileId
The id of the file to download
@param target
The target file to save the contents to
@throws IOException
If there was an error reading or writing the file | [
"Downloads",
"the",
"file",
"and",
"saves",
"it",
"to",
"given",
"file"
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/file/FileAPI.java#L40-L49 |
139,467 | podio/podio-java | src/main/java/com/podio/file/FileAPI.java | FileAPI.uploadFile | public int uploadFile(String name, java.io.File file) {
FileDataBodyPart filePart = new FileDataBodyPart("source", file);
// Work around for bug in cherrypy
FormDataContentDisposition.FormDataContentDispositionBuilder builder = FormDataContentDisposition
.name(filePart.getName());
builder.fileName(file.getName());
builder.size(file.length());
filePart.setFormDataContentDisposition(builder.build());
FormDataMultiPart multiPart = new FormDataMultiPart();
multiPart.bodyPart(filePart);
multiPart.field("filename", name);
Builder resource = getResourceFactory().getApiResource("/file/v2/")
.entity(multiPart,
new MediaType("multipart", "form-data", Collections
.singletonMap("boundary", "AaB03x")));
return resource.post(File.class).getId();
} | java | public int uploadFile(String name, java.io.File file) {
FileDataBodyPart filePart = new FileDataBodyPart("source", file);
// Work around for bug in cherrypy
FormDataContentDisposition.FormDataContentDispositionBuilder builder = FormDataContentDisposition
.name(filePart.getName());
builder.fileName(file.getName());
builder.size(file.length());
filePart.setFormDataContentDisposition(builder.build());
FormDataMultiPart multiPart = new FormDataMultiPart();
multiPart.bodyPart(filePart);
multiPart.field("filename", name);
Builder resource = getResourceFactory().getApiResource("/file/v2/")
.entity(multiPart,
new MediaType("multipart", "form-data", Collections
.singletonMap("boundary", "AaB03x")));
return resource.post(File.class).getId();
} | [
"public",
"int",
"uploadFile",
"(",
"String",
"name",
",",
"java",
".",
"io",
".",
"File",
"file",
")",
"{",
"FileDataBodyPart",
"filePart",
"=",
"new",
"FileDataBodyPart",
"(",
"\"source\"",
",",
"file",
")",
";",
"// Work around for bug in cherrypy",
"FormDataContentDisposition",
".",
"FormDataContentDispositionBuilder",
"builder",
"=",
"FormDataContentDisposition",
".",
"name",
"(",
"filePart",
".",
"getName",
"(",
")",
")",
";",
"builder",
".",
"fileName",
"(",
"file",
".",
"getName",
"(",
")",
")",
";",
"builder",
".",
"size",
"(",
"file",
".",
"length",
"(",
")",
")",
";",
"filePart",
".",
"setFormDataContentDisposition",
"(",
"builder",
".",
"build",
"(",
")",
")",
";",
"FormDataMultiPart",
"multiPart",
"=",
"new",
"FormDataMultiPart",
"(",
")",
";",
"multiPart",
".",
"bodyPart",
"(",
"filePart",
")",
";",
"multiPart",
".",
"field",
"(",
"\"filename\"",
",",
"name",
")",
";",
"Builder",
"resource",
"=",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/file/v2/\"",
")",
".",
"entity",
"(",
"multiPart",
",",
"new",
"MediaType",
"(",
"\"multipart\"",
",",
"\"form-data\"",
",",
"Collections",
".",
"singletonMap",
"(",
"\"boundary\"",
",",
"\"AaB03x\"",
")",
")",
")",
";",
"return",
"resource",
".",
"post",
"(",
"File",
".",
"class",
")",
".",
"getId",
"(",
")",
";",
"}"
] | Uploads the file to the API | [
"Uploads",
"the",
"file",
"to",
"the",
"API"
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/file/FileAPI.java#L54-L72 |
139,468 | podio/podio-java | src/main/java/com/podio/file/FileAPI.java | FileAPI.updateFile | public void updateFile(int fileId, FileUpdate update) {
getResourceFactory().getApiResource("/file/" + fileId)
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateFile(int fileId, FileUpdate update) {
getResourceFactory().getApiResource("/file/" + fileId)
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateFile",
"(",
"int",
"fileId",
",",
"FileUpdate",
"update",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/file/\"",
"+",
"fileId",
")",
".",
"entity",
"(",
"update",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | Used to update the description of the file. | [
"Used",
"to",
"update",
"the",
"description",
"of",
"the",
"file",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/file/FileAPI.java#L123-L126 |
139,469 | podio/podio-java | src/main/java/com/podio/file/FileAPI.java | FileAPI.getOnApp | public List<File> getOnApp(int appId, Integer limit, Integer offset) {
WebResource resource = getResourceFactory().getApiResource(
"/file/app/" + appId + "/");
if (limit != null) {
resource = resource.queryParam("limit", limit.toString());
}
if (offset != null) {
resource = resource.queryParam("offset", offset.toString());
}
return resource.get(new GenericType<List<File>>() {
});
} | java | public List<File> getOnApp(int appId, Integer limit, Integer offset) {
WebResource resource = getResourceFactory().getApiResource(
"/file/app/" + appId + "/");
if (limit != null) {
resource = resource.queryParam("limit", limit.toString());
}
if (offset != null) {
resource = resource.queryParam("offset", offset.toString());
}
return resource.get(new GenericType<List<File>>() {
});
} | [
"public",
"List",
"<",
"File",
">",
"getOnApp",
"(",
"int",
"appId",
",",
"Integer",
"limit",
",",
"Integer",
"offset",
")",
"{",
"WebResource",
"resource",
"=",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/file/app/\"",
"+",
"appId",
"+",
"\"/\"",
")",
";",
"if",
"(",
"limit",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"limit\"",
",",
"limit",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"offset",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"offset\"",
",",
"offset",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"resource",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"File",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Returns all the files related to the items in the application. This
includes files both on the item itself and in comments on the item.
@param limit
The maximum number of files to be returned. Defaults to 50 and
cannot be higher than 100.
@param offset
The offset to use when returning files to be used for
pagination. Defaults to 0 (no offset). | [
"Returns",
"all",
"the",
"files",
"related",
"to",
"the",
"items",
"in",
"the",
"application",
".",
"This",
"includes",
"files",
"both",
"on",
"the",
"item",
"itself",
"and",
"in",
"comments",
"on",
"the",
"item",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/file/FileAPI.java#L146-L158 |
139,470 | podio/podio-java | src/main/java/com/podio/file/FileAPI.java | FileAPI.getOnSpace | public List<File> getOnSpace(int spaceId, Integer limit, Integer offset) {
WebResource resource = getResourceFactory().getApiResource(
"/file/space/" + spaceId + "/");
if (limit != null) {
resource = resource.queryParam("limit", limit.toString());
}
if (offset != null) {
resource = resource.queryParam("offset", offset.toString());
}
return resource.get(new GenericType<List<File>>() {
});
} | java | public List<File> getOnSpace(int spaceId, Integer limit, Integer offset) {
WebResource resource = getResourceFactory().getApiResource(
"/file/space/" + spaceId + "/");
if (limit != null) {
resource = resource.queryParam("limit", limit.toString());
}
if (offset != null) {
resource = resource.queryParam("offset", offset.toString());
}
return resource.get(new GenericType<List<File>>() {
});
} | [
"public",
"List",
"<",
"File",
">",
"getOnSpace",
"(",
"int",
"spaceId",
",",
"Integer",
"limit",
",",
"Integer",
"offset",
")",
"{",
"WebResource",
"resource",
"=",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/file/space/\"",
"+",
"spaceId",
"+",
"\"/\"",
")",
";",
"if",
"(",
"limit",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"limit\"",
",",
"limit",
".",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"offset",
"!=",
"null",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"\"offset\"",
",",
"offset",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"resource",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"File",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Returns all the files on the space order by the file name.
@param limit
The maximum number of files to be returned. Defaults to 50 and
cannot be higher than 100.
@param offset
The offset to use when returning files to be used for
pagination. Defaults to 0 (no offset). | [
"Returns",
"all",
"the",
"files",
"on",
"the",
"space",
"order",
"by",
"the",
"file",
"name",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/file/FileAPI.java#L170-L182 |
139,471 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validator/AbstractFieldValidator.java | AbstractFieldValidator.validate | @Override
public List<Diagnostic> validate(final List<Diagnostic> diags) {
if (!isValid()) {
List<Serializable> argList = getMessageArguments();
Serializable[] args = argList.toArray(new Serializable[argList.size()]);
diags.add(new DiagnosticImpl(Diagnostic.ERROR, input, getErrorMessage(), args));
}
return diags;
} | java | @Override
public List<Diagnostic> validate(final List<Diagnostic> diags) {
if (!isValid()) {
List<Serializable> argList = getMessageArguments();
Serializable[] args = argList.toArray(new Serializable[argList.size()]);
diags.add(new DiagnosticImpl(Diagnostic.ERROR, input, getErrorMessage(), args));
}
return diags;
} | [
"@",
"Override",
"public",
"List",
"<",
"Diagnostic",
">",
"validate",
"(",
"final",
"List",
"<",
"Diagnostic",
">",
"diags",
")",
"{",
"if",
"(",
"!",
"isValid",
"(",
")",
")",
"{",
"List",
"<",
"Serializable",
">",
"argList",
"=",
"getMessageArguments",
"(",
")",
";",
"Serializable",
"[",
"]",
"args",
"=",
"argList",
".",
"toArray",
"(",
"new",
"Serializable",
"[",
"argList",
".",
"size",
"(",
")",
"]",
")",
";",
"diags",
".",
"add",
"(",
"new",
"DiagnosticImpl",
"(",
"Diagnostic",
".",
"ERROR",
",",
"input",
",",
"getErrorMessage",
"(",
")",
",",
"args",
")",
")",
";",
"}",
"return",
"diags",
";",
"}"
] | Validates the input field.
@param diags the list of Diagnostics to add validation errors to.
@return the updated list of validation errors. | [
"Validates",
"the",
"input",
"field",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validator/AbstractFieldValidator.java#L123-L133 |
139,472 | ebean-orm/ebean-querybean | src/main/java/io/ebean/typequery/PBaseNumber.java | PBaseNumber.between | public R between(int lower, int upper) {
expr().between(_name, lower, upper);
return _root;
} | java | public R between(int lower, int upper) {
expr().between(_name, lower, upper);
return _root;
} | [
"public",
"R",
"between",
"(",
"int",
"lower",
",",
"int",
"upper",
")",
"{",
"expr",
"(",
")",
".",
"between",
"(",
"_name",
",",
"lower",
",",
"upper",
")",
";",
"return",
"_root",
";",
"}"
] | Between lower and upper values.
@param lower the lower bind value
@param upper the upper bind value
@return the root query bean instance | [
"Between",
"lower",
"and",
"upper",
"values",
"."
] | 821650cb817c9c0fdcc97f93408dc79170b12423 | https://github.com/ebean-orm/ebean-querybean/blob/821650cb817c9c0fdcc97f93408dc79170b12423/src/main/java/io/ebean/typequery/PBaseNumber.java#L105-L108 |
139,473 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WFieldSetRenderer.java | WFieldSetRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WFieldSet fieldSet = (WFieldSet) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:fieldset");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", fieldSet.isHidden(), "true");
switch (fieldSet.getFrameType()) {
case NO_BORDER:
xml.appendOptionalAttribute("frame", "noborder");
break;
case NO_TEXT:
xml.appendOptionalAttribute("frame", "notext");
break;
case NONE:
xml.appendOptionalAttribute("frame", "none");
break;
case NORMAL:
default:
break;
}
xml.appendOptionalAttribute("required", fieldSet.isMandatory(), "true");
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(fieldSet, renderContext);
// Label
WDecoratedLabel label = fieldSet.getTitle();
label.paint(renderContext);
// Children
xml.appendTag("ui:content");
int size = fieldSet.getChildCount();
for (int i = 0; i < size; i++) {
WComponent child = fieldSet.getChildAt(i);
// Skip label, as it has already been painted
if (child != label) {
child.paint(renderContext);
}
}
xml.appendEndTag("ui:content");
DiagnosticRenderUtil.renderDiagnostics(fieldSet, renderContext);
xml.appendEndTag("ui:fieldset");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WFieldSet fieldSet = (WFieldSet) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:fieldset");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", fieldSet.isHidden(), "true");
switch (fieldSet.getFrameType()) {
case NO_BORDER:
xml.appendOptionalAttribute("frame", "noborder");
break;
case NO_TEXT:
xml.appendOptionalAttribute("frame", "notext");
break;
case NONE:
xml.appendOptionalAttribute("frame", "none");
break;
case NORMAL:
default:
break;
}
xml.appendOptionalAttribute("required", fieldSet.isMandatory(), "true");
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(fieldSet, renderContext);
// Label
WDecoratedLabel label = fieldSet.getTitle();
label.paint(renderContext);
// Children
xml.appendTag("ui:content");
int size = fieldSet.getChildCount();
for (int i = 0; i < size; i++) {
WComponent child = fieldSet.getChildAt(i);
// Skip label, as it has already been painted
if (child != label) {
child.paint(renderContext);
}
}
xml.appendEndTag("ui:content");
DiagnosticRenderUtil.renderDiagnostics(fieldSet, renderContext);
xml.appendEndTag("ui:fieldset");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WFieldSet",
"fieldSet",
"=",
"(",
"WFieldSet",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:fieldset\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"fieldSet",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"switch",
"(",
"fieldSet",
".",
"getFrameType",
"(",
")",
")",
"{",
"case",
"NO_BORDER",
":",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"frame\"",
",",
"\"noborder\"",
")",
";",
"break",
";",
"case",
"NO_TEXT",
":",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"frame\"",
",",
"\"notext\"",
")",
";",
"break",
";",
"case",
"NONE",
":",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"frame\"",
",",
"\"none\"",
")",
";",
"break",
";",
"case",
"NORMAL",
":",
"default",
":",
"break",
";",
"}",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"required\"",
",",
"fieldSet",
".",
"isMandatory",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"// Render margin",
"MarginRendererUtil",
".",
"renderMargin",
"(",
"fieldSet",
",",
"renderContext",
")",
";",
"// Label",
"WDecoratedLabel",
"label",
"=",
"fieldSet",
".",
"getTitle",
"(",
")",
";",
"label",
".",
"paint",
"(",
"renderContext",
")",
";",
"// Children",
"xml",
".",
"appendTag",
"(",
"\"ui:content\"",
")",
";",
"int",
"size",
"=",
"fieldSet",
".",
"getChildCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"WComponent",
"child",
"=",
"fieldSet",
".",
"getChildAt",
"(",
"i",
")",
";",
"// Skip label, as it has already been painted",
"if",
"(",
"child",
"!=",
"label",
")",
"{",
"child",
".",
"paint",
"(",
"renderContext",
")",
";",
"}",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:content\"",
")",
";",
"DiagnosticRenderUtil",
".",
"renderDiagnostics",
"(",
"fieldSet",
",",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:fieldset\"",
")",
";",
"}"
] | Paints the given WFieldSet.
@param component the WFieldSet to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WFieldSet",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WFieldSetRenderer.java#L23-L78 |
139,474 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WApplicationExample.java | WApplicationExample.findApplication | private WApplication findApplication() {
WApplication appl = WApplication.instance(this);
if (appl == null) {
messages.addMessage(new Message(Message.WARNING_MESSAGE,
"There is no WApplication available for this example."));
}
return appl;
} | java | private WApplication findApplication() {
WApplication appl = WApplication.instance(this);
if (appl == null) {
messages.addMessage(new Message(Message.WARNING_MESSAGE,
"There is no WApplication available for this example."));
}
return appl;
} | [
"private",
"WApplication",
"findApplication",
"(",
")",
"{",
"WApplication",
"appl",
"=",
"WApplication",
".",
"instance",
"(",
"this",
")",
";",
"if",
"(",
"appl",
"==",
"null",
")",
"{",
"messages",
".",
"addMessage",
"(",
"new",
"Message",
"(",
"Message",
".",
"WARNING_MESSAGE",
",",
"\"There is no WApplication available for this example.\"",
")",
")",
";",
"}",
"return",
"appl",
";",
"}"
] | Find the closest WApplication instance.
@return the closest WApplication instance | [
"Find",
"the",
"closest",
"WApplication",
"instance",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WApplicationExample.java#L105-L114 |
139,475 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java | WTemplate.addTaggedComponent | public void addTaggedComponent(final String tag, final WComponent component) {
if (Util.empty(tag)) {
throw new IllegalArgumentException("A tag must be provided.");
}
if (component == null) {
throw new IllegalArgumentException("A component must be provided.");
}
TemplateModel model = getOrCreateComponentModel();
if (model.taggedComponents == null) {
model.taggedComponents = new HashMap<>();
} else {
if (model.taggedComponents.containsKey(tag)) {
throw new IllegalArgumentException("The tag [" + tag + "] has already been added.");
}
if (model.taggedComponents.containsValue(component)) {
throw new IllegalArgumentException("Component has already been added.");
}
}
model.taggedComponents.put(tag, component);
add(component);
} | java | public void addTaggedComponent(final String tag, final WComponent component) {
if (Util.empty(tag)) {
throw new IllegalArgumentException("A tag must be provided.");
}
if (component == null) {
throw new IllegalArgumentException("A component must be provided.");
}
TemplateModel model = getOrCreateComponentModel();
if (model.taggedComponents == null) {
model.taggedComponents = new HashMap<>();
} else {
if (model.taggedComponents.containsKey(tag)) {
throw new IllegalArgumentException("The tag [" + tag + "] has already been added.");
}
if (model.taggedComponents.containsValue(component)) {
throw new IllegalArgumentException("Component has already been added.");
}
}
model.taggedComponents.put(tag, component);
add(component);
} | [
"public",
"void",
"addTaggedComponent",
"(",
"final",
"String",
"tag",
",",
"final",
"WComponent",
"component",
")",
"{",
"if",
"(",
"Util",
".",
"empty",
"(",
"tag",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A tag must be provided.\"",
")",
";",
"}",
"if",
"(",
"component",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A component must be provided.\"",
")",
";",
"}",
"TemplateModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"taggedComponents",
"==",
"null",
")",
"{",
"model",
".",
"taggedComponents",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"model",
".",
"taggedComponents",
".",
"containsKey",
"(",
"tag",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The tag [\"",
"+",
"tag",
"+",
"\"] has already been added.\"",
")",
";",
"}",
"if",
"(",
"model",
".",
"taggedComponents",
".",
"containsValue",
"(",
"component",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Component has already been added.\"",
")",
";",
"}",
"}",
"model",
".",
"taggedComponents",
".",
"put",
"(",
"tag",
",",
"component",
")",
";",
"add",
"(",
"component",
")",
";",
"}"
] | Add a tagged component to be included in the template. The component will be rendered in place of the
corresponding tag in the template.
@param tag the tag for this component in the template
@param component the component to add | [
"Add",
"a",
"tagged",
"component",
"to",
"be",
"included",
"in",
"the",
"template",
".",
"The",
"component",
"will",
"be",
"rendered",
"in",
"place",
"of",
"the",
"corresponding",
"tag",
"in",
"the",
"template",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L132-L153 |
139,476 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java | WTemplate.removeTaggedComponent | public void removeTaggedComponent(final WComponent component) {
TemplateModel model = getOrCreateComponentModel();
if (model.taggedComponents != null) {
// Find tag
String tag = null;
for (Map.Entry<String, WComponent> entry : model.taggedComponents.entrySet()) {
if (entry.getValue().equals(component)) {
tag = entry.getKey();
break;
}
}
if (tag != null) {
removeTaggedComponent(tag);
}
}
} | java | public void removeTaggedComponent(final WComponent component) {
TemplateModel model = getOrCreateComponentModel();
if (model.taggedComponents != null) {
// Find tag
String tag = null;
for (Map.Entry<String, WComponent> entry : model.taggedComponents.entrySet()) {
if (entry.getValue().equals(component)) {
tag = entry.getKey();
break;
}
}
if (tag != null) {
removeTaggedComponent(tag);
}
}
} | [
"public",
"void",
"removeTaggedComponent",
"(",
"final",
"WComponent",
"component",
")",
"{",
"TemplateModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"taggedComponents",
"!=",
"null",
")",
"{",
"// Find tag",
"String",
"tag",
"=",
"null",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"WComponent",
">",
"entry",
":",
"model",
".",
"taggedComponents",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"component",
")",
")",
"{",
"tag",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"tag",
"!=",
"null",
")",
"{",
"removeTaggedComponent",
"(",
"tag",
")",
";",
"}",
"}",
"}"
] | Remove a tagged component via the component instance.
@param component the tagged component to remove | [
"Remove",
"a",
"tagged",
"component",
"via",
"the",
"component",
"instance",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L160-L175 |
139,477 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java | WTemplate.removeTaggedComponent | public void removeTaggedComponent(final String tag) {
TemplateModel model = getOrCreateComponentModel();
if (model.taggedComponents != null) {
WComponent component = model.taggedComponents.remove(tag);
if (model.taggedComponents.isEmpty()) {
model.taggedComponents = null;
}
if (component != null) {
remove(component);
}
}
} | java | public void removeTaggedComponent(final String tag) {
TemplateModel model = getOrCreateComponentModel();
if (model.taggedComponents != null) {
WComponent component = model.taggedComponents.remove(tag);
if (model.taggedComponents.isEmpty()) {
model.taggedComponents = null;
}
if (component != null) {
remove(component);
}
}
} | [
"public",
"void",
"removeTaggedComponent",
"(",
"final",
"String",
"tag",
")",
"{",
"TemplateModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"taggedComponents",
"!=",
"null",
")",
"{",
"WComponent",
"component",
"=",
"model",
".",
"taggedComponents",
".",
"remove",
"(",
"tag",
")",
";",
"if",
"(",
"model",
".",
"taggedComponents",
".",
"isEmpty",
"(",
")",
")",
"{",
"model",
".",
"taggedComponents",
"=",
"null",
";",
"}",
"if",
"(",
"component",
"!=",
"null",
")",
"{",
"remove",
"(",
"component",
")",
";",
"}",
"}",
"}"
] | Remove a tagged component by its tag.
@param tag the tag of the component to remove | [
"Remove",
"a",
"tagged",
"component",
"by",
"its",
"tag",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L182-L193 |
139,478 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java | WTemplate.addParameter | public void addParameter(final String tag, final Object value) {
if (Util.empty(tag)) {
throw new IllegalArgumentException("A tag must be provided");
}
TemplateModel model = getOrCreateComponentModel();
if (model.parameters == null) {
model.parameters = new HashMap<>();
}
model.parameters.put(tag, value);
} | java | public void addParameter(final String tag, final Object value) {
if (Util.empty(tag)) {
throw new IllegalArgumentException("A tag must be provided");
}
TemplateModel model = getOrCreateComponentModel();
if (model.parameters == null) {
model.parameters = new HashMap<>();
}
model.parameters.put(tag, value);
} | [
"public",
"void",
"addParameter",
"(",
"final",
"String",
"tag",
",",
"final",
"Object",
"value",
")",
"{",
"if",
"(",
"Util",
".",
"empty",
"(",
"tag",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A tag must be provided\"",
")",
";",
"}",
"TemplateModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"parameters",
"==",
"null",
")",
"{",
"model",
".",
"parameters",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"model",
".",
"parameters",
".",
"put",
"(",
"tag",
",",
"value",
")",
";",
"}"
] | Add a template parameter.
@param tag the tag for the template parameter
@param value the value for the template parameter | [
"Add",
"a",
"template",
"parameter",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L223-L233 |
139,479 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java | WTemplate.setEngineName | public void setEngineName(final TemplateRendererFactory.TemplateEngine templateEngine) {
setEngineName(templateEngine == null ? null : templateEngine.getEngineName());
} | java | public void setEngineName(final TemplateRendererFactory.TemplateEngine templateEngine) {
setEngineName(templateEngine == null ? null : templateEngine.getEngineName());
} | [
"public",
"void",
"setEngineName",
"(",
"final",
"TemplateRendererFactory",
".",
"TemplateEngine",
"templateEngine",
")",
"{",
"setEngineName",
"(",
"templateEngine",
"==",
"null",
"?",
"null",
":",
"templateEngine",
".",
"getEngineName",
"(",
")",
")",
";",
"}"
] | Set a predefined template engine. If null then the default engine is used.
@param templateEngine the provided template engine or null to use the default engine | [
"Set",
"a",
"predefined",
"template",
"engine",
".",
"If",
"null",
"then",
"the",
"default",
"engine",
"is",
"used",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L277-L279 |
139,480 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java | WTemplate.removeEngineOption | public void removeEngineOption(final String key) {
TemplateModel model = getOrCreateComponentModel();
if (model.engineOptions != null) {
model.engineOptions.remove(key);
}
} | java | public void removeEngineOption(final String key) {
TemplateModel model = getOrCreateComponentModel();
if (model.engineOptions != null) {
model.engineOptions.remove(key);
}
} | [
"public",
"void",
"removeEngineOption",
"(",
"final",
"String",
"key",
")",
"{",
"TemplateModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"engineOptions",
"!=",
"null",
")",
"{",
"model",
".",
"engineOptions",
".",
"remove",
"(",
"key",
")",
";",
"}",
"}"
] | Remove a template engine option.
@param key the engine option to remove | [
"Remove",
"a",
"template",
"engine",
"option",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L329-L334 |
139,481 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/DateUtilities.java | DateUtilities.createDate | public static Date createDate(final int day, final int month, final int year) {
Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.YEAR, year);
return cal.getTime();
} | java | public static Date createDate(final int day, final int month, final int year) {
Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.YEAR, year);
return cal.getTime();
} | [
"public",
"static",
"Date",
"createDate",
"(",
"final",
"int",
"day",
",",
"final",
"int",
"month",
",",
"final",
"int",
"year",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"clear",
"(",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"day",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"MONTH",
",",
"month",
"-",
"1",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"YEAR",
",",
"year",
")",
";",
"return",
"cal",
".",
"getTime",
"(",
")",
";",
"}"
] | Creates a date from the given components.
@param day the day of the month, 1-31.
@param month the month, 1-12.
@param year the year.
@return a date with the specified settings. | [
"Creates",
"a",
"date",
"from",
"the",
"given",
"components",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/DateUtilities.java#L29-L38 |
139,482 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/HeadLineInterceptor.java | HeadLineInterceptor.preparePaint | @Override
public void preparePaint(final Request request) {
// Headers
// The WHeaders comes from the root WComponent and is a
// mechanism for WComponents to add their own headers
// (eg more JavaScript references).
Headers headers = this.getUI().getHeaders();
headers.reset();
super.preparePaint(request);
} | java | @Override
public void preparePaint(final Request request) {
// Headers
// The WHeaders comes from the root WComponent and is a
// mechanism for WComponents to add their own headers
// (eg more JavaScript references).
Headers headers = this.getUI().getHeaders();
headers.reset();
super.preparePaint(request);
} | [
"@",
"Override",
"public",
"void",
"preparePaint",
"(",
"final",
"Request",
"request",
")",
"{",
"// Headers",
"// The WHeaders comes from the root WComponent and is a",
"// mechanism for WComponents to add their own headers",
"// (eg more JavaScript references).",
"Headers",
"headers",
"=",
"this",
".",
"getUI",
"(",
")",
".",
"getHeaders",
"(",
")",
";",
"headers",
".",
"reset",
"(",
")",
";",
"super",
".",
"preparePaint",
"(",
"request",
")",
";",
"}"
] | Override preparePaint in order to perform processing specific to this interceptor. Any old headers are cleared
out before preparePaint is called on the main UI.
@param request the request being responded to. | [
"Override",
"preparePaint",
"in",
"order",
"to",
"perform",
"processing",
"specific",
"to",
"this",
"interceptor",
".",
"Any",
"old",
"headers",
"are",
"cleared",
"out",
"before",
"preparePaint",
"is",
"called",
"on",
"the",
"main",
"UI",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/HeadLineInterceptor.java#L23-L34 |
139,483 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/HeadLineInterceptor.java | HeadLineInterceptor.paint | @Override
public void paint(final RenderContext renderContext) {
if (renderContext instanceof WebXmlRenderContext) {
PageContentHelper.addAllHeadlines(((WebXmlRenderContext) renderContext).getWriter(),
getUI().getHeaders());
}
getBackingComponent().paint(renderContext);
} | java | @Override
public void paint(final RenderContext renderContext) {
if (renderContext instanceof WebXmlRenderContext) {
PageContentHelper.addAllHeadlines(((WebXmlRenderContext) renderContext).getWriter(),
getUI().getHeaders());
}
getBackingComponent().paint(renderContext);
} | [
"@",
"Override",
"public",
"void",
"paint",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"if",
"(",
"renderContext",
"instanceof",
"WebXmlRenderContext",
")",
"{",
"PageContentHelper",
".",
"addAllHeadlines",
"(",
"(",
"(",
"WebXmlRenderContext",
")",
"renderContext",
")",
".",
"getWriter",
"(",
")",
",",
"getUI",
"(",
")",
".",
"getHeaders",
"(",
")",
")",
";",
"}",
"getBackingComponent",
"(",
")",
".",
"paint",
"(",
"renderContext",
")",
";",
"}"
] | Override paint in order to perform processing specific to this interceptor. This implementation is responsible
for rendering the headlines for the UI.
@param renderContext the renderContext to send the output to. | [
"Override",
"paint",
"in",
"order",
"to",
"perform",
"processing",
"specific",
"to",
"this",
"interceptor",
".",
"This",
"implementation",
"is",
"responsible",
"for",
"rendering",
"the",
"headlines",
"for",
"the",
"UI",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/HeadLineInterceptor.java#L42-L50 |
139,484 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java | WCardManager.handleRequest | @Override
public void handleRequest(final Request request) {
super.handleRequest(request);
WComponent visibleDialog = getVisible();
if (visibleDialog != null) {
visibleDialog.serviceRequest(request);
}
} | java | @Override
public void handleRequest(final Request request) {
super.handleRequest(request);
WComponent visibleDialog = getVisible();
if (visibleDialog != null) {
visibleDialog.serviceRequest(request);
}
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"handleRequest",
"(",
"request",
")",
";",
"WComponent",
"visibleDialog",
"=",
"getVisible",
"(",
")",
";",
"if",
"(",
"visibleDialog",
"!=",
"null",
")",
"{",
"visibleDialog",
".",
"serviceRequest",
"(",
"request",
")",
";",
"}",
"}"
] | Since none of the children are visible to standard processing, handleRequest has been overridden so that the
visible card is processed.
@param request the request being responded to. | [
"Since",
"none",
"of",
"the",
"children",
"are",
"visible",
"to",
"standard",
"processing",
"handleRequest",
"has",
"been",
"overridden",
"so",
"that",
"the",
"visible",
"card",
"is",
"processed",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java#L112-L121 |
139,485 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java | WCardManager.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
WComponent visibleDialog = getVisible();
if (visibleDialog != null) {
visibleDialog.preparePaint(request);
}
} | java | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
WComponent visibleDialog = getVisible();
if (visibleDialog != null) {
visibleDialog.preparePaint(request);
}
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"preparePaintComponent",
"(",
"request",
")",
";",
"WComponent",
"visibleDialog",
"=",
"getVisible",
"(",
")",
";",
"if",
"(",
"visibleDialog",
"!=",
"null",
")",
"{",
"visibleDialog",
".",
"preparePaint",
"(",
"request",
")",
";",
"}",
"}"
] | Since none of the children are visible to standard processing, preparePaintComponent has been overridden so that
the visible card is prepared.
@param request the request being responded to. | [
"Since",
"none",
"of",
"the",
"children",
"are",
"visible",
"to",
"standard",
"processing",
"preparePaintComponent",
"has",
"been",
"overridden",
"so",
"that",
"the",
"visible",
"card",
"is",
"prepared",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java#L129-L138 |
139,486 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java | WCardManager.paintComponent | @Override
protected void paintComponent(final RenderContext renderContext) {
super.paintComponent(renderContext);
WComponent visibleDialog = getVisible();
if (visibleDialog != null) {
visibleDialog.paint(renderContext);
}
} | java | @Override
protected void paintComponent(final RenderContext renderContext) {
super.paintComponent(renderContext);
WComponent visibleDialog = getVisible();
if (visibleDialog != null) {
visibleDialog.paint(renderContext);
}
} | [
"@",
"Override",
"protected",
"void",
"paintComponent",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"super",
".",
"paintComponent",
"(",
"renderContext",
")",
";",
"WComponent",
"visibleDialog",
"=",
"getVisible",
"(",
")",
";",
"if",
"(",
"visibleDialog",
"!=",
"null",
")",
"{",
"visibleDialog",
".",
"paint",
"(",
"renderContext",
")",
";",
"}",
"}"
] | Since none of the children are visible to standard processing, paintComponent has been overridden so that the
visible card is painted.
@param renderContext the RenderContext to paint to. | [
"Since",
"none",
"of",
"the",
"children",
"are",
"visible",
"to",
"standard",
"processing",
"paintComponent",
"has",
"been",
"overridden",
"so",
"that",
"the",
"visible",
"card",
"is",
"painted",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java#L146-L155 |
139,487 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java | WCardManager.validateComponent | @Override
protected void validateComponent(final List<Diagnostic> diags) {
super.validateComponent(diags);
WComponent visibleDialog = getVisible();
if (visibleDialog != null) {
visibleDialog.validate(diags);
}
} | java | @Override
protected void validateComponent(final List<Diagnostic> diags) {
super.validateComponent(diags);
WComponent visibleDialog = getVisible();
if (visibleDialog != null) {
visibleDialog.validate(diags);
}
} | [
"@",
"Override",
"protected",
"void",
"validateComponent",
"(",
"final",
"List",
"<",
"Diagnostic",
">",
"diags",
")",
"{",
"super",
".",
"validateComponent",
"(",
"diags",
")",
";",
"WComponent",
"visibleDialog",
"=",
"getVisible",
"(",
")",
";",
"if",
"(",
"visibleDialog",
"!=",
"null",
")",
"{",
"visibleDialog",
".",
"validate",
"(",
"diags",
")",
";",
"}",
"}"
] | Since none of the children are visible to standard processing, validateComponent has been overridden so that the
visible card is processed.
@param diags the list to add validation diagnostics to. | [
"Since",
"none",
"of",
"the",
"children",
"are",
"visible",
"to",
"standard",
"processing",
"validateComponent",
"has",
"been",
"overridden",
"so",
"that",
"the",
"visible",
"card",
"is",
"processed",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java#L163-L172 |
139,488 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java | WCardManager.showErrorIndicators | @Override
public void showErrorIndicators(final List<Diagnostic> diags) {
WComponent visibleComponent = getVisible();
visibleComponent.showErrorIndicators(diags);
} | java | @Override
public void showErrorIndicators(final List<Diagnostic> diags) {
WComponent visibleComponent = getVisible();
visibleComponent.showErrorIndicators(diags);
} | [
"@",
"Override",
"public",
"void",
"showErrorIndicators",
"(",
"final",
"List",
"<",
"Diagnostic",
">",
"diags",
")",
"{",
"WComponent",
"visibleComponent",
"=",
"getVisible",
"(",
")",
";",
"visibleComponent",
".",
"showErrorIndicators",
"(",
"diags",
")",
";",
"}"
] | Override method to show Error indicators on the visible card.
@param diags the list of diagnostics containing errors. | [
"Override",
"method",
"to",
"show",
"Error",
"indicators",
"on",
"the",
"visible",
"card",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java#L179-L183 |
139,489 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java | WCardManager.showWarningIndicators | @Override
public void showWarningIndicators(final List<Diagnostic> diags) {
WComponent visibleComponent = getVisible();
visibleComponent.showWarningIndicators(diags);
} | java | @Override
public void showWarningIndicators(final List<Diagnostic> diags) {
WComponent visibleComponent = getVisible();
visibleComponent.showWarningIndicators(diags);
} | [
"@",
"Override",
"public",
"void",
"showWarningIndicators",
"(",
"final",
"List",
"<",
"Diagnostic",
">",
"diags",
")",
"{",
"WComponent",
"visibleComponent",
"=",
"getVisible",
"(",
")",
";",
"visibleComponent",
".",
"showWarningIndicators",
"(",
"diags",
")",
";",
"}"
] | Override method to show Warning indicators on the visible card.
@param diags the list of diagnostics containing warnings. | [
"Override",
"method",
"to",
"show",
"Warning",
"indicators",
"on",
"the",
"visible",
"card",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WCardManager.java#L190-L194 |
139,490 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WListRenderer.java | WListRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WList list = (WList) component;
XmlStringBuilder xml = renderContext.getWriter();
WList.Type type = list.getType();
WList.Separator separator = list.getSeparator();
Size gap = list.getSpace();
String gapString = gap == null ? null : gap.toString();
xml.appendTagOpen("ui:panel");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("type", list.isRenderBorder(), "box");
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(list, renderContext);
xml.appendTagOpen("ui:listlayout");
xml.appendOptionalAttribute("gap", gapString);
if (type != null) {
switch (type) {
case FLAT:
xml.appendAttribute("type", "flat");
break;
case STACKED:
xml.appendAttribute("type", "stacked");
break;
case STRIPED:
xml.appendAttribute("type", "striped");
break;
default:
throw new SystemException("Unknown list type: " + type);
}
}
if (separator != null) {
switch (separator) {
case BAR:
xml.appendAttribute("separator", "bar");
break;
case DOT:
xml.appendAttribute("separator", "dot");
break;
case NONE:
break;
default:
throw new SystemException("Unknown list type: " + type);
}
}
xml.appendClose();
paintRows(list, renderContext);
xml.appendEndTag("ui:listlayout");
xml.appendEndTag("ui:panel");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WList list = (WList) component;
XmlStringBuilder xml = renderContext.getWriter();
WList.Type type = list.getType();
WList.Separator separator = list.getSeparator();
Size gap = list.getSpace();
String gapString = gap == null ? null : gap.toString();
xml.appendTagOpen("ui:panel");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("type", list.isRenderBorder(), "box");
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(list, renderContext);
xml.appendTagOpen("ui:listlayout");
xml.appendOptionalAttribute("gap", gapString);
if (type != null) {
switch (type) {
case FLAT:
xml.appendAttribute("type", "flat");
break;
case STACKED:
xml.appendAttribute("type", "stacked");
break;
case STRIPED:
xml.appendAttribute("type", "striped");
break;
default:
throw new SystemException("Unknown list type: " + type);
}
}
if (separator != null) {
switch (separator) {
case BAR:
xml.appendAttribute("separator", "bar");
break;
case DOT:
xml.appendAttribute("separator", "dot");
break;
case NONE:
break;
default:
throw new SystemException("Unknown list type: " + type);
}
}
xml.appendClose();
paintRows(list, renderContext);
xml.appendEndTag("ui:listlayout");
xml.appendEndTag("ui:panel");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WList",
"list",
"=",
"(",
"WList",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"WList",
".",
"Type",
"type",
"=",
"list",
".",
"getType",
"(",
")",
";",
"WList",
".",
"Separator",
"separator",
"=",
"list",
".",
"getSeparator",
"(",
")",
";",
"Size",
"gap",
"=",
"list",
".",
"getSpace",
"(",
")",
";",
"String",
"gapString",
"=",
"gap",
"==",
"null",
"?",
"null",
":",
"gap",
".",
"toString",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:panel\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"type\"",
",",
"list",
".",
"isRenderBorder",
"(",
")",
",",
"\"box\"",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"// Render margin",
"MarginRendererUtil",
".",
"renderMargin",
"(",
"list",
",",
"renderContext",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:listlayout\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"gap\"",
",",
"gapString",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"FLAT",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"flat\"",
")",
";",
"break",
";",
"case",
"STACKED",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"stacked\"",
")",
";",
"break",
";",
"case",
"STRIPED",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"striped\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown list type: \"",
"+",
"type",
")",
";",
"}",
"}",
"if",
"(",
"separator",
"!=",
"null",
")",
"{",
"switch",
"(",
"separator",
")",
"{",
"case",
"BAR",
":",
"xml",
".",
"appendAttribute",
"(",
"\"separator\"",
",",
"\"bar\"",
")",
";",
"break",
";",
"case",
"DOT",
":",
"xml",
".",
"appendAttribute",
"(",
"\"separator\"",
",",
"\"dot\"",
")",
";",
"break",
";",
"case",
"NONE",
":",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown list type: \"",
"+",
"type",
")",
";",
"}",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"paintRows",
"(",
"list",
",",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:listlayout\"",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:panel\"",
")",
";",
"}"
] | Paints the given WList.
@param component the WList to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WList",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WListRenderer.java#L28-L92 |
139,491 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java | WCheckBoxSelectExample.addInteractiveExamples | private void addInteractiveExamples() {
add(new WHeading(HeadingLevel.H2, "Simple WCheckBoxSelect examples"));
addExampleUsingLookupTable();
addExampleUsingArrayList();
addExampleUsingStringArray();
addInsideAFieldLayoutExamples();
add(new WHeading(HeadingLevel.H2, "Examples showing LAYOUT properties"));
addFlatSelectExample();
addColumnSelectExample();
addSingleColumnSelectExample();
add(new WHeading(HeadingLevel.H2, "WCheckBoxSelect showing the frameless state"));
add(new WHeading(HeadingLevel.H3, "Normal (with frame)"));
WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
add(select);
select.setToolTip("Make a selection");
add(new WHeading(HeadingLevel.H3, "Without frame"));
select = new WCheckBoxSelect("australian_state");
add(select);
select.setFrameless(true);
select.setToolTip("Make a selection (no frame)");
} | java | private void addInteractiveExamples() {
add(new WHeading(HeadingLevel.H2, "Simple WCheckBoxSelect examples"));
addExampleUsingLookupTable();
addExampleUsingArrayList();
addExampleUsingStringArray();
addInsideAFieldLayoutExamples();
add(new WHeading(HeadingLevel.H2, "Examples showing LAYOUT properties"));
addFlatSelectExample();
addColumnSelectExample();
addSingleColumnSelectExample();
add(new WHeading(HeadingLevel.H2, "WCheckBoxSelect showing the frameless state"));
add(new WHeading(HeadingLevel.H3, "Normal (with frame)"));
WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
add(select);
select.setToolTip("Make a selection");
add(new WHeading(HeadingLevel.H3, "Without frame"));
select = new WCheckBoxSelect("australian_state");
add(select);
select.setFrameless(true);
select.setToolTip("Make a selection (no frame)");
} | [
"private",
"void",
"addInteractiveExamples",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H2",
",",
"\"Simple WCheckBoxSelect examples\"",
")",
")",
";",
"addExampleUsingLookupTable",
"(",
")",
";",
"addExampleUsingArrayList",
"(",
")",
";",
"addExampleUsingStringArray",
"(",
")",
";",
"addInsideAFieldLayoutExamples",
"(",
")",
";",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H2",
",",
"\"Examples showing LAYOUT properties\"",
")",
")",
";",
"addFlatSelectExample",
"(",
")",
";",
"addColumnSelectExample",
"(",
")",
";",
"addSingleColumnSelectExample",
"(",
")",
";",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H2",
",",
"\"WCheckBoxSelect showing the frameless state\"",
")",
")",
";",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"Normal (with frame)\"",
")",
")",
";",
"WCheckBoxSelect",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"\"australian_state\"",
")",
";",
"add",
"(",
"select",
")",
";",
"select",
".",
"setToolTip",
"(",
"\"Make a selection\"",
")",
";",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"Without frame\"",
")",
")",
";",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"\"australian_state\"",
")",
";",
"add",
"(",
"select",
")",
";",
"select",
".",
"setFrameless",
"(",
"true",
")",
";",
"select",
".",
"setToolTip",
"(",
"\"Make a selection (no frame)\"",
")",
";",
"}"
] | Simple interactive-state WCheckBoxSelect examples. | [
"Simple",
"interactive",
"-",
"state",
"WCheckBoxSelect",
"examples",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L56-L76 |
139,492 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java | WCheckBoxSelectExample.addExampleUsingStringArray | private void addExampleUsingStringArray() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect created using a String array"));
String[] options = new String[]{"Dog", "Cat", "Bird", "Turtle"};
final WCheckBoxSelect select = new WCheckBoxSelect(options);
select.setToolTip("Animals");
select.setMandatory(true);
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Animals");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select.getSelected().isEmpty() ? NO_SELECTION : "The selected animals are: "
+ select.getSelected();
text.setText(output);
}
});
select.setDefaultSubmitButton(update);
WLabel animalLabel = new WLabel("A selection is required", select);
animalLabel.setHint("mandatory");
add(animalLabel);
add(select);
add(update);
add(text);
add(new WAjaxControl(update, text));
} | java | private void addExampleUsingStringArray() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect created using a String array"));
String[] options = new String[]{"Dog", "Cat", "Bird", "Turtle"};
final WCheckBoxSelect select = new WCheckBoxSelect(options);
select.setToolTip("Animals");
select.setMandatory(true);
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Animals");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select.getSelected().isEmpty() ? NO_SELECTION : "The selected animals are: "
+ select.getSelected();
text.setText(output);
}
});
select.setDefaultSubmitButton(update);
WLabel animalLabel = new WLabel("A selection is required", select);
animalLabel.setHint("mandatory");
add(animalLabel);
add(select);
add(update);
add(text);
add(new WAjaxControl(update, text));
} | [
"private",
"void",
"addExampleUsingStringArray",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect created using a String array\"",
")",
")",
";",
"String",
"[",
"]",
"options",
"=",
"new",
"String",
"[",
"]",
"{",
"\"Dog\"",
",",
"\"Cat\"",
",",
"\"Bird\"",
",",
"\"Turtle\"",
"}",
";",
"final",
"WCheckBoxSelect",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"options",
")",
";",
"select",
".",
"setToolTip",
"(",
"\"Animals\"",
")",
";",
"select",
".",
"setMandatory",
"(",
"true",
")",
";",
"final",
"WTextField",
"text",
"=",
"new",
"WTextField",
"(",
")",
";",
"text",
".",
"setReadOnly",
"(",
"true",
")",
";",
"text",
".",
"setText",
"(",
"NO_SELECTION",
")",
";",
"WButton",
"update",
"=",
"new",
"WButton",
"(",
"\"Select Animals\"",
")",
";",
"update",
".",
"setAction",
"(",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"String",
"output",
"=",
"select",
".",
"getSelected",
"(",
")",
".",
"isEmpty",
"(",
")",
"?",
"NO_SELECTION",
":",
"\"The selected animals are: \"",
"+",
"select",
".",
"getSelected",
"(",
")",
";",
"text",
".",
"setText",
"(",
"output",
")",
";",
"}",
"}",
")",
";",
"select",
".",
"setDefaultSubmitButton",
"(",
"update",
")",
";",
"WLabel",
"animalLabel",
"=",
"new",
"WLabel",
"(",
"\"A selection is required\"",
",",
"select",
")",
";",
"animalLabel",
".",
"setHint",
"(",
"\"mandatory\"",
")",
";",
"add",
"(",
"animalLabel",
")",
";",
"add",
"(",
"select",
")",
";",
"add",
"(",
"update",
")",
";",
"add",
"(",
"text",
")",
";",
"add",
"(",
"new",
"WAjaxControl",
"(",
"update",
",",
"text",
")",
")",
";",
"}"
] | This example creates the WCheckBoxSelect from an array of Strings. | [
"This",
"example",
"creates",
"the",
"WCheckBoxSelect",
"from",
"an",
"array",
"of",
"Strings",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L110-L137 |
139,493 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java | WCheckBoxSelectExample.addExampleUsingArrayList | private void addExampleUsingArrayList() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect created using an array list of options"));
List<CarOption> options = new ArrayList<>();
options.add(new CarOption("1", "Ferrari", "F-360"));
options.add(new CarOption("2", "Mercedez Benz", "amg"));
options.add(new CarOption("3", "Nissan", "Skyline"));
options.add(new CarOption("5", "Toyota", "Prius"));
final WCheckBoxSelect select = new WCheckBoxSelect(options);
select.setToolTip("Cars");
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Cars");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select.getSelected().isEmpty() ? NO_SELECTION : "The selected cars are: "
+ select.getSelected();
text.setText(output);
}
});
select.setDefaultSubmitButton(update);
add(select);
add(update);
add(text);
add(new WAjaxControl(update, text));
} | java | private void addExampleUsingArrayList() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect created using an array list of options"));
List<CarOption> options = new ArrayList<>();
options.add(new CarOption("1", "Ferrari", "F-360"));
options.add(new CarOption("2", "Mercedez Benz", "amg"));
options.add(new CarOption("3", "Nissan", "Skyline"));
options.add(new CarOption("5", "Toyota", "Prius"));
final WCheckBoxSelect select = new WCheckBoxSelect(options);
select.setToolTip("Cars");
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Cars");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select.getSelected().isEmpty() ? NO_SELECTION : "The selected cars are: "
+ select.getSelected();
text.setText(output);
}
});
select.setDefaultSubmitButton(update);
add(select);
add(update);
add(text);
add(new WAjaxControl(update, text));
} | [
"private",
"void",
"addExampleUsingArrayList",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect created using an array list of options\"",
")",
")",
";",
"List",
"<",
"CarOption",
">",
"options",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"options",
".",
"add",
"(",
"new",
"CarOption",
"(",
"\"1\"",
",",
"\"Ferrari\"",
",",
"\"F-360\"",
")",
")",
";",
"options",
".",
"add",
"(",
"new",
"CarOption",
"(",
"\"2\"",
",",
"\"Mercedez Benz\"",
",",
"\"amg\"",
")",
")",
";",
"options",
".",
"add",
"(",
"new",
"CarOption",
"(",
"\"3\"",
",",
"\"Nissan\"",
",",
"\"Skyline\"",
")",
")",
";",
"options",
".",
"add",
"(",
"new",
"CarOption",
"(",
"\"5\"",
",",
"\"Toyota\"",
",",
"\"Prius\"",
")",
")",
";",
"final",
"WCheckBoxSelect",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"options",
")",
";",
"select",
".",
"setToolTip",
"(",
"\"Cars\"",
")",
";",
"final",
"WTextField",
"text",
"=",
"new",
"WTextField",
"(",
")",
";",
"text",
".",
"setReadOnly",
"(",
"true",
")",
";",
"text",
".",
"setText",
"(",
"NO_SELECTION",
")",
";",
"WButton",
"update",
"=",
"new",
"WButton",
"(",
"\"Select Cars\"",
")",
";",
"update",
".",
"setAction",
"(",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"String",
"output",
"=",
"select",
".",
"getSelected",
"(",
")",
".",
"isEmpty",
"(",
")",
"?",
"NO_SELECTION",
":",
"\"The selected cars are: \"",
"+",
"select",
".",
"getSelected",
"(",
")",
";",
"text",
".",
"setText",
"(",
"output",
")",
";",
"}",
"}",
")",
";",
"select",
".",
"setDefaultSubmitButton",
"(",
"update",
")",
";",
"add",
"(",
"select",
")",
";",
"add",
"(",
"update",
")",
";",
"add",
"(",
"text",
")",
";",
"add",
"(",
"new",
"WAjaxControl",
"(",
"update",
",",
"text",
")",
")",
";",
"}"
] | This example creates the WCheckBoxSelect from a List of CarOptions. | [
"This",
"example",
"creates",
"the",
"WCheckBoxSelect",
"from",
"a",
"List",
"of",
"CarOptions",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L142-L171 |
139,494 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java | WCheckBoxSelectExample.addInsideAFieldLayoutExamples | private void addInsideAFieldLayoutExamples() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect inside a WFieldLayout"));
add(new ExplanatoryText("When a WCheckBoxSelect is inside a WField its label is exposed in a way which appears and behaves like a regular "
+ "HTML label. This allows WCheckBoxSelects to be used in a layout with simple form controls (such as WTextField) and produce a "
+ "consistent and predicatable interface. The third example in this set uses a null label and a toolTip to hide the labelling "
+ "element. This can lead to user confusion and is not recommended."));
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(25);
add(layout);
String[] options = new String[]{"Dog", "Cat", "Bird", "Turtle"};
WCheckBoxSelect select = new WCheckBoxSelect(options);
layout.addField("Select some animals", select);
String[] options2 = new String[]{"Parrot", "Galah", "Cockatoo", "Lyre"};
select = new WCheckBoxSelect(options2);
layout.addField("Select some birds", select);
select.setFrameless(true);
// a tooltip can be used as a label stand-in even in a WField
String[] options3 = new String[]{"Carrot", "Beet", "Brocolli", "Bacon - the perfect vegetable"};
select = new WCheckBoxSelect(options3);
layout.addField((WLabel) null, select);
select.setToolTip("Veggies");
select = new WCheckBoxSelect("australian_state");
layout.addField("Select a state", select).getLabel().setHint("This is an ajax trigger");
add(new WAjaxControl(select, layout));
} | java | private void addInsideAFieldLayoutExamples() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect inside a WFieldLayout"));
add(new ExplanatoryText("When a WCheckBoxSelect is inside a WField its label is exposed in a way which appears and behaves like a regular "
+ "HTML label. This allows WCheckBoxSelects to be used in a layout with simple form controls (such as WTextField) and produce a "
+ "consistent and predicatable interface. The third example in this set uses a null label and a toolTip to hide the labelling "
+ "element. This can lead to user confusion and is not recommended."));
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(25);
add(layout);
String[] options = new String[]{"Dog", "Cat", "Bird", "Turtle"};
WCheckBoxSelect select = new WCheckBoxSelect(options);
layout.addField("Select some animals", select);
String[] options2 = new String[]{"Parrot", "Galah", "Cockatoo", "Lyre"};
select = new WCheckBoxSelect(options2);
layout.addField("Select some birds", select);
select.setFrameless(true);
// a tooltip can be used as a label stand-in even in a WField
String[] options3 = new String[]{"Carrot", "Beet", "Brocolli", "Bacon - the perfect vegetable"};
select = new WCheckBoxSelect(options3);
layout.addField((WLabel) null, select);
select.setToolTip("Veggies");
select = new WCheckBoxSelect("australian_state");
layout.addField("Select a state", select).getLabel().setHint("This is an ajax trigger");
add(new WAjaxControl(select, layout));
} | [
"private",
"void",
"addInsideAFieldLayoutExamples",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect inside a WFieldLayout\"",
")",
")",
";",
"add",
"(",
"new",
"ExplanatoryText",
"(",
"\"When a WCheckBoxSelect is inside a WField its label is exposed in a way which appears and behaves like a regular \"",
"+",
"\"HTML label. This allows WCheckBoxSelects to be used in a layout with simple form controls (such as WTextField) and produce a \"",
"+",
"\"consistent and predicatable interface. The third example in this set uses a null label and a toolTip to hide the labelling \"",
"+",
"\"element. This can lead to user confusion and is not recommended.\"",
")",
")",
";",
"WFieldLayout",
"layout",
"=",
"new",
"WFieldLayout",
"(",
")",
";",
"layout",
".",
"setLabelWidth",
"(",
"25",
")",
";",
"add",
"(",
"layout",
")",
";",
"String",
"[",
"]",
"options",
"=",
"new",
"String",
"[",
"]",
"{",
"\"Dog\"",
",",
"\"Cat\"",
",",
"\"Bird\"",
",",
"\"Turtle\"",
"}",
";",
"WCheckBoxSelect",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"options",
")",
";",
"layout",
".",
"addField",
"(",
"\"Select some animals\"",
",",
"select",
")",
";",
"String",
"[",
"]",
"options2",
"=",
"new",
"String",
"[",
"]",
"{",
"\"Parrot\"",
",",
"\"Galah\"",
",",
"\"Cockatoo\"",
",",
"\"Lyre\"",
"}",
";",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"options2",
")",
";",
"layout",
".",
"addField",
"(",
"\"Select some birds\"",
",",
"select",
")",
";",
"select",
".",
"setFrameless",
"(",
"true",
")",
";",
"// a tooltip can be used as a label stand-in even in a WField",
"String",
"[",
"]",
"options3",
"=",
"new",
"String",
"[",
"]",
"{",
"\"Carrot\"",
",",
"\"Beet\"",
",",
"\"Brocolli\"",
",",
"\"Bacon - the perfect vegetable\"",
"}",
";",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"options3",
")",
";",
"layout",
".",
"addField",
"(",
"(",
"WLabel",
")",
"null",
",",
"select",
")",
";",
"select",
".",
"setToolTip",
"(",
"\"Veggies\"",
")",
";",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"\"australian_state\"",
")",
";",
"layout",
".",
"addField",
"(",
"\"Select a state\"",
",",
"select",
")",
".",
"getLabel",
"(",
")",
".",
"setHint",
"(",
"\"This is an ajax trigger\"",
")",
";",
"add",
"(",
"new",
"WAjaxControl",
"(",
"select",
",",
"layout",
")",
")",
";",
"}"
] | When a WCheckBoxSelect is added to a WFieldLayout the legend is moved. The first CheckBoxSelect has a frame, the
second doesn't | [
"When",
"a",
"WCheckBoxSelect",
"is",
"added",
"to",
"a",
"WFieldLayout",
"the",
"legend",
"is",
"moved",
".",
"The",
"first",
"CheckBoxSelect",
"has",
"a",
"frame",
"the",
"second",
"doesn",
"t"
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L177-L204 |
139,495 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java | WCheckBoxSelectExample.addColumnSelectExample | private void addColumnSelectExample() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect laid out in columns"));
add(new ExplanatoryText("Setting the layout to COLUMN will make the check boxes be rendered in 'n' columns. The number of columns is"
+ " determined by the layoutColumnCount property."));
final WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
select.setToolTip("Make a selection");
select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS);
select.setButtonColumns(2);
add(select);
add(new WHeading(HeadingLevel.H3, "Options equal to columns"));
String[] options = new String[]{"Dog", "Cat", "Bird"};
final WCheckBoxSelect select2 = new WCheckBoxSelect(options);
select2.setToolTip("Animals");
select2.setButtonColumns(3);
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Animals");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select2.getSelected().isEmpty() ? NO_SELECTION : "The selected animals are: "
+ select2.getSelected();
text.setText(output);
}
});
select2.setDefaultSubmitButton(update);
add(select2);
add(update);
add(text);
add(new WAjaxControl(update, text));
} | java | private void addColumnSelectExample() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect laid out in columns"));
add(new ExplanatoryText("Setting the layout to COLUMN will make the check boxes be rendered in 'n' columns. The number of columns is"
+ " determined by the layoutColumnCount property."));
final WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
select.setToolTip("Make a selection");
select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS);
select.setButtonColumns(2);
add(select);
add(new WHeading(HeadingLevel.H3, "Options equal to columns"));
String[] options = new String[]{"Dog", "Cat", "Bird"};
final WCheckBoxSelect select2 = new WCheckBoxSelect(options);
select2.setToolTip("Animals");
select2.setButtonColumns(3);
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Animals");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select2.getSelected().isEmpty() ? NO_SELECTION : "The selected animals are: "
+ select2.getSelected();
text.setText(output);
}
});
select2.setDefaultSubmitButton(update);
add(select2);
add(update);
add(text);
add(new WAjaxControl(update, text));
} | [
"private",
"void",
"addColumnSelectExample",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect laid out in columns\"",
")",
")",
";",
"add",
"(",
"new",
"ExplanatoryText",
"(",
"\"Setting the layout to COLUMN will make the check boxes be rendered in 'n' columns. The number of columns is\"",
"+",
"\" determined by the layoutColumnCount property.\"",
")",
")",
";",
"final",
"WCheckBoxSelect",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"\"australian_state\"",
")",
";",
"select",
".",
"setToolTip",
"(",
"\"Make a selection\"",
")",
";",
"select",
".",
"setButtonLayout",
"(",
"WCheckBoxSelect",
".",
"LAYOUT_COLUMNS",
")",
";",
"select",
".",
"setButtonColumns",
"(",
"2",
")",
";",
"add",
"(",
"select",
")",
";",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"Options equal to columns\"",
")",
")",
";",
"String",
"[",
"]",
"options",
"=",
"new",
"String",
"[",
"]",
"{",
"\"Dog\"",
",",
"\"Cat\"",
",",
"\"Bird\"",
"}",
";",
"final",
"WCheckBoxSelect",
"select2",
"=",
"new",
"WCheckBoxSelect",
"(",
"options",
")",
";",
"select2",
".",
"setToolTip",
"(",
"\"Animals\"",
")",
";",
"select2",
".",
"setButtonColumns",
"(",
"3",
")",
";",
"final",
"WTextField",
"text",
"=",
"new",
"WTextField",
"(",
")",
";",
"text",
".",
"setReadOnly",
"(",
"true",
")",
";",
"text",
".",
"setText",
"(",
"NO_SELECTION",
")",
";",
"WButton",
"update",
"=",
"new",
"WButton",
"(",
"\"Select Animals\"",
")",
";",
"update",
".",
"setAction",
"(",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"String",
"output",
"=",
"select2",
".",
"getSelected",
"(",
")",
".",
"isEmpty",
"(",
")",
"?",
"NO_SELECTION",
":",
"\"The selected animals are: \"",
"+",
"select2",
".",
"getSelected",
"(",
")",
";",
"text",
".",
"setText",
"(",
"output",
")",
";",
"}",
"}",
")",
";",
"select2",
".",
"setDefaultSubmitButton",
"(",
"update",
")",
";",
"add",
"(",
"select2",
")",
";",
"add",
"(",
"update",
")",
";",
"add",
"(",
"text",
")",
";",
"add",
"(",
"new",
"WAjaxControl",
"(",
"update",
",",
"text",
")",
")",
";",
"}"
] | adds a WCheckBoxSelect with LAYOUT_COLUMN in 2 columns. | [
"adds",
"a",
"WCheckBoxSelect",
"with",
"LAYOUT_COLUMN",
"in",
"2",
"columns",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L223-L257 |
139,496 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java | WCheckBoxSelectExample.addAntiPatternExamples | private void addAntiPatternExamples() {
add(new WHeading(HeadingLevel.H2, "WCheckBoxSelect anti-pattern examples"));
add(new WMessageBox(
WMessageBox.WARN,
"These examples are purposely bad and should not be used as samples of how to use WComponents but samples of how NOT to use them."));
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect with submitOnChange"));
WFieldLayout layout = new WFieldLayout(WFieldLayout.LAYOUT_STACKED);
add(layout);
WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
select.setSubmitOnChange(true);
layout.addField("Select a state or territory with auto save", select);
select = new WCheckBoxSelect("australian_state");
select.setSubmitOnChange(true);
layout.addField("Select a state or territory with auto save and hint", select).getLabel().setHint("This is a hint");
// Even compound controls need a label
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect with no labelling component"));
add(new ExplanatoryText("All input controls, even those which are complex and do not output labellable HTML elements, must be associated with"
+ " a WLabel or have a toolTip."));
add(new WCheckBoxSelect("australian_state"));
// Too many options anti-pattern
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect with too many options"));
add(new ExplanatoryText("Don't use a WCheckBoxSelect if you have more than a handful of options. A good rule of thumb is fewer than 10."));
select = new WCheckBoxSelect(new String[]{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z"});
select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS);
select.setButtonColumns(6);
select.setFrameless(true);
add(new WLabel("Select your country of birth", select));
add(select);
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect with no options."));
add(new ExplanatoryText("An interactive WCheckBoxSelect with no options is rather pointless."));
select = new WCheckBoxSelect();
add(new WLabel("WCheckBoxSelect with no options", select));
add(select);
} | java | private void addAntiPatternExamples() {
add(new WHeading(HeadingLevel.H2, "WCheckBoxSelect anti-pattern examples"));
add(new WMessageBox(
WMessageBox.WARN,
"These examples are purposely bad and should not be used as samples of how to use WComponents but samples of how NOT to use them."));
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect with submitOnChange"));
WFieldLayout layout = new WFieldLayout(WFieldLayout.LAYOUT_STACKED);
add(layout);
WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
select.setSubmitOnChange(true);
layout.addField("Select a state or territory with auto save", select);
select = new WCheckBoxSelect("australian_state");
select.setSubmitOnChange(true);
layout.addField("Select a state or territory with auto save and hint", select).getLabel().setHint("This is a hint");
// Even compound controls need a label
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect with no labelling component"));
add(new ExplanatoryText("All input controls, even those which are complex and do not output labellable HTML elements, must be associated with"
+ " a WLabel or have a toolTip."));
add(new WCheckBoxSelect("australian_state"));
// Too many options anti-pattern
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect with too many options"));
add(new ExplanatoryText("Don't use a WCheckBoxSelect if you have more than a handful of options. A good rule of thumb is fewer than 10."));
select = new WCheckBoxSelect(new String[]{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z"});
select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS);
select.setButtonColumns(6);
select.setFrameless(true);
add(new WLabel("Select your country of birth", select));
add(select);
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect with no options."));
add(new ExplanatoryText("An interactive WCheckBoxSelect with no options is rather pointless."));
select = new WCheckBoxSelect();
add(new WLabel("WCheckBoxSelect with no options", select));
add(select);
} | [
"private",
"void",
"addAntiPatternExamples",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H2",
",",
"\"WCheckBoxSelect anti-pattern examples\"",
")",
")",
";",
"add",
"(",
"new",
"WMessageBox",
"(",
"WMessageBox",
".",
"WARN",
",",
"\"These examples are purposely bad and should not be used as samples of how to use WComponents but samples of how NOT to use them.\"",
")",
")",
";",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect with submitOnChange\"",
")",
")",
";",
"WFieldLayout",
"layout",
"=",
"new",
"WFieldLayout",
"(",
"WFieldLayout",
".",
"LAYOUT_STACKED",
")",
";",
"add",
"(",
"layout",
")",
";",
"WCheckBoxSelect",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"\"australian_state\"",
")",
";",
"select",
".",
"setSubmitOnChange",
"(",
"true",
")",
";",
"layout",
".",
"addField",
"(",
"\"Select a state or territory with auto save\"",
",",
"select",
")",
";",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"\"australian_state\"",
")",
";",
"select",
".",
"setSubmitOnChange",
"(",
"true",
")",
";",
"layout",
".",
"addField",
"(",
"\"Select a state or territory with auto save and hint\"",
",",
"select",
")",
".",
"getLabel",
"(",
")",
".",
"setHint",
"(",
"\"This is a hint\"",
")",
";",
"// Even compound controls need a label",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect with no labelling component\"",
")",
")",
";",
"add",
"(",
"new",
"ExplanatoryText",
"(",
"\"All input controls, even those which are complex and do not output labellable HTML elements, must be associated with\"",
"+",
"\" a WLabel or have a toolTip.\"",
")",
")",
";",
"add",
"(",
"new",
"WCheckBoxSelect",
"(",
"\"australian_state\"",
")",
")",
";",
"// Too many options anti-pattern",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect with too many options\"",
")",
")",
";",
"add",
"(",
"new",
"ExplanatoryText",
"(",
"\"Don't use a WCheckBoxSelect if you have more than a handful of options. A good rule of thumb is fewer than 10.\"",
")",
")",
";",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
"new",
"String",
"[",
"]",
"{",
"\"a\"",
",",
"\"b\"",
",",
"\"c\"",
",",
"\"d\"",
",",
"\"e\"",
",",
"\"f\"",
",",
"\"g\"",
",",
"\"h\"",
",",
"\"i\"",
",",
"\"j\"",
",",
"\"k\"",
",",
"\"l\"",
",",
"\"m\"",
",",
"\"n\"",
",",
"\"o\"",
",",
"\"p\"",
",",
"\"q\"",
",",
"\"r\"",
",",
"\"s\"",
",",
"\"t\"",
",",
"\"u\"",
",",
"\"v\"",
",",
"\"w\"",
",",
"\"x\"",
",",
"\"y\"",
",",
"\"z\"",
"}",
")",
";",
"select",
".",
"setButtonLayout",
"(",
"WCheckBoxSelect",
".",
"LAYOUT_COLUMNS",
")",
";",
"select",
".",
"setButtonColumns",
"(",
"6",
")",
";",
"select",
".",
"setFrameless",
"(",
"true",
")",
";",
"add",
"(",
"new",
"WLabel",
"(",
"\"Select your country of birth\"",
",",
"select",
")",
")",
";",
"add",
"(",
"select",
")",
";",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect with no options.\"",
")",
")",
";",
"add",
"(",
"new",
"ExplanatoryText",
"(",
"\"An interactive WCheckBoxSelect with no options is rather pointless.\"",
")",
")",
";",
"select",
"=",
"new",
"WCheckBoxSelect",
"(",
")",
";",
"add",
"(",
"new",
"WLabel",
"(",
"\"WCheckBoxSelect with no options\"",
",",
"select",
")",
")",
";",
"add",
"(",
"select",
")",
";",
"}"
] | Examples of what not to do when using WCheckBoxSelect. | [
"Examples",
"of",
"what",
"not",
"to",
"do",
"when",
"using",
"WCheckBoxSelect",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L405-L444 |
139,497 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WLinkRenderer.java | WLinkRenderer.paintAjaxTrigger | private void paintAjaxTrigger(final WLink link, final XmlStringBuilder xml) {
AjaxTarget[] actionTargets = link.getActionTargets();
// Start tag
xml.appendTagOpen("ui:ajaxtrigger");
xml.appendAttribute("triggerId", link.getId());
xml.appendClose();
if (actionTargets != null && actionTargets.length > 0) {
// Targets
for (AjaxTarget target : actionTargets) {
xml.appendTagOpen("ui:ajaxtargetid");
xml.appendAttribute("targetId", target.getId());
xml.appendEnd();
}
} else {
// Target itself
xml.appendTagOpen("ui:ajaxtargetid");
xml.appendAttribute("targetId", link.getId());
xml.appendEnd();
}
// End tag
xml.appendEndTag("ui:ajaxtrigger");
} | java | private void paintAjaxTrigger(final WLink link, final XmlStringBuilder xml) {
AjaxTarget[] actionTargets = link.getActionTargets();
// Start tag
xml.appendTagOpen("ui:ajaxtrigger");
xml.appendAttribute("triggerId", link.getId());
xml.appendClose();
if (actionTargets != null && actionTargets.length > 0) {
// Targets
for (AjaxTarget target : actionTargets) {
xml.appendTagOpen("ui:ajaxtargetid");
xml.appendAttribute("targetId", target.getId());
xml.appendEnd();
}
} else {
// Target itself
xml.appendTagOpen("ui:ajaxtargetid");
xml.appendAttribute("targetId", link.getId());
xml.appendEnd();
}
// End tag
xml.appendEndTag("ui:ajaxtrigger");
} | [
"private",
"void",
"paintAjaxTrigger",
"(",
"final",
"WLink",
"link",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"AjaxTarget",
"[",
"]",
"actionTargets",
"=",
"link",
".",
"getActionTargets",
"(",
")",
";",
"// Start tag",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:ajaxtrigger\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"triggerId\"",
",",
"link",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"if",
"(",
"actionTargets",
"!=",
"null",
"&&",
"actionTargets",
".",
"length",
">",
"0",
")",
"{",
"// Targets",
"for",
"(",
"AjaxTarget",
"target",
":",
"actionTargets",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:ajaxtargetid\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"targetId\"",
",",
"target",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendEnd",
"(",
")",
";",
"}",
"}",
"else",
"{",
"// Target itself",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:ajaxtargetid\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"targetId\"",
",",
"link",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendEnd",
"(",
")",
";",
"}",
"// End tag",
"xml",
".",
"appendEndTag",
"(",
"\"ui:ajaxtrigger\"",
")",
";",
"}"
] | Paint the AJAX trigger if the link has an action.
@param link the link component being rendered
@param xml the XmlStringBuilder to paint to. | [
"Paint",
"the",
"AJAX",
"trigger",
"if",
"the",
"link",
"has",
"an",
"action",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WLinkRenderer.java#L130-L154 |
139,498 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/VelocityInterceptor.java | VelocityInterceptor.paint | @Override
public void paint(final RenderContext renderContext) {
if (!(renderContext instanceof WebXmlRenderContext)) {
throw new SystemException("Unable to render to " + renderContext);
}
PrintWriter writer = ((WebXmlRenderContext) renderContext).getWriter();
Template template = null;
try {
template = VelocityEngineFactory.getVelocityEngine().getTemplate(templateUrl);
} catch (Exception ex) {
String message = "Could not open velocity template \"" + templateUrl + "\" for \"" + this.
getClass().getName() + "\"";
LOG.error(message, ex);
writer.println(message);
return;
}
try {
VelocityContext context = new VelocityContext();
fillContext(context);
template.merge(context, writer);
} catch (ResourceNotFoundException rnfe) {
LOG.error("Could not find template " + templateUrl, rnfe);
} catch (ParseErrorException pee) {
// syntax error : problem parsing the template
LOG.error("Parse problems", pee);
} catch (MethodInvocationException mie) {
// something invoked in the template
// threw an exception
Throwable wrapped = mie.getWrappedThrowable();
LOG.error("Problems with velocity", mie);
if (wrapped != null) {
LOG.error("Wrapped exception...", wrapped);
}
} catch (Exception e) {
LOG.error("Problems with velocity", e);
}
} | java | @Override
public void paint(final RenderContext renderContext) {
if (!(renderContext instanceof WebXmlRenderContext)) {
throw new SystemException("Unable to render to " + renderContext);
}
PrintWriter writer = ((WebXmlRenderContext) renderContext).getWriter();
Template template = null;
try {
template = VelocityEngineFactory.getVelocityEngine().getTemplate(templateUrl);
} catch (Exception ex) {
String message = "Could not open velocity template \"" + templateUrl + "\" for \"" + this.
getClass().getName() + "\"";
LOG.error(message, ex);
writer.println(message);
return;
}
try {
VelocityContext context = new VelocityContext();
fillContext(context);
template.merge(context, writer);
} catch (ResourceNotFoundException rnfe) {
LOG.error("Could not find template " + templateUrl, rnfe);
} catch (ParseErrorException pee) {
// syntax error : problem parsing the template
LOG.error("Parse problems", pee);
} catch (MethodInvocationException mie) {
// something invoked in the template
// threw an exception
Throwable wrapped = mie.getWrappedThrowable();
LOG.error("Problems with velocity", mie);
if (wrapped != null) {
LOG.error("Wrapped exception...", wrapped);
}
} catch (Exception e) {
LOG.error("Problems with velocity", e);
}
} | [
"@",
"Override",
"public",
"void",
"paint",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"if",
"(",
"!",
"(",
"renderContext",
"instanceof",
"WebXmlRenderContext",
")",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"Unable to render to \"",
"+",
"renderContext",
")",
";",
"}",
"PrintWriter",
"writer",
"=",
"(",
"(",
"WebXmlRenderContext",
")",
"renderContext",
")",
".",
"getWriter",
"(",
")",
";",
"Template",
"template",
"=",
"null",
";",
"try",
"{",
"template",
"=",
"VelocityEngineFactory",
".",
"getVelocityEngine",
"(",
")",
".",
"getTemplate",
"(",
"templateUrl",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"String",
"message",
"=",
"\"Could not open velocity template \\\"\"",
"+",
"templateUrl",
"+",
"\"\\\" for \\\"\"",
"+",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"\\\"\"",
";",
"LOG",
".",
"error",
"(",
"message",
",",
"ex",
")",
";",
"writer",
".",
"println",
"(",
"message",
")",
";",
"return",
";",
"}",
"try",
"{",
"VelocityContext",
"context",
"=",
"new",
"VelocityContext",
"(",
")",
";",
"fillContext",
"(",
"context",
")",
";",
"template",
".",
"merge",
"(",
"context",
",",
"writer",
")",
";",
"}",
"catch",
"(",
"ResourceNotFoundException",
"rnfe",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not find template \"",
"+",
"templateUrl",
",",
"rnfe",
")",
";",
"}",
"catch",
"(",
"ParseErrorException",
"pee",
")",
"{",
"// syntax error : problem parsing the template",
"LOG",
".",
"error",
"(",
"\"Parse problems\"",
",",
"pee",
")",
";",
"}",
"catch",
"(",
"MethodInvocationException",
"mie",
")",
"{",
"// something invoked in the template",
"// threw an exception",
"Throwable",
"wrapped",
"=",
"mie",
".",
"getWrappedThrowable",
"(",
")",
";",
"LOG",
".",
"error",
"(",
"\"Problems with velocity\"",
",",
"mie",
")",
";",
"if",
"(",
"wrapped",
"!=",
"null",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Wrapped exception...\"",
",",
"wrapped",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Problems with velocity\"",
",",
"e",
")",
";",
"}",
"}"
] | Renders the component using the velocity template which has been provided.
@param renderContext the context for rendering. | [
"Renders",
"the",
"component",
"using",
"the",
"velocity",
"template",
"which",
"has",
"been",
"provided",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/VelocityInterceptor.java#L63-L107 |
139,499 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WDropdownTriggerActionExample.java | WDropdownTriggerActionExample.getRegions | private static String[] getRegions(final String state) {
if ("ACT".equals(state)) {
return ACT_REGIONS;
} else if ("VIC".equals(state)) {
return VIC_REGIONS;
} else {
return null;
}
} | java | private static String[] getRegions(final String state) {
if ("ACT".equals(state)) {
return ACT_REGIONS;
} else if ("VIC".equals(state)) {
return VIC_REGIONS;
} else {
return null;
}
} | [
"private",
"static",
"String",
"[",
"]",
"getRegions",
"(",
"final",
"String",
"state",
")",
"{",
"if",
"(",
"\"ACT\"",
".",
"equals",
"(",
"state",
")",
")",
"{",
"return",
"ACT_REGIONS",
";",
"}",
"else",
"if",
"(",
"\"VIC\"",
".",
"equals",
"(",
"state",
")",
")",
"{",
"return",
"VIC_REGIONS",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Retrieves the regions in a state.
@param state the state.
@return the regions in the given state. | [
"Retrieves",
"the",
"regions",
"in",
"a",
"state",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WDropdownTriggerActionExample.java#L151-L161 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.