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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
138,900 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractCompare.java | AbstractCompare.execute | @Override
protected boolean execute() {
// Disabled triggers are always false
if ((trigger instanceof Disableable) && ((Disableable) trigger).isDisabled()
&& !(trigger instanceof Input && ((Input) trigger).isReadOnly())) {
return false;
}
final Object triggerValue = getTriggerValue(null);
final Object compareValue = getCompareValue();
return executeCompare(triggerValue, compareValue);
} | java | @Override
protected boolean execute() {
// Disabled triggers are always false
if ((trigger instanceof Disableable) && ((Disableable) trigger).isDisabled()
&& !(trigger instanceof Input && ((Input) trigger).isReadOnly())) {
return false;
}
final Object triggerValue = getTriggerValue(null);
final Object compareValue = getCompareValue();
return executeCompare(triggerValue, compareValue);
} | [
"@",
"Override",
"protected",
"boolean",
"execute",
"(",
")",
"{",
"// Disabled triggers are always false",
"if",
"(",
"(",
"trigger",
"instanceof",
"Disableable",
")",
"&&",
"(",
"(",
"Disableable",
")",
"trigger",
")",
".",
"isDisabled",
"(",
")",
"&&",
"!",
"(",
"trigger",
"instanceof",
"Input",
"&&",
"(",
"(",
"Input",
")",
"trigger",
")",
".",
"isReadOnly",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"Object",
"triggerValue",
"=",
"getTriggerValue",
"(",
"null",
")",
";",
"final",
"Object",
"compareValue",
"=",
"getCompareValue",
"(",
")",
";",
"return",
"executeCompare",
"(",
"triggerValue",
",",
"compareValue",
")",
";",
"}"
] | Compare the trigger and compare value.
@return true if the trigger input's value compares to the compare value, otherwise false | [
"Compare",
"the",
"trigger",
"and",
"compare",
"value",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractCompare.java#L88-L100 |
138,901 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java | WTabSet.isTabVisible | public boolean isTabVisible(final int idx) {
WTab tab = getTab(idx);
Container tabParent = tab.getParent();
if (tabParent instanceof WTabGroup) {
return tab.isVisible() && tabParent.isVisible();
} else {
return tab.isVisible();
}
} | java | public boolean isTabVisible(final int idx) {
WTab tab = getTab(idx);
Container tabParent = tab.getParent();
if (tabParent instanceof WTabGroup) {
return tab.isVisible() && tabParent.isVisible();
} else {
return tab.isVisible();
}
} | [
"public",
"boolean",
"isTabVisible",
"(",
"final",
"int",
"idx",
")",
"{",
"WTab",
"tab",
"=",
"getTab",
"(",
"idx",
")",
";",
"Container",
"tabParent",
"=",
"tab",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"tabParent",
"instanceof",
"WTabGroup",
")",
"{",
"return",
"tab",
".",
"isVisible",
"(",
")",
"&&",
"tabParent",
".",
"isVisible",
"(",
")",
";",
"}",
"else",
"{",
"return",
"tab",
".",
"isVisible",
"(",
")",
";",
"}",
"}"
] | Indicates whether the tab at the given index is visible.
@param idx the index of the WTab to test.
@return true if the tab at the given index is visible, false if it is invisible. | [
"Indicates",
"whether",
"the",
"tab",
"at",
"the",
"given",
"index",
"is",
"visible",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java#L525-L534 |
138,902 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java | WTabSet.getTabIndex | public int getTabIndex(final WComponent content) {
List<WTab> tabs = getTabs();
final int count = tabs.size();
for (int i = 0; i < count; i++) {
WTab tab = tabs.get(i);
if (content == tab.getContent()) {
return i;
}
}
return -1;
} | java | public int getTabIndex(final WComponent content) {
List<WTab> tabs = getTabs();
final int count = tabs.size();
for (int i = 0; i < count; i++) {
WTab tab = tabs.get(i);
if (content == tab.getContent()) {
return i;
}
}
return -1;
} | [
"public",
"int",
"getTabIndex",
"(",
"final",
"WComponent",
"content",
")",
"{",
"List",
"<",
"WTab",
">",
"tabs",
"=",
"getTabs",
"(",
")",
";",
"final",
"int",
"count",
"=",
"tabs",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"WTab",
"tab",
"=",
"tabs",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"content",
"==",
"tab",
".",
"getContent",
"(",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] | Retrieves the tab index for the given tab content.
@param content the tab content
@return the tab index, or -1 if the content is not in a tab in this tab set. | [
"Retrieves",
"the",
"tab",
"index",
"for",
"the",
"given",
"tab",
"content",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java#L566-L579 |
138,903 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java | WTabSet.clientIndexToTabIndex | private int clientIndexToTabIndex(final int clientIndex) {
int childCount = getTotalTabs();
int serverIndex = clientIndex;
for (int i = 0; i <= serverIndex && i < childCount; i++) {
if (!isTabVisible(i)) {
serverIndex++;
}
}
return serverIndex;
} | java | private int clientIndexToTabIndex(final int clientIndex) {
int childCount = getTotalTabs();
int serverIndex = clientIndex;
for (int i = 0; i <= serverIndex && i < childCount; i++) {
if (!isTabVisible(i)) {
serverIndex++;
}
}
return serverIndex;
} | [
"private",
"int",
"clientIndexToTabIndex",
"(",
"final",
"int",
"clientIndex",
")",
"{",
"int",
"childCount",
"=",
"getTotalTabs",
"(",
")",
";",
"int",
"serverIndex",
"=",
"clientIndex",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"serverIndex",
"&&",
"i",
"<",
"childCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"isTabVisible",
"(",
"i",
")",
")",
"{",
"serverIndex",
"++",
";",
"}",
"}",
"return",
"serverIndex",
";",
"}"
] | The client-side tab indices will differ from the WTabSet's indices when one or more tabs are invisible.
@param clientIndex the client-side index
@return the WTabSet index corresponding to the given client index | [
"The",
"client",
"-",
"side",
"tab",
"indices",
"will",
"differ",
"from",
"the",
"WTabSet",
"s",
"indices",
"when",
"one",
"or",
"more",
"tabs",
"are",
"invisible",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java#L698-L709 |
138,904 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java | WTabSet.getGroupName | public String getGroupName() {
if (TabSetType.ACCORDION.equals(getType())) {
CollapsibleGroup group = getComponentModel().group;
return (group == null ? null : group.getGroupName());
}
return null;
} | java | public String getGroupName() {
if (TabSetType.ACCORDION.equals(getType())) {
CollapsibleGroup group = getComponentModel().group;
return (group == null ? null : group.getGroupName());
}
return null;
} | [
"public",
"String",
"getGroupName",
"(",
")",
"{",
"if",
"(",
"TabSetType",
".",
"ACCORDION",
".",
"equals",
"(",
"getType",
"(",
")",
")",
")",
"{",
"CollapsibleGroup",
"group",
"=",
"getComponentModel",
"(",
")",
".",
"group",
";",
"return",
"(",
"group",
"==",
"null",
"?",
"null",
":",
"group",
".",
"getGroupName",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] | The "collapsible" group name that this tabset belongs to.
@return the collapsible group name | [
"The",
"collapsible",
"group",
"name",
"that",
"this",
"tabset",
"belongs",
"to",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java#L820-L826 |
138,905 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java | ColumnMenuExample.buildColumnMenu | private WMenu buildColumnMenu(final WText selectedMenuText) {
WMenu menu = new WMenu(WMenu.MenuType.COLUMN);
menu.setSelectMode(SelectMode.SINGLE);
menu.setRows(8);
StringTreeNode root = getOrgHierarchyTree();
mapColumnHierarchy(menu, root, selectedMenuText);
// Demonstrate different menu modes
getSubMenuByText("Australia", menu).setAccessKey('A');
getSubMenuByText("NSW", menu).setMode(MenuMode.CLIENT);
getSubMenuByText("Branch 1", menu).setMode(MenuMode.DYNAMIC);
getSubMenuByText("VIC", menu).setMode(MenuMode.LAZY);
WMenuItem itemWithIcon = new WMenuItem("Help");
itemWithIcon.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
// do something
}
});
itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE);
menu.add(itemWithIcon);
return menu;
} | java | private WMenu buildColumnMenu(final WText selectedMenuText) {
WMenu menu = new WMenu(WMenu.MenuType.COLUMN);
menu.setSelectMode(SelectMode.SINGLE);
menu.setRows(8);
StringTreeNode root = getOrgHierarchyTree();
mapColumnHierarchy(menu, root, selectedMenuText);
// Demonstrate different menu modes
getSubMenuByText("Australia", menu).setAccessKey('A');
getSubMenuByText("NSW", menu).setMode(MenuMode.CLIENT);
getSubMenuByText("Branch 1", menu).setMode(MenuMode.DYNAMIC);
getSubMenuByText("VIC", menu).setMode(MenuMode.LAZY);
WMenuItem itemWithIcon = new WMenuItem("Help");
itemWithIcon.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
// do something
}
});
itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE);
menu.add(itemWithIcon);
return menu;
} | [
"private",
"WMenu",
"buildColumnMenu",
"(",
"final",
"WText",
"selectedMenuText",
")",
"{",
"WMenu",
"menu",
"=",
"new",
"WMenu",
"(",
"WMenu",
".",
"MenuType",
".",
"COLUMN",
")",
";",
"menu",
".",
"setSelectMode",
"(",
"SelectMode",
".",
"SINGLE",
")",
";",
"menu",
".",
"setRows",
"(",
"8",
")",
";",
"StringTreeNode",
"root",
"=",
"getOrgHierarchyTree",
"(",
")",
";",
"mapColumnHierarchy",
"(",
"menu",
",",
"root",
",",
"selectedMenuText",
")",
";",
"// Demonstrate different menu modes",
"getSubMenuByText",
"(",
"\"Australia\"",
",",
"menu",
")",
".",
"setAccessKey",
"(",
"'",
"'",
")",
";",
"getSubMenuByText",
"(",
"\"NSW\"",
",",
"menu",
")",
".",
"setMode",
"(",
"MenuMode",
".",
"CLIENT",
")",
";",
"getSubMenuByText",
"(",
"\"Branch 1\"",
",",
"menu",
")",
".",
"setMode",
"(",
"MenuMode",
".",
"DYNAMIC",
")",
";",
"getSubMenuByText",
"(",
"\"VIC\"",
",",
"menu",
")",
".",
"setMode",
"(",
"MenuMode",
".",
"LAZY",
")",
";",
"WMenuItem",
"itemWithIcon",
"=",
"new",
"WMenuItem",
"(",
"\"Help\"",
")",
";",
"itemWithIcon",
".",
"setAction",
"(",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"// do something",
"}",
"}",
")",
";",
"itemWithIcon",
".",
"setHtmlClass",
"(",
"HtmlClassProperties",
".",
"ICON_HELP_BEFORE",
")",
";",
"menu",
".",
"add",
"(",
"itemWithIcon",
")",
";",
"return",
"menu",
";",
"}"
] | Builds up a column menu for inclusion in the example.
@param selectedMenuText the WText to display the selected menu.
@return a column menu for the example. | [
"Builds",
"up",
"a",
"column",
"menu",
"for",
"inclusion",
"in",
"the",
"example",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java#L53-L77 |
138,906 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java | ColumnMenuExample.getOrgHierarchyTree | private StringTreeNode getOrgHierarchyTree() {
// Hierarchical data in a flat format.
// If an Object array contains 1 String element, it is a leaf node.
// Else an Object array contains 1 String element + object arrays and is a branch node.
Object[] data = new Object[]{
"Australia",
new Object[]{"ACT"},
new Object[]{
"NSW",
new Object[]{"Paramatta"},
new Object[]{
"Sydney",
new Object[]{
"Branch 1",
new Object[]{"Processing Team 1"},
new Object[]{
"Processing Team 2",
new Object[]{"Robert Rogriguez"},
new Object[]{"Phillip Sedgwick"},
new Object[]{"Donald Sullivan"},
new Object[]{"All"}
},
new Object[]{
"Processing Team 3",
new Object[]{"Jim McCarthy"},
new Object[]{"Peter Dunne"},
new Object[]{"Nicole Brown"},
new Object[]{"All"}
},
new Object[]{"Processing Team 4"},
new Object[]{"Processing Team 5"},
new Object[]{"All"}
},
new Object[]{"Branch 2"},
new Object[]{"Branch 3"}
},
new Object[]{"Broken Hill"},
new Object[]{"Tamworth"},
new Object[]{"Griffith"},
new Object[]{"Wollongong"},
new Object[]{"Port Macquarie"},
new Object[]{"Moree"},
new Object[]{"Orange"},
new Object[]{"Richmond"},
new Object[]{"Bathurst"},
new Object[]{"Newcastle"},
new Object[]{"Nowra"},
new Object[]{"Woy Woy"},
new Object[]{"Maitland"},
new Object[]{"Hay"},
new Object[]{"Bourke"},
new Object[]{"Lightning Ridge"},
new Object[]{"Coffs Harbour"},
new Object[]{"All"}
},
new Object[]{
"VIC",
new Object[]{"Melbourne"},
new Object[]{"Wangaratta"},
new Object[]{"Broken Hill"},
new Object[]{"Albury"},
new Object[]{"Ballarat"},
new Object[]{"Bendigo"},
new Object[]{"Horsham"},
new Object[]{"Portland"},
new Object[]{"Geelong"},
new Object[]{"Shepparton"},
new Object[]{"Hamilton"},
new Object[]{"Morewell"}
},
new Object[]{"SA"},
new Object[]{"NT"},
new Object[]{"QLD"},
new Object[]{"WA"},
new Object[]{"TAS"}
};
return buildOrgHierarchyTree(data);
} | java | private StringTreeNode getOrgHierarchyTree() {
// Hierarchical data in a flat format.
// If an Object array contains 1 String element, it is a leaf node.
// Else an Object array contains 1 String element + object arrays and is a branch node.
Object[] data = new Object[]{
"Australia",
new Object[]{"ACT"},
new Object[]{
"NSW",
new Object[]{"Paramatta"},
new Object[]{
"Sydney",
new Object[]{
"Branch 1",
new Object[]{"Processing Team 1"},
new Object[]{
"Processing Team 2",
new Object[]{"Robert Rogriguez"},
new Object[]{"Phillip Sedgwick"},
new Object[]{"Donald Sullivan"},
new Object[]{"All"}
},
new Object[]{
"Processing Team 3",
new Object[]{"Jim McCarthy"},
new Object[]{"Peter Dunne"},
new Object[]{"Nicole Brown"},
new Object[]{"All"}
},
new Object[]{"Processing Team 4"},
new Object[]{"Processing Team 5"},
new Object[]{"All"}
},
new Object[]{"Branch 2"},
new Object[]{"Branch 3"}
},
new Object[]{"Broken Hill"},
new Object[]{"Tamworth"},
new Object[]{"Griffith"},
new Object[]{"Wollongong"},
new Object[]{"Port Macquarie"},
new Object[]{"Moree"},
new Object[]{"Orange"},
new Object[]{"Richmond"},
new Object[]{"Bathurst"},
new Object[]{"Newcastle"},
new Object[]{"Nowra"},
new Object[]{"Woy Woy"},
new Object[]{"Maitland"},
new Object[]{"Hay"},
new Object[]{"Bourke"},
new Object[]{"Lightning Ridge"},
new Object[]{"Coffs Harbour"},
new Object[]{"All"}
},
new Object[]{
"VIC",
new Object[]{"Melbourne"},
new Object[]{"Wangaratta"},
new Object[]{"Broken Hill"},
new Object[]{"Albury"},
new Object[]{"Ballarat"},
new Object[]{"Bendigo"},
new Object[]{"Horsham"},
new Object[]{"Portland"},
new Object[]{"Geelong"},
new Object[]{"Shepparton"},
new Object[]{"Hamilton"},
new Object[]{"Morewell"}
},
new Object[]{"SA"},
new Object[]{"NT"},
new Object[]{"QLD"},
new Object[]{"WA"},
new Object[]{"TAS"}
};
return buildOrgHierarchyTree(data);
} | [
"private",
"StringTreeNode",
"getOrgHierarchyTree",
"(",
")",
"{",
"// Hierarchical data in a flat format.",
"// If an Object array contains 1 String element, it is a leaf node.",
"// Else an Object array contains 1 String element + object arrays and is a branch node.",
"Object",
"[",
"]",
"data",
"=",
"new",
"Object",
"[",
"]",
"{",
"\"Australia\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"ACT\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"NSW\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Paramatta\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Sydney\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Branch 1\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Processing Team 1\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Processing Team 2\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Robert Rogriguez\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Phillip Sedgwick\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Donald Sullivan\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"All\"",
"}",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Processing Team 3\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Jim McCarthy\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Peter Dunne\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Nicole Brown\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"All\"",
"}",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Processing Team 4\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Processing Team 5\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"All\"",
"}",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Branch 2\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Branch 3\"",
"}",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Broken Hill\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Tamworth\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Griffith\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Wollongong\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Port Macquarie\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Moree\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Orange\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Richmond\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Bathurst\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Newcastle\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Nowra\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Woy Woy\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Maitland\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Hay\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Bourke\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Lightning Ridge\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Coffs Harbour\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"All\"",
"}",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"VIC\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Melbourne\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Wangaratta\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Broken Hill\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Albury\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Ballarat\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Bendigo\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Horsham\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Portland\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Geelong\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Shepparton\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Hamilton\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Morewell\"",
"}",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"SA\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"NT\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"QLD\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"WA\"",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"\"TAS\"",
"}",
"}",
";",
"return",
"buildOrgHierarchyTree",
"(",
"data",
")",
";",
"}"
] | Builds an organisation hierarchy tree for the column menu example.
@return an organisation hierarchy tree. | [
"Builds",
"an",
"organisation",
"hierarchy",
"tree",
"for",
"the",
"column",
"menu",
"example",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java#L128-L206 |
138,907 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java | ColumnMenuExample.buildOrgHierarchyTree | private StringTreeNode buildOrgHierarchyTree(final Object[] data) {
StringTreeNode childNode = new StringTreeNode((String) data[0]);
if (data.length > 1) {
for (int i = 1; i < data.length; i++) {
childNode.add(buildOrgHierarchyTree((Object[]) data[i]));
}
}
return childNode;
} | java | private StringTreeNode buildOrgHierarchyTree(final Object[] data) {
StringTreeNode childNode = new StringTreeNode((String) data[0]);
if (data.length > 1) {
for (int i = 1; i < data.length; i++) {
childNode.add(buildOrgHierarchyTree((Object[]) data[i]));
}
}
return childNode;
} | [
"private",
"StringTreeNode",
"buildOrgHierarchyTree",
"(",
"final",
"Object",
"[",
"]",
"data",
")",
"{",
"StringTreeNode",
"childNode",
"=",
"new",
"StringTreeNode",
"(",
"(",
"String",
")",
"data",
"[",
"0",
"]",
")",
";",
"if",
"(",
"data",
".",
"length",
">",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"childNode",
".",
"add",
"(",
"buildOrgHierarchyTree",
"(",
"(",
"Object",
"[",
"]",
")",
"data",
"[",
"i",
"]",
")",
")",
";",
"}",
"}",
"return",
"childNode",
";",
"}"
] | Builds one level of the org hierarchy tree.
The data parameter should either contain a single String, or a String plus data arrays for child nodes.
@param data the node data.
@return the tree node created from the data. | [
"Builds",
"one",
"level",
"of",
"the",
"org",
"hierarchy",
"tree",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java#L216-L226 |
138,908 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java | ColumnMenuExample.getSubMenuByText | private WSubMenu getSubMenuByText(final String text, final WComponent node) {
if (node instanceof WSubMenu) {
WSubMenu subMenu = (WSubMenu) node;
if (text.equals(subMenu.getText())) {
return subMenu;
}
for (MenuItem item : subMenu.getMenuItems()) {
WSubMenu result = getSubMenuByText(text, item);
if (result != null) {
return result;
}
}
} else if (node instanceof WMenu) {
WMenu menu = (WMenu) node;
for (MenuItem item : menu.getMenuItems()) {
WSubMenu result = getSubMenuByText(text, item);
if (result != null) {
return result;
}
}
}
return null;
} | java | private WSubMenu getSubMenuByText(final String text, final WComponent node) {
if (node instanceof WSubMenu) {
WSubMenu subMenu = (WSubMenu) node;
if (text.equals(subMenu.getText())) {
return subMenu;
}
for (MenuItem item : subMenu.getMenuItems()) {
WSubMenu result = getSubMenuByText(text, item);
if (result != null) {
return result;
}
}
} else if (node instanceof WMenu) {
WMenu menu = (WMenu) node;
for (MenuItem item : menu.getMenuItems()) {
WSubMenu result = getSubMenuByText(text, item);
if (result != null) {
return result;
}
}
}
return null;
} | [
"private",
"WSubMenu",
"getSubMenuByText",
"(",
"final",
"String",
"text",
",",
"final",
"WComponent",
"node",
")",
"{",
"if",
"(",
"node",
"instanceof",
"WSubMenu",
")",
"{",
"WSubMenu",
"subMenu",
"=",
"(",
"WSubMenu",
")",
"node",
";",
"if",
"(",
"text",
".",
"equals",
"(",
"subMenu",
".",
"getText",
"(",
")",
")",
")",
"{",
"return",
"subMenu",
";",
"}",
"for",
"(",
"MenuItem",
"item",
":",
"subMenu",
".",
"getMenuItems",
"(",
")",
")",
"{",
"WSubMenu",
"result",
"=",
"getSubMenuByText",
"(",
"text",
",",
"item",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"return",
"result",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"WMenu",
")",
"{",
"WMenu",
"menu",
"=",
"(",
"WMenu",
")",
"node",
";",
"for",
"(",
"MenuItem",
"item",
":",
"menu",
".",
"getMenuItems",
"(",
")",
")",
"{",
"WSubMenu",
"result",
"=",
"getSubMenuByText",
"(",
"text",
",",
"item",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"return",
"result",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Retrieves a sub menu by its text.
@param text the text to search for.
@param node the current node in the WComponent tree.
@return the sub menu with the given text, or null if not found. | [
"Retrieves",
"a",
"sub",
"menu",
"by",
"its",
"text",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java#L235-L259 |
138,909 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/SpaceUtil.java | SpaceUtil.intToSize | @Deprecated
public static Size intToSize(final int convert) {
// NOTE: no zero size margin in the old versions.
if (convert <= 0) {
return null;
}
if (convert <= MAX_SMALL) {
return Size.SMALL;
}
if (convert <= MAX_MED) {
return Size.MEDIUM;
}
if (convert <= MAX_LARGE) {
return Size.LARGE;
}
return Size.XL;
} | java | @Deprecated
public static Size intToSize(final int convert) {
// NOTE: no zero size margin in the old versions.
if (convert <= 0) {
return null;
}
if (convert <= MAX_SMALL) {
return Size.SMALL;
}
if (convert <= MAX_MED) {
return Size.MEDIUM;
}
if (convert <= MAX_LARGE) {
return Size.LARGE;
}
return Size.XL;
} | [
"@",
"Deprecated",
"public",
"static",
"Size",
"intToSize",
"(",
"final",
"int",
"convert",
")",
"{",
"// NOTE: no zero size margin in the old versions.",
"if",
"(",
"convert",
"<=",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"convert",
"<=",
"MAX_SMALL",
")",
"{",
"return",
"Size",
".",
"SMALL",
";",
"}",
"if",
"(",
"convert",
"<=",
"MAX_MED",
")",
"{",
"return",
"Size",
".",
"MEDIUM",
";",
"}",
"if",
"(",
"convert",
"<=",
"MAX_LARGE",
")",
"{",
"return",
"Size",
".",
"LARGE",
";",
"}",
"return",
"Size",
".",
"XL",
";",
"}"
] | Convert an int space to a Size. For backwards compatibility during conversion of int spaces to Size spaces.
@param convert the int size to convert
@return a Size appropriate to the int | [
"Convert",
"an",
"int",
"space",
"to",
"a",
"Size",
".",
"For",
"backwards",
"compatibility",
"during",
"conversion",
"of",
"int",
"spaces",
"to",
"Size",
"spaces",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/SpaceUtil.java#L49-L65 |
138,910 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/SpaceUtil.java | SpaceUtil.sizeToInt | @Deprecated
public static int sizeToInt(final Size size) {
if (size == null) {
return -1;
}
switch (size) {
case ZERO:
return 0;
case SMALL:
return MAX_SMALL;
case MEDIUM:
return MAX_MED;
case LARGE:
return MAX_LARGE;
default:
return COMMON_XL;
}
} | java | @Deprecated
public static int sizeToInt(final Size size) {
if (size == null) {
return -1;
}
switch (size) {
case ZERO:
return 0;
case SMALL:
return MAX_SMALL;
case MEDIUM:
return MAX_MED;
case LARGE:
return MAX_LARGE;
default:
return COMMON_XL;
}
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"sizeToInt",
"(",
"final",
"Size",
"size",
")",
"{",
"if",
"(",
"size",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"switch",
"(",
"size",
")",
"{",
"case",
"ZERO",
":",
"return",
"0",
";",
"case",
"SMALL",
":",
"return",
"MAX_SMALL",
";",
"case",
"MEDIUM",
":",
"return",
"MAX_MED",
";",
"case",
"LARGE",
":",
"return",
"MAX_LARGE",
";",
"default",
":",
"return",
"COMMON_XL",
";",
"}",
"}"
] | Convert a size back to a representative int. For testing only during conversion of int spaces to Size spaces.
@param size the Size to convert
@return an int representative of the Size | [
"Convert",
"a",
"size",
"back",
"to",
"a",
"representative",
"int",
".",
"For",
"testing",
"only",
"during",
"conversion",
"of",
"int",
"spaces",
"to",
"Size",
"spaces",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/SpaceUtil.java#L72-L89 |
138,911 | podio/podio-java | src/main/java/com/podio/tag/TagAPI.java | TagAPI.removeTag | public void removeTag(Reference reference, String tag) {
getResourceFactory()
.getApiResource("/tag/" + reference.toURLFragment())
.queryParam("text", tag).delete();
} | java | public void removeTag(Reference reference, String tag) {
getResourceFactory()
.getApiResource("/tag/" + reference.toURLFragment())
.queryParam("text", tag).delete();
} | [
"public",
"void",
"removeTag",
"(",
"Reference",
"reference",
",",
"String",
"tag",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/tag/\"",
"+",
"reference",
".",
"toURLFragment",
"(",
")",
")",
".",
"queryParam",
"(",
"\"text\"",
",",
"tag",
")",
".",
"delete",
"(",
")",
";",
"}"
] | Removes a single tag from an object.
@param reference
The object the tag should be removed from
@param tag
The tag to remove | [
"Removes",
"a",
"single",
"tag",
"from",
"an",
"object",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/tag/TagAPI.java#L91-L95 |
138,912 | podio/podio-java | src/main/java/com/podio/tag/TagAPI.java | TagAPI.getTagsOnAppWithText | public List<TagReference> getTagsOnAppWithText(int appId, String text) {
return getResourceFactory()
.getApiResource("/tag/app/" + appId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | java | public List<TagReference> getTagsOnAppWithText(int appId, String text) {
return getResourceFactory()
.getApiResource("/tag/app/" + appId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | [
"public",
"List",
"<",
"TagReference",
">",
"getTagsOnAppWithText",
"(",
"int",
"appId",
",",
"String",
"text",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/tag/app/\"",
"+",
"appId",
"+",
"\"/search/\"",
")",
".",
"queryParam",
"(",
"\"text\"",
",",
"text",
")",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"TagReference",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Returns the objects that are tagged with the given text on the app. The
objects are returned sorted descending by the time the tag was added.
@param appId
The id of the app to search within
@param text
The tag to search for
@return The list of objects in the app that have the given tag | [
"Returns",
"the",
"objects",
"that",
"are",
"tagged",
"with",
"the",
"given",
"text",
"on",
"the",
"app",
".",
"The",
"objects",
"are",
"returned",
"sorted",
"descending",
"by",
"the",
"time",
"the",
"tag",
"was",
"added",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/tag/TagAPI.java#L274-L280 |
138,913 | podio/podio-java | src/main/java/com/podio/tag/TagAPI.java | TagAPI.getTagsOnOrgWithText | public List<TagReference> getTagsOnOrgWithText(int orgId, String text) {
return getResourceFactory()
.getApiResource("/tag/org/" + orgId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | java | public List<TagReference> getTagsOnOrgWithText(int orgId, String text) {
return getResourceFactory()
.getApiResource("/tag/org/" + orgId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | [
"public",
"List",
"<",
"TagReference",
">",
"getTagsOnOrgWithText",
"(",
"int",
"orgId",
",",
"String",
"text",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/tag/org/\"",
"+",
"orgId",
"+",
"\"/search/\"",
")",
".",
"queryParam",
"(",
"\"text\"",
",",
"text",
")",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"TagReference",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Returns the objects that are tagged with the given text on the org. The
objects are returned sorted descending by the time the tag was added.
@param orgId
The id of the org to search within
@param text
The tag to search for
@return The list of objects in the org that have the given tag | [
"Returns",
"the",
"objects",
"that",
"are",
"tagged",
"with",
"the",
"given",
"text",
"on",
"the",
"org",
".",
"The",
"objects",
"are",
"returned",
"sorted",
"descending",
"by",
"the",
"time",
"the",
"tag",
"was",
"added",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/tag/TagAPI.java#L292-L298 |
138,914 | podio/podio-java | src/main/java/com/podio/tag/TagAPI.java | TagAPI.getTagsOnSpaceWithText | public List<TagReference> getTagsOnSpaceWithText(int spaceId, String text) {
return getResourceFactory()
.getApiResource("/tag/space/" + spaceId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | java | public List<TagReference> getTagsOnSpaceWithText(int spaceId, String text) {
return getResourceFactory()
.getApiResource("/tag/space/" + spaceId + "/search/")
.queryParam("text", text)
.get(new GenericType<List<TagReference>>() {
});
} | [
"public",
"List",
"<",
"TagReference",
">",
"getTagsOnSpaceWithText",
"(",
"int",
"spaceId",
",",
"String",
"text",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/tag/space/\"",
"+",
"spaceId",
"+",
"\"/search/\"",
")",
".",
"queryParam",
"(",
"\"text\"",
",",
"text",
")",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"TagReference",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Returns the objects that are tagged with the given text on the space. The
objects are returned sorted descending by the time the tag was added.
@param spaceId
The id of the space to search within
@param text
The tag to search for
@return The list of objects in the space that have the given tag | [
"Returns",
"the",
"objects",
"that",
"are",
"tagged",
"with",
"the",
"given",
"text",
"on",
"the",
"space",
".",
"The",
"objects",
"are",
"returned",
"sorted",
"descending",
"by",
"the",
"time",
"the",
"tag",
"was",
"added",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/tag/TagAPI.java#L310-L316 |
138,915 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/SimpleTabs.java | SimpleTabs.addTab | public void addTab(final WComponent card, final String name) {
WContainer titledCard = new WContainer();
WText title = new WText("<b>[" + name + "]:</b><br/>");
title.setEncodeText(false);
titledCard.add(title);
titledCard.add(card);
deck.add(titledCard);
final TabButton button = new TabButton(name, titledCard);
button.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
deck.makeVisible(button.getAssociatedCard());
}
});
btnPanel.add(button);
} | java | public void addTab(final WComponent card, final String name) {
WContainer titledCard = new WContainer();
WText title = new WText("<b>[" + name + "]:</b><br/>");
title.setEncodeText(false);
titledCard.add(title);
titledCard.add(card);
deck.add(titledCard);
final TabButton button = new TabButton(name, titledCard);
button.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
deck.makeVisible(button.getAssociatedCard());
}
});
btnPanel.add(button);
} | [
"public",
"void",
"addTab",
"(",
"final",
"WComponent",
"card",
",",
"final",
"String",
"name",
")",
"{",
"WContainer",
"titledCard",
"=",
"new",
"WContainer",
"(",
")",
";",
"WText",
"title",
"=",
"new",
"WText",
"(",
"\"<b>[\"",
"+",
"name",
"+",
"\"]:</b><br/>\"",
")",
";",
"title",
".",
"setEncodeText",
"(",
"false",
")",
";",
"titledCard",
".",
"add",
"(",
"title",
")",
";",
"titledCard",
".",
"add",
"(",
"card",
")",
";",
"deck",
".",
"add",
"(",
"titledCard",
")",
";",
"final",
"TabButton",
"button",
"=",
"new",
"TabButton",
"(",
"name",
",",
"titledCard",
")",
";",
"button",
".",
"setAction",
"(",
"new",
"Action",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"deck",
".",
"makeVisible",
"(",
"button",
".",
"getAssociatedCard",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"btnPanel",
".",
"add",
"(",
"button",
")",
";",
"}"
] | Adds a tab.
@param card the tab content.
@param name the tab name. | [
"Adds",
"a",
"tab",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/SimpleTabs.java#L46-L65 |
138,916 | BorderTech/wcomponents | wcomponents-lde/src/main/java/com/github/bordertech/wcomponents/lde/StandaloneLauncher.java | StandaloneLauncher.main | public static void main(final String[] args) throws Exception {
// Set the logger to use the text area logger
System.setProperty("org.apache.commons.logging.Log",
"com.github.bordertech.wcomponents.lde.StandaloneLauncher$TextAreaLogger");
// Set the port number to a random port
Configuration internalWComponentConfig = Config.getInstance();
CompositeConfiguration config = new CompositeConfiguration(new MapConfiguration(
new HashMap<String, Object>()));
config.addConfiguration(internalWComponentConfig); // Internal WComponent config next
config.setProperty(ConfigurationProperties.LDE_SERVER_PORT, 0);
Config.setConfiguration(config);
getInstance().launcher.run();
getInstance().log("LDE now running on " + getInstance().launcher.getUrl() + '\n');
} | java | public static void main(final String[] args) throws Exception {
// Set the logger to use the text area logger
System.setProperty("org.apache.commons.logging.Log",
"com.github.bordertech.wcomponents.lde.StandaloneLauncher$TextAreaLogger");
// Set the port number to a random port
Configuration internalWComponentConfig = Config.getInstance();
CompositeConfiguration config = new CompositeConfiguration(new MapConfiguration(
new HashMap<String, Object>()));
config.addConfiguration(internalWComponentConfig); // Internal WComponent config next
config.setProperty(ConfigurationProperties.LDE_SERVER_PORT, 0);
Config.setConfiguration(config);
getInstance().launcher.run();
getInstance().log("LDE now running on " + getInstance().launcher.getUrl() + '\n');
} | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// Set the logger to use the text area logger",
"System",
".",
"setProperty",
"(",
"\"org.apache.commons.logging.Log\"",
",",
"\"com.github.bordertech.wcomponents.lde.StandaloneLauncher$TextAreaLogger\"",
")",
";",
"// Set the port number to a random port",
"Configuration",
"internalWComponentConfig",
"=",
"Config",
".",
"getInstance",
"(",
")",
";",
"CompositeConfiguration",
"config",
"=",
"new",
"CompositeConfiguration",
"(",
"new",
"MapConfiguration",
"(",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
")",
")",
";",
"config",
".",
"addConfiguration",
"(",
"internalWComponentConfig",
")",
";",
"// Internal WComponent config next",
"config",
".",
"setProperty",
"(",
"ConfigurationProperties",
".",
"LDE_SERVER_PORT",
",",
"0",
")",
";",
"Config",
".",
"setConfiguration",
"(",
"config",
")",
";",
"getInstance",
"(",
")",
".",
"launcher",
".",
"run",
"(",
")",
";",
"getInstance",
"(",
")",
".",
"log",
"(",
"\"LDE now running on \"",
"+",
"getInstance",
"(",
")",
".",
"launcher",
".",
"getUrl",
"(",
")",
"+",
"'",
"'",
")",
";",
"}"
] | The entry point when the launcher is run as a java application.
@param args command-line arguments, ignored.
@throws Exception on error | [
"The",
"entry",
"point",
"when",
"the",
"launcher",
"is",
"run",
"as",
"a",
"java",
"application",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-lde/src/main/java/com/github/bordertech/wcomponents/lde/StandaloneLauncher.java#L163-L178 |
138,917 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/TextFieldExample.java | TextFieldExample.readFields | private void readFields() {
plain.setText(tf1.getText());
mandatory.setText(tf2.getText());
readOnly.setText(tf3.getText());
disabled.setText(tf4.getText());
width.setText(tf5.getText());
} | java | private void readFields() {
plain.setText(tf1.getText());
mandatory.setText(tf2.getText());
readOnly.setText(tf3.getText());
disabled.setText(tf4.getText());
width.setText(tf5.getText());
} | [
"private",
"void",
"readFields",
"(",
")",
"{",
"plain",
".",
"setText",
"(",
"tf1",
".",
"getText",
"(",
")",
")",
";",
"mandatory",
".",
"setText",
"(",
"tf2",
".",
"getText",
"(",
")",
")",
";",
"readOnly",
".",
"setText",
"(",
"tf3",
".",
"getText",
"(",
")",
")",
";",
"disabled",
".",
"setText",
"(",
"tf4",
".",
"getText",
"(",
")",
")",
";",
"width",
".",
"setText",
"(",
"tf5",
".",
"getText",
"(",
")",
")",
";",
"}"
] | Read fields is a simple method to read all the fields and populate the encoded text fields. | [
"Read",
"fields",
"is",
"a",
"simple",
"method",
"to",
"read",
"all",
"the",
"fields",
"and",
"populate",
"the",
"encoded",
"text",
"fields",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/TextFieldExample.java#L170-L176 |
138,918 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SourcePanel.java | SourcePanel.setSource | public void setSource(final String sourceText) {
String formattedSource;
if (sourceText == null) {
formattedSource = "";
} else {
formattedSource = WebUtilities.encode(sourceText); // XML escape content
}
source.setText(formattedSource);
} | java | public void setSource(final String sourceText) {
String formattedSource;
if (sourceText == null) {
formattedSource = "";
} else {
formattedSource = WebUtilities.encode(sourceText); // XML escape content
}
source.setText(formattedSource);
} | [
"public",
"void",
"setSource",
"(",
"final",
"String",
"sourceText",
")",
"{",
"String",
"formattedSource",
";",
"if",
"(",
"sourceText",
"==",
"null",
")",
"{",
"formattedSource",
"=",
"\"\"",
";",
"}",
"else",
"{",
"formattedSource",
"=",
"WebUtilities",
".",
"encode",
"(",
"sourceText",
")",
";",
"// XML escape content",
"}",
"source",
".",
"setText",
"(",
"formattedSource",
")",
";",
"}"
] | Sets the source code to be displayed in the panel.
@param sourceText the source code to display. | [
"Sets",
"the",
"source",
"code",
"to",
"be",
"displayed",
"in",
"the",
"panel",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/SourcePanel.java#L74-L84 |
138,919 | BorderTech/wcomponents | wcomponents-lde/src/main/java/com/github/bordertech/wcomponents/lde/examples/HelloWServlet.java | HelloWServlet.main | public static void main(final String[] args)
throws Exception {
// Use jetty to run the servlet.
Server server = new Server();
SocketConnector connector = new SocketConnector();
connector.setMaxIdleTime(0);
connector.setPort(8080);
server.addConnector(connector);
WebAppContext context = new WebAppContext();
context.setContextPath("/");
context.addServlet(HelloWServlet.class.getName(), "/*");
context.addServlet(ThemeServlet.class.getName(), "/theme/*");
context.setResourceBase(".");
server.setHandler(context);
server.start();
} | java | public static void main(final String[] args)
throws Exception {
// Use jetty to run the servlet.
Server server = new Server();
SocketConnector connector = new SocketConnector();
connector.setMaxIdleTime(0);
connector.setPort(8080);
server.addConnector(connector);
WebAppContext context = new WebAppContext();
context.setContextPath("/");
context.addServlet(HelloWServlet.class.getName(), "/*");
context.addServlet(ThemeServlet.class.getName(), "/theme/*");
context.setResourceBase(".");
server.setHandler(context);
server.start();
} | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// Use jetty to run the servlet.",
"Server",
"server",
"=",
"new",
"Server",
"(",
")",
";",
"SocketConnector",
"connector",
"=",
"new",
"SocketConnector",
"(",
")",
";",
"connector",
".",
"setMaxIdleTime",
"(",
"0",
")",
";",
"connector",
".",
"setPort",
"(",
"8080",
")",
";",
"server",
".",
"addConnector",
"(",
"connector",
")",
";",
"WebAppContext",
"context",
"=",
"new",
"WebAppContext",
"(",
")",
";",
"context",
".",
"setContextPath",
"(",
"\"/\"",
")",
";",
"context",
".",
"addServlet",
"(",
"HelloWServlet",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"/*\"",
")",
";",
"context",
".",
"addServlet",
"(",
"ThemeServlet",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"/theme/*\"",
")",
";",
"context",
".",
"setResourceBase",
"(",
"\".\"",
")",
";",
"server",
".",
"setHandler",
"(",
"context",
")",
";",
"server",
".",
"start",
"(",
")",
";",
"}"
] | This main method exists to make it easy to run this servlet without having to create a web.xml file, build a war
and deploy it.
@param args command-line arguments, ignored.
@throws Exception Thrown if a problem occurs. | [
"This",
"main",
"method",
"exists",
"to",
"make",
"it",
"easy",
"to",
"run",
"this",
"servlet",
"without",
"having",
"to",
"create",
"a",
"web",
".",
"xml",
"file",
"build",
"a",
"war",
"and",
"deploy",
"it",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-lde/src/main/java/com/github/bordertech/wcomponents/lde/examples/HelloWServlet.java#L42-L60 |
138,920 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WSubMenu.java | WSubMenu.isDisabled | @Override
public boolean isDisabled() {
if (isFlagSet(ComponentModel.DISABLED_FLAG)) {
return true;
}
MenuContainer container = WebUtilities.getAncestorOfClass(MenuContainer.class, this);
if (container instanceof Disableable && ((Disableable) container).isDisabled()) {
return true;
}
return false;
} | java | @Override
public boolean isDisabled() {
if (isFlagSet(ComponentModel.DISABLED_FLAG)) {
return true;
}
MenuContainer container = WebUtilities.getAncestorOfClass(MenuContainer.class, this);
if (container instanceof Disableable && ((Disableable) container).isDisabled()) {
return true;
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"isDisabled",
"(",
")",
"{",
"if",
"(",
"isFlagSet",
"(",
"ComponentModel",
".",
"DISABLED_FLAG",
")",
")",
"{",
"return",
"true",
";",
"}",
"MenuContainer",
"container",
"=",
"WebUtilities",
".",
"getAncestorOfClass",
"(",
"MenuContainer",
".",
"class",
",",
"this",
")",
";",
"if",
"(",
"container",
"instanceof",
"Disableable",
"&&",
"(",
"(",
"Disableable",
")",
"container",
")",
".",
"isDisabled",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Indicates whether this sub menu is disabled in the given context.
@return true if this sub menu is disabled. | [
"Indicates",
"whether",
"this",
"sub",
"menu",
"is",
"disabled",
"in",
"the",
"given",
"context",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WSubMenu.java#L229-L241 |
138,921 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WSubMenu.java | WSubMenu.handleRequest | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
// If current ajax trigger, process menu for current selections
if (AjaxHelper.isCurrentAjaxTrigger(this)) {
WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
menu.handleRequest(request);
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
this.getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
boolean openState = "true".equals(request.getParameter(getId() + ".open"));
setOpen(openState);
}
} | java | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
// If current ajax trigger, process menu for current selections
if (AjaxHelper.isCurrentAjaxTrigger(this)) {
WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
menu.handleRequest(request);
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
this.getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
boolean openState = "true".equals(request.getParameter(getId() + ".open"));
setOpen(openState);
}
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"// Protect against client-side tampering of disabled/read-only fields.",
"return",
";",
"}",
"if",
"(",
"isMenuPresent",
"(",
"request",
")",
")",
"{",
"// If current ajax trigger, process menu for current selections",
"if",
"(",
"AjaxHelper",
".",
"isCurrentAjaxTrigger",
"(",
"this",
")",
")",
"{",
"WMenu",
"menu",
"=",
"WebUtilities",
".",
"getAncestorOfClass",
"(",
"WMenu",
".",
"class",
",",
"this",
")",
";",
"menu",
".",
"handleRequest",
"(",
"request",
")",
";",
"// Execute associated action, if set",
"final",
"Action",
"action",
"=",
"getAction",
"(",
")",
";",
"if",
"(",
"action",
"!=",
"null",
")",
"{",
"final",
"ActionEvent",
"event",
"=",
"new",
"ActionEvent",
"(",
"this",
",",
"this",
".",
"getActionCommand",
"(",
")",
",",
"this",
".",
"getActionObject",
"(",
")",
")",
";",
"Runnable",
"later",
"=",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"action",
".",
"execute",
"(",
"event",
")",
";",
"}",
"}",
";",
"invokeLater",
"(",
"later",
")",
";",
"}",
"}",
"boolean",
"openState",
"=",
"\"true\"",
".",
"equals",
"(",
"request",
".",
"getParameter",
"(",
"getId",
"(",
")",
"+",
"\".open\"",
")",
")",
";",
"setOpen",
"(",
"openState",
")",
";",
"}",
"}"
] | Override handleRequest in order to perform processing for this component. This implementation checks for submenu
selection and executes the associated action if it has been set.
@param request the request being responded to. | [
"Override",
"handleRequest",
"in",
"order",
"to",
"perform",
"processing",
"for",
"this",
"component",
".",
"This",
"implementation",
"checks",
"for",
"submenu",
"selection",
"and",
"executes",
"the",
"associated",
"action",
"if",
"it",
"has",
"been",
"set",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WSubMenu.java#L519-L553 |
138,922 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WSubMenu.java | WSubMenu.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
String targetId = getContent().getId();
String contentId = getId() + "-content";
switch (getComponentModel().mode) {
case LAZY: {
getContent().setVisible(isOpen());
AjaxHelper.registerContainer(getId(), contentId, targetId);
break;
}
case DYNAMIC: {
AjaxHelper.registerContainer(getId(), contentId, targetId);
getContent().setVisible(isOpen());
break;
}
case EAGER: {
AjaxHelper.registerContainer(getId(), contentId, targetId);
// Will always be visible
break;
}
case SERVER: {
// same as DYNAMIC
AjaxHelper.registerContainer(getId(), contentId, targetId);
getContent().setVisible(isOpen());
break;
}
case CLIENT: {
// Will always be visible
break;
}
default:
// do nothing.
break;
}
} | java | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
String targetId = getContent().getId();
String contentId = getId() + "-content";
switch (getComponentModel().mode) {
case LAZY: {
getContent().setVisible(isOpen());
AjaxHelper.registerContainer(getId(), contentId, targetId);
break;
}
case DYNAMIC: {
AjaxHelper.registerContainer(getId(), contentId, targetId);
getContent().setVisible(isOpen());
break;
}
case EAGER: {
AjaxHelper.registerContainer(getId(), contentId, targetId);
// Will always be visible
break;
}
case SERVER: {
// same as DYNAMIC
AjaxHelper.registerContainer(getId(), contentId, targetId);
getContent().setVisible(isOpen());
break;
}
case CLIENT: {
// Will always be visible
break;
}
default:
// do nothing.
break;
}
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"preparePaintComponent",
"(",
"request",
")",
";",
"String",
"targetId",
"=",
"getContent",
"(",
")",
".",
"getId",
"(",
")",
";",
"String",
"contentId",
"=",
"getId",
"(",
")",
"+",
"\"-content\"",
";",
"switch",
"(",
"getComponentModel",
"(",
")",
".",
"mode",
")",
"{",
"case",
"LAZY",
":",
"{",
"getContent",
"(",
")",
".",
"setVisible",
"(",
"isOpen",
"(",
")",
")",
";",
"AjaxHelper",
".",
"registerContainer",
"(",
"getId",
"(",
")",
",",
"contentId",
",",
"targetId",
")",
";",
"break",
";",
"}",
"case",
"DYNAMIC",
":",
"{",
"AjaxHelper",
".",
"registerContainer",
"(",
"getId",
"(",
")",
",",
"contentId",
",",
"targetId",
")",
";",
"getContent",
"(",
")",
".",
"setVisible",
"(",
"isOpen",
"(",
")",
")",
";",
"break",
";",
"}",
"case",
"EAGER",
":",
"{",
"AjaxHelper",
".",
"registerContainer",
"(",
"getId",
"(",
")",
",",
"contentId",
",",
"targetId",
")",
";",
"// Will always be visible",
"break",
";",
"}",
"case",
"SERVER",
":",
"{",
"// same as DYNAMIC",
"AjaxHelper",
".",
"registerContainer",
"(",
"getId",
"(",
")",
",",
"contentId",
",",
"targetId",
")",
";",
"getContent",
"(",
")",
".",
"setVisible",
"(",
"isOpen",
"(",
")",
")",
";",
"break",
";",
"}",
"case",
"CLIENT",
":",
"{",
"// Will always be visible",
"break",
";",
"}",
"default",
":",
"// do nothing.",
"break",
";",
"}",
"}"
] | Override preparePaintComponent in order to correct the visibility of the sub-menu's children before they are
rendered.
@param request the request being responded to. | [
"Override",
"preparePaintComponent",
"in",
"order",
"to",
"correct",
"the",
"visibility",
"of",
"the",
"sub",
"-",
"menu",
"s",
"children",
"before",
"they",
"are",
"rendered",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WSubMenu.java#L572-L610 |
138,923 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMultiTextField.java | WMultiTextField.getValueAsString | @Override
public String getValueAsString() {
String result = null;
String[] inputs = getValue();
if (inputs != null && inputs.length > 0) {
StringBuffer stringValues = new StringBuffer();
for (int i = 0; i < inputs.length; i++) {
if (i > 0) {
stringValues.append(", ");
}
stringValues.append(inputs[i]);
}
result = stringValues.toString();
}
return result;
} | java | @Override
public String getValueAsString() {
String result = null;
String[] inputs = getValue();
if (inputs != null && inputs.length > 0) {
StringBuffer stringValues = new StringBuffer();
for (int i = 0; i < inputs.length; i++) {
if (i > 0) {
stringValues.append(", ");
}
stringValues.append(inputs[i]);
}
result = stringValues.toString();
}
return result;
} | [
"@",
"Override",
"public",
"String",
"getValueAsString",
"(",
")",
"{",
"String",
"result",
"=",
"null",
";",
"String",
"[",
"]",
"inputs",
"=",
"getValue",
"(",
")",
";",
"if",
"(",
"inputs",
"!=",
"null",
"&&",
"inputs",
".",
"length",
">",
"0",
")",
"{",
"StringBuffer",
"stringValues",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"inputs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"stringValues",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"stringValues",
".",
"append",
"(",
"inputs",
"[",
"i",
"]",
")",
";",
"}",
"result",
"=",
"stringValues",
".",
"toString",
"(",
")",
";",
"}",
"return",
"result",
";",
"}"
] | The string is a comma seperated list of the string inputs.
@return A string concatenation of the string inputs. | [
"The",
"string",
"is",
"a",
"comma",
"seperated",
"list",
"of",
"the",
"string",
"inputs",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMultiTextField.java#L243-L265 |
138,924 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java | WWindowInterceptor.serviceRequest | @Override
public void serviceRequest(final Request request) {
// Get window id off the request
windowId = request.getParameter(WWindow.WWINDOW_REQUEST_PARAM_KEY);
if (windowId == null) {
super.serviceRequest(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
// Setup the Environment on the context
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
if (attachWindow) {
attachUI(target.getComponent());
}
UIContextHolder.pushContext(target.getContext());
try {
super.serviceRequest(request);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | java | @Override
public void serviceRequest(final Request request) {
// Get window id off the request
windowId = request.getParameter(WWindow.WWINDOW_REQUEST_PARAM_KEY);
if (windowId == null) {
super.serviceRequest(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
// Setup the Environment on the context
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
if (attachWindow) {
attachUI(target.getComponent());
}
UIContextHolder.pushContext(target.getContext());
try {
super.serviceRequest(request);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | [
"@",
"Override",
"public",
"void",
"serviceRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"// Get window id off the request",
"windowId",
"=",
"request",
".",
"getParameter",
"(",
"WWindow",
".",
"WWINDOW_REQUEST_PARAM_KEY",
")",
";",
"if",
"(",
"windowId",
"==",
"null",
")",
"{",
"super",
".",
"serviceRequest",
"(",
"request",
")",
";",
"}",
"else",
"{",
"// Get the window component",
"ComponentWithContext",
"target",
"=",
"WebUtilities",
".",
"getComponentById",
"(",
"windowId",
",",
"true",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No window component for id \"",
"+",
"windowId",
")",
";",
"}",
"// Setup the Environment on the context",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrentPrimaryUIContext",
"(",
")",
";",
"Environment",
"originalEnvironment",
"=",
"uic",
".",
"getEnvironment",
"(",
")",
";",
"uic",
".",
"setEnvironment",
"(",
"new",
"EnvironmentDelegate",
"(",
"originalEnvironment",
",",
"windowId",
",",
"target",
")",
")",
";",
"if",
"(",
"attachWindow",
")",
"{",
"attachUI",
"(",
"target",
".",
"getComponent",
"(",
")",
")",
";",
"}",
"UIContextHolder",
".",
"pushContext",
"(",
"target",
".",
"getContext",
"(",
")",
")",
";",
"try",
"{",
"super",
".",
"serviceRequest",
"(",
"request",
")",
";",
"}",
"finally",
"{",
"uic",
".",
"setEnvironment",
"(",
"originalEnvironment",
")",
";",
"UIContextHolder",
".",
"popContext",
"(",
")",
";",
"}",
"}",
"}"
] | Temporarily replaces the environment while the request is being handled.
@param request the request being responded to. | [
"Temporarily",
"replaces",
"the",
"environment",
"while",
"the",
"request",
"is",
"being",
"handled",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java#L53-L83 |
138,925 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java | WWindowInterceptor.preparePaint | @Override
public void preparePaint(final Request request) {
if (windowId == null) {
super.preparePaint(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
UIContextHolder.pushContext(target.getContext());
try {
super.preparePaint(request);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | java | @Override
public void preparePaint(final Request request) {
if (windowId == null) {
super.preparePaint(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
UIContextHolder.pushContext(target.getContext());
try {
super.preparePaint(request);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | [
"@",
"Override",
"public",
"void",
"preparePaint",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"windowId",
"==",
"null",
")",
"{",
"super",
".",
"preparePaint",
"(",
"request",
")",
";",
"}",
"else",
"{",
"// Get the window component",
"ComponentWithContext",
"target",
"=",
"WebUtilities",
".",
"getComponentById",
"(",
"windowId",
",",
"true",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No window component for id \"",
"+",
"windowId",
")",
";",
"}",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrentPrimaryUIContext",
"(",
")",
";",
"Environment",
"originalEnvironment",
"=",
"uic",
".",
"getEnvironment",
"(",
")",
";",
"uic",
".",
"setEnvironment",
"(",
"new",
"EnvironmentDelegate",
"(",
"originalEnvironment",
",",
"windowId",
",",
"target",
")",
")",
";",
"UIContextHolder",
".",
"pushContext",
"(",
"target",
".",
"getContext",
"(",
")",
")",
";",
"try",
"{",
"super",
".",
"preparePaint",
"(",
"request",
")",
";",
"}",
"finally",
"{",
"uic",
".",
"setEnvironment",
"(",
"originalEnvironment",
")",
";",
"UIContextHolder",
".",
"popContext",
"(",
")",
";",
"}",
"}",
"}"
] | Temporarily replaces the environment while the UI prepares to render.
@param request the request being responded to. | [
"Temporarily",
"replaces",
"the",
"environment",
"while",
"the",
"UI",
"prepares",
"to",
"render",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java#L90-L113 |
138,926 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java | WWindowInterceptor.paint | @Override
public void paint(final RenderContext renderContext) {
if (windowId == null) {
super.paint(renderContext);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
UIContextHolder.pushContext(target.getContext());
try {
super.paint(renderContext);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | java | @Override
public void paint(final RenderContext renderContext) {
if (windowId == null) {
super.paint(renderContext);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
UIContextHolder.pushContext(target.getContext());
try {
super.paint(renderContext);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | [
"@",
"Override",
"public",
"void",
"paint",
"(",
"final",
"RenderContext",
"renderContext",
")",
"{",
"if",
"(",
"windowId",
"==",
"null",
")",
"{",
"super",
".",
"paint",
"(",
"renderContext",
")",
";",
"}",
"else",
"{",
"// Get the window component",
"ComponentWithContext",
"target",
"=",
"WebUtilities",
".",
"getComponentById",
"(",
"windowId",
",",
"true",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No window component for id \"",
"+",
"windowId",
")",
";",
"}",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrentPrimaryUIContext",
"(",
")",
";",
"Environment",
"originalEnvironment",
"=",
"uic",
".",
"getEnvironment",
"(",
")",
";",
"uic",
".",
"setEnvironment",
"(",
"new",
"EnvironmentDelegate",
"(",
"originalEnvironment",
",",
"windowId",
",",
"target",
")",
")",
";",
"UIContextHolder",
".",
"pushContext",
"(",
"target",
".",
"getContext",
"(",
")",
")",
";",
"try",
"{",
"super",
".",
"paint",
"(",
"renderContext",
")",
";",
"}",
"finally",
"{",
"uic",
".",
"setEnvironment",
"(",
"originalEnvironment",
")",
";",
"UIContextHolder",
".",
"popContext",
"(",
")",
";",
"}",
"}",
"}"
] | Temporarily replaces the environment while the UI is being rendered.
@param renderContext the context to render to. | [
"Temporarily",
"replaces",
"the",
"environment",
"while",
"the",
"UI",
"is",
"being",
"rendered",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java#L120-L143 |
138,927 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java | WTableRenderer.paintPaginationDetails | private void paintPaginationDetails(final WTable table, final XmlStringBuilder xml) {
TableModel model = table.getTableModel();
xml.appendTagOpen("ui:pagination");
xml.appendAttribute("rows", model.getRowCount());
xml.appendOptionalAttribute("rowsPerPage", table.getRowsPerPage() > 0, table.
getRowsPerPage());
xml.appendAttribute("currentPage", table.getCurrentPage());
switch (table.getPaginationMode()) {
case CLIENT:
xml.appendAttribute("mode", "client");
break;
case DYNAMIC:
xml.appendAttribute("mode", "dynamic");
break;
case NONE:
break;
default:
throw new SystemException("Unknown pagination mode: " + table.
getPaginationMode());
}
if (table.getPaginationLocation() != WTable.PaginationLocation.AUTO) {
switch (table.getPaginationLocation()) {
case TOP:
xml.appendAttribute("controls", "top");
break;
case BOTTOM:
xml.appendAttribute("controls", "bottom");
break;
case BOTH:
xml.appendAttribute("controls", "both");
break;
default:
throw new SystemException("Unknown pagination control location: " + table.getPaginationLocation());
}
}
xml.appendClose();
// Rows per page options
if (table.getRowsPerPageOptions() != null) {
xml.appendTag("ui:rowsselect");
for (Integer option : table.getRowsPerPageOptions()) {
xml.appendTagOpen("ui:option");
xml.appendAttribute("value", option);
xml.appendEnd();
}
xml.appendEndTag("ui:rowsselect");
}
xml.appendEndTag("ui:pagination");
} | java | private void paintPaginationDetails(final WTable table, final XmlStringBuilder xml) {
TableModel model = table.getTableModel();
xml.appendTagOpen("ui:pagination");
xml.appendAttribute("rows", model.getRowCount());
xml.appendOptionalAttribute("rowsPerPage", table.getRowsPerPage() > 0, table.
getRowsPerPage());
xml.appendAttribute("currentPage", table.getCurrentPage());
switch (table.getPaginationMode()) {
case CLIENT:
xml.appendAttribute("mode", "client");
break;
case DYNAMIC:
xml.appendAttribute("mode", "dynamic");
break;
case NONE:
break;
default:
throw new SystemException("Unknown pagination mode: " + table.
getPaginationMode());
}
if (table.getPaginationLocation() != WTable.PaginationLocation.AUTO) {
switch (table.getPaginationLocation()) {
case TOP:
xml.appendAttribute("controls", "top");
break;
case BOTTOM:
xml.appendAttribute("controls", "bottom");
break;
case BOTH:
xml.appendAttribute("controls", "both");
break;
default:
throw new SystemException("Unknown pagination control location: " + table.getPaginationLocation());
}
}
xml.appendClose();
// Rows per page options
if (table.getRowsPerPageOptions() != null) {
xml.appendTag("ui:rowsselect");
for (Integer option : table.getRowsPerPageOptions()) {
xml.appendTagOpen("ui:option");
xml.appendAttribute("value", option);
xml.appendEnd();
}
xml.appendEndTag("ui:rowsselect");
}
xml.appendEndTag("ui:pagination");
} | [
"private",
"void",
"paintPaginationDetails",
"(",
"final",
"WTable",
"table",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"TableModel",
"model",
"=",
"table",
".",
"getTableModel",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:pagination\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"rows\"",
",",
"model",
".",
"getRowCount",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"rowsPerPage\"",
",",
"table",
".",
"getRowsPerPage",
"(",
")",
">",
"0",
",",
"table",
".",
"getRowsPerPage",
"(",
")",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"currentPage\"",
",",
"table",
".",
"getCurrentPage",
"(",
")",
")",
";",
"switch",
"(",
"table",
".",
"getPaginationMode",
"(",
")",
")",
"{",
"case",
"CLIENT",
":",
"xml",
".",
"appendAttribute",
"(",
"\"mode\"",
",",
"\"client\"",
")",
";",
"break",
";",
"case",
"DYNAMIC",
":",
"xml",
".",
"appendAttribute",
"(",
"\"mode\"",
",",
"\"dynamic\"",
")",
";",
"break",
";",
"case",
"NONE",
":",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown pagination mode: \"",
"+",
"table",
".",
"getPaginationMode",
"(",
")",
")",
";",
"}",
"if",
"(",
"table",
".",
"getPaginationLocation",
"(",
")",
"!=",
"WTable",
".",
"PaginationLocation",
".",
"AUTO",
")",
"{",
"switch",
"(",
"table",
".",
"getPaginationLocation",
"(",
")",
")",
"{",
"case",
"TOP",
":",
"xml",
".",
"appendAttribute",
"(",
"\"controls\"",
",",
"\"top\"",
")",
";",
"break",
";",
"case",
"BOTTOM",
":",
"xml",
".",
"appendAttribute",
"(",
"\"controls\"",
",",
"\"bottom\"",
")",
";",
"break",
";",
"case",
"BOTH",
":",
"xml",
".",
"appendAttribute",
"(",
"\"controls\"",
",",
"\"both\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown pagination control location: \"",
"+",
"table",
".",
"getPaginationLocation",
"(",
")",
")",
";",
"}",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"// Rows per page options",
"if",
"(",
"table",
".",
"getRowsPerPageOptions",
"(",
")",
"!=",
"null",
")",
"{",
"xml",
".",
"appendTag",
"(",
"\"ui:rowsselect\"",
")",
";",
"for",
"(",
"Integer",
"option",
":",
"table",
".",
"getRowsPerPageOptions",
"(",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:option\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"value\"",
",",
"option",
")",
";",
"xml",
".",
"appendEnd",
"(",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:rowsselect\"",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:pagination\"",
")",
";",
"}"
] | Paint the pagination aspects of the table.
@param table the WDataTable being rendered
@param xml the string builder in use | [
"Paint",
"the",
"pagination",
"aspects",
"of",
"the",
"table",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java#L126-L178 |
138,928 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java | WTableRenderer.paintSortDetails | private void paintSortDetails(final WTable table, final XmlStringBuilder xml) {
int col = table.getSortColumnIndex();
boolean ascending = table.isSortAscending();
xml.appendTagOpen("ui:sort");
if (col >= 0) {
// Allow for column order
int[] cols = table.getColumnOrder();
if (cols != null) {
for (int i = 0; i < cols.length; i++) {
if (cols[i] == col) {
col = i;
break;
}
}
}
xml.appendAttribute("col", col);
xml.appendOptionalAttribute("descending", !ascending, "true");
}
switch (table.getSortMode()) {
case DYNAMIC:
xml.appendAttribute("mode", "dynamic");
break;
default:
throw new SystemException("Unknown sort mode: " + table.getSortMode());
}
xml.appendEnd();
} | java | private void paintSortDetails(final WTable table, final XmlStringBuilder xml) {
int col = table.getSortColumnIndex();
boolean ascending = table.isSortAscending();
xml.appendTagOpen("ui:sort");
if (col >= 0) {
// Allow for column order
int[] cols = table.getColumnOrder();
if (cols != null) {
for (int i = 0; i < cols.length; i++) {
if (cols[i] == col) {
col = i;
break;
}
}
}
xml.appendAttribute("col", col);
xml.appendOptionalAttribute("descending", !ascending, "true");
}
switch (table.getSortMode()) {
case DYNAMIC:
xml.appendAttribute("mode", "dynamic");
break;
default:
throw new SystemException("Unknown sort mode: " + table.getSortMode());
}
xml.appendEnd();
} | [
"private",
"void",
"paintSortDetails",
"(",
"final",
"WTable",
"table",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"int",
"col",
"=",
"table",
".",
"getSortColumnIndex",
"(",
")",
";",
"boolean",
"ascending",
"=",
"table",
".",
"isSortAscending",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:sort\"",
")",
";",
"if",
"(",
"col",
">=",
"0",
")",
"{",
"// Allow for column order",
"int",
"[",
"]",
"cols",
"=",
"table",
".",
"getColumnOrder",
"(",
")",
";",
"if",
"(",
"cols",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cols",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"cols",
"[",
"i",
"]",
"==",
"col",
")",
"{",
"col",
"=",
"i",
";",
"break",
";",
"}",
"}",
"}",
"xml",
".",
"appendAttribute",
"(",
"\"col\"",
",",
"col",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"descending\"",
",",
"!",
"ascending",
",",
"\"true\"",
")",
";",
"}",
"switch",
"(",
"table",
".",
"getSortMode",
"(",
")",
")",
"{",
"case",
"DYNAMIC",
":",
"xml",
".",
"appendAttribute",
"(",
"\"mode\"",
",",
"\"dynamic\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown sort mode: \"",
"+",
"table",
".",
"getSortMode",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendEnd",
"(",
")",
";",
"}"
] | Paints the sort details.
@param table the table being rendered
@param xml the string builder in use | [
"Paints",
"the",
"sort",
"details",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java#L245-L275 |
138,929 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java | WTableRenderer.paintTableActions | private void paintTableActions(final WTable table, final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
List<WButton> tableActions = table.getActions();
if (!tableActions.isEmpty()) {
boolean hasActions = false;
for (WButton button : tableActions) {
if (!button.isVisible()) {
continue;
}
if (!hasActions) {
hasActions = true;
xml.appendTag("ui:actions");
}
xml.appendTag("ui:action");
List<WTable.ActionConstraint> constraints = table.getActionConstraints(button);
if (constraints != null) {
for (WTable.ActionConstraint constraint : constraints) {
int minRows = constraint.getMinSelectedRowCount();
int maxRows = constraint.getMaxSelectedRowCount();
String message = constraint.getMessage();
String type = constraint.isError() ? "error" : "warning";
xml.appendTagOpen("ui:condition");
xml.appendOptionalAttribute("minSelectedRows", minRows > 0, minRows);
xml.appendOptionalAttribute("maxSelectedRows", maxRows > 0, maxRows);
xml.appendAttribute("selectedOnOther", this.selectedOnOther);
xml.appendAttribute("type", type);
xml.appendAttribute("message", I18nUtilities.format(null, message));
xml.appendEnd();
}
}
button.paint(renderContext);
xml.appendEndTag("ui:action");
}
if (hasActions) {
xml.appendEndTag("ui:actions");
}
}
} | java | private void paintTableActions(final WTable table, final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
List<WButton> tableActions = table.getActions();
if (!tableActions.isEmpty()) {
boolean hasActions = false;
for (WButton button : tableActions) {
if (!button.isVisible()) {
continue;
}
if (!hasActions) {
hasActions = true;
xml.appendTag("ui:actions");
}
xml.appendTag("ui:action");
List<WTable.ActionConstraint> constraints = table.getActionConstraints(button);
if (constraints != null) {
for (WTable.ActionConstraint constraint : constraints) {
int minRows = constraint.getMinSelectedRowCount();
int maxRows = constraint.getMaxSelectedRowCount();
String message = constraint.getMessage();
String type = constraint.isError() ? "error" : "warning";
xml.appendTagOpen("ui:condition");
xml.appendOptionalAttribute("minSelectedRows", minRows > 0, minRows);
xml.appendOptionalAttribute("maxSelectedRows", maxRows > 0, maxRows);
xml.appendAttribute("selectedOnOther", this.selectedOnOther);
xml.appendAttribute("type", type);
xml.appendAttribute("message", I18nUtilities.format(null, message));
xml.appendEnd();
}
}
button.paint(renderContext);
xml.appendEndTag("ui:action");
}
if (hasActions) {
xml.appendEndTag("ui:actions");
}
}
} | [
"private",
"void",
"paintTableActions",
"(",
"final",
"WTable",
"table",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"List",
"<",
"WButton",
">",
"tableActions",
"=",
"table",
".",
"getActions",
"(",
")",
";",
"if",
"(",
"!",
"tableActions",
".",
"isEmpty",
"(",
")",
")",
"{",
"boolean",
"hasActions",
"=",
"false",
";",
"for",
"(",
"WButton",
"button",
":",
"tableActions",
")",
"{",
"if",
"(",
"!",
"button",
".",
"isVisible",
"(",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"!",
"hasActions",
")",
"{",
"hasActions",
"=",
"true",
";",
"xml",
".",
"appendTag",
"(",
"\"ui:actions\"",
")",
";",
"}",
"xml",
".",
"appendTag",
"(",
"\"ui:action\"",
")",
";",
"List",
"<",
"WTable",
".",
"ActionConstraint",
">",
"constraints",
"=",
"table",
".",
"getActionConstraints",
"(",
"button",
")",
";",
"if",
"(",
"constraints",
"!=",
"null",
")",
"{",
"for",
"(",
"WTable",
".",
"ActionConstraint",
"constraint",
":",
"constraints",
")",
"{",
"int",
"minRows",
"=",
"constraint",
".",
"getMinSelectedRowCount",
"(",
")",
";",
"int",
"maxRows",
"=",
"constraint",
".",
"getMaxSelectedRowCount",
"(",
")",
";",
"String",
"message",
"=",
"constraint",
".",
"getMessage",
"(",
")",
";",
"String",
"type",
"=",
"constraint",
".",
"isError",
"(",
")",
"?",
"\"error\"",
":",
"\"warning\"",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:condition\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"minSelectedRows\"",
",",
"minRows",
">",
"0",
",",
"minRows",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"maxSelectedRows\"",
",",
"maxRows",
">",
"0",
",",
"maxRows",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"selectedOnOther\"",
",",
"this",
".",
"selectedOnOther",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"type",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"message\"",
",",
"I18nUtilities",
".",
"format",
"(",
"null",
",",
"message",
")",
")",
";",
"xml",
".",
"appendEnd",
"(",
")",
";",
"}",
"}",
"button",
".",
"paint",
"(",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:action\"",
")",
";",
"}",
"if",
"(",
"hasActions",
")",
"{",
"xml",
".",
"appendEndTag",
"(",
"\"ui:actions\"",
")",
";",
"}",
"}",
"}"
] | Paints the table actions of the table.
@param table the table to paint the table actions for.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"table",
"actions",
"of",
"the",
"table",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java#L283-L330 |
138,930 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java | WTableRenderer.paintColumnHeading | private void paintColumnHeading(final WTableColumn col, final boolean sortable,
final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
int width = col.getWidth();
Alignment align = col.getAlign();
xml.appendTagOpen("ui:th");
xml.appendOptionalAttribute("width", width > 0, width);
xml.appendOptionalAttribute("sortable", sortable, "true");
if (Alignment.RIGHT.equals(align)) {
xml.appendAttribute("align", "right");
} else if (Alignment.CENTER.equals(align)) {
xml.appendAttribute("align", "center");
}
xml.appendClose();
col.paint(renderContext);
xml.appendEndTag("ui:th");
} | java | private void paintColumnHeading(final WTableColumn col, final boolean sortable,
final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
int width = col.getWidth();
Alignment align = col.getAlign();
xml.appendTagOpen("ui:th");
xml.appendOptionalAttribute("width", width > 0, width);
xml.appendOptionalAttribute("sortable", sortable, "true");
if (Alignment.RIGHT.equals(align)) {
xml.appendAttribute("align", "right");
} else if (Alignment.CENTER.equals(align)) {
xml.appendAttribute("align", "center");
}
xml.appendClose();
col.paint(renderContext);
xml.appendEndTag("ui:th");
} | [
"private",
"void",
"paintColumnHeading",
"(",
"final",
"WTableColumn",
"col",
",",
"final",
"boolean",
"sortable",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"int",
"width",
"=",
"col",
".",
"getWidth",
"(",
")",
";",
"Alignment",
"align",
"=",
"col",
".",
"getAlign",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:th\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"width\"",
",",
"width",
">",
"0",
",",
"width",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"sortable\"",
",",
"sortable",
",",
"\"true\"",
")",
";",
"if",
"(",
"Alignment",
".",
"RIGHT",
".",
"equals",
"(",
"align",
")",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"align\"",
",",
"\"right\"",
")",
";",
"}",
"else",
"if",
"(",
"Alignment",
".",
"CENTER",
".",
"equals",
"(",
"align",
")",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"align\"",
",",
"\"center\"",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"col",
".",
"paint",
"(",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:th\"",
")",
";",
"}"
] | Paints a single column heading.
@param col the column to paint.
@param sortable true if the column is sortable, false otherwise
@param renderContext the RenderContext to paint to. | [
"Paints",
"a",
"single",
"column",
"heading",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java#L447-L468 |
138,931 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java | WPanelTypeExample.updateUI | public void updateUI() {
if (!Util.empty(panelContent.getText())) {
panelContentRO.setData(panelContent.getData());
} else {
panelContentRO.setText(SAMPLE_CONTENT);
}
panel.setType((WPanel.Type) panelType.getSelected());
String headingText = tfHeading.getText();
if (!Util.empty(tfHeading.getText())) {
heading.setText(tfHeading.getText());
panel.setTitleText(headingText);
} else {
heading.setText(SAMPLE_HEADER);
panel.setTitleText(SAMPLE_TITLE_TEXT);
}
} | java | public void updateUI() {
if (!Util.empty(panelContent.getText())) {
panelContentRO.setData(panelContent.getData());
} else {
panelContentRO.setText(SAMPLE_CONTENT);
}
panel.setType((WPanel.Type) panelType.getSelected());
String headingText = tfHeading.getText();
if (!Util.empty(tfHeading.getText())) {
heading.setText(tfHeading.getText());
panel.setTitleText(headingText);
} else {
heading.setText(SAMPLE_HEADER);
panel.setTitleText(SAMPLE_TITLE_TEXT);
}
} | [
"public",
"void",
"updateUI",
"(",
")",
"{",
"if",
"(",
"!",
"Util",
".",
"empty",
"(",
"panelContent",
".",
"getText",
"(",
")",
")",
")",
"{",
"panelContentRO",
".",
"setData",
"(",
"panelContent",
".",
"getData",
"(",
")",
")",
";",
"}",
"else",
"{",
"panelContentRO",
".",
"setText",
"(",
"SAMPLE_CONTENT",
")",
";",
"}",
"panel",
".",
"setType",
"(",
"(",
"WPanel",
".",
"Type",
")",
"panelType",
".",
"getSelected",
"(",
")",
")",
";",
"String",
"headingText",
"=",
"tfHeading",
".",
"getText",
"(",
")",
";",
"if",
"(",
"!",
"Util",
".",
"empty",
"(",
"tfHeading",
".",
"getText",
"(",
")",
")",
")",
"{",
"heading",
".",
"setText",
"(",
"tfHeading",
".",
"getText",
"(",
")",
")",
";",
"panel",
".",
"setTitleText",
"(",
"headingText",
")",
";",
"}",
"else",
"{",
"heading",
".",
"setText",
"(",
"SAMPLE_HEADER",
")",
";",
"panel",
".",
"setTitleText",
"(",
"SAMPLE_TITLE_TEXT",
")",
";",
"}",
"}"
] | Set up the WPanel so that the appropriate items are visible based on configuration settings. | [
"Set",
"up",
"the",
"WPanel",
"so",
"that",
"the",
"appropriate",
"items",
"are",
"visible",
"based",
"on",
"configuration",
"settings",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java#L181-L198 |
138,932 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java | WPanelTypeExample.buildUI | private void buildUI() {
buildTargetPanel();
buildConfigOptions();
add(new WHorizontalRule());
add(panel);
add(new WHorizontalRule());
// We need this reflection of the selected menu item just so we can reuse the menu from the
// MenuBarExample. It serves no purpose in this example so I am going to hide it.
WPanel hiddenPanel = new WPanel() {
@Override
public boolean isHidden() {
return true;
}
};
hiddenPanel.add(selectedMenuText);
add(hiddenPanel);
add(new WAjaxControl(applyConfigButton, panel));
buildSubordinates();
} | java | private void buildUI() {
buildTargetPanel();
buildConfigOptions();
add(new WHorizontalRule());
add(panel);
add(new WHorizontalRule());
// We need this reflection of the selected menu item just so we can reuse the menu from the
// MenuBarExample. It serves no purpose in this example so I am going to hide it.
WPanel hiddenPanel = new WPanel() {
@Override
public boolean isHidden() {
return true;
}
};
hiddenPanel.add(selectedMenuText);
add(hiddenPanel);
add(new WAjaxControl(applyConfigButton, panel));
buildSubordinates();
} | [
"private",
"void",
"buildUI",
"(",
")",
"{",
"buildTargetPanel",
"(",
")",
";",
"buildConfigOptions",
"(",
")",
";",
"add",
"(",
"new",
"WHorizontalRule",
"(",
")",
")",
";",
"add",
"(",
"panel",
")",
";",
"add",
"(",
"new",
"WHorizontalRule",
"(",
")",
")",
";",
"// We need this reflection of the selected menu item just so we can reuse the menu from the",
"// MenuBarExample. It serves no purpose in this example so I am going to hide it.",
"WPanel",
"hiddenPanel",
"=",
"new",
"WPanel",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"isHidden",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
";",
"hiddenPanel",
".",
"add",
"(",
"selectedMenuText",
")",
";",
"add",
"(",
"hiddenPanel",
")",
";",
"add",
"(",
"new",
"WAjaxControl",
"(",
"applyConfigButton",
",",
"panel",
")",
")",
";",
"buildSubordinates",
"(",
")",
";",
"}"
] | Add the components in the required order. | [
"Add",
"the",
"components",
"in",
"the",
"required",
"order",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java#L213-L232 |
138,933 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java | WPanelTypeExample.buildConfigOptions | private void buildConfigOptions() {
WFieldLayout layout = new WFieldLayout(WFieldLayout.LAYOUT_STACKED);
layout.setMargin(new Margin(null, null, Size.LARGE, null));
layout.addField("Select a WPanel Type", panelType);
contentField = layout.addField("Panel content", panelContent);
headingField = layout.addField("heading", tfHeading);
showMenuField = layout.addField("Show menu", showMenu);
showUtilBarField = layout.addField("Show utility bar", showUtilBar);
layout.addField((WLabel) null, applyConfigButton);
add(layout);
} | java | private void buildConfigOptions() {
WFieldLayout layout = new WFieldLayout(WFieldLayout.LAYOUT_STACKED);
layout.setMargin(new Margin(null, null, Size.LARGE, null));
layout.addField("Select a WPanel Type", panelType);
contentField = layout.addField("Panel content", panelContent);
headingField = layout.addField("heading", tfHeading);
showMenuField = layout.addField("Show menu", showMenu);
showUtilBarField = layout.addField("Show utility bar", showUtilBar);
layout.addField((WLabel) null, applyConfigButton);
add(layout);
} | [
"private",
"void",
"buildConfigOptions",
"(",
")",
"{",
"WFieldLayout",
"layout",
"=",
"new",
"WFieldLayout",
"(",
"WFieldLayout",
".",
"LAYOUT_STACKED",
")",
";",
"layout",
".",
"setMargin",
"(",
"new",
"Margin",
"(",
"null",
",",
"null",
",",
"Size",
".",
"LARGE",
",",
"null",
")",
")",
";",
"layout",
".",
"addField",
"(",
"\"Select a WPanel Type\"",
",",
"panelType",
")",
";",
"contentField",
"=",
"layout",
".",
"addField",
"(",
"\"Panel content\"",
",",
"panelContent",
")",
";",
"headingField",
"=",
"layout",
".",
"addField",
"(",
"\"heading\"",
",",
"tfHeading",
")",
";",
"showMenuField",
"=",
"layout",
".",
"addField",
"(",
"\"Show menu\"",
",",
"showMenu",
")",
";",
"showUtilBarField",
"=",
"layout",
".",
"addField",
"(",
"\"Show utility bar\"",
",",
"showUtilBar",
")",
";",
"layout",
".",
"addField",
"(",
"(",
"WLabel",
")",
"null",
",",
"applyConfigButton",
")",
";",
"add",
"(",
"layout",
")",
";",
"}"
] | Set up the UI for the configuration options. | [
"Set",
"up",
"the",
"UI",
"for",
"the",
"configuration",
"options",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java#L237-L247 |
138,934 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java | WPanelTypeExample.buildTargetPanel | private void buildTargetPanel() {
setUpUtilBar();
panel.add(utilBar);
panel.add(heading);
panel.add(panelContentRO);
panel.add(menu);
} | java | private void buildTargetPanel() {
setUpUtilBar();
panel.add(utilBar);
panel.add(heading);
panel.add(panelContentRO);
panel.add(menu);
} | [
"private",
"void",
"buildTargetPanel",
"(",
")",
"{",
"setUpUtilBar",
"(",
")",
";",
"panel",
".",
"add",
"(",
"utilBar",
")",
";",
"panel",
".",
"add",
"(",
"heading",
")",
";",
"panel",
".",
"add",
"(",
"panelContentRO",
")",
";",
"panel",
".",
"add",
"(",
"menu",
")",
";",
"}"
] | Set up the target panel contents. | [
"Set",
"up",
"the",
"target",
"panel",
"contents",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java#L252-L258 |
138,935 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java | WPanelTypeExample.setUpUtilBar | private void setUpUtilBar() {
utilBar.setLayout(new ListLayout(ListLayout.Type.FLAT, ListLayout.Alignment.RIGHT, ListLayout.Separator.NONE, false));
WTextField selectOther = new WTextField();
selectOther.setToolTip("Enter text.");
utilBar.add(selectOther);
utilBar.add(new WButton("Go"));
utilBar.add(new WButton("A"));
utilBar.add(new WButton("B"));
utilBar.add(new WButton("C"));
utilBar.setVisible(false);
} | java | private void setUpUtilBar() {
utilBar.setLayout(new ListLayout(ListLayout.Type.FLAT, ListLayout.Alignment.RIGHT, ListLayout.Separator.NONE, false));
WTextField selectOther = new WTextField();
selectOther.setToolTip("Enter text.");
utilBar.add(selectOther);
utilBar.add(new WButton("Go"));
utilBar.add(new WButton("A"));
utilBar.add(new WButton("B"));
utilBar.add(new WButton("C"));
utilBar.setVisible(false);
} | [
"private",
"void",
"setUpUtilBar",
"(",
")",
"{",
"utilBar",
".",
"setLayout",
"(",
"new",
"ListLayout",
"(",
"ListLayout",
".",
"Type",
".",
"FLAT",
",",
"ListLayout",
".",
"Alignment",
".",
"RIGHT",
",",
"ListLayout",
".",
"Separator",
".",
"NONE",
",",
"false",
")",
")",
";",
"WTextField",
"selectOther",
"=",
"new",
"WTextField",
"(",
")",
";",
"selectOther",
".",
"setToolTip",
"(",
"\"Enter text.\"",
")",
";",
"utilBar",
".",
"add",
"(",
"selectOther",
")",
";",
"utilBar",
".",
"add",
"(",
"new",
"WButton",
"(",
"\"Go\"",
")",
")",
";",
"utilBar",
".",
"add",
"(",
"new",
"WButton",
"(",
"\"A\"",
")",
")",
";",
"utilBar",
".",
"add",
"(",
"new",
"WButton",
"(",
"\"B\"",
")",
")",
";",
"utilBar",
".",
"add",
"(",
"new",
"WButton",
"(",
"\"C\"",
")",
")",
";",
"utilBar",
".",
"setVisible",
"(",
"false",
")",
";",
"}"
] | Add some UI to a "utility bar" type structure. | [
"Add",
"some",
"UI",
"to",
"a",
"utility",
"bar",
"type",
"structure",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java#L290-L300 |
138,936 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/AjaxSetupInterceptor.java | AjaxSetupInterceptor.serviceRequest | @Override
public void serviceRequest(final Request request) {
// Get trigger id
String triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME);
if (triggerId == null) {
throw new SystemException("No AJAX trigger id to on request");
}
// Find the Component for this trigger
ComponentWithContext trigger = WebUtilities.getComponentById(triggerId,
true);
if (trigger == null) {
throw new SystemException("No component found for AJAX trigger " + triggerId + ".");
}
WComponent triggerComponent = trigger.getComponent();
// Check for an internal AJAX request (if client has flagged it as internal)
boolean internal = request.getParameter(WServlet.AJAX_TRIGGER_INTERNAL_PARAM_NAME) != null;
AjaxOperation ajaxOperation = null;
if (internal) {
if (!(triggerComponent instanceof AjaxInternalTrigger)) {
throw new SystemException("AJAX trigger [" + triggerId + "] does not support internal actions.");
}
// Create internal operation
ajaxOperation = new AjaxOperation(triggerId);
} else {
// Check for a registered AJAX operation
ajaxOperation = AjaxHelper.getAjaxOperation(triggerId);
// Override registered operation if it is a GET and trigger supports Internal AJAX
// TODO This is only required until all components start using the Internal param flag
if (ajaxOperation != null && "GET".equals(request.getMethod()) && triggerComponent instanceof AjaxInternalTrigger) {
// Create internal operation
ajaxOperation = new AjaxOperation(triggerId);
}
}
// If no operation registered, check if the trigger supports internal AJAX then assume it is an Internal Action
if (ajaxOperation == null && trigger.getComponent() instanceof AjaxInternalTrigger) {
// Create internal operation
ajaxOperation = new AjaxOperation(triggerId);
}
// No Valid operation
if (ajaxOperation == null) {
throw new SystemException("No AJAX operation has been registered for trigger " + triggerId + ".");
}
// Set current operation
AjaxHelper.setCurrentOperationDetails(ajaxOperation, trigger);
// Process Service Request
super.serviceRequest(request);
} | java | @Override
public void serviceRequest(final Request request) {
// Get trigger id
String triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME);
if (triggerId == null) {
throw new SystemException("No AJAX trigger id to on request");
}
// Find the Component for this trigger
ComponentWithContext trigger = WebUtilities.getComponentById(triggerId,
true);
if (trigger == null) {
throw new SystemException("No component found for AJAX trigger " + triggerId + ".");
}
WComponent triggerComponent = trigger.getComponent();
// Check for an internal AJAX request (if client has flagged it as internal)
boolean internal = request.getParameter(WServlet.AJAX_TRIGGER_INTERNAL_PARAM_NAME) != null;
AjaxOperation ajaxOperation = null;
if (internal) {
if (!(triggerComponent instanceof AjaxInternalTrigger)) {
throw new SystemException("AJAX trigger [" + triggerId + "] does not support internal actions.");
}
// Create internal operation
ajaxOperation = new AjaxOperation(triggerId);
} else {
// Check for a registered AJAX operation
ajaxOperation = AjaxHelper.getAjaxOperation(triggerId);
// Override registered operation if it is a GET and trigger supports Internal AJAX
// TODO This is only required until all components start using the Internal param flag
if (ajaxOperation != null && "GET".equals(request.getMethod()) && triggerComponent instanceof AjaxInternalTrigger) {
// Create internal operation
ajaxOperation = new AjaxOperation(triggerId);
}
}
// If no operation registered, check if the trigger supports internal AJAX then assume it is an Internal Action
if (ajaxOperation == null && trigger.getComponent() instanceof AjaxInternalTrigger) {
// Create internal operation
ajaxOperation = new AjaxOperation(triggerId);
}
// No Valid operation
if (ajaxOperation == null) {
throw new SystemException("No AJAX operation has been registered for trigger " + triggerId + ".");
}
// Set current operation
AjaxHelper.setCurrentOperationDetails(ajaxOperation, trigger);
// Process Service Request
super.serviceRequest(request);
} | [
"@",
"Override",
"public",
"void",
"serviceRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"// Get trigger id",
"String",
"triggerId",
"=",
"request",
".",
"getParameter",
"(",
"WServlet",
".",
"AJAX_TRIGGER_PARAM_NAME",
")",
";",
"if",
"(",
"triggerId",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No AJAX trigger id to on request\"",
")",
";",
"}",
"// Find the Component for this trigger",
"ComponentWithContext",
"trigger",
"=",
"WebUtilities",
".",
"getComponentById",
"(",
"triggerId",
",",
"true",
")",
";",
"if",
"(",
"trigger",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No component found for AJAX trigger \"",
"+",
"triggerId",
"+",
"\".\"",
")",
";",
"}",
"WComponent",
"triggerComponent",
"=",
"trigger",
".",
"getComponent",
"(",
")",
";",
"// Check for an internal AJAX request (if client has flagged it as internal)",
"boolean",
"internal",
"=",
"request",
".",
"getParameter",
"(",
"WServlet",
".",
"AJAX_TRIGGER_INTERNAL_PARAM_NAME",
")",
"!=",
"null",
";",
"AjaxOperation",
"ajaxOperation",
"=",
"null",
";",
"if",
"(",
"internal",
")",
"{",
"if",
"(",
"!",
"(",
"triggerComponent",
"instanceof",
"AjaxInternalTrigger",
")",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"AJAX trigger [\"",
"+",
"triggerId",
"+",
"\"] does not support internal actions.\"",
")",
";",
"}",
"// Create internal operation",
"ajaxOperation",
"=",
"new",
"AjaxOperation",
"(",
"triggerId",
")",
";",
"}",
"else",
"{",
"// Check for a registered AJAX operation",
"ajaxOperation",
"=",
"AjaxHelper",
".",
"getAjaxOperation",
"(",
"triggerId",
")",
";",
"// Override registered operation if it is a GET and trigger supports Internal AJAX",
"// TODO This is only required until all components start using the Internal param flag",
"if",
"(",
"ajaxOperation",
"!=",
"null",
"&&",
"\"GET\"",
".",
"equals",
"(",
"request",
".",
"getMethod",
"(",
")",
")",
"&&",
"triggerComponent",
"instanceof",
"AjaxInternalTrigger",
")",
"{",
"// Create internal operation",
"ajaxOperation",
"=",
"new",
"AjaxOperation",
"(",
"triggerId",
")",
";",
"}",
"}",
"// If no operation registered, check if the trigger supports internal AJAX then assume it is an Internal Action",
"if",
"(",
"ajaxOperation",
"==",
"null",
"&&",
"trigger",
".",
"getComponent",
"(",
")",
"instanceof",
"AjaxInternalTrigger",
")",
"{",
"// Create internal operation",
"ajaxOperation",
"=",
"new",
"AjaxOperation",
"(",
"triggerId",
")",
";",
"}",
"// No Valid operation",
"if",
"(",
"ajaxOperation",
"==",
"null",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"No AJAX operation has been registered for trigger \"",
"+",
"triggerId",
"+",
"\".\"",
")",
";",
"}",
"// Set current operation",
"AjaxHelper",
".",
"setCurrentOperationDetails",
"(",
"ajaxOperation",
",",
"trigger",
")",
";",
"// Process Service Request",
"super",
".",
"serviceRequest",
"(",
"request",
")",
";",
"}"
] | Setup the AJAX operation details.
@param request the request being serviced. | [
"Setup",
"the",
"AJAX",
"operation",
"details",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/AjaxSetupInterceptor.java#L27-L82 |
138,937 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDecoratedLabelRenderer.java | WDecoratedLabelRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDecoratedLabel label = (WDecoratedLabel) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent head = label.getHead();
WComponent body = label.getBody();
WComponent tail = label.getTail();
xml.appendTagOpen("ui:decoratedlabel");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", label.isHidden(), "true");
xml.appendClose();
if (head != null && head.isVisible()) {
xml.appendTagOpen("ui:labelhead");
xml.appendAttribute("id", label.getId() + "-head");
xml.appendClose();
head.paint(renderContext);
xml.appendEndTag("ui:labelhead");
}
xml.appendTagOpen("ui:labelbody");
xml.appendAttribute("id", label.getId() + "-body");
xml.appendClose();
body.paint(renderContext);
xml.appendEndTag("ui:labelbody");
if (tail != null && tail.isVisible()) {
xml.appendTagOpen("ui:labeltail");
xml.appendAttribute("id", label.getId() + "-tail");
xml.appendClose();
tail.paint(renderContext);
xml.appendEndTag("ui:labeltail");
}
xml.appendEndTag("ui:decoratedlabel");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDecoratedLabel label = (WDecoratedLabel) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent head = label.getHead();
WComponent body = label.getBody();
WComponent tail = label.getTail();
xml.appendTagOpen("ui:decoratedlabel");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", label.isHidden(), "true");
xml.appendClose();
if (head != null && head.isVisible()) {
xml.appendTagOpen("ui:labelhead");
xml.appendAttribute("id", label.getId() + "-head");
xml.appendClose();
head.paint(renderContext);
xml.appendEndTag("ui:labelhead");
}
xml.appendTagOpen("ui:labelbody");
xml.appendAttribute("id", label.getId() + "-body");
xml.appendClose();
body.paint(renderContext);
xml.appendEndTag("ui:labelbody");
if (tail != null && tail.isVisible()) {
xml.appendTagOpen("ui:labeltail");
xml.appendAttribute("id", label.getId() + "-tail");
xml.appendClose();
tail.paint(renderContext);
xml.appendEndTag("ui:labeltail");
}
xml.appendEndTag("ui:decoratedlabel");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WDecoratedLabel",
"label",
"=",
"(",
"WDecoratedLabel",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"WComponent",
"head",
"=",
"label",
".",
"getHead",
"(",
")",
";",
"WComponent",
"body",
"=",
"label",
".",
"getBody",
"(",
")",
";",
"WComponent",
"tail",
"=",
"label",
".",
"getTail",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:decoratedlabel\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"label",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"if",
"(",
"head",
"!=",
"null",
"&&",
"head",
".",
"isVisible",
"(",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:labelhead\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"label",
".",
"getId",
"(",
")",
"+",
"\"-head\"",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"head",
".",
"paint",
"(",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:labelhead\"",
")",
";",
"}",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:labelbody\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"label",
".",
"getId",
"(",
")",
"+",
"\"-body\"",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"body",
".",
"paint",
"(",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:labelbody\"",
")",
";",
"if",
"(",
"tail",
"!=",
"null",
"&&",
"tail",
".",
"isVisible",
"(",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:labeltail\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"label",
".",
"getId",
"(",
")",
"+",
"\"-tail\"",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"tail",
".",
"paint",
"(",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:labeltail\"",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:decoratedlabel\"",
")",
";",
"}"
] | Paints the given WDecoratedLabel.
@param component the WDecoratedLabel to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WDecoratedLabel",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDecoratedLabelRenderer.java#L23-L61 |
138,938 | podio/podio-java | src/main/java/com/podio/comment/CommentAPI.java | CommentAPI.getComments | public List<Comment> getComments(Reference reference) {
return getResourceFactory().getApiResource(
"/comment/" + reference.getType() + "/" + reference.getId())
.get(new GenericType<List<Comment>>() {
});
} | java | public List<Comment> getComments(Reference reference) {
return getResourceFactory().getApiResource(
"/comment/" + reference.getType() + "/" + reference.getId())
.get(new GenericType<List<Comment>>() {
});
} | [
"public",
"List",
"<",
"Comment",
">",
"getComments",
"(",
"Reference",
"reference",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/comment/\"",
"+",
"reference",
".",
"getType",
"(",
")",
"+",
"\"/\"",
"+",
"reference",
".",
"getId",
"(",
")",
")",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"Comment",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Used to retrieve all the comments that have been made on an object of the
given type and with the given id. It returns a list of all the comments
sorted in ascending order by time created.
@param reference
The reference to the object from which the comments should be
retrieved
@return The comments on the object | [
"Used",
"to",
"retrieve",
"all",
"the",
"comments",
"that",
"have",
"been",
"made",
"on",
"an",
"object",
"of",
"the",
"given",
"type",
"and",
"with",
"the",
"given",
"id",
".",
"It",
"returns",
"a",
"list",
"of",
"all",
"the",
"comments",
"sorted",
"in",
"ascending",
"order",
"by",
"time",
"created",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/comment/CommentAPI.java#L35-L40 |
138,939 | podio/podio-java | src/main/java/com/podio/comment/CommentAPI.java | CommentAPI.addComment | public int addComment(Reference reference, CommentCreate comment,
boolean silent, boolean hook) {
return getResourceFactory()
.getApiResource(
"/comment/" + reference.getType() + "/"
+ reference.getId())
.queryParam("silent", silent ? "1" : "0")
.queryParam("hook", hook ? "1" : "0")
.entity(comment, MediaType.APPLICATION_JSON_TYPE)
.post(CommentCreateResponse.class).getId();
} | java | public int addComment(Reference reference, CommentCreate comment,
boolean silent, boolean hook) {
return getResourceFactory()
.getApiResource(
"/comment/" + reference.getType() + "/"
+ reference.getId())
.queryParam("silent", silent ? "1" : "0")
.queryParam("hook", hook ? "1" : "0")
.entity(comment, MediaType.APPLICATION_JSON_TYPE)
.post(CommentCreateResponse.class).getId();
} | [
"public",
"int",
"addComment",
"(",
"Reference",
"reference",
",",
"CommentCreate",
"comment",
",",
"boolean",
"silent",
",",
"boolean",
"hook",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/comment/\"",
"+",
"reference",
".",
"getType",
"(",
")",
"+",
"\"/\"",
"+",
"reference",
".",
"getId",
"(",
")",
")",
".",
"queryParam",
"(",
"\"silent\"",
",",
"silent",
"?",
"\"1\"",
":",
"\"0\"",
")",
".",
"queryParam",
"(",
"\"hook\"",
",",
"hook",
"?",
"\"1\"",
":",
"\"0\"",
")",
".",
"entity",
"(",
"comment",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"post",
"(",
"CommentCreateResponse",
".",
"class",
")",
".",
"getId",
"(",
")",
";",
"}"
] | Adds a new comment to the object of the given type and id, f.ex. item 1.
@param reference
The reference to the object the comment should be added to
@param comment
The comment that should be added
@param silent
True if the update should be silent, false otherwise | [
"Adds",
"a",
"new",
"comment",
"to",
"the",
"object",
"of",
"the",
"given",
"type",
"and",
"id",
"f",
".",
"ex",
".",
"item",
"1",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/comment/CommentAPI.java#L65-L75 |
138,940 | podio/podio-java | src/main/java/com/podio/comment/CommentAPI.java | CommentAPI.updateComment | public void updateComment(int commentId, CommentUpdate comment) {
getResourceFactory().getApiResource("/comment/" + commentId)
.entity(comment, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateComment(int commentId, CommentUpdate comment) {
getResourceFactory().getApiResource("/comment/" + commentId)
.entity(comment, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateComment",
"(",
"int",
"commentId",
",",
"CommentUpdate",
"comment",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/comment/\"",
"+",
"commentId",
")",
".",
"entity",
"(",
"comment",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | Updates an already created comment. This should only be used to correct
spelling and grammatical mistakes in the comment.
@param commentId
The id of the comment
@param comment
The updated comment definition | [
"Updates",
"an",
"already",
"created",
"comment",
".",
"This",
"should",
"only",
"be",
"used",
"to",
"correct",
"spelling",
"and",
"grammatical",
"mistakes",
"in",
"the",
"comment",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/comment/CommentAPI.java#L86-L89 |
138,941 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java | VelocityRenderer.render | @Override
public void render(final WComponent component, final RenderContext context) {
PrintWriter out = ((WebXmlRenderContext) context).getWriter();
// If we are debugging the layout, write markers so that the html
// designer can see where templates start and end.
boolean debugLayout = ConfigurationProperties.getDeveloperVelocityDebug();
if (debugLayout) {
String templateUrl = url;
if (url == null && component instanceof AbstractWComponent) {
templateUrl = ((AbstractWComponent) component).getTemplate();
}
out.println("<!-- Start " + templateUrl + " -->");
paintXml(component, out);
out.println("<!-- End " + templateUrl + " -->");
} else {
paintXml(component, out);
}
} | java | @Override
public void render(final WComponent component, final RenderContext context) {
PrintWriter out = ((WebXmlRenderContext) context).getWriter();
// If we are debugging the layout, write markers so that the html
// designer can see where templates start and end.
boolean debugLayout = ConfigurationProperties.getDeveloperVelocityDebug();
if (debugLayout) {
String templateUrl = url;
if (url == null && component instanceof AbstractWComponent) {
templateUrl = ((AbstractWComponent) component).getTemplate();
}
out.println("<!-- Start " + templateUrl + " -->");
paintXml(component, out);
out.println("<!-- End " + templateUrl + " -->");
} else {
paintXml(component, out);
}
} | [
"@",
"Override",
"public",
"void",
"render",
"(",
"final",
"WComponent",
"component",
",",
"final",
"RenderContext",
"context",
")",
"{",
"PrintWriter",
"out",
"=",
"(",
"(",
"WebXmlRenderContext",
")",
"context",
")",
".",
"getWriter",
"(",
")",
";",
"// If we are debugging the layout, write markers so that the html",
"// designer can see where templates start and end.",
"boolean",
"debugLayout",
"=",
"ConfigurationProperties",
".",
"getDeveloperVelocityDebug",
"(",
")",
";",
"if",
"(",
"debugLayout",
")",
"{",
"String",
"templateUrl",
"=",
"url",
";",
"if",
"(",
"url",
"==",
"null",
"&&",
"component",
"instanceof",
"AbstractWComponent",
")",
"{",
"templateUrl",
"=",
"(",
"(",
"AbstractWComponent",
")",
"component",
")",
".",
"getTemplate",
"(",
")",
";",
"}",
"out",
".",
"println",
"(",
"\"<!-- Start \"",
"+",
"templateUrl",
"+",
"\" -->\"",
")",
";",
"paintXml",
"(",
"component",
",",
"out",
")",
";",
"out",
".",
"println",
"(",
"\"<!-- End \"",
"+",
"templateUrl",
"+",
"\" -->\"",
")",
";",
"}",
"else",
"{",
"paintXml",
"(",
"component",
",",
"out",
")",
";",
"}",
"}"
] | Paints the component in HTML using the Velocity Template.
@param component the component to paint.
@param context the context to send the XML output to. | [
"Paints",
"the",
"component",
"in",
"HTML",
"using",
"the",
"Velocity",
"Template",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java#L122-L143 |
138,942 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java | VelocityRenderer.paintXml | public void paintXml(final WComponent component, final Writer writer) {
if (LOG.isDebugEnabled()) {
LOG.debug("paintXml called for component class " + component.getClass());
}
String templateText = null;
if (component instanceof AbstractWComponent) {
AbstractWComponent abstractComp = ((AbstractWComponent) component);
templateText = abstractComp.getTemplateMarkUp();
}
try {
Map<String, WComponent> componentsByKey = new HashMap<>();
VelocityContext context = new VelocityContext();
fillContext(component, context, componentsByKey);
VelocityWriter velocityWriter = new VelocityWriter(writer, componentsByKey,
UIContextHolder.getCurrent());
if (templateText != null) {
VelocityEngine engine = VelocityEngineFactory.getVelocityEngine();
engine.evaluate(context, velocityWriter, component.getClass().getSimpleName(),
templateText);
} else {
Template template = getTemplate(component);
if (template == null) {
LOG.warn(
"VelocityRenderer invoked for a component with no template: " + component.
getClass().getName());
} else {
template.merge(context, velocityWriter);
}
}
velocityWriter.close();
if (component instanceof VelocityProperties) {
((VelocityProperties) component).mapUsed();
}
} catch (ResourceNotFoundException rnfe) {
LOG.error("Could not find template '" + url + "' for component " + component.getClass().
getName(), 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 | public void paintXml(final WComponent component, final Writer writer) {
if (LOG.isDebugEnabled()) {
LOG.debug("paintXml called for component class " + component.getClass());
}
String templateText = null;
if (component instanceof AbstractWComponent) {
AbstractWComponent abstractComp = ((AbstractWComponent) component);
templateText = abstractComp.getTemplateMarkUp();
}
try {
Map<String, WComponent> componentsByKey = new HashMap<>();
VelocityContext context = new VelocityContext();
fillContext(component, context, componentsByKey);
VelocityWriter velocityWriter = new VelocityWriter(writer, componentsByKey,
UIContextHolder.getCurrent());
if (templateText != null) {
VelocityEngine engine = VelocityEngineFactory.getVelocityEngine();
engine.evaluate(context, velocityWriter, component.getClass().getSimpleName(),
templateText);
} else {
Template template = getTemplate(component);
if (template == null) {
LOG.warn(
"VelocityRenderer invoked for a component with no template: " + component.
getClass().getName());
} else {
template.merge(context, velocityWriter);
}
}
velocityWriter.close();
if (component instanceof VelocityProperties) {
((VelocityProperties) component).mapUsed();
}
} catch (ResourceNotFoundException rnfe) {
LOG.error("Could not find template '" + url + "' for component " + component.getClass().
getName(), 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);
}
} | [
"public",
"void",
"paintXml",
"(",
"final",
"WComponent",
"component",
",",
"final",
"Writer",
"writer",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"paintXml called for component class \"",
"+",
"component",
".",
"getClass",
"(",
")",
")",
";",
"}",
"String",
"templateText",
"=",
"null",
";",
"if",
"(",
"component",
"instanceof",
"AbstractWComponent",
")",
"{",
"AbstractWComponent",
"abstractComp",
"=",
"(",
"(",
"AbstractWComponent",
")",
"component",
")",
";",
"templateText",
"=",
"abstractComp",
".",
"getTemplateMarkUp",
"(",
")",
";",
"}",
"try",
"{",
"Map",
"<",
"String",
",",
"WComponent",
">",
"componentsByKey",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"VelocityContext",
"context",
"=",
"new",
"VelocityContext",
"(",
")",
";",
"fillContext",
"(",
"component",
",",
"context",
",",
"componentsByKey",
")",
";",
"VelocityWriter",
"velocityWriter",
"=",
"new",
"VelocityWriter",
"(",
"writer",
",",
"componentsByKey",
",",
"UIContextHolder",
".",
"getCurrent",
"(",
")",
")",
";",
"if",
"(",
"templateText",
"!=",
"null",
")",
"{",
"VelocityEngine",
"engine",
"=",
"VelocityEngineFactory",
".",
"getVelocityEngine",
"(",
")",
";",
"engine",
".",
"evaluate",
"(",
"context",
",",
"velocityWriter",
",",
"component",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"templateText",
")",
";",
"}",
"else",
"{",
"Template",
"template",
"=",
"getTemplate",
"(",
"component",
")",
";",
"if",
"(",
"template",
"==",
"null",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"VelocityRenderer invoked for a component with no template: \"",
"+",
"component",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"template",
".",
"merge",
"(",
"context",
",",
"velocityWriter",
")",
";",
"}",
"}",
"velocityWriter",
".",
"close",
"(",
")",
";",
"if",
"(",
"component",
"instanceof",
"VelocityProperties",
")",
"{",
"(",
"(",
"VelocityProperties",
")",
"component",
")",
".",
"mapUsed",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"ResourceNotFoundException",
"rnfe",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not find template '\"",
"+",
"url",
"+",
"\"' for component \"",
"+",
"component",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"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",
")",
";",
"}",
"}"
] | Paints the component in XML using the Velocity Template.
@param component the component to paint.
@param writer the writer to send the HTML output to. | [
"Paints",
"the",
"component",
"in",
"XML",
"using",
"the",
"Velocity",
"Template",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java#L151-L211 |
138,943 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java | VelocityRenderer.fillContext | private void fillContext(final WComponent component,
final VelocityContext context, final Map<String, WComponent> componentsByKey) {
// Also make the component available under the "this" key.
context.put("this", component);
// Make the UIContext available under the "uicontext" key.
UIContext uic = UIContextHolder.getCurrent();
context.put("uicontext", uic);
context.put("uic", uic);
if (component instanceof VelocityProperties) {
Map<?, ?> map = ((VelocityProperties) component).getVelocityMap();
for (Map.Entry<?, ?> entry : map.entrySet()) {
String key = (String) entry.getKey();
Object value = entry.getValue();
context.put(key, value);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("Handling children");
}
// As well as going into their own named slots, visible children are also
// placed into a list called children
ArrayList<String> children = new ArrayList<>();
if (component instanceof Container) {
Container container = (Container) component;
for (int i = 0; i < container.getChildCount(); i++) {
WComponent child = container.getChildAt(i);
String tag = child.getTag();
if (tag != null || child.isVisible()) {
// The key needs to be something which would never be output by a Velocity template.
String key = "<VelocityLayout" + child.getId() + "/>";
componentsByKey.put(key, child);
if (tag != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Adding child " + tag + " to context");
}
addToContext(context, tag, key);
}
if (child.isVisible()) {
children.add(key);
}
}
}
context.put("children", children);
}
// Put the context in the context
context.put("context", context);
} | java | private void fillContext(final WComponent component,
final VelocityContext context, final Map<String, WComponent> componentsByKey) {
// Also make the component available under the "this" key.
context.put("this", component);
// Make the UIContext available under the "uicontext" key.
UIContext uic = UIContextHolder.getCurrent();
context.put("uicontext", uic);
context.put("uic", uic);
if (component instanceof VelocityProperties) {
Map<?, ?> map = ((VelocityProperties) component).getVelocityMap();
for (Map.Entry<?, ?> entry : map.entrySet()) {
String key = (String) entry.getKey();
Object value = entry.getValue();
context.put(key, value);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("Handling children");
}
// As well as going into their own named slots, visible children are also
// placed into a list called children
ArrayList<String> children = new ArrayList<>();
if (component instanceof Container) {
Container container = (Container) component;
for (int i = 0; i < container.getChildCount(); i++) {
WComponent child = container.getChildAt(i);
String tag = child.getTag();
if (tag != null || child.isVisible()) {
// The key needs to be something which would never be output by a Velocity template.
String key = "<VelocityLayout" + child.getId() + "/>";
componentsByKey.put(key, child);
if (tag != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Adding child " + tag + " to context");
}
addToContext(context, tag, key);
}
if (child.isVisible()) {
children.add(key);
}
}
}
context.put("children", children);
}
// Put the context in the context
context.put("context", context);
} | [
"private",
"void",
"fillContext",
"(",
"final",
"WComponent",
"component",
",",
"final",
"VelocityContext",
"context",
",",
"final",
"Map",
"<",
"String",
",",
"WComponent",
">",
"componentsByKey",
")",
"{",
"// Also make the component available under the \"this\" key.",
"context",
".",
"put",
"(",
"\"this\"",
",",
"component",
")",
";",
"// Make the UIContext available under the \"uicontext\" key.",
"UIContext",
"uic",
"=",
"UIContextHolder",
".",
"getCurrent",
"(",
")",
";",
"context",
".",
"put",
"(",
"\"uicontext\"",
",",
"uic",
")",
";",
"context",
".",
"put",
"(",
"\"uic\"",
",",
"uic",
")",
";",
"if",
"(",
"component",
"instanceof",
"VelocityProperties",
")",
"{",
"Map",
"<",
"?",
",",
"?",
">",
"map",
"=",
"(",
"(",
"VelocityProperties",
")",
"component",
")",
".",
"getVelocityMap",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"?",
",",
"?",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"(",
"String",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"Object",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"context",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Handling children\"",
")",
";",
"}",
"// As well as going into their own named slots, visible children are also",
"// placed into a list called children",
"ArrayList",
"<",
"String",
">",
"children",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"component",
"instanceof",
"Container",
")",
"{",
"Container",
"container",
"=",
"(",
"Container",
")",
"component",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"container",
".",
"getChildCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"WComponent",
"child",
"=",
"container",
".",
"getChildAt",
"(",
"i",
")",
";",
"String",
"tag",
"=",
"child",
".",
"getTag",
"(",
")",
";",
"if",
"(",
"tag",
"!=",
"null",
"||",
"child",
".",
"isVisible",
"(",
")",
")",
"{",
"// The key needs to be something which would never be output by a Velocity template.",
"String",
"key",
"=",
"\"<VelocityLayout\"",
"+",
"child",
".",
"getId",
"(",
")",
"+",
"\"/>\"",
";",
"componentsByKey",
".",
"put",
"(",
"key",
",",
"child",
")",
";",
"if",
"(",
"tag",
"!=",
"null",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Adding child \"",
"+",
"tag",
"+",
"\" to context\"",
")",
";",
"}",
"addToContext",
"(",
"context",
",",
"tag",
",",
"key",
")",
";",
"}",
"if",
"(",
"child",
".",
"isVisible",
"(",
")",
")",
"{",
"children",
".",
"add",
"(",
"key",
")",
";",
"}",
"}",
"}",
"context",
".",
"put",
"(",
"\"children\"",
",",
"children",
")",
";",
"}",
"// Put the context in the context",
"context",
".",
"put",
"(",
"\"context\"",
",",
"context",
")",
";",
"}"
] | Fills the given velocity context with data from the component which is being rendered. A map of components is
also built up, in order to support deferred rendering.
@param component the current component being rendered.
@param context the velocity context to modify.
@param componentsByKey a map to store components for deferred rendering. | [
"Fills",
"the",
"given",
"velocity",
"context",
"with",
"data",
"from",
"the",
"component",
"which",
"is",
"being",
"rendered",
".",
"A",
"map",
"of",
"components",
"is",
"also",
"built",
"up",
"in",
"order",
"to",
"support",
"deferred",
"rendering",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java#L221-L280 |
138,944 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java | VelocityRenderer.noTemplatePaintHtml | @Deprecated
protected void noTemplatePaintHtml(final WComponent component, final Writer writer) {
try {
writer.write("<!-- Start " + url + " not found -->\n");
new VelocityRenderer(NO_TEMPLATE_LAYOUT).paintXml(component, writer);
writer.write("<!-- End " + url + " (template not found) -->\n");
} catch (IOException e) {
LOG.error("Failed to paint component", e);
}
} | java | @Deprecated
protected void noTemplatePaintHtml(final WComponent component, final Writer writer) {
try {
writer.write("<!-- Start " + url + " not found -->\n");
new VelocityRenderer(NO_TEMPLATE_LAYOUT).paintXml(component, writer);
writer.write("<!-- End " + url + " (template not found) -->\n");
} catch (IOException e) {
LOG.error("Failed to paint component", e);
}
} | [
"@",
"Deprecated",
"protected",
"void",
"noTemplatePaintHtml",
"(",
"final",
"WComponent",
"component",
",",
"final",
"Writer",
"writer",
")",
"{",
"try",
"{",
"writer",
".",
"write",
"(",
"\"<!-- Start \"",
"+",
"url",
"+",
"\" not found -->\\n\"",
")",
";",
"new",
"VelocityRenderer",
"(",
"NO_TEMPLATE_LAYOUT",
")",
".",
"paintXml",
"(",
"component",
",",
"writer",
")",
";",
"writer",
".",
"write",
"(",
"\"<!-- End \"",
"+",
"url",
"+",
"\" (template not found) -->\\n\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to paint component\"",
",",
"e",
")",
";",
"}",
"}"
] | Paints the component in HTML using the NoTemplateLayout.
@param component the component to paint.
@param writer the writer to send the HTML output to.
@deprecated Unused. Will be removed in the next major release. | [
"Paints",
"the",
"component",
"in",
"HTML",
"using",
"the",
"NoTemplateLayout",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java#L319-L328 |
138,945 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java | VelocityRenderer.getTemplate | private Template getTemplate(final WComponent component) {
String templateUrl = url;
if (templateUrl == null && component instanceof AbstractWComponent) {
templateUrl = ((AbstractWComponent) component).getTemplate();
}
if (templateUrl != null) {
try {
return VelocityEngineFactory.getVelocityEngine().getTemplate(templateUrl);
} catch (Exception ex) {
// If the resource is not available (eg if the template does not
// exist), paint using a default layout and inform the user
// of what's going on in the html comments.
LOG.warn("Could not open " + templateUrl, ex);
try {
return VelocityEngineFactory.getVelocityEngine().getTemplate(NO_TEMPLATE_LAYOUT);
} catch (Exception e) {
LOG.error("Failed to read no template layout", e);
}
}
}
return null;
} | java | private Template getTemplate(final WComponent component) {
String templateUrl = url;
if (templateUrl == null && component instanceof AbstractWComponent) {
templateUrl = ((AbstractWComponent) component).getTemplate();
}
if (templateUrl != null) {
try {
return VelocityEngineFactory.getVelocityEngine().getTemplate(templateUrl);
} catch (Exception ex) {
// If the resource is not available (eg if the template does not
// exist), paint using a default layout and inform the user
// of what's going on in the html comments.
LOG.warn("Could not open " + templateUrl, ex);
try {
return VelocityEngineFactory.getVelocityEngine().getTemplate(NO_TEMPLATE_LAYOUT);
} catch (Exception e) {
LOG.error("Failed to read no template layout", e);
}
}
}
return null;
} | [
"private",
"Template",
"getTemplate",
"(",
"final",
"WComponent",
"component",
")",
"{",
"String",
"templateUrl",
"=",
"url",
";",
"if",
"(",
"templateUrl",
"==",
"null",
"&&",
"component",
"instanceof",
"AbstractWComponent",
")",
"{",
"templateUrl",
"=",
"(",
"(",
"AbstractWComponent",
")",
"component",
")",
".",
"getTemplate",
"(",
")",
";",
"}",
"if",
"(",
"templateUrl",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"VelocityEngineFactory",
".",
"getVelocityEngine",
"(",
")",
".",
"getTemplate",
"(",
"templateUrl",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// If the resource is not available (eg if the template does not",
"// exist), paint using a default layout and inform the user",
"// of what's going on in the html comments.",
"LOG",
".",
"warn",
"(",
"\"Could not open \"",
"+",
"templateUrl",
",",
"ex",
")",
";",
"try",
"{",
"return",
"VelocityEngineFactory",
".",
"getVelocityEngine",
"(",
")",
".",
"getTemplate",
"(",
"NO_TEMPLATE_LAYOUT",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to read no template layout\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Retrieves the Velocity template for the given component.
@param component the component to retrieve the template for.
@return the template for the given component, or null if there is no template. | [
"Retrieves",
"the",
"Velocity",
"template",
"for",
"the",
"given",
"component",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java#L344-L369 |
138,946 | podio/podio-java | src/main/java/com/podio/stream/StreamAPI.java | StreamAPI.getGlobalStream | public List<StreamObject> getGlobalStream(Integer limit, Integer offset,
DateTime dateFrom, DateTime dateTo) {
return getStream("/stream/", limit, offset, dateFrom, dateTo);
} | java | public List<StreamObject> getGlobalStream(Integer limit, Integer offset,
DateTime dateFrom, DateTime dateTo) {
return getStream("/stream/", limit, offset, dateFrom, dateTo);
} | [
"public",
"List",
"<",
"StreamObject",
">",
"getGlobalStream",
"(",
"Integer",
"limit",
",",
"Integer",
"offset",
",",
"DateTime",
"dateFrom",
",",
"DateTime",
"dateTo",
")",
"{",
"return",
"getStream",
"(",
"\"/stream/\"",
",",
"limit",
",",
"offset",
",",
"dateFrom",
",",
"dateTo",
")",
";",
"}"
] | Returns the global stream. This includes items and statuses with
comments, ratings, files and edits.
@param limit
How many objects should be returned, defaults to 10
@param offset
How far should the objects be offset, defaults to 0
@param dateFrom
The date and time that all events should be after, defaults to
no limit
@param dateTo
The date and time that all events should be before, defaults
to no limit
@return The list of stream objects | [
"Returns",
"the",
"global",
"stream",
".",
"This",
"includes",
"items",
"and",
"statuses",
"with",
"comments",
"ratings",
"files",
"and",
"edits",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/stream/StreamAPI.java#L70-L73 |
138,947 | podio/podio-java | src/main/java/com/podio/stream/StreamAPI.java | StreamAPI.getGlobalStreamV2 | public List<StreamObjectV2> getGlobalStreamV2(Integer limit,
Integer offset, DateTime dateFrom, DateTime dateTo) {
return getStreamV2("/stream/v2/", limit, offset, dateFrom, dateTo);
} | java | public List<StreamObjectV2> getGlobalStreamV2(Integer limit,
Integer offset, DateTime dateFrom, DateTime dateTo) {
return getStreamV2("/stream/v2/", limit, offset, dateFrom, dateTo);
} | [
"public",
"List",
"<",
"StreamObjectV2",
">",
"getGlobalStreamV2",
"(",
"Integer",
"limit",
",",
"Integer",
"offset",
",",
"DateTime",
"dateFrom",
",",
"DateTime",
"dateTo",
")",
"{",
"return",
"getStreamV2",
"(",
"\"/stream/v2/\"",
",",
"limit",
",",
"offset",
",",
"dateFrom",
",",
"dateTo",
")",
";",
"}"
] | Returns the global stream. The types of objects in the stream can be
either "item", "status" or "task".
@param limit
How many objects should be returned, defaults to 10
@param offset
How far should the objects be offset, defaults to 0
@param dateFrom
The date and time that all events should be after, defaults to
no limit
@param dateTo
The date and time that all events should be before, defaults
to no limit
@return The list of stream objects | [
"Returns",
"the",
"global",
"stream",
".",
"The",
"types",
"of",
"objects",
"in",
"the",
"stream",
"can",
"be",
"either",
"item",
"status",
"or",
"task",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/stream/StreamAPI.java#L91-L94 |
138,948 | podio/podio-java | src/main/java/com/podio/stream/StreamAPI.java | StreamAPI.getAppStream | public List<StreamObjectV2> getAppStream(int appId, Integer limit,
Integer offset) {
return getStreamV2("/stream/app/" + appId + "/", limit, offset, null,
null);
} | java | public List<StreamObjectV2> getAppStream(int appId, Integer limit,
Integer offset) {
return getStreamV2("/stream/app/" + appId + "/", limit, offset, null,
null);
} | [
"public",
"List",
"<",
"StreamObjectV2",
">",
"getAppStream",
"(",
"int",
"appId",
",",
"Integer",
"limit",
",",
"Integer",
"offset",
")",
"{",
"return",
"getStreamV2",
"(",
"\"/stream/app/\"",
"+",
"appId",
"+",
"\"/\"",
",",
"limit",
",",
"offset",
",",
"null",
",",
"null",
")",
";",
"}"
] | Returns the stream for the app. Is identical to the global stream, but
only returns objects in the app.
@param limit
How many objects should be returned, defaults to 10
@param offset
How far should the objects be offset, defaults to 0
@param dateFrom
The date and time that all events should be after, defaults to
no limit
@param dateTo
The date and time that all events should be before, defaults
to no limit
@return The list of stream objects | [
"Returns",
"the",
"stream",
"for",
"the",
"app",
".",
"Is",
"identical",
"to",
"the",
"global",
"stream",
"but",
"only",
"returns",
"objects",
"in",
"the",
"app",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/stream/StreamAPI.java#L200-L204 |
138,949 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WVideoExample.java | WVideoExample.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request); //To change body of generated methods, choose Tools | Templates.
if (!isInitialised()) {
setInitialised(true);
setupVideo();
}
} | java | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request); //To change body of generated methods, choose Tools | Templates.
if (!isInitialised()) {
setInitialised(true);
setupVideo();
}
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"preparePaintComponent",
"(",
"request",
")",
";",
"//To change body of generated methods, choose Tools | Templates.",
"if",
"(",
"!",
"isInitialised",
"(",
")",
")",
"{",
"setInitialised",
"(",
"true",
")",
";",
"setupVideo",
"(",
")",
";",
"}",
"}"
] | Set up the initial state of the video component.
@param request The http request being processed. | [
"Set",
"up",
"the",
"initial",
"state",
"of",
"the",
"video",
"component",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WVideoExample.java#L133-L140 |
138,950 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WVideoExample.java | WVideoExample.setupVideo | private void setupVideo() {
video.setAutoplay(cbAutoPlay.isSelected());
video.setLoop(cbLoop.isSelected());
video.setMuted(!cbMute.isDisabled() && cbMute.isSelected());
video.setControls(cbControls.isSelected() ? WVideo.Controls.PLAY_PAUSE : WVideo.Controls.NATIVE);
video.setDisabled(cbControls.isSelected() && cbDisable.isSelected());
} | java | private void setupVideo() {
video.setAutoplay(cbAutoPlay.isSelected());
video.setLoop(cbLoop.isSelected());
video.setMuted(!cbMute.isDisabled() && cbMute.isSelected());
video.setControls(cbControls.isSelected() ? WVideo.Controls.PLAY_PAUSE : WVideo.Controls.NATIVE);
video.setDisabled(cbControls.isSelected() && cbDisable.isSelected());
} | [
"private",
"void",
"setupVideo",
"(",
")",
"{",
"video",
".",
"setAutoplay",
"(",
"cbAutoPlay",
".",
"isSelected",
"(",
")",
")",
";",
"video",
".",
"setLoop",
"(",
"cbLoop",
".",
"isSelected",
"(",
")",
")",
";",
"video",
".",
"setMuted",
"(",
"!",
"cbMute",
".",
"isDisabled",
"(",
")",
"&&",
"cbMute",
".",
"isSelected",
"(",
")",
")",
";",
"video",
".",
"setControls",
"(",
"cbControls",
".",
"isSelected",
"(",
")",
"?",
"WVideo",
".",
"Controls",
".",
"PLAY_PAUSE",
":",
"WVideo",
".",
"Controls",
".",
"NATIVE",
")",
";",
"video",
".",
"setDisabled",
"(",
"cbControls",
".",
"isSelected",
"(",
")",
"&&",
"cbDisable",
".",
"isSelected",
"(",
")",
")",
";",
"}"
] | Set the video configuration options. | [
"Set",
"the",
"video",
"configuration",
"options",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WVideoExample.java#L146-L152 |
138,951 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/HeadersImpl.java | HeadersImpl.getHeadLines | @Override
public List<String> getHeadLines(final String type) {
ArrayList<String> lines = headers.get(type);
return lines == null ? null : Collections.unmodifiableList(lines);
} | java | @Override
public List<String> getHeadLines(final String type) {
ArrayList<String> lines = headers.get(type);
return lines == null ? null : Collections.unmodifiableList(lines);
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getHeadLines",
"(",
"final",
"String",
"type",
")",
"{",
"ArrayList",
"<",
"String",
">",
"lines",
"=",
"headers",
".",
"get",
"(",
"type",
")",
";",
"return",
"lines",
"==",
"null",
"?",
"null",
":",
"Collections",
".",
"unmodifiableList",
"(",
"lines",
")",
";",
"}"
] | Gets the head lines, of a specified type.
@param type the type of lines to retrieve.
@return a list of headlines, or null if there are no headlines of the given type. | [
"Gets",
"the",
"head",
"lines",
"of",
"a",
"specified",
"type",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/HeadersImpl.java#L109-L113 |
138,952 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java | XmlStringBuilder.append | public void append(final Object text) {
if (text instanceof Message) {
append(translate(text), true);
} else if (text != null) {
append(text.toString(), true);
}
} | java | public void append(final Object text) {
if (text instanceof Message) {
append(translate(text), true);
} else if (text != null) {
append(text.toString(), true);
}
} | [
"public",
"void",
"append",
"(",
"final",
"Object",
"text",
")",
"{",
"if",
"(",
"text",
"instanceof",
"Message",
")",
"{",
"append",
"(",
"translate",
"(",
"text",
")",
",",
"true",
")",
";",
"}",
"else",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"append",
"(",
"text",
".",
"toString",
"(",
")",
",",
"true",
")",
";",
"}",
"}"
] | Appends the given text to this XmlStringBuilder. XML values are escaped.
@param text the message to append. | [
"Appends",
"the",
"given",
"text",
"to",
"this",
"XmlStringBuilder",
".",
"XML",
"values",
"are",
"escaped",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java#L298-L304 |
138,953 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java | XmlStringBuilder.append | public void append(final String string, final boolean encode) {
if (encode) {
appendOptional(WebUtilities.encode(string));
} else {
// unescaped content still has to be XML compliant.
write(HtmlToXMLUtil.unescapeToXML(string));
}
} | java | public void append(final String string, final boolean encode) {
if (encode) {
appendOptional(WebUtilities.encode(string));
} else {
// unescaped content still has to be XML compliant.
write(HtmlToXMLUtil.unescapeToXML(string));
}
} | [
"public",
"void",
"append",
"(",
"final",
"String",
"string",
",",
"final",
"boolean",
"encode",
")",
"{",
"if",
"(",
"encode",
")",
"{",
"appendOptional",
"(",
"WebUtilities",
".",
"encode",
"(",
"string",
")",
")",
";",
"}",
"else",
"{",
"// unescaped content still has to be XML compliant.",
"write",
"(",
"HtmlToXMLUtil",
".",
"unescapeToXML",
"(",
"string",
")",
")",
";",
"}",
"}"
] | Appends the string to this XmlStringBuilder. XML values are not escaped.
@param string the String to append.
@param encode true to encode the string before output, false to output as is | [
"Appends",
"the",
"string",
"to",
"this",
"XmlStringBuilder",
".",
"XML",
"values",
"are",
"not",
"escaped",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java#L312-L319 |
138,954 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java | XmlStringBuilder.translate | private String translate(final Object messageObject) {
if (messageObject instanceof Message) {
Message message = (Message) messageObject;
return I18nUtilities.format(locale, message.getMessage(), (Object[]) message.getArgs());
} else if (messageObject != null) {
return I18nUtilities.format(locale, messageObject.toString());
}
return null;
} | java | private String translate(final Object messageObject) {
if (messageObject instanceof Message) {
Message message = (Message) messageObject;
return I18nUtilities.format(locale, message.getMessage(), (Object[]) message.getArgs());
} else if (messageObject != null) {
return I18nUtilities.format(locale, messageObject.toString());
}
return null;
} | [
"private",
"String",
"translate",
"(",
"final",
"Object",
"messageObject",
")",
"{",
"if",
"(",
"messageObject",
"instanceof",
"Message",
")",
"{",
"Message",
"message",
"=",
"(",
"Message",
")",
"messageObject",
";",
"return",
"I18nUtilities",
".",
"format",
"(",
"locale",
",",
"message",
".",
"getMessage",
"(",
")",
",",
"(",
"Object",
"[",
"]",
")",
"message",
".",
"getArgs",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"messageObject",
"!=",
"null",
")",
"{",
"return",
"I18nUtilities",
".",
"format",
"(",
"locale",
",",
"messageObject",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Translates the given message into the appropriate user text. This takes the current locale into consideration, if
set.
@param messageObject the message to translate.
@return the translated message. | [
"Translates",
"the",
"given",
"message",
"into",
"the",
"appropriate",
"user",
"text",
".",
"This",
"takes",
"the",
"current",
"locale",
"into",
"consideration",
"if",
"set",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java#L359-L368 |
138,955 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/RequestUtil.java | RequestUtil.addFileItem | public static void addFileItem(final Map<String, FileItem[]> files, final String name, final FileItem item) {
if (files.containsKey(name)) {
// This field contains multiple values, append the new value to the existing values.
FileItem[] oldValues = files.get(name);
FileItem[] newValues = new FileItem[oldValues.length + 1];
System.arraycopy(oldValues, 0, newValues, 0, oldValues.length);
newValues[newValues.length - 1] = item;
files.put(name, newValues);
} else {
files.put(name, new FileItem[]{item});
}
} | java | public static void addFileItem(final Map<String, FileItem[]> files, final String name, final FileItem item) {
if (files.containsKey(name)) {
// This field contains multiple values, append the new value to the existing values.
FileItem[] oldValues = files.get(name);
FileItem[] newValues = new FileItem[oldValues.length + 1];
System.arraycopy(oldValues, 0, newValues, 0, oldValues.length);
newValues[newValues.length - 1] = item;
files.put(name, newValues);
} else {
files.put(name, new FileItem[]{item});
}
} | [
"public",
"static",
"void",
"addFileItem",
"(",
"final",
"Map",
"<",
"String",
",",
"FileItem",
"[",
"]",
">",
"files",
",",
"final",
"String",
"name",
",",
"final",
"FileItem",
"item",
")",
"{",
"if",
"(",
"files",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"// This field contains multiple values, append the new value to the existing values.",
"FileItem",
"[",
"]",
"oldValues",
"=",
"files",
".",
"get",
"(",
"name",
")",
";",
"FileItem",
"[",
"]",
"newValues",
"=",
"new",
"FileItem",
"[",
"oldValues",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldValues",
",",
"0",
",",
"newValues",
",",
"0",
",",
"oldValues",
".",
"length",
")",
";",
"newValues",
"[",
"newValues",
".",
"length",
"-",
"1",
"]",
"=",
"item",
";",
"files",
".",
"put",
"(",
"name",
",",
"newValues",
")",
";",
"}",
"else",
"{",
"files",
".",
"put",
"(",
"name",
",",
"new",
"FileItem",
"[",
"]",
"{",
"item",
"}",
")",
";",
"}",
"}"
] | Add the file data to the files collection. If a file already exists with the given name then the value for this
name will be an array of all registered files.
@param files the map in which to store file data.
@param name the name of the file, i.e. the key to store the file against.
@param item the file data. | [
"Add",
"the",
"file",
"data",
"to",
"the",
"files",
"collection",
".",
"If",
"a",
"file",
"already",
"exists",
"with",
"the",
"given",
"name",
"then",
"the",
"value",
"for",
"this",
"name",
"will",
"be",
"an",
"array",
"of",
"all",
"registered",
"files",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/RequestUtil.java#L28-L39 |
138,956 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/RequestUtil.java | RequestUtil.addParameter | public static void addParameter(final Map<String, String[]> parameters, final String name, final String value) {
if (parameters.containsKey(name)) {
// This field contains multiple values, append the new value to the existing values.
String[] oldValues = parameters.get(name);
String[] newValues = new String[oldValues.length + 1];
System.arraycopy(oldValues, 0, newValues, 0, oldValues.length);
newValues[newValues.length - 1] = value;
parameters.put(name, newValues);
} else {
parameters.put(name, new String[]{value});
}
} | java | public static void addParameter(final Map<String, String[]> parameters, final String name, final String value) {
if (parameters.containsKey(name)) {
// This field contains multiple values, append the new value to the existing values.
String[] oldValues = parameters.get(name);
String[] newValues = new String[oldValues.length + 1];
System.arraycopy(oldValues, 0, newValues, 0, oldValues.length);
newValues[newValues.length - 1] = value;
parameters.put(name, newValues);
} else {
parameters.put(name, new String[]{value});
}
} | [
"public",
"static",
"void",
"addParameter",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parameters",
",",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"parameters",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"// This field contains multiple values, append the new value to the existing values.",
"String",
"[",
"]",
"oldValues",
"=",
"parameters",
".",
"get",
"(",
"name",
")",
";",
"String",
"[",
"]",
"newValues",
"=",
"new",
"String",
"[",
"oldValues",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldValues",
",",
"0",
",",
"newValues",
",",
"0",
",",
"oldValues",
".",
"length",
")",
";",
"newValues",
"[",
"newValues",
".",
"length",
"-",
"1",
"]",
"=",
"value",
";",
"parameters",
".",
"put",
"(",
"name",
",",
"newValues",
")",
";",
"}",
"else",
"{",
"parameters",
".",
"put",
"(",
"name",
",",
"new",
"String",
"[",
"]",
"{",
"value",
"}",
")",
";",
"}",
"}"
] | Add the request parameter to the parameters collection. If a parameter already exists with the given name then
the Map will contain an array of all registered values.
@param parameters the map to store non-file request parameters in.
@param name the name of the parameter.
@param value the parameter value. | [
"Add",
"the",
"request",
"parameter",
"to",
"the",
"parameters",
"collection",
".",
"If",
"a",
"parameter",
"already",
"exists",
"with",
"the",
"given",
"name",
"then",
"the",
"Map",
"will",
"contain",
"an",
"array",
"of",
"all",
"registered",
"values",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/RequestUtil.java#L49-L60 |
138,957 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WImageRenderer.java | WImageRenderer.renderTagOpen | protected static void renderTagOpen(final WImage imageComponent, final XmlStringBuilder xml) {
// Check for alternative text on the image
String alternativeText = imageComponent.getAlternativeText();
if (alternativeText == null) {
alternativeText = "";
} else {
alternativeText = I18nUtilities.format(null, alternativeText);
}
xml.appendTagOpen("img");
xml.appendAttribute("id", imageComponent.getId());
xml.appendOptionalAttribute("class", imageComponent.getHtmlClass());
xml.appendOptionalAttribute("track", imageComponent.isTracking(), "true");
xml.appendUrlAttribute("src", imageComponent.getTargetUrl());
xml.appendAttribute("alt", alternativeText);
xml.appendOptionalAttribute("hidden", imageComponent.isHidden(), "hidden");
// Check for size information on the image
Dimension size = imageComponent.getSize();
if (size != null) {
if (size.getHeight() >= 0) {
xml.appendAttribute("height", size.height);
}
if (size.getWidth() >= 0) {
xml.appendAttribute("width", size.width);
}
}
} | java | protected static void renderTagOpen(final WImage imageComponent, final XmlStringBuilder xml) {
// Check for alternative text on the image
String alternativeText = imageComponent.getAlternativeText();
if (alternativeText == null) {
alternativeText = "";
} else {
alternativeText = I18nUtilities.format(null, alternativeText);
}
xml.appendTagOpen("img");
xml.appendAttribute("id", imageComponent.getId());
xml.appendOptionalAttribute("class", imageComponent.getHtmlClass());
xml.appendOptionalAttribute("track", imageComponent.isTracking(), "true");
xml.appendUrlAttribute("src", imageComponent.getTargetUrl());
xml.appendAttribute("alt", alternativeText);
xml.appendOptionalAttribute("hidden", imageComponent.isHidden(), "hidden");
// Check for size information on the image
Dimension size = imageComponent.getSize();
if (size != null) {
if (size.getHeight() >= 0) {
xml.appendAttribute("height", size.height);
}
if (size.getWidth() >= 0) {
xml.appendAttribute("width", size.width);
}
}
} | [
"protected",
"static",
"void",
"renderTagOpen",
"(",
"final",
"WImage",
"imageComponent",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"// Check for alternative text on the image",
"String",
"alternativeText",
"=",
"imageComponent",
".",
"getAlternativeText",
"(",
")",
";",
"if",
"(",
"alternativeText",
"==",
"null",
")",
"{",
"alternativeText",
"=",
"\"\"",
";",
"}",
"else",
"{",
"alternativeText",
"=",
"I18nUtilities",
".",
"format",
"(",
"null",
",",
"alternativeText",
")",
";",
"}",
"xml",
".",
"appendTagOpen",
"(",
"\"img\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"imageComponent",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"imageComponent",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"imageComponent",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendUrlAttribute",
"(",
"\"src\"",
",",
"imageComponent",
".",
"getTargetUrl",
"(",
")",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"alt\"",
",",
"alternativeText",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"imageComponent",
".",
"isHidden",
"(",
")",
",",
"\"hidden\"",
")",
";",
"// Check for size information on the image",
"Dimension",
"size",
"=",
"imageComponent",
".",
"getSize",
"(",
")",
";",
"if",
"(",
"size",
"!=",
"null",
")",
"{",
"if",
"(",
"size",
".",
"getHeight",
"(",
")",
">=",
"0",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"height\"",
",",
"size",
".",
"height",
")",
";",
"}",
"if",
"(",
"size",
".",
"getWidth",
"(",
")",
">=",
"0",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"width\"",
",",
"size",
".",
"width",
")",
";",
"}",
"}",
"}"
] | Builds the "open tag" part of the XML, that is the tagname and attributes.
E.g. <ui:image src="example.png" alt="some alt txt"
The caller may then append any additional attributes and then close the XML tag.
@param imageComponent The WImage to render.
@param xml The buffer to render the XML into. | [
"Builds",
"the",
"open",
"tag",
"part",
"of",
"the",
"XML",
"that",
"is",
"the",
"tagname",
"and",
"attributes",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WImageRenderer.java#L28-L57 |
138,958 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/Integrity.java | Integrity.issue | public static void issue(final WComponent comp, final String message) {
String debugMessage = message + ' ' + comp;
if (ConfigurationProperties.getIntegrityErrorMode()) {
throw new IntegrityException(debugMessage);
} else {
LogFactory.getLog(Integrity.class).warn(debugMessage);
}
} | java | public static void issue(final WComponent comp, final String message) {
String debugMessage = message + ' ' + comp;
if (ConfigurationProperties.getIntegrityErrorMode()) {
throw new IntegrityException(debugMessage);
} else {
LogFactory.getLog(Integrity.class).warn(debugMessage);
}
} | [
"public",
"static",
"void",
"issue",
"(",
"final",
"WComponent",
"comp",
",",
"final",
"String",
"message",
")",
"{",
"String",
"debugMessage",
"=",
"message",
"+",
"'",
"'",
"+",
"comp",
";",
"if",
"(",
"ConfigurationProperties",
".",
"getIntegrityErrorMode",
"(",
")",
")",
"{",
"throw",
"new",
"IntegrityException",
"(",
"debugMessage",
")",
";",
"}",
"else",
"{",
"LogFactory",
".",
"getLog",
"(",
"Integrity",
".",
"class",
")",
".",
"warn",
"(",
"debugMessage",
")",
";",
"}",
"}"
] | Raises an integrity issue.
@param comp the component to issue the exception for.
@param message the integrity message to issue. | [
"Raises",
"an",
"integrity",
"issue",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/Integrity.java#L32-L40 |
138,959 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/AbstractWFieldIndicatorRenderer.java | AbstractWFieldIndicatorRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
AbstractWFieldIndicator fieldIndicator = (AbstractWFieldIndicator) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent validationTarget = fieldIndicator.getTargetComponent();
// no need to render an indicator for nothing.
// Diagnosables takes care of thieir own messaging.
if (validationTarget == null || (validationTarget instanceof Diagnosable && !(validationTarget instanceof Input))) {
return;
}
if (validationTarget instanceof Input && !((Input) validationTarget).isReadOnly()) {
return;
}
List<Diagnostic> diags = fieldIndicator.getDiagnostics();
if (diags != null && !diags.isEmpty()) {
xml.appendTagOpen("ui:fieldindicator");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (fieldIndicator.getFieldIndicatorType()) {
case INFO:
xml.appendAttribute("type", "info");
break;
case WARN:
xml.appendAttribute("type", "warn");
break;
case ERROR:
xml.appendAttribute("type", "error");
break;
default:
throw new SystemException("Cannot paint field indicator due to an invalid field indicator type: "
+ fieldIndicator.getFieldIndicatorType());
}
xml.appendAttribute("for", fieldIndicator.getRelatedFieldId());
xml.appendClose();
for (Diagnostic diag : diags) {
xml.appendTag("ui:message");
xml.appendEscaped(diag.getDescription());
xml.appendEndTag("ui:message");
}
xml.appendEndTag("ui:fieldindicator");
}
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
AbstractWFieldIndicator fieldIndicator = (AbstractWFieldIndicator) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent validationTarget = fieldIndicator.getTargetComponent();
// no need to render an indicator for nothing.
// Diagnosables takes care of thieir own messaging.
if (validationTarget == null || (validationTarget instanceof Diagnosable && !(validationTarget instanceof Input))) {
return;
}
if (validationTarget instanceof Input && !((Input) validationTarget).isReadOnly()) {
return;
}
List<Diagnostic> diags = fieldIndicator.getDiagnostics();
if (diags != null && !diags.isEmpty()) {
xml.appendTagOpen("ui:fieldindicator");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (fieldIndicator.getFieldIndicatorType()) {
case INFO:
xml.appendAttribute("type", "info");
break;
case WARN:
xml.appendAttribute("type", "warn");
break;
case ERROR:
xml.appendAttribute("type", "error");
break;
default:
throw new SystemException("Cannot paint field indicator due to an invalid field indicator type: "
+ fieldIndicator.getFieldIndicatorType());
}
xml.appendAttribute("for", fieldIndicator.getRelatedFieldId());
xml.appendClose();
for (Diagnostic diag : diags) {
xml.appendTag("ui:message");
xml.appendEscaped(diag.getDescription());
xml.appendEndTag("ui:message");
}
xml.appendEndTag("ui:fieldindicator");
}
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"AbstractWFieldIndicator",
"fieldIndicator",
"=",
"(",
"AbstractWFieldIndicator",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"WComponent",
"validationTarget",
"=",
"fieldIndicator",
".",
"getTargetComponent",
"(",
")",
";",
"// no need to render an indicator for nothing.",
"// Diagnosables takes care of thieir own messaging.",
"if",
"(",
"validationTarget",
"==",
"null",
"||",
"(",
"validationTarget",
"instanceof",
"Diagnosable",
"&&",
"!",
"(",
"validationTarget",
"instanceof",
"Input",
")",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"validationTarget",
"instanceof",
"Input",
"&&",
"!",
"(",
"(",
"Input",
")",
"validationTarget",
")",
".",
"isReadOnly",
"(",
")",
")",
"{",
"return",
";",
"}",
"List",
"<",
"Diagnostic",
">",
"diags",
"=",
"fieldIndicator",
".",
"getDiagnostics",
"(",
")",
";",
"if",
"(",
"diags",
"!=",
"null",
"&&",
"!",
"diags",
".",
"isEmpty",
"(",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:fieldindicator\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"switch",
"(",
"fieldIndicator",
".",
"getFieldIndicatorType",
"(",
")",
")",
"{",
"case",
"INFO",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"info\"",
")",
";",
"break",
";",
"case",
"WARN",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"warn\"",
")",
";",
"break",
";",
"case",
"ERROR",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"error\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Cannot paint field indicator due to an invalid field indicator type: \"",
"+",
"fieldIndicator",
".",
"getFieldIndicatorType",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendAttribute",
"(",
"\"for\"",
",",
"fieldIndicator",
".",
"getRelatedFieldId",
"(",
")",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"for",
"(",
"Diagnostic",
"diag",
":",
"diags",
")",
"{",
"xml",
".",
"appendTag",
"(",
"\"ui:message\"",
")",
";",
"xml",
".",
"appendEscaped",
"(",
"diag",
".",
"getDescription",
"(",
")",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:message\"",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:fieldindicator\"",
")",
";",
"}",
"}"
] | Paints the given AbstractWFieldIndicator.
@param component the WFieldErrorIndicator to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"AbstractWFieldIndicator",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/AbstractWFieldIndicatorRenderer.java#L28-L81 |
138,960 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePicker.java | ExamplePicker.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
// Check project versions for Wcomponents-examples and WComponents match
String egVersion = Config.getInstance().getString("wcomponents-examples.version");
String wcVersion = WebUtilities.getProjectVersion();
if (egVersion != null && !egVersion.equals(wcVersion)) {
String msg = "WComponents-Examples version (" + egVersion + ") does not match WComponents version ("
+ wcVersion + ").";
LOG.error(msg);
messages.addMessage(new Message(Message.ERROR_MESSAGE, msg));
}
setInitialised(true);
}
} | java | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
// Check project versions for Wcomponents-examples and WComponents match
String egVersion = Config.getInstance().getString("wcomponents-examples.version");
String wcVersion = WebUtilities.getProjectVersion();
if (egVersion != null && !egVersion.equals(wcVersion)) {
String msg = "WComponents-Examples version (" + egVersion + ") does not match WComponents version ("
+ wcVersion + ").";
LOG.error(msg);
messages.addMessage(new Message(Message.ERROR_MESSAGE, msg));
}
setInitialised(true);
}
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"preparePaintComponent",
"(",
"request",
")",
";",
"if",
"(",
"!",
"isInitialised",
"(",
")",
")",
"{",
"// Check project versions for Wcomponents-examples and WComponents match",
"String",
"egVersion",
"=",
"Config",
".",
"getInstance",
"(",
")",
".",
"getString",
"(",
"\"wcomponents-examples.version\"",
")",
";",
"String",
"wcVersion",
"=",
"WebUtilities",
".",
"getProjectVersion",
"(",
")",
";",
"if",
"(",
"egVersion",
"!=",
"null",
"&&",
"!",
"egVersion",
".",
"equals",
"(",
"wcVersion",
")",
")",
"{",
"String",
"msg",
"=",
"\"WComponents-Examples version (\"",
"+",
"egVersion",
"+",
"\") does not match WComponents version (\"",
"+",
"wcVersion",
"+",
"\").\"",
";",
"LOG",
".",
"error",
"(",
"msg",
")",
";",
"messages",
".",
"addMessage",
"(",
"new",
"Message",
"(",
"Message",
".",
"ERROR_MESSAGE",
",",
"msg",
")",
")",
";",
"}",
"setInitialised",
"(",
"true",
")",
";",
"}",
"}"
] | Override preparePaint in order to set up the resources on first access by a user.
@param request the request being responded to. | [
"Override",
"preparePaint",
"in",
"order",
"to",
"set",
"up",
"the",
"resources",
"on",
"first",
"access",
"by",
"a",
"user",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePicker.java#L79-L99 |
138,961 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WField.java | WField.setInputWidth | public void setInputWidth(final int inputWidth) {
if (inputWidth > 100) {
throw new IllegalArgumentException(
"inputWidth (" + inputWidth + ") cannot be greater than 100 percent.");
}
getOrCreateComponentModel().inputWidth = Math.max(0, inputWidth);
} | java | public void setInputWidth(final int inputWidth) {
if (inputWidth > 100) {
throw new IllegalArgumentException(
"inputWidth (" + inputWidth + ") cannot be greater than 100 percent.");
}
getOrCreateComponentModel().inputWidth = Math.max(0, inputWidth);
} | [
"public",
"void",
"setInputWidth",
"(",
"final",
"int",
"inputWidth",
")",
"{",
"if",
"(",
"inputWidth",
">",
"100",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"inputWidth (\"",
"+",
"inputWidth",
"+",
"\") cannot be greater than 100 percent.\"",
")",
";",
"}",
"getOrCreateComponentModel",
"(",
")",
".",
"inputWidth",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"inputWidth",
")",
";",
"}"
] | Sets the desired width of the input field, as a percentage of the available space.
@param inputWidth the percentage width, or <= 0 to use the default field width. | [
"Sets",
"the",
"desired",
"width",
"of",
"the",
"input",
"field",
"as",
"a",
"percentage",
"of",
"the",
"available",
"space",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WField.java#L260-L266 |
138,962 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePickerTree.java | ExamplePickerTree.setUp | private void setUp() {
addExamples("AJAX", ExampleData.AJAX_EXAMPLES);
addExamples("Form controls", ExampleData.FORM_CONTROLS);
addExamples("Feedback and indicators", ExampleData.FEEDBACK_AND_INDICATORS);
addExamples("Layout", ExampleData.LAYOUT_EXAMPLES);
addExamples("Menus", ExampleData.MENU_EXAMPLES);
addExamples("Links", ExampleData.LINK_EXAMPLES);
addExamples("Popups / dialogs", ExampleData.POPUP_EXAMPLES);
addExamples("Subordinate", ExampleData.SUBORDINATE_EXAMPLES);
addExamples("Tabs", ExampleData.TABSET_EXAMPLES);
addExamples("Tables", ExampleData.WTABLE_EXAMPLES);
addExamples("Validation", ExampleData.VALIDATION_EXAMPLES);
addExamples("Other examples (uncategorised)", ExampleData.MISC_EXAMPLES);
addExamples("DataTable (deprecated)", ExampleData.WDATATABLE_EXAMPLES);
} | java | private void setUp() {
addExamples("AJAX", ExampleData.AJAX_EXAMPLES);
addExamples("Form controls", ExampleData.FORM_CONTROLS);
addExamples("Feedback and indicators", ExampleData.FEEDBACK_AND_INDICATORS);
addExamples("Layout", ExampleData.LAYOUT_EXAMPLES);
addExamples("Menus", ExampleData.MENU_EXAMPLES);
addExamples("Links", ExampleData.LINK_EXAMPLES);
addExamples("Popups / dialogs", ExampleData.POPUP_EXAMPLES);
addExamples("Subordinate", ExampleData.SUBORDINATE_EXAMPLES);
addExamples("Tabs", ExampleData.TABSET_EXAMPLES);
addExamples("Tables", ExampleData.WTABLE_EXAMPLES);
addExamples("Validation", ExampleData.VALIDATION_EXAMPLES);
addExamples("Other examples (uncategorised)", ExampleData.MISC_EXAMPLES);
addExamples("DataTable (deprecated)", ExampleData.WDATATABLE_EXAMPLES);
} | [
"private",
"void",
"setUp",
"(",
")",
"{",
"addExamples",
"(",
"\"AJAX\"",
",",
"ExampleData",
".",
"AJAX_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Form controls\"",
",",
"ExampleData",
".",
"FORM_CONTROLS",
")",
";",
"addExamples",
"(",
"\"Feedback and indicators\"",
",",
"ExampleData",
".",
"FEEDBACK_AND_INDICATORS",
")",
";",
"addExamples",
"(",
"\"Layout\"",
",",
"ExampleData",
".",
"LAYOUT_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Menus\"",
",",
"ExampleData",
".",
"MENU_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Links\"",
",",
"ExampleData",
".",
"LINK_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Popups / dialogs\"",
",",
"ExampleData",
".",
"POPUP_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Subordinate\"",
",",
"ExampleData",
".",
"SUBORDINATE_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Tabs\"",
",",
"ExampleData",
".",
"TABSET_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Tables\"",
",",
"ExampleData",
".",
"WTABLE_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Validation\"",
",",
"ExampleData",
".",
"VALIDATION_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"Other examples (uncategorised)\"",
",",
"ExampleData",
".",
"MISC_EXAMPLES",
")",
";",
"addExamples",
"(",
"\"DataTable (deprecated)\"",
",",
"ExampleData",
".",
"WDATATABLE_EXAMPLES",
")",
";",
"}"
] | Add the examples as data in the tree. | [
"Add",
"the",
"examples",
"as",
"data",
"in",
"the",
"tree",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePickerTree.java#L37-L51 |
138,963 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePickerTree.java | ExamplePickerTree.addExamples | public void addExamples(final String groupName, final ExampleData[] entries) {
data.add(new ExampleMenuList(groupName, entries));
} | java | public void addExamples(final String groupName, final ExampleData[] entries) {
data.add(new ExampleMenuList(groupName, entries));
} | [
"public",
"void",
"addExamples",
"(",
"final",
"String",
"groupName",
",",
"final",
"ExampleData",
"[",
"]",
"entries",
")",
"{",
"data",
".",
"add",
"(",
"new",
"ExampleMenuList",
"(",
"groupName",
",",
"entries",
")",
")",
";",
"}"
] | Add a set of examples to the WTree.
@param groupName The name of the example group.
@param entries An array of examples in this group. | [
"Add",
"a",
"set",
"of",
"examples",
"to",
"the",
"WTree",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePickerTree.java#L67-L69 |
138,964 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePickerTree.java | ExamplePickerTree.getSelectedExampleData | public final ExampleData getSelectedExampleData() {
Set<String> allSelectedItems = getSelectedRows();
if (allSelectedItems == null || allSelectedItems.isEmpty()) {
return null;
}
for (String selectedItem : allSelectedItems) {
// Only interested in the first selected item as it is a single select list.
List<Integer> rowIndex = TreeItemUtil.rowIndexStringToList(selectedItem);
return getTreeModel().getExampleData(rowIndex);
}
return null;
} | java | public final ExampleData getSelectedExampleData() {
Set<String> allSelectedItems = getSelectedRows();
if (allSelectedItems == null || allSelectedItems.isEmpty()) {
return null;
}
for (String selectedItem : allSelectedItems) {
// Only interested in the first selected item as it is a single select list.
List<Integer> rowIndex = TreeItemUtil.rowIndexStringToList(selectedItem);
return getTreeModel().getExampleData(rowIndex);
}
return null;
} | [
"public",
"final",
"ExampleData",
"getSelectedExampleData",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"allSelectedItems",
"=",
"getSelectedRows",
"(",
")",
";",
"if",
"(",
"allSelectedItems",
"==",
"null",
"||",
"allSelectedItems",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"String",
"selectedItem",
":",
"allSelectedItems",
")",
"{",
"// Only interested in the first selected item as it is a single select list.",
"List",
"<",
"Integer",
">",
"rowIndex",
"=",
"TreeItemUtil",
".",
"rowIndexStringToList",
"(",
"selectedItem",
")",
";",
"return",
"getTreeModel",
"(",
")",
".",
"getExampleData",
"(",
"rowIndex",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Get the example which is selected in the tree.
@return an example data object. | [
"Get",
"the",
"example",
"which",
"is",
"selected",
"in",
"the",
"tree",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePickerTree.java#L76-L87 |
138,965 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePickerTree.java | ExamplePickerTree.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
setInitialised(true);
setTreeModel(new MenuTreeModel(data));
}
} | java | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
setInitialised(true);
setTreeModel(new MenuTreeModel(data));
}
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"preparePaintComponent",
"(",
"request",
")",
";",
"if",
"(",
"!",
"isInitialised",
"(",
")",
")",
"{",
"setInitialised",
"(",
"true",
")",
";",
"setTreeModel",
"(",
"new",
"MenuTreeModel",
"(",
"data",
")",
")",
";",
"}",
"}"
] | Set the tree model on first use.
@param request The request. | [
"Set",
"the",
"tree",
"model",
"on",
"first",
"use",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExamplePickerTree.java#L94-L101 |
138,966 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/BorderLayoutExample.java | BorderLayoutExample.createPanelWithText | private WPanel createPanelWithText(final String title, final String text) {
WPanel panel = new WPanel(WPanel.Type.CHROME);
panel.setTitleText(title);
WText textComponent = new WText(text);
textComponent.setEncodeText(false);
panel.add(textComponent);
return panel;
} | java | private WPanel createPanelWithText(final String title, final String text) {
WPanel panel = new WPanel(WPanel.Type.CHROME);
panel.setTitleText(title);
WText textComponent = new WText(text);
textComponent.setEncodeText(false);
panel.add(textComponent);
return panel;
} | [
"private",
"WPanel",
"createPanelWithText",
"(",
"final",
"String",
"title",
",",
"final",
"String",
"text",
")",
"{",
"WPanel",
"panel",
"=",
"new",
"WPanel",
"(",
"WPanel",
".",
"Type",
".",
"CHROME",
")",
";",
"panel",
".",
"setTitleText",
"(",
"title",
")",
";",
"WText",
"textComponent",
"=",
"new",
"WText",
"(",
"text",
")",
";",
"textComponent",
".",
"setEncodeText",
"(",
"false",
")",
";",
"panel",
".",
"add",
"(",
"textComponent",
")",
";",
"return",
"panel",
";",
"}"
] | Convenience method to create a WPanel with the given title and text.
@param title the panel title.
@param text the panel text.
@return a new WPanel with the given title and text. | [
"Convenience",
"method",
"to",
"create",
"a",
"WPanel",
"with",
"the",
"given",
"title",
"and",
"text",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/BorderLayoutExample.java#L148-L156 |
138,967 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validation/WValidationErrors.java | WValidationErrors.setErrors | public void setErrors(final List<Diagnostic> errors) {
if (errors != null) {
ValidationErrorsModel model = getOrCreateComponentModel();
for (Diagnostic error : errors) {
if (error.getSeverity() == Diagnostic.ERROR) {
model.errors.add(error);
}
}
}
} | java | public void setErrors(final List<Diagnostic> errors) {
if (errors != null) {
ValidationErrorsModel model = getOrCreateComponentModel();
for (Diagnostic error : errors) {
if (error.getSeverity() == Diagnostic.ERROR) {
model.errors.add(error);
}
}
}
} | [
"public",
"void",
"setErrors",
"(",
"final",
"List",
"<",
"Diagnostic",
">",
"errors",
")",
"{",
"if",
"(",
"errors",
"!=",
"null",
")",
"{",
"ValidationErrorsModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"for",
"(",
"Diagnostic",
"error",
":",
"errors",
")",
"{",
"if",
"(",
"error",
".",
"getSeverity",
"(",
")",
"==",
"Diagnostic",
".",
"ERROR",
")",
"{",
"model",
".",
"errors",
".",
"add",
"(",
"error",
")",
";",
"}",
"}",
"}",
"}"
] | Sets the errors for a given user.
@param errors the errors to set. | [
"Sets",
"the",
"errors",
"for",
"a",
"given",
"user",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validation/WValidationErrors.java#L46-L56 |
138,968 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validation/WValidationErrors.java | WValidationErrors.getGroupedErrors | public List<GroupedDiagnositcs> getGroupedErrors() {
List<GroupedDiagnositcs> grouped = new ArrayList<>();
Diagnostic previousError = null;
GroupedDiagnositcs group = null;
for (Diagnostic theError : getErrors()) {
boolean isNewField = ((previousError == null) || (previousError.getContext() != theError.
getContext())
|| (previousError.getComponent() != theError.getComponent()));
if (group == null || isNewField) {
group = new GroupedDiagnositcs();
grouped.add(group);
}
group.addDiagnostic(theError);
previousError = theError;
}
return Collections.unmodifiableList(grouped);
} | java | public List<GroupedDiagnositcs> getGroupedErrors() {
List<GroupedDiagnositcs> grouped = new ArrayList<>();
Diagnostic previousError = null;
GroupedDiagnositcs group = null;
for (Diagnostic theError : getErrors()) {
boolean isNewField = ((previousError == null) || (previousError.getContext() != theError.
getContext())
|| (previousError.getComponent() != theError.getComponent()));
if (group == null || isNewField) {
group = new GroupedDiagnositcs();
grouped.add(group);
}
group.addDiagnostic(theError);
previousError = theError;
}
return Collections.unmodifiableList(grouped);
} | [
"public",
"List",
"<",
"GroupedDiagnositcs",
">",
"getGroupedErrors",
"(",
")",
"{",
"List",
"<",
"GroupedDiagnositcs",
">",
"grouped",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Diagnostic",
"previousError",
"=",
"null",
";",
"GroupedDiagnositcs",
"group",
"=",
"null",
";",
"for",
"(",
"Diagnostic",
"theError",
":",
"getErrors",
"(",
")",
")",
"{",
"boolean",
"isNewField",
"=",
"(",
"(",
"previousError",
"==",
"null",
")",
"||",
"(",
"previousError",
".",
"getContext",
"(",
")",
"!=",
"theError",
".",
"getContext",
"(",
")",
")",
"||",
"(",
"previousError",
".",
"getComponent",
"(",
")",
"!=",
"theError",
".",
"getComponent",
"(",
")",
")",
")",
";",
"if",
"(",
"group",
"==",
"null",
"||",
"isNewField",
")",
"{",
"group",
"=",
"new",
"GroupedDiagnositcs",
"(",
")",
";",
"grouped",
".",
"add",
"(",
"group",
")",
";",
"}",
"group",
".",
"addDiagnostic",
"(",
"theError",
")",
";",
"previousError",
"=",
"theError",
";",
"}",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"grouped",
")",
";",
"}"
] | Groups the errors by their source field.
@return a list of grouped errors. | [
"Groups",
"the",
"errors",
"by",
"their",
"source",
"field",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validation/WValidationErrors.java#L82-L103 |
138,969 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDateFieldRenderer.java | WDateFieldRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDateField dateField = (WDateField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = dateField.isReadOnly();
Date date = dateField.getDate();
xml.appendTagOpen("ui:datefield");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", dateField.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
xml.appendOptionalAttribute("disabled", dateField.isDisabled(), "true");
xml.appendOptionalAttribute("required", dateField.isMandatory(), "true");
xml.appendOptionalAttribute("toolTip", dateField.getToolTip());
xml.appendOptionalAttribute("accessibleText", dateField.getAccessibleText());
WComponent submitControl = dateField.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
xml.appendOptionalAttribute("buttonId", submitControlId);
Date minDate = dateField.getMinDate();
Date maxDate = dateField.getMaxDate();
if (minDate != null) {
xml.appendAttribute("min", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(minDate));
}
if (maxDate != null) {
xml.appendAttribute("max", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(maxDate));
}
String autocomplete = dateField.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
}
if (date != null) {
xml.appendAttribute("date", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(date));
}
xml.appendClose();
if (date == null) {
xml.appendEscaped(dateField.getText());
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(dateField, renderContext);
}
xml.appendEndTag("ui:datefield");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDateField dateField = (WDateField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = dateField.isReadOnly();
Date date = dateField.getDate();
xml.appendTagOpen("ui:datefield");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", dateField.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
xml.appendOptionalAttribute("disabled", dateField.isDisabled(), "true");
xml.appendOptionalAttribute("required", dateField.isMandatory(), "true");
xml.appendOptionalAttribute("toolTip", dateField.getToolTip());
xml.appendOptionalAttribute("accessibleText", dateField.getAccessibleText());
WComponent submitControl = dateField.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
xml.appendOptionalAttribute("buttonId", submitControlId);
Date minDate = dateField.getMinDate();
Date maxDate = dateField.getMaxDate();
if (minDate != null) {
xml.appendAttribute("min", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(minDate));
}
if (maxDate != null) {
xml.appendAttribute("max", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(maxDate));
}
String autocomplete = dateField.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
}
if (date != null) {
xml.appendAttribute("date", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(date));
}
xml.appendClose();
if (date == null) {
xml.appendEscaped(dateField.getText());
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(dateField, renderContext);
}
xml.appendEndTag("ui:datefield");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WDateField",
"dateField",
"=",
"(",
"WDateField",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"boolean",
"readOnly",
"=",
"dateField",
".",
"isReadOnly",
"(",
")",
";",
"Date",
"date",
"=",
"dateField",
".",
"getDate",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:datefield\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"dateField",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"if",
"(",
"readOnly",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"readOnly\"",
",",
"\"true\"",
")",
";",
"}",
"else",
"{",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"disabled\"",
",",
"dateField",
".",
"isDisabled",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"required\"",
",",
"dateField",
".",
"isMandatory",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"toolTip\"",
",",
"dateField",
".",
"getToolTip",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"accessibleText\"",
",",
"dateField",
".",
"getAccessibleText",
"(",
")",
")",
";",
"WComponent",
"submitControl",
"=",
"dateField",
".",
"getDefaultSubmitButton",
"(",
")",
";",
"String",
"submitControlId",
"=",
"submitControl",
"==",
"null",
"?",
"null",
":",
"submitControl",
".",
"getId",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"buttonId\"",
",",
"submitControlId",
")",
";",
"Date",
"minDate",
"=",
"dateField",
".",
"getMinDate",
"(",
")",
";",
"Date",
"maxDate",
"=",
"dateField",
".",
"getMaxDate",
"(",
")",
";",
"if",
"(",
"minDate",
"!=",
"null",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"min\"",
",",
"new",
"SimpleDateFormat",
"(",
"INTERNAL_DATE_FORMAT",
")",
".",
"format",
"(",
"minDate",
")",
")",
";",
"}",
"if",
"(",
"maxDate",
"!=",
"null",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"max\"",
",",
"new",
"SimpleDateFormat",
"(",
"INTERNAL_DATE_FORMAT",
")",
".",
"format",
"(",
"maxDate",
")",
")",
";",
"}",
"String",
"autocomplete",
"=",
"dateField",
".",
"getAutocomplete",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"autocomplete\"",
",",
"!",
"Util",
".",
"empty",
"(",
"autocomplete",
")",
",",
"autocomplete",
")",
";",
"}",
"if",
"(",
"date",
"!=",
"null",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"date\"",
",",
"new",
"SimpleDateFormat",
"(",
"INTERNAL_DATE_FORMAT",
")",
".",
"format",
"(",
"date",
")",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"xml",
".",
"appendEscaped",
"(",
"dateField",
".",
"getText",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"readOnly",
")",
"{",
"DiagnosticRenderUtil",
".",
"renderDiagnostics",
"(",
"dateField",
",",
"renderContext",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:datefield\"",
")",
";",
"}"
] | Paints the given WDateField.
@param component the WDateField to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WDateField",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDateFieldRenderer.java#L31-L84 |
138,970 | podio/podio-java | src/main/java/com/podio/user/UserAPI.java | UserAPI.updateUser | public void updateUser(UserUpdate update) {
getResourceFactory().getApiResource("/user/")
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateUser(UserUpdate update) {
getResourceFactory().getApiResource("/user/")
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateUser",
"(",
"UserUpdate",
"update",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/user/\"",
")",
".",
"entity",
"(",
"update",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | Updates the active user. The old and new password can be left out, in
which case the password will not be changed. If the mail is changed, the
old password has to be supplied as well. | [
"Updates",
"the",
"active",
"user",
".",
"The",
"old",
"and",
"new",
"password",
"can",
"be",
"left",
"out",
"in",
"which",
"case",
"the",
"password",
"will",
"not",
"be",
"changed",
".",
"If",
"the",
"mail",
"is",
"changed",
"the",
"old",
"password",
"has",
"to",
"be",
"supplied",
"as",
"well",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/user/UserAPI.java#L31-L34 |
138,971 | podio/podio-java | src/main/java/com/podio/user/UserAPI.java | UserAPI.getProfileField | public <T, R> List<T> getProfileField(ProfileField<T, R> field) {
List<R> values = getResourceFactory().getApiResource(
"/user/profile/" + field.getName()).get(
new GenericType<List<R>>() {
});
List<T> formatted = new ArrayList<T>();
for (R value : values) {
formatted.add(field.parse(value));
}
return formatted;
} | java | public <T, R> List<T> getProfileField(ProfileField<T, R> field) {
List<R> values = getResourceFactory().getApiResource(
"/user/profile/" + field.getName()).get(
new GenericType<List<R>>() {
});
List<T> formatted = new ArrayList<T>();
for (R value : values) {
formatted.add(field.parse(value));
}
return formatted;
} | [
"public",
"<",
"T",
",",
"R",
">",
"List",
"<",
"T",
">",
"getProfileField",
"(",
"ProfileField",
"<",
"T",
",",
"R",
">",
"field",
")",
"{",
"List",
"<",
"R",
">",
"values",
"=",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/user/profile/\"",
"+",
"field",
".",
"getName",
"(",
")",
")",
".",
"get",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"R",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"List",
"<",
"T",
">",
"formatted",
"=",
"new",
"ArrayList",
"<",
"T",
">",
"(",
")",
";",
"for",
"(",
"R",
"value",
":",
"values",
")",
"{",
"formatted",
".",
"add",
"(",
"field",
".",
"parse",
"(",
"value",
")",
")",
";",
"}",
"return",
"formatted",
";",
"}"
] | Returns the field of the profile for the given key from the active user.
@param field
The field to return the values for
@return The values for the given field | [
"Returns",
"the",
"field",
"of",
"the",
"profile",
"for",
"the",
"given",
"key",
"from",
"the",
"active",
"user",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/user/UserAPI.java#L64-L76 |
138,972 | podio/podio-java | src/main/java/com/podio/user/UserAPI.java | UserAPI.updateProfile | public void updateProfile(ProfileUpdate profile) {
getResourceFactory().getApiResource("/user/profile/")
.entity(profile, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateProfile(ProfileUpdate profile) {
getResourceFactory().getApiResource("/user/profile/")
.entity(profile, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateProfile",
"(",
"ProfileUpdate",
"profile",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/user/profile/\"",
")",
".",
"entity",
"(",
"profile",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | Updates the fields of an existing profile. All fields must be filled out,
as any fields not included will not be part of the new revision.
@param profile
The updated profile | [
"Updates",
"the",
"fields",
"of",
"an",
"existing",
"profile",
".",
"All",
"fields",
"must",
"be",
"filled",
"out",
"as",
"any",
"fields",
"not",
"included",
"will",
"not",
"be",
"part",
"of",
"the",
"new",
"revision",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/user/UserAPI.java#L85-L88 |
138,973 | podio/podio-java | src/main/java/com/podio/user/UserAPI.java | UserAPI.updateProfile | public void updateProfile(ProfileFieldValues values) {
getResourceFactory().getApiResource("/user/profile/")
.entity(values, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateProfile(ProfileFieldValues values) {
getResourceFactory().getApiResource("/user/profile/")
.entity(values, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateProfile",
"(",
"ProfileFieldValues",
"values",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/user/profile/\"",
")",
".",
"entity",
"(",
"values",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | Updates the fields of an existing profile. Will only update the fields in
the values.
@param values
The updated values for the profile | [
"Updates",
"the",
"fields",
"of",
"an",
"existing",
"profile",
".",
"Will",
"only",
"update",
"the",
"fields",
"in",
"the",
"values",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/user/UserAPI.java#L151-L154 |
138,974 | podio/podio-java | src/main/java/com/podio/user/UserAPI.java | UserAPI.setProperty | public void setProperty(String key, boolean value) {
getResourceFactory()
.getApiResource("/user/property/" + key)
.entity(new PropertyValue(value),
MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void setProperty(String key, boolean value) {
getResourceFactory()
.getApiResource("/user/property/" + key)
.entity(new PropertyValue(value),
MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"setProperty",
"(",
"String",
"key",
",",
"boolean",
"value",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/user/property/\"",
"+",
"key",
")",
".",
"entity",
"(",
"new",
"PropertyValue",
"(",
"value",
")",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | Sets the value of the property for the active user with the given name.
The property is specific to the auth client used.
@param key
The key of the property
@param value
The value of the property | [
"Sets",
"the",
"value",
"of",
"the",
"property",
"for",
"the",
"active",
"user",
"with",
"the",
"given",
"name",
".",
"The",
"property",
"is",
"specific",
"to",
"the",
"auth",
"client",
"used",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/user/UserAPI.java#L186-L191 |
138,975 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractTreeTableDataModel.java | AbstractTreeTableDataModel.getNodeAtLine | @Override
public final TableTreeNode getNodeAtLine(final int row) {
TableTreeNode node = root.next(); // the root node is never used
for (int index = 0; node != null && index < row; index++) {
node = node.next();
}
return node;
} | java | @Override
public final TableTreeNode getNodeAtLine(final int row) {
TableTreeNode node = root.next(); // the root node is never used
for (int index = 0; node != null && index < row; index++) {
node = node.next();
}
return node;
} | [
"@",
"Override",
"public",
"final",
"TableTreeNode",
"getNodeAtLine",
"(",
"final",
"int",
"row",
")",
"{",
"TableTreeNode",
"node",
"=",
"root",
".",
"next",
"(",
")",
";",
"// the root node is never used",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"node",
"!=",
"null",
"&&",
"index",
"<",
"row",
";",
"index",
"++",
")",
"{",
"node",
"=",
"node",
".",
"next",
"(",
")",
";",
"}",
"return",
"node",
";",
"}"
] | Returns the node at the given line.
@param row the row index.
@return the node at the given line, or null if the index is out of bounds. | [
"Returns",
"the",
"node",
"at",
"the",
"given",
"line",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractTreeTableDataModel.java#L42-L51 |
138,976 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java | WMenu.handleRequest | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isPresent(request)) {
List<MenuItemSelectable> selectedItems = new ArrayList<>();
// Unfortunately, we need to recurse through all the menu/sub-menus
findSelections(request, this, selectedItems);
setSelectedMenuItems(selectedItems);
}
} | java | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isPresent(request)) {
List<MenuItemSelectable> selectedItems = new ArrayList<>();
// Unfortunately, we need to recurse through all the menu/sub-menus
findSelections(request, this, selectedItems);
setSelectedMenuItems(selectedItems);
}
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"// Protect against client-side tampering of disabled/read-only fields.",
"return",
";",
"}",
"if",
"(",
"isPresent",
"(",
"request",
")",
")",
"{",
"List",
"<",
"MenuItemSelectable",
">",
"selectedItems",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// Unfortunately, we need to recurse through all the menu/sub-menus",
"findSelections",
"(",
"request",
",",
"this",
",",
"selectedItems",
")",
";",
"setSelectedMenuItems",
"(",
"selectedItems",
")",
";",
"}",
"}"
] | Override handleRequest in order to perform processing specific to WMenu.
@param request the request being handled. | [
"Override",
"handleRequest",
"in",
"order",
"to",
"perform",
"processing",
"specific",
"to",
"WMenu",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java#L448-L461 |
138,977 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java | WMenu.findSelections | private void findSelections(final Request request, final MenuSelectContainer selectContainer,
final List<MenuItemSelectable> selections) {
// Don't bother checking disabled or invisible containers
if (!selectContainer.isVisible()
|| (selectContainer instanceof Disableable && ((Disableable) selectContainer).isDisabled())) {
return;
}
// Get any selectable children of this container
List<MenuItemSelectable> selectableItems = getSelectableItems(selectContainer);
// Now add the selections (if in the request)
for (MenuItemSelectable selectableItem : selectableItems) {
// Check if the item is on the request
if (request.getParameter(selectableItem.getId() + ".selected") != null) {
selections.add(selectableItem);
if (SelectionMode.SINGLE.equals(selectContainer.getSelectionMode())) {
// Only select the first item at this level.
// We still need to check other levels of the menu for selection.
break;
}
}
}
// We need to recurse through and check for other selectable containers
for (MenuItem item : selectContainer.getMenuItems()) {
if (item instanceof MenuItemGroup) {
for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
if (groupItem instanceof MenuSelectContainer) {
findSelections(request, (MenuSelectContainer) groupItem, selections);
}
}
} else if (item instanceof MenuSelectContainer) {
findSelections(request, (MenuSelectContainer) item, selections);
}
}
} | java | private void findSelections(final Request request, final MenuSelectContainer selectContainer,
final List<MenuItemSelectable> selections) {
// Don't bother checking disabled or invisible containers
if (!selectContainer.isVisible()
|| (selectContainer instanceof Disableable && ((Disableable) selectContainer).isDisabled())) {
return;
}
// Get any selectable children of this container
List<MenuItemSelectable> selectableItems = getSelectableItems(selectContainer);
// Now add the selections (if in the request)
for (MenuItemSelectable selectableItem : selectableItems) {
// Check if the item is on the request
if (request.getParameter(selectableItem.getId() + ".selected") != null) {
selections.add(selectableItem);
if (SelectionMode.SINGLE.equals(selectContainer.getSelectionMode())) {
// Only select the first item at this level.
// We still need to check other levels of the menu for selection.
break;
}
}
}
// We need to recurse through and check for other selectable containers
for (MenuItem item : selectContainer.getMenuItems()) {
if (item instanceof MenuItemGroup) {
for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
if (groupItem instanceof MenuSelectContainer) {
findSelections(request, (MenuSelectContainer) groupItem, selections);
}
}
} else if (item instanceof MenuSelectContainer) {
findSelections(request, (MenuSelectContainer) item, selections);
}
}
} | [
"private",
"void",
"findSelections",
"(",
"final",
"Request",
"request",
",",
"final",
"MenuSelectContainer",
"selectContainer",
",",
"final",
"List",
"<",
"MenuItemSelectable",
">",
"selections",
")",
"{",
"// Don't bother checking disabled or invisible containers",
"if",
"(",
"!",
"selectContainer",
".",
"isVisible",
"(",
")",
"||",
"(",
"selectContainer",
"instanceof",
"Disableable",
"&&",
"(",
"(",
"Disableable",
")",
"selectContainer",
")",
".",
"isDisabled",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"// Get any selectable children of this container",
"List",
"<",
"MenuItemSelectable",
">",
"selectableItems",
"=",
"getSelectableItems",
"(",
"selectContainer",
")",
";",
"// Now add the selections (if in the request)",
"for",
"(",
"MenuItemSelectable",
"selectableItem",
":",
"selectableItems",
")",
"{",
"// Check if the item is on the request",
"if",
"(",
"request",
".",
"getParameter",
"(",
"selectableItem",
".",
"getId",
"(",
")",
"+",
"\".selected\"",
")",
"!=",
"null",
")",
"{",
"selections",
".",
"add",
"(",
"selectableItem",
")",
";",
"if",
"(",
"SelectionMode",
".",
"SINGLE",
".",
"equals",
"(",
"selectContainer",
".",
"getSelectionMode",
"(",
")",
")",
")",
"{",
"// Only select the first item at this level.",
"// We still need to check other levels of the menu for selection.",
"break",
";",
"}",
"}",
"}",
"// We need to recurse through and check for other selectable containers",
"for",
"(",
"MenuItem",
"item",
":",
"selectContainer",
".",
"getMenuItems",
"(",
")",
")",
"{",
"if",
"(",
"item",
"instanceof",
"MenuItemGroup",
")",
"{",
"for",
"(",
"MenuItem",
"groupItem",
":",
"(",
"(",
"MenuItemGroup",
")",
"item",
")",
".",
"getMenuItems",
"(",
")",
")",
"{",
"if",
"(",
"groupItem",
"instanceof",
"MenuSelectContainer",
")",
"{",
"findSelections",
"(",
"request",
",",
"(",
"MenuSelectContainer",
")",
"groupItem",
",",
"selections",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"item",
"instanceof",
"MenuSelectContainer",
")",
"{",
"findSelections",
"(",
"request",
",",
"(",
"MenuSelectContainer",
")",
"item",
",",
"selections",
")",
";",
"}",
"}",
"}"
] | Finds the selected items in a menu for a request.
@param request the request being handled
@param selectContainer the menu or sub-menu
@param selections the current set of selections | [
"Finds",
"the",
"selected",
"items",
"in",
"a",
"menu",
"for",
"a",
"request",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java#L496-L533 |
138,978 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java | WMenu.getSelectableItems | private List<MenuItemSelectable> getSelectableItems(final MenuSelectContainer selectContainer) {
List<MenuItemSelectable> result = new ArrayList<>(selectContainer.getMenuItems().size());
SelectionMode selectionMode = selectContainer.getSelectionMode();
for (MenuItem item : selectContainer.getMenuItems()) {
if (item instanceof MenuItemGroup) {
for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
if (isSelectable(groupItem, selectionMode)) {
result.add((MenuItemSelectable) groupItem);
}
}
} else if (isSelectable(item, selectionMode)) {
result.add((MenuItemSelectable) item);
}
}
return result;
} | java | private List<MenuItemSelectable> getSelectableItems(final MenuSelectContainer selectContainer) {
List<MenuItemSelectable> result = new ArrayList<>(selectContainer.getMenuItems().size());
SelectionMode selectionMode = selectContainer.getSelectionMode();
for (MenuItem item : selectContainer.getMenuItems()) {
if (item instanceof MenuItemGroup) {
for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
if (isSelectable(groupItem, selectionMode)) {
result.add((MenuItemSelectable) groupItem);
}
}
} else if (isSelectable(item, selectionMode)) {
result.add((MenuItemSelectable) item);
}
}
return result;
} | [
"private",
"List",
"<",
"MenuItemSelectable",
">",
"getSelectableItems",
"(",
"final",
"MenuSelectContainer",
"selectContainer",
")",
"{",
"List",
"<",
"MenuItemSelectable",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"selectContainer",
".",
"getMenuItems",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"SelectionMode",
"selectionMode",
"=",
"selectContainer",
".",
"getSelectionMode",
"(",
")",
";",
"for",
"(",
"MenuItem",
"item",
":",
"selectContainer",
".",
"getMenuItems",
"(",
")",
")",
"{",
"if",
"(",
"item",
"instanceof",
"MenuItemGroup",
")",
"{",
"for",
"(",
"MenuItem",
"groupItem",
":",
"(",
"(",
"MenuItemGroup",
")",
"item",
")",
".",
"getMenuItems",
"(",
")",
")",
"{",
"if",
"(",
"isSelectable",
"(",
"groupItem",
",",
"selectionMode",
")",
")",
"{",
"result",
".",
"add",
"(",
"(",
"MenuItemSelectable",
")",
"groupItem",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"isSelectable",
"(",
"item",
",",
"selectionMode",
")",
")",
"{",
"result",
".",
"add",
"(",
"(",
"MenuItemSelectable",
")",
"item",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Retrieves the selectable items for the given container.
@param selectContainer the component to search within.
@return the list of selectable items for the given component. May be empty. | [
"Retrieves",
"the",
"selectable",
"items",
"for",
"the",
"given",
"container",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java#L541-L559 |
138,979 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java | WMenu.isSelectable | private boolean isSelectable(final MenuItem item, final SelectionMode selectionMode) {
if (!(item instanceof MenuItemSelectable) || !item.isVisible()
|| (item instanceof Disableable && ((Disableable) item).isDisabled())) {
return false;
}
// SubMenus are only selectable in a column menu type
if (item instanceof WSubMenu && !MenuType.COLUMN.equals(getType())) {
return false;
}
// Item is specificially set to selectable/unselectable
Boolean itemSelectable = ((MenuItemSelectable) item).getSelectability();
if (itemSelectable != null) {
return itemSelectable;
}
// Container has selection turned on
return SelectionMode.SINGLE.equals(selectionMode) || SelectionMode.MULTIPLE.equals(selectionMode);
} | java | private boolean isSelectable(final MenuItem item, final SelectionMode selectionMode) {
if (!(item instanceof MenuItemSelectable) || !item.isVisible()
|| (item instanceof Disableable && ((Disableable) item).isDisabled())) {
return false;
}
// SubMenus are only selectable in a column menu type
if (item instanceof WSubMenu && !MenuType.COLUMN.equals(getType())) {
return false;
}
// Item is specificially set to selectable/unselectable
Boolean itemSelectable = ((MenuItemSelectable) item).getSelectability();
if (itemSelectable != null) {
return itemSelectable;
}
// Container has selection turned on
return SelectionMode.SINGLE.equals(selectionMode) || SelectionMode.MULTIPLE.equals(selectionMode);
} | [
"private",
"boolean",
"isSelectable",
"(",
"final",
"MenuItem",
"item",
",",
"final",
"SelectionMode",
"selectionMode",
")",
"{",
"if",
"(",
"!",
"(",
"item",
"instanceof",
"MenuItemSelectable",
")",
"||",
"!",
"item",
".",
"isVisible",
"(",
")",
"||",
"(",
"item",
"instanceof",
"Disableable",
"&&",
"(",
"(",
"Disableable",
")",
"item",
")",
".",
"isDisabled",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"// SubMenus are only selectable in a column menu type",
"if",
"(",
"item",
"instanceof",
"WSubMenu",
"&&",
"!",
"MenuType",
".",
"COLUMN",
".",
"equals",
"(",
"getType",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Item is specificially set to selectable/unselectable",
"Boolean",
"itemSelectable",
"=",
"(",
"(",
"MenuItemSelectable",
")",
"item",
")",
".",
"getSelectability",
"(",
")",
";",
"if",
"(",
"itemSelectable",
"!=",
"null",
")",
"{",
"return",
"itemSelectable",
";",
"}",
"// Container has selection turned on",
"return",
"SelectionMode",
".",
"SINGLE",
".",
"equals",
"(",
"selectionMode",
")",
"||",
"SelectionMode",
".",
"MULTIPLE",
".",
"equals",
"(",
"selectionMode",
")",
";",
"}"
] | Indicates whether the given menu item is selectable.
@param item the menu item to check.
@param selectionMode the select mode of the current menu/sub-menu
@return true if the meu item is selectable, false otherwise. | [
"Indicates",
"whether",
"the",
"given",
"menu",
"item",
"is",
"selectable",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java#L568-L589 |
138,980 | ebean-orm/ebean-querybean | src/main/java/io/ebean/typequery/PBaseValueEqual.java | PBaseValueEqual.in | @SafeVarargs
public final R in(T... values) {
expr().in(_name, (Object[]) values);
return _root;
} | java | @SafeVarargs
public final R in(T... values) {
expr().in(_name, (Object[]) values);
return _root;
} | [
"@",
"SafeVarargs",
"public",
"final",
"R",
"in",
"(",
"T",
"...",
"values",
")",
"{",
"expr",
"(",
")",
".",
"in",
"(",
"_name",
",",
"(",
"Object",
"[",
"]",
")",
"values",
")",
";",
"return",
"_root",
";",
"}"
] | Is in a list of values.
@param values the list of values for the predicate
@return the root query bean instance | [
"Is",
"in",
"a",
"list",
"of",
"values",
"."
] | 821650cb817c9c0fdcc97f93408dc79170b12423 | https://github.com/ebean-orm/ebean-querybean/blob/821650cb817c9c0fdcc97f93408dc79170b12423/src/main/java/io/ebean/typequery/PBaseValueEqual.java#L111-L115 |
138,981 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/AbstractSearchReplaceWriter.java | AbstractSearchReplaceWriter.write | @Override
public void write(final char[] cbuf, final int off, final int len) throws IOException {
if (buffer == null) {
// Nothing to replace, just pass the data through
backing.write(cbuf, off, len);
} else {
for (int i = off; i < off + len; i++) {
buffer[bufferLen++] = cbuf[i];
if (bufferLen == buffer.length) {
writeBuf(buffer.length / 2);
}
}
}
} | java | @Override
public void write(final char[] cbuf, final int off, final int len) throws IOException {
if (buffer == null) {
// Nothing to replace, just pass the data through
backing.write(cbuf, off, len);
} else {
for (int i = off; i < off + len; i++) {
buffer[bufferLen++] = cbuf[i];
if (bufferLen == buffer.length) {
writeBuf(buffer.length / 2);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"final",
"char",
"[",
"]",
"cbuf",
",",
"final",
"int",
"off",
",",
"final",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"// Nothing to replace, just pass the data through",
"backing",
".",
"write",
"(",
"cbuf",
",",
"off",
",",
"len",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"off",
";",
"i",
"<",
"off",
"+",
"len",
";",
"i",
"++",
")",
"{",
"buffer",
"[",
"bufferLen",
"++",
"]",
"=",
"cbuf",
"[",
"i",
"]",
";",
"if",
"(",
"bufferLen",
"==",
"buffer",
".",
"length",
")",
"{",
"writeBuf",
"(",
"buffer",
".",
"length",
"/",
"2",
")",
";",
"}",
"}",
"}",
"}"
] | Implementation of Writer's write method.
@param cbuf the character buffer to write.
@param off the start position in the array to write from.
@param len the amount of character data to write.
@throws IOException if there is an error writing to the underlying buffer. | [
"Implementation",
"of",
"Writer",
"s",
"write",
"method",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/AbstractSearchReplaceWriter.java#L111-L125 |
138,982 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/AbstractSearchReplaceWriter.java | AbstractSearchReplaceWriter.writeBuf | private void writeBuf(final int endPos) throws IOException {
// If the stream is not closed, we only process half the buffer at once.
String searchTerm;
int pos = 0;
int lastWritePos = 0;
while (pos < endPos) {
searchTerm = findSearchStrings(pos);
if (searchTerm != null) {
if (lastWritePos != pos) {
backing.write(buffer, lastWritePos, pos - lastWritePos);
}
doReplace(searchTerm, backing);
pos += searchTerm.length();
lastWritePos = pos;
} else {
pos++;
}
}
// Write the remaining characters that weren't matched
if (lastWritePos != pos) {
backing.write(buffer, lastWritePos, pos - lastWritePos);
}
// Shuffle the buffer
System.arraycopy(buffer, pos, buffer, 0, buffer.length - pos);
bufferLen -= pos;
} | java | private void writeBuf(final int endPos) throws IOException {
// If the stream is not closed, we only process half the buffer at once.
String searchTerm;
int pos = 0;
int lastWritePos = 0;
while (pos < endPos) {
searchTerm = findSearchStrings(pos);
if (searchTerm != null) {
if (lastWritePos != pos) {
backing.write(buffer, lastWritePos, pos - lastWritePos);
}
doReplace(searchTerm, backing);
pos += searchTerm.length();
lastWritePos = pos;
} else {
pos++;
}
}
// Write the remaining characters that weren't matched
if (lastWritePos != pos) {
backing.write(buffer, lastWritePos, pos - lastWritePos);
}
// Shuffle the buffer
System.arraycopy(buffer, pos, buffer, 0, buffer.length - pos);
bufferLen -= pos;
} | [
"private",
"void",
"writeBuf",
"(",
"final",
"int",
"endPos",
")",
"throws",
"IOException",
"{",
"// If the stream is not closed, we only process half the buffer at once.",
"String",
"searchTerm",
";",
"int",
"pos",
"=",
"0",
";",
"int",
"lastWritePos",
"=",
"0",
";",
"while",
"(",
"pos",
"<",
"endPos",
")",
"{",
"searchTerm",
"=",
"findSearchStrings",
"(",
"pos",
")",
";",
"if",
"(",
"searchTerm",
"!=",
"null",
")",
"{",
"if",
"(",
"lastWritePos",
"!=",
"pos",
")",
"{",
"backing",
".",
"write",
"(",
"buffer",
",",
"lastWritePos",
",",
"pos",
"-",
"lastWritePos",
")",
";",
"}",
"doReplace",
"(",
"searchTerm",
",",
"backing",
")",
";",
"pos",
"+=",
"searchTerm",
".",
"length",
"(",
")",
";",
"lastWritePos",
"=",
"pos",
";",
"}",
"else",
"{",
"pos",
"++",
";",
"}",
"}",
"// Write the remaining characters that weren't matched",
"if",
"(",
"lastWritePos",
"!=",
"pos",
")",
"{",
"backing",
".",
"write",
"(",
"buffer",
",",
"lastWritePos",
",",
"pos",
"-",
"lastWritePos",
")",
";",
"}",
"// Shuffle the buffer",
"System",
".",
"arraycopy",
"(",
"buffer",
",",
"pos",
",",
"buffer",
",",
"0",
",",
"buffer",
".",
"length",
"-",
"pos",
")",
";",
"bufferLen",
"-=",
"pos",
";",
"}"
] | Writes the current contents of the buffer, up to the given position. More data may be written from the buffer
when there is a search string that crosses over endPos.
@param endPos the end position to stop writing
@throws IOException if there is an error writing to the underlying writer. | [
"Writes",
"the",
"current",
"contents",
"of",
"the",
"buffer",
"up",
"to",
"the",
"given",
"position",
".",
"More",
"data",
"may",
"be",
"written",
"from",
"the",
"buffer",
"when",
"there",
"is",
"a",
"search",
"string",
"that",
"crosses",
"over",
"endPos",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/AbstractSearchReplaceWriter.java#L134-L164 |
138,983 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/AbstractSearchReplaceWriter.java | AbstractSearchReplaceWriter.findSearchStrings | private String findSearchStrings(final int start) {
String longestMatch = null;
// Loop for each string
for (int i = 0; i < search.length; i++) {
// No point checking a String that's too long
if (start + search[i].length() > bufferLen) {
continue;
}
boolean found = true;
// Loop for each character in range
for (int j = 0; j < search[i].length() && (start + j < bufferLen); j++) {
int diff = buffer[start + j] - search[i].charAt(j);
if (diff < 0) {
// Since the strings are all sorted, we can abort if
// the character is less than the corresponding character in
// the current search string.
return longestMatch;
} else if (diff != 0) {
found = false;
break;
}
}
if (found && (longestMatch == null || longestMatch.length() < search[i].length())) {
longestMatch = search[i];
}
}
return longestMatch;
} | java | private String findSearchStrings(final int start) {
String longestMatch = null;
// Loop for each string
for (int i = 0; i < search.length; i++) {
// No point checking a String that's too long
if (start + search[i].length() > bufferLen) {
continue;
}
boolean found = true;
// Loop for each character in range
for (int j = 0; j < search[i].length() && (start + j < bufferLen); j++) {
int diff = buffer[start + j] - search[i].charAt(j);
if (diff < 0) {
// Since the strings are all sorted, we can abort if
// the character is less than the corresponding character in
// the current search string.
return longestMatch;
} else if (diff != 0) {
found = false;
break;
}
}
if (found && (longestMatch == null || longestMatch.length() < search[i].length())) {
longestMatch = search[i];
}
}
return longestMatch;
} | [
"private",
"String",
"findSearchStrings",
"(",
"final",
"int",
"start",
")",
"{",
"String",
"longestMatch",
"=",
"null",
";",
"// Loop for each string",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"search",
".",
"length",
";",
"i",
"++",
")",
"{",
"// No point checking a String that's too long",
"if",
"(",
"start",
"+",
"search",
"[",
"i",
"]",
".",
"length",
"(",
")",
">",
"bufferLen",
")",
"{",
"continue",
";",
"}",
"boolean",
"found",
"=",
"true",
";",
"// Loop for each character in range",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"search",
"[",
"i",
"]",
".",
"length",
"(",
")",
"&&",
"(",
"start",
"+",
"j",
"<",
"bufferLen",
")",
";",
"j",
"++",
")",
"{",
"int",
"diff",
"=",
"buffer",
"[",
"start",
"+",
"j",
"]",
"-",
"search",
"[",
"i",
"]",
".",
"charAt",
"(",
"j",
")",
";",
"if",
"(",
"diff",
"<",
"0",
")",
"{",
"// Since the strings are all sorted, we can abort if",
"// the character is less than the corresponding character in",
"// the current search string.",
"return",
"longestMatch",
";",
"}",
"else",
"if",
"(",
"diff",
"!=",
"0",
")",
"{",
"found",
"=",
"false",
";",
"break",
";",
"}",
"}",
"if",
"(",
"found",
"&&",
"(",
"longestMatch",
"==",
"null",
"||",
"longestMatch",
".",
"length",
"(",
")",
"<",
"search",
"[",
"i",
"]",
".",
"length",
"(",
")",
")",
")",
"{",
"longestMatch",
"=",
"search",
"[",
"i",
"]",
";",
"}",
"}",
"return",
"longestMatch",
";",
"}"
] | Searches for any search strings in the buffer that start between the specified offsets.
@param start the start search offset
@return the first search String found, or null if none were found. | [
"Searches",
"for",
"any",
"search",
"strings",
"in",
"the",
"buffer",
"that",
"start",
"between",
"the",
"specified",
"offsets",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/AbstractSearchReplaceWriter.java#L173-L206 |
138,984 | podio/podio-java | src/main/java/com/podio/status/StatusAPI.java | StatusAPI.createStatus | public int createStatus(int spaceId, StatusCreate status) {
return getResourceFactory()
.getApiResource("/status/space/" + spaceId + "/")
.entity(status, MediaType.APPLICATION_JSON_TYPE)
.post(StatusCreateResponse.class).getId();
} | java | public int createStatus(int spaceId, StatusCreate status) {
return getResourceFactory()
.getApiResource("/status/space/" + spaceId + "/")
.entity(status, MediaType.APPLICATION_JSON_TYPE)
.post(StatusCreateResponse.class).getId();
} | [
"public",
"int",
"createStatus",
"(",
"int",
"spaceId",
",",
"StatusCreate",
"status",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/status/space/\"",
"+",
"spaceId",
"+",
"\"/\"",
")",
".",
"entity",
"(",
"status",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"post",
"(",
"StatusCreateResponse",
".",
"class",
")",
".",
"getId",
"(",
")",
";",
"}"
] | Creates a new status message for a user on a specific space. A status
update is simply a short text message that the user wishes to share with
the rest of the space.
@param status
The data for the new status message
@return The id of the newly created status message | [
"Creates",
"a",
"new",
"status",
"message",
"for",
"a",
"user",
"on",
"a",
"specific",
"space",
".",
"A",
"status",
"update",
"is",
"simply",
"a",
"short",
"text",
"message",
"that",
"the",
"user",
"wishes",
"to",
"share",
"with",
"the",
"rest",
"of",
"the",
"space",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/status/StatusAPI.java#L32-L37 |
138,985 | podio/podio-java | src/main/java/com/podio/status/StatusAPI.java | StatusAPI.updateStatus | public void updateStatus(int statusId, StatusUpdate update) {
getResourceFactory().getApiResource("/status/" + statusId)
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | java | public void updateStatus(int statusId, StatusUpdate update) {
getResourceFactory().getApiResource("/status/" + statusId)
.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
} | [
"public",
"void",
"updateStatus",
"(",
"int",
"statusId",
",",
"StatusUpdate",
"update",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/status/\"",
"+",
"statusId",
")",
".",
"entity",
"(",
"update",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] | This will update an existing status message. This will normally only be
used to correct spelling and grammatical mistakes.
@param statusId
The id of the status to be updated
@param update
The new data for the status | [
"This",
"will",
"update",
"an",
"existing",
"status",
"message",
".",
"This",
"will",
"normally",
"only",
"be",
"used",
"to",
"correct",
"spelling",
"and",
"grammatical",
"mistakes",
"."
] | a520b23bac118c957ce02cdd8ff42a6c7d17b49a | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/status/StatusAPI.java#L73-L76 |
138,986 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/registry/UIRegistryClassLoaderImpl.java | UIRegistryClassLoaderImpl.register | @Override
public synchronized void register(final String key, final WComponent ui) {
if (isRegistered(key)) {
throw new SystemException("Cannot re-register a component. Key = " + key);
}
registry.put(key, ui);
} | java | @Override
public synchronized void register(final String key, final WComponent ui) {
if (isRegistered(key)) {
throw new SystemException("Cannot re-register a component. Key = " + key);
}
registry.put(key, ui);
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"register",
"(",
"final",
"String",
"key",
",",
"final",
"WComponent",
"ui",
")",
"{",
"if",
"(",
"isRegistered",
"(",
"key",
")",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"Cannot re-register a component. Key = \"",
"+",
"key",
")",
";",
"}",
"registry",
".",
"put",
"(",
"key",
",",
"ui",
")",
";",
"}"
] | Registers the given user interface with the given key.
@param key the registration key.
@param ui the user interface to register. | [
"Registers",
"the",
"given",
"user",
"interface",
"with",
"the",
"given",
"key",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/registry/UIRegistryClassLoaderImpl.java#L34-L41 |
138,987 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/registry/UIRegistryClassLoaderImpl.java | UIRegistryClassLoaderImpl.loadUI | private static Object loadUI(final String key) {
String classname = key.trim();
try {
Class<?> clas = Class.forName(classname);
if (WComponent.class.isAssignableFrom(clas)) {
Object instance = clas.newInstance();
LOG.debug("WComponent successfully loaded with class name \"" + classname + "\".");
return instance;
} else {
LOG.error("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);
}
return Boolean.FALSE;
} | java | private static Object loadUI(final String key) {
String classname = key.trim();
try {
Class<?> clas = Class.forName(classname);
if (WComponent.class.isAssignableFrom(clas)) {
Object instance = clas.newInstance();
LOG.debug("WComponent successfully loaded with class name \"" + classname + "\".");
return instance;
} else {
LOG.error("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);
}
return Boolean.FALSE;
} | [
"private",
"static",
"Object",
"loadUI",
"(",
"final",
"String",
"key",
")",
"{",
"String",
"classname",
"=",
"key",
".",
"trim",
"(",
")",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"clas",
"=",
"Class",
".",
"forName",
"(",
"classname",
")",
";",
"if",
"(",
"WComponent",
".",
"class",
".",
"isAssignableFrom",
"(",
"clas",
")",
")",
"{",
"Object",
"instance",
"=",
"clas",
".",
"newInstance",
"(",
")",
";",
"LOG",
".",
"debug",
"(",
"\"WComponent successfully loaded with class name \\\"\"",
"+",
"classname",
"+",
"\"\\\".\"",
")",
";",
"return",
"instance",
";",
"}",
"else",
"{",
"LOG",
".",
"error",
"(",
"\"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",
")",
";",
"}",
"return",
"Boolean",
".",
"FALSE",
";",
"}"
] | Attemps 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 it returns Boolean.FALSE. | [
"Attemps",
"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/UIRegistryClassLoaderImpl.java#L92-L111 |
138,988 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WComponentGroupRenderer.java | WComponentGroupRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WComponentGroup group = (WComponentGroup) component;
XmlStringBuilder xml = renderContext.getWriter();
List<WComponent> components = group.getComponents();
if (components != null && !components.isEmpty()) {
xml.appendTagOpen("ui:componentGroup");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendClose();
for (WComponent comp : components) {
xml.appendTagOpen("ui:component");
xml.appendAttribute("id", comp.getId());
xml.appendEnd();
}
xml.appendEndTag("ui:componentGroup");
}
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WComponentGroup group = (WComponentGroup) component;
XmlStringBuilder xml = renderContext.getWriter();
List<WComponent> components = group.getComponents();
if (components != null && !components.isEmpty()) {
xml.appendTagOpen("ui:componentGroup");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendClose();
for (WComponent comp : components) {
xml.appendTagOpen("ui:component");
xml.appendAttribute("id", comp.getId());
xml.appendEnd();
}
xml.appendEndTag("ui:componentGroup");
}
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WComponentGroup",
"group",
"=",
"(",
"WComponentGroup",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"List",
"<",
"WComponent",
">",
"components",
"=",
"group",
".",
"getComponents",
"(",
")",
";",
"if",
"(",
"components",
"!=",
"null",
"&&",
"!",
"components",
".",
"isEmpty",
"(",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:componentGroup\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"for",
"(",
"WComponent",
"comp",
":",
"components",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:component\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"comp",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendEnd",
"(",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:componentGroup\"",
")",
";",
"}",
"}"
] | Paints the given WComponentGroup.
@param component the WComponentGroup to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WComponentGroup",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WComponentGroupRenderer.java#L23-L43 |
138,989 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSectionRenderer.java | WSectionRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WSection section = (WSection) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean renderChildren = isRenderContent(section);
xml.appendTagOpen("ui:section");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
if (SectionMode.LAZY.equals(section.getMode())) {
xml.appendOptionalAttribute("hidden", !renderChildren, "true");
} else {
xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
}
SectionMode mode = section.getMode();
if (mode != null) {
switch (mode) {
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
case EAGER:
xml.appendAttribute("mode", "eager");
break;
default:
throw new SystemException("Unknown section mode: " + section.getMode());
}
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(section, renderContext);
if (renderChildren) {
// Label
section.getDecoratedLabel().paint(renderContext);
// Content
section.getContent().paint(renderContext);
}
xml.appendEndTag("ui:section");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WSection section = (WSection) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean renderChildren = isRenderContent(section);
xml.appendTagOpen("ui:section");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
if (SectionMode.LAZY.equals(section.getMode())) {
xml.appendOptionalAttribute("hidden", !renderChildren, "true");
} else {
xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
}
SectionMode mode = section.getMode();
if (mode != null) {
switch (mode) {
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
case EAGER:
xml.appendAttribute("mode", "eager");
break;
default:
throw new SystemException("Unknown section mode: " + section.getMode());
}
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(section, renderContext);
if (renderChildren) {
// Label
section.getDecoratedLabel().paint(renderContext);
// Content
section.getContent().paint(renderContext);
}
xml.appendEndTag("ui:section");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WSection",
"section",
"=",
"(",
"WSection",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"boolean",
"renderChildren",
"=",
"isRenderContent",
"(",
"section",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:section\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"if",
"(",
"SectionMode",
".",
"LAZY",
".",
"equals",
"(",
"section",
".",
"getMode",
"(",
")",
")",
")",
"{",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"!",
"renderChildren",
",",
"\"true\"",
")",
";",
"}",
"else",
"{",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"component",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"}",
"SectionMode",
"mode",
"=",
"section",
".",
"getMode",
"(",
")",
";",
"if",
"(",
"mode",
"!=",
"null",
")",
"{",
"switch",
"(",
"mode",
")",
"{",
"case",
"LAZY",
":",
"xml",
".",
"appendAttribute",
"(",
"\"mode\"",
",",
"\"lazy\"",
")",
";",
"break",
";",
"case",
"EAGER",
":",
"xml",
".",
"appendAttribute",
"(",
"\"mode\"",
",",
"\"eager\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown section mode: \"",
"+",
"section",
".",
"getMode",
"(",
")",
")",
";",
"}",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"// Render margin",
"MarginRendererUtil",
".",
"renderMargin",
"(",
"section",
",",
"renderContext",
")",
";",
"if",
"(",
"renderChildren",
")",
"{",
"// Label",
"section",
".",
"getDecoratedLabel",
"(",
")",
".",
"paint",
"(",
"renderContext",
")",
";",
"// Content",
"section",
".",
"getContent",
"(",
")",
".",
"paint",
"(",
"renderContext",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:section\"",
")",
";",
"}"
] | Paints the given WSection.
@param component the WSection to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WSection",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSectionRenderer.java#L25-L69 |
138,990 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPanel.java | WPanel.remove | @Override
public void remove(final WComponent aChild) {
super.remove(aChild);
PanelModel model = getOrCreateComponentModel();
if (model.layoutConstraints == null) {
Map<WComponent, Serializable> defaultConstraints = ((PanelModel) getDefaultModel()).layoutConstraints;
if (defaultConstraints != null) {
model.layoutConstraints = new HashMap<>(defaultConstraints);
}
}
if (model.layoutConstraints != null) {
model.layoutConstraints.remove(aChild);
// Deallocate constraints list if possible, to reduce session size.
if (model.layoutConstraints.isEmpty()) {
model.layoutConstraints = null;
}
}
} | java | @Override
public void remove(final WComponent aChild) {
super.remove(aChild);
PanelModel model = getOrCreateComponentModel();
if (model.layoutConstraints == null) {
Map<WComponent, Serializable> defaultConstraints = ((PanelModel) getDefaultModel()).layoutConstraints;
if (defaultConstraints != null) {
model.layoutConstraints = new HashMap<>(defaultConstraints);
}
}
if (model.layoutConstraints != null) {
model.layoutConstraints.remove(aChild);
// Deallocate constraints list if possible, to reduce session size.
if (model.layoutConstraints.isEmpty()) {
model.layoutConstraints = null;
}
}
} | [
"@",
"Override",
"public",
"void",
"remove",
"(",
"final",
"WComponent",
"aChild",
")",
"{",
"super",
".",
"remove",
"(",
"aChild",
")",
";",
"PanelModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"layoutConstraints",
"==",
"null",
")",
"{",
"Map",
"<",
"WComponent",
",",
"Serializable",
">",
"defaultConstraints",
"=",
"(",
"(",
"PanelModel",
")",
"getDefaultModel",
"(",
")",
")",
".",
"layoutConstraints",
";",
"if",
"(",
"defaultConstraints",
"!=",
"null",
")",
"{",
"model",
".",
"layoutConstraints",
"=",
"new",
"HashMap",
"<>",
"(",
"defaultConstraints",
")",
";",
"}",
"}",
"if",
"(",
"model",
".",
"layoutConstraints",
"!=",
"null",
")",
"{",
"model",
".",
"layoutConstraints",
".",
"remove",
"(",
"aChild",
")",
";",
"// Deallocate constraints list if possible, to reduce session size.",
"if",
"(",
"model",
".",
"layoutConstraints",
".",
"isEmpty",
"(",
")",
")",
"{",
"model",
".",
"layoutConstraints",
"=",
"null",
";",
"}",
"}",
"}"
] | Removes the given component from this component's list of children. This method has been overriden to remove any
associated layout constraints.
@param aChild the child component to remove | [
"Removes",
"the",
"given",
"component",
"from",
"this",
"component",
"s",
"list",
"of",
"children",
".",
"This",
"method",
"has",
"been",
"overriden",
"to",
"remove",
"any",
"associated",
"layout",
"constraints",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPanel.java#L282-L303 |
138,991 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPanel.java | WPanel.getLayoutConstraints | public Serializable getLayoutConstraints(final WComponent child) {
PanelModel model = getComponentModel();
if (model.layoutConstraints != null) {
return model.layoutConstraints.get(child);
}
return null;
} | java | public Serializable getLayoutConstraints(final WComponent child) {
PanelModel model = getComponentModel();
if (model.layoutConstraints != null) {
return model.layoutConstraints.get(child);
}
return null;
} | [
"public",
"Serializable",
"getLayoutConstraints",
"(",
"final",
"WComponent",
"child",
")",
"{",
"PanelModel",
"model",
"=",
"getComponentModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"layoutConstraints",
"!=",
"null",
")",
"{",
"return",
"model",
".",
"layoutConstraints",
".",
"get",
"(",
"child",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Retrieves the layout constraints for the given component, if they have been set.
@param child the child component to retrieve the constraints for.
@return the layout constraints for the given child, if set. | [
"Retrieves",
"the",
"layout",
"constraints",
"for",
"the",
"given",
"component",
"if",
"they",
"have",
"been",
"set",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPanel.java#L320-L328 |
138,992 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDefinitionListRenderer.java | WDefinitionListRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDefinitionList list = (WDefinitionList) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:definitionlist");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (list.getType()) {
case FLAT:
xml.appendAttribute("type", "flat");
break;
case COLUMN:
xml.appendAttribute("type", "column");
break;
case STACKED:
xml.appendAttribute("type", "stacked");
break;
case NORMAL:
break;
default:
throw new SystemException("Unknown layout type: " + list.getType());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(list, renderContext);
for (Duplet<String, ArrayList<WComponent>> term : list.getTerms()) {
xml.appendTagOpen("ui:term");
xml.appendAttribute("text", I18nUtilities.format(null, term.getFirst()));
xml.appendClose();
for (WComponent data : term.getSecond()) {
xml.appendTag("ui:data");
data.paint(renderContext);
xml.appendEndTag("ui:data");
}
xml.appendEndTag("ui:term");
}
xml.appendEndTag("ui:definitionlist");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDefinitionList list = (WDefinitionList) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:definitionlist");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (list.getType()) {
case FLAT:
xml.appendAttribute("type", "flat");
break;
case COLUMN:
xml.appendAttribute("type", "column");
break;
case STACKED:
xml.appendAttribute("type", "stacked");
break;
case NORMAL:
break;
default:
throw new SystemException("Unknown layout type: " + list.getType());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(list, renderContext);
for (Duplet<String, ArrayList<WComponent>> term : list.getTerms()) {
xml.appendTagOpen("ui:term");
xml.appendAttribute("text", I18nUtilities.format(null, term.getFirst()));
xml.appendClose();
for (WComponent data : term.getSecond()) {
xml.appendTag("ui:data");
data.paint(renderContext);
xml.appendEndTag("ui:data");
}
xml.appendEndTag("ui:term");
}
xml.appendEndTag("ui:definitionlist");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WDefinitionList",
"list",
"=",
"(",
"WDefinitionList",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:definitionlist\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"switch",
"(",
"list",
".",
"getType",
"(",
")",
")",
"{",
"case",
"FLAT",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"flat\"",
")",
";",
"break",
";",
"case",
"COLUMN",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"column\"",
")",
";",
"break",
";",
"case",
"STACKED",
":",
"xml",
".",
"appendAttribute",
"(",
"\"type\"",
",",
"\"stacked\"",
")",
";",
"break",
";",
"case",
"NORMAL",
":",
"break",
";",
"default",
":",
"throw",
"new",
"SystemException",
"(",
"\"Unknown layout type: \"",
"+",
"list",
".",
"getType",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"// Render margin",
"MarginRendererUtil",
".",
"renderMargin",
"(",
"list",
",",
"renderContext",
")",
";",
"for",
"(",
"Duplet",
"<",
"String",
",",
"ArrayList",
"<",
"WComponent",
">",
">",
"term",
":",
"list",
".",
"getTerms",
"(",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:term\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"text\"",
",",
"I18nUtilities",
".",
"format",
"(",
"null",
",",
"term",
".",
"getFirst",
"(",
")",
")",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"for",
"(",
"WComponent",
"data",
":",
"term",
".",
"getSecond",
"(",
")",
")",
"{",
"xml",
".",
"appendTag",
"(",
"\"ui:data\"",
")",
";",
"data",
".",
"paint",
"(",
"renderContext",
")",
";",
"xml",
".",
"appendEndTag",
"(",
"\"ui:data\"",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:term\"",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:definitionlist\"",
")",
";",
"}"
] | Paints the given definition list.
@param component the list to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"definition",
"list",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDefinitionListRenderer.java#L27-L77 |
138,993 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRowExample.java | WRowExample.addAlignedExample | private void addAlignedExample() {
add(new WHeading(HeadingLevel.H2, "WRow / WCol with column alignment"));
WRow alignedColsRow = new WRow();
add(alignedColsRow);
WColumn alignedCol = new WColumn();
alignedCol.setAlignment(WColumn.Alignment.LEFT);
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
WPanel box = new WPanel(Type.BOX);
box.add(new WText("Left"));
alignedCol.add(box);
alignedCol = new WColumn();
alignedCol.setAlignment(WColumn.Alignment.CENTER);
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
box = new WPanel(Type.BOX);
box.add(new WText("Center"));
alignedCol.add(box);
alignedCol = new WColumn();
alignedCol.setAlignment(WColumn.Alignment.RIGHT);
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
box = new WPanel(Type.BOX);
box.add(new WText("Right"));
alignedCol.add(box);
alignedCol = new WColumn();
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
box = new WPanel(Type.BOX);
box.add(new WText("Undefined"));
alignedCol.add(box);
} | java | private void addAlignedExample() {
add(new WHeading(HeadingLevel.H2, "WRow / WCol with column alignment"));
WRow alignedColsRow = new WRow();
add(alignedColsRow);
WColumn alignedCol = new WColumn();
alignedCol.setAlignment(WColumn.Alignment.LEFT);
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
WPanel box = new WPanel(Type.BOX);
box.add(new WText("Left"));
alignedCol.add(box);
alignedCol = new WColumn();
alignedCol.setAlignment(WColumn.Alignment.CENTER);
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
box = new WPanel(Type.BOX);
box.add(new WText("Center"));
alignedCol.add(box);
alignedCol = new WColumn();
alignedCol.setAlignment(WColumn.Alignment.RIGHT);
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
box = new WPanel(Type.BOX);
box.add(new WText("Right"));
alignedCol.add(box);
alignedCol = new WColumn();
alignedCol.setWidth(25);
alignedColsRow.add(alignedCol);
box = new WPanel(Type.BOX);
box.add(new WText("Undefined"));
alignedCol.add(box);
} | [
"private",
"void",
"addAlignedExample",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H2",
",",
"\"WRow / WCol with column alignment\"",
")",
")",
";",
"WRow",
"alignedColsRow",
"=",
"new",
"WRow",
"(",
")",
";",
"add",
"(",
"alignedColsRow",
")",
";",
"WColumn",
"alignedCol",
"=",
"new",
"WColumn",
"(",
")",
";",
"alignedCol",
".",
"setAlignment",
"(",
"WColumn",
".",
"Alignment",
".",
"LEFT",
")",
";",
"alignedCol",
".",
"setWidth",
"(",
"25",
")",
";",
"alignedColsRow",
".",
"add",
"(",
"alignedCol",
")",
";",
"WPanel",
"box",
"=",
"new",
"WPanel",
"(",
"Type",
".",
"BOX",
")",
";",
"box",
".",
"add",
"(",
"new",
"WText",
"(",
"\"Left\"",
")",
")",
";",
"alignedCol",
".",
"add",
"(",
"box",
")",
";",
"alignedCol",
"=",
"new",
"WColumn",
"(",
")",
";",
"alignedCol",
".",
"setAlignment",
"(",
"WColumn",
".",
"Alignment",
".",
"CENTER",
")",
";",
"alignedCol",
".",
"setWidth",
"(",
"25",
")",
";",
"alignedColsRow",
".",
"add",
"(",
"alignedCol",
")",
";",
"box",
"=",
"new",
"WPanel",
"(",
"Type",
".",
"BOX",
")",
";",
"box",
".",
"add",
"(",
"new",
"WText",
"(",
"\"Center\"",
")",
")",
";",
"alignedCol",
".",
"add",
"(",
"box",
")",
";",
"alignedCol",
"=",
"new",
"WColumn",
"(",
")",
";",
"alignedCol",
".",
"setAlignment",
"(",
"WColumn",
".",
"Alignment",
".",
"RIGHT",
")",
";",
"alignedCol",
".",
"setWidth",
"(",
"25",
")",
";",
"alignedColsRow",
".",
"add",
"(",
"alignedCol",
")",
";",
"box",
"=",
"new",
"WPanel",
"(",
"Type",
".",
"BOX",
")",
";",
"box",
".",
"add",
"(",
"new",
"WText",
"(",
"\"Right\"",
")",
")",
";",
"alignedCol",
".",
"add",
"(",
"box",
")",
";",
"alignedCol",
"=",
"new",
"WColumn",
"(",
")",
";",
"alignedCol",
".",
"setWidth",
"(",
"25",
")",
";",
"alignedColsRow",
".",
"add",
"(",
"alignedCol",
")",
";",
"box",
"=",
"new",
"WPanel",
"(",
"Type",
".",
"BOX",
")",
";",
"box",
".",
"add",
"(",
"new",
"WText",
"(",
"\"Undefined\"",
")",
")",
";",
"alignedCol",
".",
"add",
"(",
"box",
")",
";",
"}"
] | Add an example showing column alignment. | [
"Add",
"an",
"example",
"showing",
"column",
"alignment",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRowExample.java#L81-L112 |
138,994 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRowExample.java | WRowExample.createRow | private WRow createRow(final int hgap, final int[] colWidths) {
WRow row = new WRow(hgap);
for (int i = 0; i < colWidths.length; i++) {
WColumn col = new WColumn(colWidths[i]);
WPanel box = new WPanel(WPanel.Type.BOX);
box.add(new WText(colWidths[i] + "%"));
col.add(box);
row.add(col);
}
return row;
} | java | private WRow createRow(final int hgap, final int[] colWidths) {
WRow row = new WRow(hgap);
for (int i = 0; i < colWidths.length; i++) {
WColumn col = new WColumn(colWidths[i]);
WPanel box = new WPanel(WPanel.Type.BOX);
box.add(new WText(colWidths[i] + "%"));
col.add(box);
row.add(col);
}
return row;
} | [
"private",
"WRow",
"createRow",
"(",
"final",
"int",
"hgap",
",",
"final",
"int",
"[",
"]",
"colWidths",
")",
"{",
"WRow",
"row",
"=",
"new",
"WRow",
"(",
"hgap",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"colWidths",
".",
"length",
";",
"i",
"++",
")",
"{",
"WColumn",
"col",
"=",
"new",
"WColumn",
"(",
"colWidths",
"[",
"i",
"]",
")",
";",
"WPanel",
"box",
"=",
"new",
"WPanel",
"(",
"WPanel",
".",
"Type",
".",
"BOX",
")",
";",
"box",
".",
"add",
"(",
"new",
"WText",
"(",
"colWidths",
"[",
"i",
"]",
"+",
"\"%\"",
")",
")",
";",
"col",
".",
"add",
"(",
"box",
")",
";",
"row",
".",
"add",
"(",
"col",
")",
";",
"}",
"return",
"row",
";",
"}"
] | Creates a row containing columns with the given widths.
@param hgap the horizontal gap between columns, in pixels.
@param colWidths the percentage widths for each column.
@return a WRow containing columns with the given widths. | [
"Creates",
"a",
"row",
"containing",
"columns",
"with",
"the",
"given",
"widths",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRowExample.java#L121-L133 |
138,995 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTextFieldRenderer.java | WTextFieldRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTextField textField = (WTextField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = textField.isReadOnly();
xml.appendTagOpen("ui:textfield");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
int cols = textField.getColumns();
int minLength = textField.getMinLength();
int maxLength = textField.getMaxLength();
String pattern = textField.getPattern();
WSuggestions suggestions = textField.getSuggestions();
String suggestionsId = suggestions == null ? null : suggestions.getId();
WComponent submitControl = textField.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true");
xml.appendOptionalAttribute("required", textField.isMandatory(), "true");
xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
xml.appendOptionalAttribute("toolTip", textField.getToolTip());
xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText());
xml.appendOptionalAttribute("size", cols > 0, cols);
xml.appendOptionalAttribute("buttonId", submitControlId);
xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern);
xml.appendOptionalAttribute("list", suggestionsId);
String placeholder = textField.getPlaceholder();
xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
String autocomplete = textField.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
}
xml.appendClose();
xml.appendEscaped(textField.getText());
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(textField, renderContext);
}
xml.appendEndTag("ui:textfield");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTextField textField = (WTextField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = textField.isReadOnly();
xml.appendTagOpen("ui:textfield");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
int cols = textField.getColumns();
int minLength = textField.getMinLength();
int maxLength = textField.getMaxLength();
String pattern = textField.getPattern();
WSuggestions suggestions = textField.getSuggestions();
String suggestionsId = suggestions == null ? null : suggestions.getId();
WComponent submitControl = textField.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true");
xml.appendOptionalAttribute("required", textField.isMandatory(), "true");
xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
xml.appendOptionalAttribute("toolTip", textField.getToolTip());
xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText());
xml.appendOptionalAttribute("size", cols > 0, cols);
xml.appendOptionalAttribute("buttonId", submitControlId);
xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern);
xml.appendOptionalAttribute("list", suggestionsId);
String placeholder = textField.getPlaceholder();
xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
String autocomplete = textField.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
}
xml.appendClose();
xml.appendEscaped(textField.getText());
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(textField, renderContext);
}
xml.appendEndTag("ui:textfield");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WTextField",
"textField",
"=",
"(",
"WTextField",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"boolean",
"readOnly",
"=",
"textField",
".",
"isReadOnly",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:textfield\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"component",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"if",
"(",
"readOnly",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"readOnly\"",
",",
"\"true\"",
")",
";",
"}",
"else",
"{",
"int",
"cols",
"=",
"textField",
".",
"getColumns",
"(",
")",
";",
"int",
"minLength",
"=",
"textField",
".",
"getMinLength",
"(",
")",
";",
"int",
"maxLength",
"=",
"textField",
".",
"getMaxLength",
"(",
")",
";",
"String",
"pattern",
"=",
"textField",
".",
"getPattern",
"(",
")",
";",
"WSuggestions",
"suggestions",
"=",
"textField",
".",
"getSuggestions",
"(",
")",
";",
"String",
"suggestionsId",
"=",
"suggestions",
"==",
"null",
"?",
"null",
":",
"suggestions",
".",
"getId",
"(",
")",
";",
"WComponent",
"submitControl",
"=",
"textField",
".",
"getDefaultSubmitButton",
"(",
")",
";",
"String",
"submitControlId",
"=",
"submitControl",
"==",
"null",
"?",
"null",
":",
"submitControl",
".",
"getId",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"disabled\"",
",",
"textField",
".",
"isDisabled",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"required\"",
",",
"textField",
".",
"isMandatory",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"minLength\"",
",",
"minLength",
">",
"0",
",",
"minLength",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"maxLength\"",
",",
"maxLength",
">",
"0",
",",
"maxLength",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"toolTip\"",
",",
"textField",
".",
"getToolTip",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"accessibleText\"",
",",
"textField",
".",
"getAccessibleText",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"size\"",
",",
"cols",
">",
"0",
",",
"cols",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"buttonId\"",
",",
"submitControlId",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"pattern\"",
",",
"!",
"Util",
".",
"empty",
"(",
"pattern",
")",
",",
"pattern",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"list\"",
",",
"suggestionsId",
")",
";",
"String",
"placeholder",
"=",
"textField",
".",
"getPlaceholder",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"placeholder\"",
",",
"!",
"Util",
".",
"empty",
"(",
"placeholder",
")",
",",
"placeholder",
")",
";",
"String",
"autocomplete",
"=",
"textField",
".",
"getAutocomplete",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"autocomplete\"",
",",
"!",
"Util",
".",
"empty",
"(",
"autocomplete",
")",
",",
"autocomplete",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"xml",
".",
"appendEscaped",
"(",
"textField",
".",
"getText",
"(",
")",
")",
";",
"if",
"(",
"!",
"readOnly",
")",
"{",
"DiagnosticRenderUtil",
".",
"renderDiagnostics",
"(",
"textField",
",",
"renderContext",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:textfield\"",
")",
";",
"}"
] | Paints the given WTextField.
@param component the WTextField to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WTextField",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTextFieldRenderer.java#L25-L73 |
138,996 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/BorderLayoutRenderer.java | BorderLayoutRenderer.getTag | private String getTag(final BorderLayoutConstraint constraint) {
switch (constraint) {
case EAST:
return "ui:east";
case NORTH:
return "ui:north";
case SOUTH:
return "ui:south";
case WEST:
return "ui:west";
case CENTER:
default:
return "ui:center";
}
} | java | private String getTag(final BorderLayoutConstraint constraint) {
switch (constraint) {
case EAST:
return "ui:east";
case NORTH:
return "ui:north";
case SOUTH:
return "ui:south";
case WEST:
return "ui:west";
case CENTER:
default:
return "ui:center";
}
} | [
"private",
"String",
"getTag",
"(",
"final",
"BorderLayoutConstraint",
"constraint",
")",
"{",
"switch",
"(",
"constraint",
")",
"{",
"case",
"EAST",
":",
"return",
"\"ui:east\"",
";",
"case",
"NORTH",
":",
"return",
"\"ui:north\"",
";",
"case",
"SOUTH",
":",
"return",
"\"ui:south\"",
";",
"case",
"WEST",
":",
"return",
"\"ui:west\"",
";",
"case",
"CENTER",
":",
"default",
":",
"return",
"\"ui:center\"",
";",
"}",
"}"
] | Retrieves the name of the element that will contain components with the given constraint.
@param constraint the constraint to retrieve the tag for.
@return the tag for the given constraint. | [
"Retrieves",
"the",
"name",
"of",
"the",
"element",
"that",
"will",
"contain",
"components",
"with",
"the",
"given",
"constraint",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/BorderLayoutRenderer.java#L72-L87 |
138,997 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/BorderLayoutRenderer.java | BorderLayoutRenderer.paintChildrenWithConstraint | private void paintChildrenWithConstraint(
final List<Duplet<WComponent, BorderLayoutConstraint>> children,
final WebXmlRenderContext renderContext, final BorderLayoutConstraint constraint) {
String containingTag = null;
XmlStringBuilder xml = renderContext.getWriter();
final int size = children.size();
for (int i = 0; i < size; i++) {
Duplet<WComponent, BorderLayoutConstraint> child = children.get(i);
if (constraint.equals(child.getSecond())) {
if (containingTag == null) {
containingTag = getTag(constraint);
xml.appendTag(containingTag);
}
child.getFirst().paint(renderContext);
}
}
if (containingTag != null) {
xml.appendEndTag(containingTag);
}
} | java | private void paintChildrenWithConstraint(
final List<Duplet<WComponent, BorderLayoutConstraint>> children,
final WebXmlRenderContext renderContext, final BorderLayoutConstraint constraint) {
String containingTag = null;
XmlStringBuilder xml = renderContext.getWriter();
final int size = children.size();
for (int i = 0; i < size; i++) {
Duplet<WComponent, BorderLayoutConstraint> child = children.get(i);
if (constraint.equals(child.getSecond())) {
if (containingTag == null) {
containingTag = getTag(constraint);
xml.appendTag(containingTag);
}
child.getFirst().paint(renderContext);
}
}
if (containingTag != null) {
xml.appendEndTag(containingTag);
}
} | [
"private",
"void",
"paintChildrenWithConstraint",
"(",
"final",
"List",
"<",
"Duplet",
"<",
"WComponent",
",",
"BorderLayoutConstraint",
">",
">",
"children",
",",
"final",
"WebXmlRenderContext",
"renderContext",
",",
"final",
"BorderLayoutConstraint",
"constraint",
")",
"{",
"String",
"containingTag",
"=",
"null",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"final",
"int",
"size",
"=",
"children",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"Duplet",
"<",
"WComponent",
",",
"BorderLayoutConstraint",
">",
"child",
"=",
"children",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"constraint",
".",
"equals",
"(",
"child",
".",
"getSecond",
"(",
")",
")",
")",
"{",
"if",
"(",
"containingTag",
"==",
"null",
")",
"{",
"containingTag",
"=",
"getTag",
"(",
"constraint",
")",
";",
"xml",
".",
"appendTag",
"(",
"containingTag",
")",
";",
"}",
"child",
".",
"getFirst",
"(",
")",
".",
"paint",
"(",
"renderContext",
")",
";",
"}",
"}",
"if",
"(",
"containingTag",
"!=",
"null",
")",
"{",
"xml",
".",
"appendEndTag",
"(",
"containingTag",
")",
";",
"}",
"}"
] | Paints all the child components with the given constraint.
@param children the list of potential children to paint.
@param renderContext the RenderContext to paint to.
@param constraint the target constraint. | [
"Paints",
"all",
"the",
"child",
"components",
"with",
"the",
"given",
"constraint",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/BorderLayoutRenderer.java#L96-L120 |
138,998 | BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTextAreaRenderer.java | WTextAreaRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTextArea textArea = (WTextArea) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = textArea.isReadOnly();
xml.appendTagOpen("ui:textarea");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", textArea.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
int cols = textArea.getColumns();
int rows = textArea.getRows();
int minLength = textArea.getMinLength();
int maxLength = textArea.getMaxLength();
WComponent submitControl = textArea.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
xml.appendOptionalAttribute("disabled", textArea.isDisabled(), "true");
xml.appendOptionalAttribute("required", textArea.isMandatory(), "true");
xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
xml.appendOptionalAttribute("toolTip", textArea.getToolTip());
xml.appendOptionalAttribute("accessibleText", textArea.getAccessibleText());
xml.appendOptionalAttribute("rows", rows > 0, rows);
xml.appendOptionalAttribute("cols", cols > 0, cols);
xml.appendOptionalAttribute("buttonId", submitControlId);
String placeholder = textArea.getPlaceholder();
xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
String autocomplete = textArea.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
}
xml.appendClose();
if (textArea.isRichTextArea()) {
/*
* This is a nested element instead of an attribute to cater for future enhancements
* such as turning rich text features on or off, or specifying JSON config either as
* a URL attribute or a nested CDATA section.
*/
xml.append("<ui:rtf />");
}
String textString = textArea.getText();
if (textString != null) {
if (textArea.isReadOnly() && textArea.isRichTextArea()) {
// read only we want to output unescaped, but it must still be XML valid.
xml.write(HtmlToXMLUtil.unescapeToXML(textString));
} else {
xml.appendEscaped(textString);
}
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(textArea, renderContext);
}
xml.appendEndTag("ui:textarea");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTextArea textArea = (WTextArea) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = textArea.isReadOnly();
xml.appendTagOpen("ui:textarea");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", textArea.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
int cols = textArea.getColumns();
int rows = textArea.getRows();
int minLength = textArea.getMinLength();
int maxLength = textArea.getMaxLength();
WComponent submitControl = textArea.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
xml.appendOptionalAttribute("disabled", textArea.isDisabled(), "true");
xml.appendOptionalAttribute("required", textArea.isMandatory(), "true");
xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
xml.appendOptionalAttribute("toolTip", textArea.getToolTip());
xml.appendOptionalAttribute("accessibleText", textArea.getAccessibleText());
xml.appendOptionalAttribute("rows", rows > 0, rows);
xml.appendOptionalAttribute("cols", cols > 0, cols);
xml.appendOptionalAttribute("buttonId", submitControlId);
String placeholder = textArea.getPlaceholder();
xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
String autocomplete = textArea.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
}
xml.appendClose();
if (textArea.isRichTextArea()) {
/*
* This is a nested element instead of an attribute to cater for future enhancements
* such as turning rich text features on or off, or specifying JSON config either as
* a URL attribute or a nested CDATA section.
*/
xml.append("<ui:rtf />");
}
String textString = textArea.getText();
if (textString != null) {
if (textArea.isReadOnly() && textArea.isRichTextArea()) {
// read only we want to output unescaped, but it must still be XML valid.
xml.write(HtmlToXMLUtil.unescapeToXML(textString));
} else {
xml.appendEscaped(textString);
}
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(textArea, renderContext);
}
xml.appendEndTag("ui:textarea");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WTextArea",
"textArea",
"=",
"(",
"WTextArea",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"boolean",
"readOnly",
"=",
"textArea",
".",
"isReadOnly",
"(",
")",
";",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:textarea\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"hidden\"",
",",
"textArea",
".",
"isHidden",
"(",
")",
",",
"\"true\"",
")",
";",
"if",
"(",
"readOnly",
")",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"readOnly\"",
",",
"\"true\"",
")",
";",
"}",
"else",
"{",
"int",
"cols",
"=",
"textArea",
".",
"getColumns",
"(",
")",
";",
"int",
"rows",
"=",
"textArea",
".",
"getRows",
"(",
")",
";",
"int",
"minLength",
"=",
"textArea",
".",
"getMinLength",
"(",
")",
";",
"int",
"maxLength",
"=",
"textArea",
".",
"getMaxLength",
"(",
")",
";",
"WComponent",
"submitControl",
"=",
"textArea",
".",
"getDefaultSubmitButton",
"(",
")",
";",
"String",
"submitControlId",
"=",
"submitControl",
"==",
"null",
"?",
"null",
":",
"submitControl",
".",
"getId",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"disabled\"",
",",
"textArea",
".",
"isDisabled",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"required\"",
",",
"textArea",
".",
"isMandatory",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"minLength\"",
",",
"minLength",
">",
"0",
",",
"minLength",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"maxLength\"",
",",
"maxLength",
">",
"0",
",",
"maxLength",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"toolTip\"",
",",
"textArea",
".",
"getToolTip",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"accessibleText\"",
",",
"textArea",
".",
"getAccessibleText",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"rows\"",
",",
"rows",
">",
"0",
",",
"rows",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"cols\"",
",",
"cols",
">",
"0",
",",
"cols",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"buttonId\"",
",",
"submitControlId",
")",
";",
"String",
"placeholder",
"=",
"textArea",
".",
"getPlaceholder",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"placeholder\"",
",",
"!",
"Util",
".",
"empty",
"(",
"placeholder",
")",
",",
"placeholder",
")",
";",
"String",
"autocomplete",
"=",
"textArea",
".",
"getAutocomplete",
"(",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"autocomplete\"",
",",
"!",
"Util",
".",
"empty",
"(",
"autocomplete",
")",
",",
"autocomplete",
")",
";",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"if",
"(",
"textArea",
".",
"isRichTextArea",
"(",
")",
")",
"{",
"/*\n\t\t\t * This is a nested element instead of an attribute to cater for future enhancements\n\t\t\t * such as turning rich text features on or off, or specifying JSON config either as\n\t\t\t * a URL attribute or a nested CDATA section.\n\t\t\t */",
"xml",
".",
"append",
"(",
"\"<ui:rtf />\"",
")",
";",
"}",
"String",
"textString",
"=",
"textArea",
".",
"getText",
"(",
")",
";",
"if",
"(",
"textString",
"!=",
"null",
")",
"{",
"if",
"(",
"textArea",
".",
"isReadOnly",
"(",
")",
"&&",
"textArea",
".",
"isRichTextArea",
"(",
")",
")",
"{",
"// read only we want to output unescaped, but it must still be XML valid.",
"xml",
".",
"write",
"(",
"HtmlToXMLUtil",
".",
"unescapeToXML",
"(",
"textString",
")",
")",
";",
"}",
"else",
"{",
"xml",
".",
"appendEscaped",
"(",
"textString",
")",
";",
"}",
"}",
"if",
"(",
"!",
"readOnly",
")",
"{",
"DiagnosticRenderUtil",
".",
"renderDiagnostics",
"(",
"textArea",
",",
"renderContext",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:textarea\"",
")",
";",
"}"
] | Paints the given WTextArea.
@param component the WTextArea to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WTextArea",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTextAreaRenderer.java#L25-L86 |
138,999 | BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/JavaDocText.java | JavaDocText.extractJavaDoc | private StringBuilder extractJavaDoc(final String source) {
int docStart = source.indexOf("/**");
int docEnd = source.indexOf("*/", docStart);
int classStart = source.indexOf("public class");
int author = source.indexOf("@author");
int since = source.indexOf("@since");
if (classStart == -1) {
classStart = docEnd;
}
if (docEnd == -1 || classStart < docStart) {
return new StringBuilder("No JavaDoc provided");
}
if (author != -1 && author < docEnd) {
docEnd = author;
}
if (since != -1 && since < docEnd) {
docEnd = since;
}
return new StringBuilder(source.substring(docStart + 3, docEnd).trim());
} | java | private StringBuilder extractJavaDoc(final String source) {
int docStart = source.indexOf("/**");
int docEnd = source.indexOf("*/", docStart);
int classStart = source.indexOf("public class");
int author = source.indexOf("@author");
int since = source.indexOf("@since");
if (classStart == -1) {
classStart = docEnd;
}
if (docEnd == -1 || classStart < docStart) {
return new StringBuilder("No JavaDoc provided");
}
if (author != -1 && author < docEnd) {
docEnd = author;
}
if (since != -1 && since < docEnd) {
docEnd = since;
}
return new StringBuilder(source.substring(docStart + 3, docEnd).trim());
} | [
"private",
"StringBuilder",
"extractJavaDoc",
"(",
"final",
"String",
"source",
")",
"{",
"int",
"docStart",
"=",
"source",
".",
"indexOf",
"(",
"\"/**\"",
")",
";",
"int",
"docEnd",
"=",
"source",
".",
"indexOf",
"(",
"\"*/\"",
",",
"docStart",
")",
";",
"int",
"classStart",
"=",
"source",
".",
"indexOf",
"(",
"\"public class\"",
")",
";",
"int",
"author",
"=",
"source",
".",
"indexOf",
"(",
"\"@author\"",
")",
";",
"int",
"since",
"=",
"source",
".",
"indexOf",
"(",
"\"@since\"",
")",
";",
"if",
"(",
"classStart",
"==",
"-",
"1",
")",
"{",
"classStart",
"=",
"docEnd",
";",
"}",
"if",
"(",
"docEnd",
"==",
"-",
"1",
"||",
"classStart",
"<",
"docStart",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
"\"No JavaDoc provided\"",
")",
";",
"}",
"if",
"(",
"author",
"!=",
"-",
"1",
"&&",
"author",
"<",
"docEnd",
")",
"{",
"docEnd",
"=",
"author",
";",
"}",
"if",
"(",
"since",
"!=",
"-",
"1",
"&&",
"since",
"<",
"docEnd",
")",
"{",
"docEnd",
"=",
"since",
";",
"}",
"return",
"new",
"StringBuilder",
"(",
"source",
".",
"substring",
"(",
"docStart",
"+",
"3",
",",
"docEnd",
")",
".",
"trim",
"(",
")",
")",
";",
"}"
] | extracts the javadoc. It assumes that the java doc for the class is the first javadoc in the file.
@param source string representing the java class.
@return a String builder containing the javadoc. | [
"extracts",
"the",
"javadoc",
".",
"It",
"assumes",
"that",
"the",
"java",
"doc",
"for",
"the",
"class",
"is",
"the",
"first",
"javadoc",
"in",
"the",
"file",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/JavaDocText.java#L49-L71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.