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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
10,700
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java
|
JQMHeader.setRightButton
|
@UiChild(tagname="rightButton", limit=1)
public void setRightButton(JQMButton button) {
if (right != null) remove(right);
button.setPosOnBand(PosOnBand.RIGHT);
right = button;
add(right);
}
|
java
|
@UiChild(tagname="rightButton", limit=1)
public void setRightButton(JQMButton button) {
if (right != null) remove(right);
button.setPosOnBand(PosOnBand.RIGHT);
right = button;
add(right);
}
|
[
"@",
"UiChild",
"(",
"tagname",
"=",
"\"rightButton\"",
",",
"limit",
"=",
"1",
")",
"public",
"void",
"setRightButton",
"(",
"JQMButton",
"button",
")",
"{",
"if",
"(",
"right",
"!=",
"null",
")",
"remove",
"(",
"right",
")",
";",
"button",
".",
"setPosOnBand",
"(",
"PosOnBand",
".",
"RIGHT",
")",
";",
"right",
"=",
"button",
";",
"add",
"(",
"right",
")",
";",
"}"
] |
Sets the right button to be the given button. Any existing button is removed.
@param button - the button to set on the right slot
|
[
"Sets",
"the",
"right",
"button",
"to",
"be",
"the",
"given",
"button",
".",
"Any",
"existing",
"button",
"is",
"removed",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java#L252-L258
|
10,701
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/html/ImageLink.java
|
ImageLink.setHref
|
public void setHref(String href) {
JQMCommon.setAttribute(a, "href", href);
if (external == null /*only if not explicitly set*/ && !Empty.is(href)
&& (href.startsWith("http:") || href.startsWith("https:"))) {
setExternal(true);
}
}
|
java
|
public void setHref(String href) {
JQMCommon.setAttribute(a, "href", href);
if (external == null /*only if not explicitly set*/ && !Empty.is(href)
&& (href.startsWith("http:") || href.startsWith("https:"))) {
setExternal(true);
}
}
|
[
"public",
"void",
"setHref",
"(",
"String",
"href",
")",
"{",
"JQMCommon",
".",
"setAttribute",
"(",
"a",
",",
"\"href\"",
",",
"href",
")",
";",
"if",
"(",
"external",
"==",
"null",
"/*only if not explicitly set*/",
"&&",
"!",
"Empty",
".",
"is",
"(",
"href",
")",
"&&",
"(",
"href",
".",
"startsWith",
"(",
"\"http:\"",
")",
"||",
"href",
".",
"startsWith",
"(",
"\"https:\"",
")",
")",
")",
"{",
"setExternal",
"(",
"true",
")",
";",
"}",
"}"
] |
The destination URL of the link
@param href
|
[
"The",
"destination",
"URL",
"of",
"the",
"link"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/html/ImageLink.java#L120-L126
|
10,702
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java
|
JQMForm.add
|
public void add(JQMSubmit submit) {
super.add(submit);
submit.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
submit();
}
});
}
|
java
|
public void add(JQMSubmit submit) {
super.add(submit);
submit.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
submit();
}
});
}
|
[
"public",
"void",
"add",
"(",
"JQMSubmit",
"submit",
")",
"{",
"super",
".",
"add",
"(",
"submit",
")",
";",
"submit",
".",
"addClickHandler",
"(",
"new",
"ClickHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onClick",
"(",
"ClickEvent",
"event",
")",
"{",
"submit",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Add the given submit button to the form and automatically have it set
to submit the form on a click event.
|
[
"Add",
"the",
"given",
"submit",
"button",
"to",
"the",
"form",
"and",
"automatically",
"have",
"it",
"set",
"to",
"submit",
"the",
"form",
"on",
"a",
"click",
"event",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java#L108-L116
|
10,703
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java
|
JQMForm.addValidator
|
public void addValidator(Widget notifiedWidget, Validator validator, boolean immediate,
Widget positionErrorAfter, JQMFormWidget... firingWidgets) {
boolean labelAdded = false;
if (firingWidgets != null) {
for (JQMFormWidget w : firingWidgets) {
Label la = w.addErrorLabel();
if (la == null) continue;
labelAdded = true;
addErrorLabel(validator, la, w.asWidget());
}
}
if (!labelAdded) {
Label label = new InlineLabel(); // create a label that will show the validation error
label.setStyleName(JQM4GWT_ERROR_LABEL_STYLENAME);
if (globalValidationErrorStyles != null && !globalValidationErrorStyles.isEmpty()) {
JQMCommon.addStyleNames(label, globalValidationErrorStyles);
}
label.setVisible(false);
if (positionErrorAfter == null) {
addErrorLabel(validator, label, null/*widget*/);
// add the error label to the document as the next child of this form container
add(label);
} else {
boolean inserted = false;
Widget w = positionErrorAfter;
while (w != null) {
int i = getWidgetIndex(w);
if (i >= 0) {
i++; // next after w
while (i < getWidgetCount()) {
Widget wi = getWidget(i);
if (wi instanceof Label && JQMCommon.hasStyle(wi, JQM4GWT_ERROR_LABEL_STYLENAME)) {
i++; // next after previous errors
} else {
break;
}
}
insert(label, i);
inserted = true;
break;
}
w = w.getParent();
}
if (!inserted) {
addErrorLabel(validator, label, null/*widget*/);
add(label);
} else {
addErrorLabel(validator, label, positionErrorAfter);
}
}
}
registerValidatorWithFiringWidgets(validator, firingWidgets, immediate);
boolean required = validator instanceof NotNullOrEmptyValidator;
String validatorClass = STYLE_FORM_VALIDATOR + getShortClassName(validator.getClass());
if (notifiedWidget != null) {
notifiedWidgets.put(validator, notifiedWidget);
notifiedWidget.getElement().addClassName(validatorClass);
if (required) notifiedWidget.getElement().addClassName(STYLE_FORM_REQUIRED);
} else if (firingWidgets != null) {
for (JQMFormWidget w : firingWidgets) {
w.asWidget().getElement().addClassName(validatorClass);
if (required) w.asWidget().getElement().addClassName(STYLE_FORM_REQUIRED);
}
}
}
|
java
|
public void addValidator(Widget notifiedWidget, Validator validator, boolean immediate,
Widget positionErrorAfter, JQMFormWidget... firingWidgets) {
boolean labelAdded = false;
if (firingWidgets != null) {
for (JQMFormWidget w : firingWidgets) {
Label la = w.addErrorLabel();
if (la == null) continue;
labelAdded = true;
addErrorLabel(validator, la, w.asWidget());
}
}
if (!labelAdded) {
Label label = new InlineLabel(); // create a label that will show the validation error
label.setStyleName(JQM4GWT_ERROR_LABEL_STYLENAME);
if (globalValidationErrorStyles != null && !globalValidationErrorStyles.isEmpty()) {
JQMCommon.addStyleNames(label, globalValidationErrorStyles);
}
label.setVisible(false);
if (positionErrorAfter == null) {
addErrorLabel(validator, label, null/*widget*/);
// add the error label to the document as the next child of this form container
add(label);
} else {
boolean inserted = false;
Widget w = positionErrorAfter;
while (w != null) {
int i = getWidgetIndex(w);
if (i >= 0) {
i++; // next after w
while (i < getWidgetCount()) {
Widget wi = getWidget(i);
if (wi instanceof Label && JQMCommon.hasStyle(wi, JQM4GWT_ERROR_LABEL_STYLENAME)) {
i++; // next after previous errors
} else {
break;
}
}
insert(label, i);
inserted = true;
break;
}
w = w.getParent();
}
if (!inserted) {
addErrorLabel(validator, label, null/*widget*/);
add(label);
} else {
addErrorLabel(validator, label, positionErrorAfter);
}
}
}
registerValidatorWithFiringWidgets(validator, firingWidgets, immediate);
boolean required = validator instanceof NotNullOrEmptyValidator;
String validatorClass = STYLE_FORM_VALIDATOR + getShortClassName(validator.getClass());
if (notifiedWidget != null) {
notifiedWidgets.put(validator, notifiedWidget);
notifiedWidget.getElement().addClassName(validatorClass);
if (required) notifiedWidget.getElement().addClassName(STYLE_FORM_REQUIRED);
} else if (firingWidgets != null) {
for (JQMFormWidget w : firingWidgets) {
w.asWidget().getElement().addClassName(validatorClass);
if (required) w.asWidget().getElement().addClassName(STYLE_FORM_REQUIRED);
}
}
}
|
[
"public",
"void",
"addValidator",
"(",
"Widget",
"notifiedWidget",
",",
"Validator",
"validator",
",",
"boolean",
"immediate",
",",
"Widget",
"positionErrorAfter",
",",
"JQMFormWidget",
"...",
"firingWidgets",
")",
"{",
"boolean",
"labelAdded",
"=",
"false",
";",
"if",
"(",
"firingWidgets",
"!=",
"null",
")",
"{",
"for",
"(",
"JQMFormWidget",
"w",
":",
"firingWidgets",
")",
"{",
"Label",
"la",
"=",
"w",
".",
"addErrorLabel",
"(",
")",
";",
"if",
"(",
"la",
"==",
"null",
")",
"continue",
";",
"labelAdded",
"=",
"true",
";",
"addErrorLabel",
"(",
"validator",
",",
"la",
",",
"w",
".",
"asWidget",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"!",
"labelAdded",
")",
"{",
"Label",
"label",
"=",
"new",
"InlineLabel",
"(",
")",
";",
"// create a label that will show the validation error",
"label",
".",
"setStyleName",
"(",
"JQM4GWT_ERROR_LABEL_STYLENAME",
")",
";",
"if",
"(",
"globalValidationErrorStyles",
"!=",
"null",
"&&",
"!",
"globalValidationErrorStyles",
".",
"isEmpty",
"(",
")",
")",
"{",
"JQMCommon",
".",
"addStyleNames",
"(",
"label",
",",
"globalValidationErrorStyles",
")",
";",
"}",
"label",
".",
"setVisible",
"(",
"false",
")",
";",
"if",
"(",
"positionErrorAfter",
"==",
"null",
")",
"{",
"addErrorLabel",
"(",
"validator",
",",
"label",
",",
"null",
"/*widget*/",
")",
";",
"// add the error label to the document as the next child of this form container",
"add",
"(",
"label",
")",
";",
"}",
"else",
"{",
"boolean",
"inserted",
"=",
"false",
";",
"Widget",
"w",
"=",
"positionErrorAfter",
";",
"while",
"(",
"w",
"!=",
"null",
")",
"{",
"int",
"i",
"=",
"getWidgetIndex",
"(",
"w",
")",
";",
"if",
"(",
"i",
">=",
"0",
")",
"{",
"i",
"++",
";",
"// next after w",
"while",
"(",
"i",
"<",
"getWidgetCount",
"(",
")",
")",
"{",
"Widget",
"wi",
"=",
"getWidget",
"(",
"i",
")",
";",
"if",
"(",
"wi",
"instanceof",
"Label",
"&&",
"JQMCommon",
".",
"hasStyle",
"(",
"wi",
",",
"JQM4GWT_ERROR_LABEL_STYLENAME",
")",
")",
"{",
"i",
"++",
";",
"// next after previous errors",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"insert",
"(",
"label",
",",
"i",
")",
";",
"inserted",
"=",
"true",
";",
"break",
";",
"}",
"w",
"=",
"w",
".",
"getParent",
"(",
")",
";",
"}",
"if",
"(",
"!",
"inserted",
")",
"{",
"addErrorLabel",
"(",
"validator",
",",
"label",
",",
"null",
"/*widget*/",
")",
";",
"add",
"(",
"label",
")",
";",
"}",
"else",
"{",
"addErrorLabel",
"(",
"validator",
",",
"label",
",",
"positionErrorAfter",
")",
";",
"}",
"}",
"}",
"registerValidatorWithFiringWidgets",
"(",
"validator",
",",
"firingWidgets",
",",
"immediate",
")",
";",
"boolean",
"required",
"=",
"validator",
"instanceof",
"NotNullOrEmptyValidator",
";",
"String",
"validatorClass",
"=",
"STYLE_FORM_VALIDATOR",
"+",
"getShortClassName",
"(",
"validator",
".",
"getClass",
"(",
")",
")",
";",
"if",
"(",
"notifiedWidget",
"!=",
"null",
")",
"{",
"notifiedWidgets",
".",
"put",
"(",
"validator",
",",
"notifiedWidget",
")",
";",
"notifiedWidget",
".",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"validatorClass",
")",
";",
"if",
"(",
"required",
")",
"notifiedWidget",
".",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"STYLE_FORM_REQUIRED",
")",
";",
"}",
"else",
"if",
"(",
"firingWidgets",
"!=",
"null",
")",
"{",
"for",
"(",
"JQMFormWidget",
"w",
":",
"firingWidgets",
")",
"{",
"w",
".",
"asWidget",
"(",
")",
".",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"validatorClass",
")",
";",
"if",
"(",
"required",
")",
"w",
".",
"asWidget",
"(",
")",
".",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"STYLE_FORM_REQUIRED",
")",
";",
"}",
"}",
"}"
] |
Adds a validator and binds it to the collection of widgets. The widget
list can be empty.
@param validator the validator that will be invoked
@param notifiedWidget the widget that will be notified of the error. If null
then the firing widget will be used.
@param firingWidgets the list of widgets that will fire the validator
@param immediate - if true then validator will be called during firingWidgets onBlur() event
@param positionErrorAfter - optional, if defined then error label will be placed
right after this widget, otherwise it will be added as the current last one.
|
[
"Adds",
"a",
"validator",
"and",
"binds",
"it",
"to",
"the",
"collection",
"of",
"widgets",
".",
"The",
"widget",
"list",
"can",
"be",
"empty",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java#L197-L263
|
10,704
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java
|
JQMForm.clearValidationStyles
|
public void clearValidationStyles() {
for (JQMFormWidget widget : widgetValidators.keySet()) {
UIObject ui = widget.asWidget();
Collection<Validator> validators = widgetValidators.get(widget);
for (Validator v : validators) {
if (notifiedWidgets.containsKey(v)) {
ui = notifiedWidgets.get(v);
}
removeStyles(v, ui);
}
}
}
|
java
|
public void clearValidationStyles() {
for (JQMFormWidget widget : widgetValidators.keySet()) {
UIObject ui = widget.asWidget();
Collection<Validator> validators = widgetValidators.get(widget);
for (Validator v : validators) {
if (notifiedWidgets.containsKey(v)) {
ui = notifiedWidgets.get(v);
}
removeStyles(v, ui);
}
}
}
|
[
"public",
"void",
"clearValidationStyles",
"(",
")",
"{",
"for",
"(",
"JQMFormWidget",
"widget",
":",
"widgetValidators",
".",
"keySet",
"(",
")",
")",
"{",
"UIObject",
"ui",
"=",
"widget",
".",
"asWidget",
"(",
")",
";",
"Collection",
"<",
"Validator",
">",
"validators",
"=",
"widgetValidators",
".",
"get",
"(",
"widget",
")",
";",
"for",
"(",
"Validator",
"v",
":",
"validators",
")",
"{",
"if",
"(",
"notifiedWidgets",
".",
"containsKey",
"(",
"v",
")",
")",
"{",
"ui",
"=",
"notifiedWidgets",
".",
"get",
"(",
"v",
")",
";",
"}",
"removeStyles",
"(",
"v",
",",
"ui",
")",
";",
"}",
"}",
"}"
] |
Remove all validation styles
|
[
"Remove",
"all",
"validation",
"styles"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java#L318-L329
|
10,705
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java
|
JQMForm.setError
|
public void setError(String string) {
Label errorLabel = new Label(string);
errorLabel.setStyleName(JQM4GWT_ERROR_LABEL_STYLENAME);
errorLabel.addStyleName(JQM4GWT_GENERAL_ERROR_LABEL_STYLENAME);
generalErrors.add(errorLabel);
generalErrors.getElement().scrollIntoView();
}
|
java
|
public void setError(String string) {
Label errorLabel = new Label(string);
errorLabel.setStyleName(JQM4GWT_ERROR_LABEL_STYLENAME);
errorLabel.addStyleName(JQM4GWT_GENERAL_ERROR_LABEL_STYLENAME);
generalErrors.add(errorLabel);
generalErrors.getElement().scrollIntoView();
}
|
[
"public",
"void",
"setError",
"(",
"String",
"string",
")",
"{",
"Label",
"errorLabel",
"=",
"new",
"Label",
"(",
"string",
")",
";",
"errorLabel",
".",
"setStyleName",
"(",
"JQM4GWT_ERROR_LABEL_STYLENAME",
")",
";",
"errorLabel",
".",
"addStyleName",
"(",
"JQM4GWT_GENERAL_ERROR_LABEL_STYLENAME",
")",
";",
"generalErrors",
".",
"add",
"(",
"errorLabel",
")",
";",
"generalErrors",
".",
"getElement",
"(",
")",
".",
"scrollIntoView",
"(",
")",
";",
"}"
] |
Set a general error on the form.
|
[
"Set",
"a",
"general",
"error",
"on",
"the",
"form",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java#L435-L441
|
10,706
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java
|
JQMForm.validate
|
public boolean validate(boolean scrollToFirstError) {
boolean validated = true;
for (JQMFormWidget widget : widgetValidators.keySet()) {
if (!validate(widget))
validated = false;
}
if (!validated && scrollToFirstError) scrollToFirstError();
return validated;
}
|
java
|
public boolean validate(boolean scrollToFirstError) {
boolean validated = true;
for (JQMFormWidget widget : widgetValidators.keySet()) {
if (!validate(widget))
validated = false;
}
if (!validated && scrollToFirstError) scrollToFirstError();
return validated;
}
|
[
"public",
"boolean",
"validate",
"(",
"boolean",
"scrollToFirstError",
")",
"{",
"boolean",
"validated",
"=",
"true",
";",
"for",
"(",
"JQMFormWidget",
"widget",
":",
"widgetValidators",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"!",
"validate",
"(",
"widget",
")",
")",
"validated",
"=",
"false",
";",
"}",
"if",
"(",
"!",
"validated",
"&&",
"scrollToFirstError",
")",
"scrollToFirstError",
"(",
")",
";",
"return",
"validated",
";",
"}"
] |
Perform validation for all validators, setting error messages where appropriate.
@param scrollToFirstError - if true then in case of unsuccessful validation first error widget will be scrolled into view.
@return true if validation was successful for all validators, otherwise false.
|
[
"Perform",
"validation",
"for",
"all",
"validators",
"setting",
"error",
"messages",
"where",
"appropriate",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java#L536-L546
|
10,707
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java
|
JQMForm.validate
|
protected boolean validate(JQMFormWidget widget) {
boolean validated = true;
Collection<Validator> validators = widgetValidators.get(widget);
for (Validator v : validators)
if (!validate(v, widget.asWidget()))
validated = false;
return validated;
}
|
java
|
protected boolean validate(JQMFormWidget widget) {
boolean validated = true;
Collection<Validator> validators = widgetValidators.get(widget);
for (Validator v : validators)
if (!validate(v, widget.asWidget()))
validated = false;
return validated;
}
|
[
"protected",
"boolean",
"validate",
"(",
"JQMFormWidget",
"widget",
")",
"{",
"boolean",
"validated",
"=",
"true",
";",
"Collection",
"<",
"Validator",
">",
"validators",
"=",
"widgetValidators",
".",
"get",
"(",
"widget",
")",
";",
"for",
"(",
"Validator",
"v",
":",
"validators",
")",
"if",
"(",
"!",
"validate",
"(",
"v",
",",
"widget",
".",
"asWidget",
"(",
")",
")",
")",
"validated",
"=",
"false",
";",
"return",
"validated",
";",
"}"
] |
Performs validation for a single widget, first resetting all validation
messages on that widget.
|
[
"Performs",
"validation",
"for",
"a",
"single",
"widget",
"first",
"resetting",
"all",
"validation",
"messages",
"on",
"that",
"widget",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java#L561-L570
|
10,708
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java
|
JQMForm.validate
|
protected boolean validate(Validator validator, UIObject ui) {
if (notifiedWidgets.containsKey(validator))
ui = notifiedWidgets.get(validator);
String msg = validator.validate();
if (msg == null || msg.length() == 0) {
validationStyles(validator, null, ui, true);
return true;
} else {
validationStyles(validator, msg, ui, false);
return false;
}
}
|
java
|
protected boolean validate(Validator validator, UIObject ui) {
if (notifiedWidgets.containsKey(validator))
ui = notifiedWidgets.get(validator);
String msg = validator.validate();
if (msg == null || msg.length() == 0) {
validationStyles(validator, null, ui, true);
return true;
} else {
validationStyles(validator, msg, ui, false);
return false;
}
}
|
[
"protected",
"boolean",
"validate",
"(",
"Validator",
"validator",
",",
"UIObject",
"ui",
")",
"{",
"if",
"(",
"notifiedWidgets",
".",
"containsKey",
"(",
"validator",
")",
")",
"ui",
"=",
"notifiedWidgets",
".",
"get",
"(",
"validator",
")",
";",
"String",
"msg",
"=",
"validator",
".",
"validate",
"(",
")",
";",
"if",
"(",
"msg",
"==",
"null",
"||",
"msg",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"validationStyles",
"(",
"validator",
",",
"null",
",",
"ui",
",",
"true",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"validationStyles",
"(",
"validator",
",",
"msg",
",",
"ui",
",",
"false",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Perform validation for a single validator
@param ui the {@link UIObject} to change the stylesheet on
@return true if this validator was successfully applied or false otherwise
|
[
"Perform",
"validation",
"for",
"a",
"single",
"validator"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java#L578-L591
|
10,709
|
yandex-qatools/hamcrest-pojo-matcher-generator
|
feature-matcher-generator/src/main/java/ru/yandex/qatools/processors/matcher/gen/elements/ElementParentsIterable.java
|
ElementParentsIterable.stream
|
public static Stream<Element> stream(Element element) {
return StreamSupport.stream(new ElementParentsIterable(element).spliterator(), false);
}
|
java
|
public static Stream<Element> stream(Element element) {
return StreamSupport.stream(new ElementParentsIterable(element).spliterator(), false);
}
|
[
"public",
"static",
"Stream",
"<",
"Element",
">",
"stream",
"(",
"Element",
"element",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"new",
"ElementParentsIterable",
"(",
"element",
")",
".",
"spliterator",
"(",
")",
",",
"false",
")",
";",
"}"
] |
Creates stream with parent chain
@param element element to start with (will be included to chain)
@return stream with elements from current with his parents until package (inclusive)
|
[
"Creates",
"stream",
"with",
"parent",
"chain"
] |
6794227006d2bf572c1e68300c7bc3dc6c3d4998
|
https://github.com/yandex-qatools/hamcrest-pojo-matcher-generator/blob/6794227006d2bf572c1e68300c7bc3dc6c3d4998/feature-matcher-generator/src/main/java/ru/yandex/qatools/processors/matcher/gen/elements/ElementParentsIterable.java#L51-L53
|
10,710
|
jqm4gwt/jqm4gwt
|
library/misc/errai/JQMListBindable.java
|
JQMListBindable.rerender
|
public void rerender() {
clear();
if (dataItems != null) {
for (M m : dataItems) {
addDataItem(m);
}
}
doRefresh();
}
|
java
|
public void rerender() {
clear();
if (dataItems != null) {
for (M m : dataItems) {
addDataItem(m);
}
}
doRefresh();
}
|
[
"public",
"void",
"rerender",
"(",
")",
"{",
"clear",
"(",
")",
";",
"if",
"(",
"dataItems",
"!=",
"null",
")",
"{",
"for",
"(",
"M",
"m",
":",
"dataItems",
")",
"{",
"addDataItem",
"(",
"m",
")",
";",
"}",
"}",
"doRefresh",
"(",
")",
";",
"}"
] |
Needed in case of renderer changed, so list has to be visually reconstructed by new renderer.
|
[
"Needed",
"in",
"case",
"of",
"renderer",
"changed",
"so",
"list",
"has",
"to",
"be",
"visually",
"reconstructed",
"by",
"new",
"renderer",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/misc/errai/JQMListBindable.java#L546-L554
|
10,711
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMWidget.java
|
JQMWidget.setThemeIfCurrentEmpty
|
public void setThemeIfCurrentEmpty(String themeName) {
if (themeName == null || themeName.isEmpty()) return;
String theme = getTheme();
if (theme == null || theme.isEmpty()) {
setTheme(themeName);
}
}
|
java
|
public void setThemeIfCurrentEmpty(String themeName) {
if (themeName == null || themeName.isEmpty()) return;
String theme = getTheme();
if (theme == null || theme.isEmpty()) {
setTheme(themeName);
}
}
|
[
"public",
"void",
"setThemeIfCurrentEmpty",
"(",
"String",
"themeName",
")",
"{",
"if",
"(",
"themeName",
"==",
"null",
"||",
"themeName",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"String",
"theme",
"=",
"getTheme",
"(",
")",
";",
"if",
"(",
"theme",
"==",
"null",
"||",
"theme",
".",
"isEmpty",
"(",
")",
")",
"{",
"setTheme",
"(",
"themeName",
")",
";",
"}",
"}"
] |
Sets new theme only in case if currently no theme is defined for this widget.
|
[
"Sets",
"new",
"theme",
"only",
"in",
"case",
"if",
"currently",
"no",
"theme",
"is",
"defined",
"for",
"this",
"widget",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMWidget.java#L152-L158
|
10,712
|
jqm4gwt/jqm4gwt
|
plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/JQMDataTable.java
|
JQMDataTable.setDfltTableStylesStr
|
public void setDfltTableStylesStr(String classes) {
dfltTableStyles.clear();
if (classes == null || classes.isEmpty()) return;
List<String> lst = StrUtils.split(classes, " ");
for (int k = 0; k < lst.size(); k++) {
String s = lst.get(k).trim();
DataTableStyleClass cls;
try {
cls = DataTableStyleClass.valueOf(s);
dfltTableStyles.add(cls);
} catch (Exception ex) {
continue;
}
}
}
|
java
|
public void setDfltTableStylesStr(String classes) {
dfltTableStyles.clear();
if (classes == null || classes.isEmpty()) return;
List<String> lst = StrUtils.split(classes, " ");
for (int k = 0; k < lst.size(); k++) {
String s = lst.get(k).trim();
DataTableStyleClass cls;
try {
cls = DataTableStyleClass.valueOf(s);
dfltTableStyles.add(cls);
} catch (Exception ex) {
continue;
}
}
}
|
[
"public",
"void",
"setDfltTableStylesStr",
"(",
"String",
"classes",
")",
"{",
"dfltTableStyles",
".",
"clear",
"(",
")",
";",
"if",
"(",
"classes",
"==",
"null",
"||",
"classes",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"List",
"<",
"String",
">",
"lst",
"=",
"StrUtils",
".",
"split",
"(",
"classes",
",",
"\" \"",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"lst",
".",
"size",
"(",
")",
";",
"k",
"++",
")",
"{",
"String",
"s",
"=",
"lst",
".",
"get",
"(",
"k",
")",
".",
"trim",
"(",
")",
";",
"DataTableStyleClass",
"cls",
";",
"try",
"{",
"cls",
"=",
"DataTableStyleClass",
".",
"valueOf",
"(",
"s",
")",
";",
"dfltTableStyles",
".",
"add",
"(",
"cls",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"continue",
";",
"}",
"}",
"}"
] |
Expected DataTableStyleClass enum values as space separated string.
|
[
"Expected",
"DataTableStyleClass",
"enum",
"values",
"as",
"space",
"separated",
"string",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/JQMDataTable.java#L624-L638
|
10,713
|
jqm4gwt/jqm4gwt
|
plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/JQMDataTable.java
|
JQMDataTable.adjustColumnSizing
|
public void adjustColumnSizing() {
JsDataTable.adjustColumnSizing(getElement());
Element sb = findUpperElement(SCROLL_BODY);
if (sb != null) sb.setScrollLeft(0);
}
|
java
|
public void adjustColumnSizing() {
JsDataTable.adjustColumnSizing(getElement());
Element sb = findUpperElement(SCROLL_BODY);
if (sb != null) sb.setScrollLeft(0);
}
|
[
"public",
"void",
"adjustColumnSizing",
"(",
")",
"{",
"JsDataTable",
".",
"adjustColumnSizing",
"(",
"getElement",
"(",
")",
")",
";",
"Element",
"sb",
"=",
"findUpperElement",
"(",
"SCROLL_BODY",
")",
";",
"if",
"(",
"sb",
"!=",
"null",
")",
"sb",
".",
"setScrollLeft",
"(",
"0",
")",
";",
"}"
] |
Aligns header to match the columns, useful after resize or orientation changes.
|
[
"Aligns",
"header",
"to",
"match",
"the",
"columns",
"useful",
"after",
"resize",
"or",
"orientation",
"changes",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/JQMDataTable.java#L956-L960
|
10,714
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.addDivider
|
public HasText addDivider(String text) {
JQMListDivider d = new JQMListDivider(text);
appendDivider(d);
return d;
}
|
java
|
public HasText addDivider(String text) {
JQMListDivider d = new JQMListDivider(text);
appendDivider(d);
return d;
}
|
[
"public",
"HasText",
"addDivider",
"(",
"String",
"text",
")",
"{",
"JQMListDivider",
"d",
"=",
"new",
"JQMListDivider",
"(",
"text",
")",
";",
"appendDivider",
"(",
"d",
")",
";",
"return",
"d",
";",
"}"
] |
Add a new divider with the given text and an automatically assigned id.
@return the created divider which can be used to change the text dynamically. Changes to that
instance write back to this list.
|
[
"Add",
"a",
"new",
"divider",
"with",
"the",
"given",
"text",
"and",
"an",
"automatically",
"assigned",
"id",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L173-L177
|
10,715
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.addItems
|
public JQMList addItems(Collection<String> items) {
for (String item : items)
addItem(item);
return this;
}
|
java
|
public JQMList addItems(Collection<String> items) {
for (String item : items)
addItem(item);
return this;
}
|
[
"public",
"JQMList",
"addItems",
"(",
"Collection",
"<",
"String",
">",
"items",
")",
"{",
"for",
"(",
"String",
"item",
":",
"items",
")",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] |
Add a collection of read only items.
|
[
"Add",
"a",
"collection",
"of",
"read",
"only",
"items",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L299-L303
|
10,716
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.removeDivider
|
public boolean removeDivider(String text) {
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && w.getElement().getInnerText().equals(text)) {
list.remove(k);
items.remove(k);
return true;
}
}
return false;
}
|
java
|
public boolean removeDivider(String text) {
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && w.getElement().getInnerText().equals(text)) {
list.remove(k);
items.remove(k);
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"removeDivider",
"(",
"String",
"text",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"list",
".",
"getWidgetCount",
"(",
")",
";",
"k",
"++",
")",
"{",
"Widget",
"w",
"=",
"list",
".",
"getWidget",
"(",
"k",
")",
";",
"if",
"(",
"isDivider",
"(",
"w",
")",
"&&",
"w",
".",
"getElement",
"(",
")",
".",
"getInnerText",
"(",
")",
".",
"equals",
"(",
"text",
")",
")",
"{",
"list",
".",
"remove",
"(",
"k",
")",
";",
"items",
".",
"remove",
"(",
"k",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Remove the divider with the given text. This method will search all the dividers and remove the first divider
found with the given text.
@return true if a divider with the given text was found and removed, otherwise false.
|
[
"Remove",
"the",
"divider",
"with",
"the",
"given",
"text",
".",
"This",
"method",
"will",
"search",
"all",
"the",
"dividers",
"and",
"remove",
"the",
"first",
"divider",
"found",
"with",
"the",
"given",
"text",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L557-L567
|
10,717
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.removeDividerByTag
|
public boolean removeDividerByTag(Object tag) {
if (tag == null) return false;
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && tag.equals(((JQMListDivider) w).getTag())) {
list.remove(k);
items.remove(k);
return true;
}
}
return false;
}
|
java
|
public boolean removeDividerByTag(Object tag) {
if (tag == null) return false;
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && tag.equals(((JQMListDivider) w).getTag())) {
list.remove(k);
items.remove(k);
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"removeDividerByTag",
"(",
"Object",
"tag",
")",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"return",
"false",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"list",
".",
"getWidgetCount",
"(",
")",
";",
"k",
"++",
")",
"{",
"Widget",
"w",
"=",
"list",
".",
"getWidget",
"(",
"k",
")",
";",
"if",
"(",
"isDivider",
"(",
"w",
")",
"&&",
"tag",
".",
"equals",
"(",
"(",
"(",
"JQMListDivider",
")",
"w",
")",
".",
"getTag",
"(",
")",
")",
")",
"{",
"list",
".",
"remove",
"(",
"k",
")",
";",
"items",
".",
"remove",
"(",
"k",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Remove the divider with the given tag. This method will search all the dividers and remove the first divider
found with the given tag.
@return true if a divider with the given tag was found and removed, otherwise false.
|
[
"Remove",
"the",
"divider",
"with",
"the",
"given",
"tag",
".",
"This",
"method",
"will",
"search",
"all",
"the",
"dividers",
"and",
"remove",
"the",
"first",
"divider",
"found",
"with",
"the",
"given",
"tag",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L575-L586
|
10,718
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.findDivider
|
public JQMListDivider findDivider(String text) {
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && w.getElement().getInnerText().equals(text)) {
return (JQMListDivider) w;
}
}
return null;
}
|
java
|
public JQMListDivider findDivider(String text) {
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && w.getElement().getInnerText().equals(text)) {
return (JQMListDivider) w;
}
}
return null;
}
|
[
"public",
"JQMListDivider",
"findDivider",
"(",
"String",
"text",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"list",
".",
"getWidgetCount",
"(",
")",
";",
"k",
"++",
")",
"{",
"Widget",
"w",
"=",
"list",
".",
"getWidget",
"(",
"k",
")",
";",
"if",
"(",
"isDivider",
"(",
"w",
")",
"&&",
"w",
".",
"getElement",
"(",
")",
".",
"getInnerText",
"(",
")",
".",
"equals",
"(",
"text",
")",
")",
"{",
"return",
"(",
"JQMListDivider",
")",
"w",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Find the divider with the given text. This method will search all the dividers and return the first divider
found with the given text.
@return the divider with the given text (if found, or null otherwise).
|
[
"Find",
"the",
"divider",
"with",
"the",
"given",
"text",
".",
"This",
"method",
"will",
"search",
"all",
"the",
"dividers",
"and",
"return",
"the",
"first",
"divider",
"found",
"with",
"the",
"given",
"text",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L594-L602
|
10,719
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.findDividerByTag
|
public JQMListDivider findDividerByTag(Object tag) {
if (tag == null) return null;
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && tag.equals(((JQMListDivider) w).getTag())) {
return (JQMListDivider) w;
}
}
return null;
}
|
java
|
public JQMListDivider findDividerByTag(Object tag) {
if (tag == null) return null;
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && tag.equals(((JQMListDivider) w).getTag())) {
return (JQMListDivider) w;
}
}
return null;
}
|
[
"public",
"JQMListDivider",
"findDividerByTag",
"(",
"Object",
"tag",
")",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"return",
"null",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"list",
".",
"getWidgetCount",
"(",
")",
";",
"k",
"++",
")",
"{",
"Widget",
"w",
"=",
"list",
".",
"getWidget",
"(",
"k",
")",
";",
"if",
"(",
"isDivider",
"(",
"w",
")",
"&&",
"tag",
".",
"equals",
"(",
"(",
"(",
"JQMListDivider",
")",
"w",
")",
".",
"getTag",
"(",
")",
")",
")",
"{",
"return",
"(",
"JQMListDivider",
")",
"w",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Find the divider with the given tag. This method will search all the dividers and return the first divider
found with the given tag.
@return the divider with the given tag (if found, or null otherwise).
|
[
"Find",
"the",
"divider",
"with",
"the",
"given",
"tag",
".",
"This",
"method",
"will",
"search",
"all",
"the",
"dividers",
"and",
"return",
"the",
"first",
"divider",
"found",
"with",
"the",
"given",
"tag",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L610-L619
|
10,720
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.findInsertIdxByDivider
|
public int findInsertIdxByDivider(JQMListDivider d) {
if (d == null) return -1;
int i = findDividerIdx(d);
if (i == -1) return -1;
List<JQMListItem> lst = getItems();
int rslt = i + 1;
while (rslt < lst.size()) {
if (lst.get(rslt) == null) { // next divider
return rslt;
}
rslt++;
}
return rslt;
}
|
java
|
public int findInsertIdxByDivider(JQMListDivider d) {
if (d == null) return -1;
int i = findDividerIdx(d);
if (i == -1) return -1;
List<JQMListItem> lst = getItems();
int rslt = i + 1;
while (rslt < lst.size()) {
if (lst.get(rslt) == null) { // next divider
return rslt;
}
rslt++;
}
return rslt;
}
|
[
"public",
"int",
"findInsertIdxByDivider",
"(",
"JQMListDivider",
"d",
")",
"{",
"if",
"(",
"d",
"==",
"null",
")",
"return",
"-",
"1",
";",
"int",
"i",
"=",
"findDividerIdx",
"(",
"d",
")",
";",
"if",
"(",
"i",
"==",
"-",
"1",
")",
"return",
"-",
"1",
";",
"List",
"<",
"JQMListItem",
">",
"lst",
"=",
"getItems",
"(",
")",
";",
"int",
"rslt",
"=",
"i",
"+",
"1",
";",
"while",
"(",
"rslt",
"<",
"lst",
".",
"size",
"(",
")",
")",
"{",
"if",
"(",
"lst",
".",
"get",
"(",
"rslt",
")",
"==",
"null",
")",
"{",
"// next divider",
"return",
"rslt",
";",
"}",
"rslt",
"++",
";",
"}",
"return",
"rslt",
";",
"}"
] |
For given divider finds the index at which new item should be inserted to become a part of
this divider's group.
@return - proper index for new item insertion, or -1 in case of error
|
[
"For",
"given",
"divider",
"finds",
"the",
"index",
"at",
"which",
"new",
"item",
"should",
"be",
"inserted",
"to",
"become",
"a",
"part",
"of",
"this",
"divider",
"s",
"group",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L649-L662
|
10,721
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.findItemOnlyIdx
|
public int findItemOnlyIdx(JQMListItem item) {
if (item == null) return -1;
List<JQMListItem> items = getItems();
if (items == null) return -1;
int i = items.indexOf(item);
if (i == -1) return -1;
int j = 0;
for (JQMListItem k : items) {
if (k == null) continue;
if (k == item) return j;
j++;
}
return -1;
}
|
java
|
public int findItemOnlyIdx(JQMListItem item) {
if (item == null) return -1;
List<JQMListItem> items = getItems();
if (items == null) return -1;
int i = items.indexOf(item);
if (i == -1) return -1;
int j = 0;
for (JQMListItem k : items) {
if (k == null) continue;
if (k == item) return j;
j++;
}
return -1;
}
|
[
"public",
"int",
"findItemOnlyIdx",
"(",
"JQMListItem",
"item",
")",
"{",
"if",
"(",
"item",
"==",
"null",
")",
"return",
"-",
"1",
";",
"List",
"<",
"JQMListItem",
">",
"items",
"=",
"getItems",
"(",
")",
";",
"if",
"(",
"items",
"==",
"null",
")",
"return",
"-",
"1",
";",
"int",
"i",
"=",
"items",
".",
"indexOf",
"(",
"item",
")",
";",
"if",
"(",
"i",
"==",
"-",
"1",
")",
"return",
"-",
"1",
";",
"int",
"j",
"=",
"0",
";",
"for",
"(",
"JQMListItem",
"k",
":",
"items",
")",
"{",
"if",
"(",
"k",
"==",
"null",
")",
"continue",
";",
"if",
"(",
"k",
"==",
"item",
")",
"return",
"j",
";",
"j",
"++",
";",
"}",
"return",
"-",
"1",
";",
"}"
] |
Ignores dividers, only counts JQMListItem bands.
@return - logical index of this item among other items (can be useful for matching/sync
between underlying data structure and UI in case of dynamic/multiple dividers
and JQMListItem's click handlers).
|
[
"Ignores",
"dividers",
"only",
"counts",
"JQMListItem",
"bands",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L681-L694
|
10,722
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.findItemByTag
|
public JQMListItem findItemByTag(Object tag) {
if (tag == null) return null;
List<JQMListItem> lst = getItems();
for (JQMListItem i : lst) {
if (i == null) continue;
if (tag.equals(i.getTag())) return i;
}
return null;
}
|
java
|
public JQMListItem findItemByTag(Object tag) {
if (tag == null) return null;
List<JQMListItem> lst = getItems();
for (JQMListItem i : lst) {
if (i == null) continue;
if (tag.equals(i.getTag())) return i;
}
return null;
}
|
[
"public",
"JQMListItem",
"findItemByTag",
"(",
"Object",
"tag",
")",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"return",
"null",
";",
"List",
"<",
"JQMListItem",
">",
"lst",
"=",
"getItems",
"(",
")",
";",
"for",
"(",
"JQMListItem",
"i",
":",
"lst",
")",
"{",
"if",
"(",
"i",
"==",
"null",
")",
"continue",
";",
"if",
"(",
"tag",
".",
"equals",
"(",
"i",
".",
"getTag",
"(",
")",
")",
")",
"return",
"i",
";",
"}",
"return",
"null",
";",
"}"
] |
Find the list item with the given tag. This method will search all the items and return
the first item found with the given tag.
@return the list item with the given tag (if found, or null otherwise).
|
[
"Find",
"the",
"list",
"item",
"with",
"the",
"given",
"tag",
".",
"This",
"method",
"will",
"search",
"all",
"the",
"items",
"and",
"return",
"the",
"first",
"item",
"found",
"with",
"the",
"given",
"tag",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L702-L710
|
10,723
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
|
JQMList.removeItem
|
public void removeItem(JQMListItem item) {
if (item != null) {
items.remove(item);
list.remove(item);
}
}
|
java
|
public void removeItem(JQMListItem item) {
if (item != null) {
items.remove(item);
list.remove(item);
}
}
|
[
"public",
"void",
"removeItem",
"(",
"JQMListItem",
"item",
")",
"{",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"items",
".",
"remove",
"(",
"item",
")",
";",
"list",
".",
"remove",
"(",
"item",
")",
";",
"}",
"}"
] |
Removes the given item from the list
@param item the item to remove
|
[
"Removes",
"the",
"given",
"item",
"from",
"the",
"list"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L727-L732
|
10,724
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/table/JQMColumnToggle.java
|
JQMColumnToggle.setHeaderTheme
|
public void setHeaderTheme(String value) {
headerTheme = value;
ComplexPanel r = findHeadRow();
if (r != null) setEltHeaderTheme(r.getElement(), value);
r = findHeadGroupsRow();
if (r != null) setEltHeaderTheme(r.getElement(), value);
}
|
java
|
public void setHeaderTheme(String value) {
headerTheme = value;
ComplexPanel r = findHeadRow();
if (r != null) setEltHeaderTheme(r.getElement(), value);
r = findHeadGroupsRow();
if (r != null) setEltHeaderTheme(r.getElement(), value);
}
|
[
"public",
"void",
"setHeaderTheme",
"(",
"String",
"value",
")",
"{",
"headerTheme",
"=",
"value",
";",
"ComplexPanel",
"r",
"=",
"findHeadRow",
"(",
")",
";",
"if",
"(",
"r",
"!=",
"null",
")",
"setEltHeaderTheme",
"(",
"r",
".",
"getElement",
"(",
")",
",",
"value",
")",
";",
"r",
"=",
"findHeadGroupsRow",
"(",
")",
";",
"if",
"(",
"r",
"!=",
"null",
")",
"setEltHeaderTheme",
"(",
"r",
".",
"getElement",
"(",
")",
",",
"value",
")",
";",
"}"
] |
Swatch header color "ui-bar-" + value will be used
|
[
"Swatch",
"header",
"color",
"ui",
"-",
"bar",
"-",
"+",
"value",
"will",
"be",
"used"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/table/JQMColumnToggle.java#L173-L179
|
10,725
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/table/JQMTableGrid.java
|
JQMTableGrid.getNumOfCols
|
protected int getNumOfCols() {
if (!columns.isEmpty()) return getHeadRegularColCnt() + columns.size();
if (loaded && !colTitleWidgets.isEmpty()) return getHeadRegularColCnt() + colTitleWidgets.size();
return getHeadRegularColCnt();
}
|
java
|
protected int getNumOfCols() {
if (!columns.isEmpty()) return getHeadRegularColCnt() + columns.size();
if (loaded && !colTitleWidgets.isEmpty()) return getHeadRegularColCnt() + colTitleWidgets.size();
return getHeadRegularColCnt();
}
|
[
"protected",
"int",
"getNumOfCols",
"(",
")",
"{",
"if",
"(",
"!",
"columns",
".",
"isEmpty",
"(",
")",
")",
"return",
"getHeadRegularColCnt",
"(",
")",
"+",
"columns",
".",
"size",
"(",
")",
";",
"if",
"(",
"loaded",
"&&",
"!",
"colTitleWidgets",
".",
"isEmpty",
"(",
")",
")",
"return",
"getHeadRegularColCnt",
"(",
")",
"+",
"colTitleWidgets",
".",
"size",
"(",
")",
";",
"return",
"getHeadRegularColCnt",
"(",
")",
";",
"}"
] |
important for body, because exact number of columns should be known when populating
|
[
"important",
"for",
"body",
"because",
"exact",
"number",
"of",
"columns",
"should",
"be",
"known",
"when",
"populating"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/table/JQMTableGrid.java#L426-L430
|
10,726
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java
|
JQMSlider.getValue
|
@Override
public Double getValue() {
Double rslt = getUiValue();
if (rslt == null) return internVal;
if (internVal == null) {
Double min = getMin();
if (rslt == min || rslt != null && rslt.equals(min)) return null;
}
internVal = rslt;
return rslt;
}
|
java
|
@Override
public Double getValue() {
Double rslt = getUiValue();
if (rslt == null) return internVal;
if (internVal == null) {
Double min = getMin();
if (rslt == min || rslt != null && rslt.equals(min)) return null;
}
internVal = rslt;
return rslt;
}
|
[
"@",
"Override",
"public",
"Double",
"getValue",
"(",
")",
"{",
"Double",
"rslt",
"=",
"getUiValue",
"(",
")",
";",
"if",
"(",
"rslt",
"==",
"null",
")",
"return",
"internVal",
";",
"if",
"(",
"internVal",
"==",
"null",
")",
"{",
"Double",
"min",
"=",
"getMin",
"(",
")",
";",
"if",
"(",
"rslt",
"==",
"min",
"||",
"rslt",
"!=",
"null",
"&&",
"rslt",
".",
"equals",
"(",
"min",
")",
")",
"return",
"null",
";",
"}",
"internVal",
"=",
"rslt",
";",
"return",
"rslt",
";",
"}"
] |
returns the current value of the slider
|
[
"returns",
"the",
"current",
"value",
"of",
"the",
"slider"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java#L199-L210
|
10,727
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java
|
JQMSlider.getMax
|
public Double getMax() {
String v = input.getElement().getAttribute("max");
if (v == null || v.isEmpty()) return null;
return Double.valueOf(v);
}
|
java
|
public Double getMax() {
String v = input.getElement().getAttribute("max");
if (v == null || v.isEmpty()) return null;
return Double.valueOf(v);
}
|
[
"public",
"Double",
"getMax",
"(",
")",
"{",
"String",
"v",
"=",
"input",
".",
"getElement",
"(",
")",
".",
"getAttribute",
"(",
"\"max\"",
")",
";",
"if",
"(",
"v",
"==",
"null",
"||",
"v",
".",
"isEmpty",
"(",
")",
")",
"return",
"null",
";",
"return",
"Double",
".",
"valueOf",
"(",
"v",
")",
";",
"}"
] |
Returns the max value of the slider
|
[
"Returns",
"the",
"max",
"value",
"of",
"the",
"slider"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java#L339-L343
|
10,728
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java
|
JQMSlider.setMax
|
public void setMax(Double max) {
String maxStr = doubleToNiceStr(max);
JQMCommon.setAttribute(input, "max", maxStr);
refreshMax(input.getElement().getId(), maxStr);
validateValue();
}
|
java
|
public void setMax(Double max) {
String maxStr = doubleToNiceStr(max);
JQMCommon.setAttribute(input, "max", maxStr);
refreshMax(input.getElement().getId(), maxStr);
validateValue();
}
|
[
"public",
"void",
"setMax",
"(",
"Double",
"max",
")",
"{",
"String",
"maxStr",
"=",
"doubleToNiceStr",
"(",
"max",
")",
";",
"JQMCommon",
".",
"setAttribute",
"(",
"input",
",",
"\"max\"",
",",
"maxStr",
")",
";",
"refreshMax",
"(",
"input",
".",
"getElement",
"(",
")",
".",
"getId",
"(",
")",
",",
"maxStr",
")",
";",
"validateValue",
"(",
")",
";",
"}"
] |
Sets the new max range for the slider.
@param max the new max range
|
[
"Sets",
"the",
"new",
"max",
"range",
"for",
"the",
"slider",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java#L359-L364
|
10,729
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java
|
JQMSlider.setMin
|
public void setMin(Double min) {
String minStr = doubleToNiceStr(min);
JQMCommon.setAttribute(input, "min", minStr);
refreshMin(input.getElement().getId(), minStr);
validateValue();
}
|
java
|
public void setMin(Double min) {
String minStr = doubleToNiceStr(min);
JQMCommon.setAttribute(input, "min", minStr);
refreshMin(input.getElement().getId(), minStr);
validateValue();
}
|
[
"public",
"void",
"setMin",
"(",
"Double",
"min",
")",
"{",
"String",
"minStr",
"=",
"doubleToNiceStr",
"(",
"min",
")",
";",
"JQMCommon",
".",
"setAttribute",
"(",
"input",
",",
"\"min\"",
",",
"minStr",
")",
";",
"refreshMin",
"(",
"input",
".",
"getElement",
"(",
")",
".",
"getId",
"(",
")",
",",
"minStr",
")",
";",
"validateValue",
"(",
")",
";",
"}"
] |
Sets the new min range for the slider
@param min the new min range
|
[
"Sets",
"the",
"new",
"min",
"range",
"for",
"the",
"slider"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java#L389-L394
|
10,730
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java
|
JQMSlider.setValue
|
@Override
public void setValue(Double value, boolean fireEvents) {
Double old = getValue();
if (old == value || old != null && old.equals(value)) return;
internVal = value;
setInputValueAttr(value);
ignoreChange = true;
try {
refresh(input.getElement().getId(), doubleToNiceStr(value));
} finally {
ignoreChange = false;
}
if (fireEvents) ValueChangeEvent.fire(this, value);
}
|
java
|
@Override
public void setValue(Double value, boolean fireEvents) {
Double old = getValue();
if (old == value || old != null && old.equals(value)) return;
internVal = value;
setInputValueAttr(value);
ignoreChange = true;
try {
refresh(input.getElement().getId(), doubleToNiceStr(value));
} finally {
ignoreChange = false;
}
if (fireEvents) ValueChangeEvent.fire(this, value);
}
|
[
"@",
"Override",
"public",
"void",
"setValue",
"(",
"Double",
"value",
",",
"boolean",
"fireEvents",
")",
"{",
"Double",
"old",
"=",
"getValue",
"(",
")",
";",
"if",
"(",
"old",
"==",
"value",
"||",
"old",
"!=",
"null",
"&&",
"old",
".",
"equals",
"(",
"value",
")",
")",
"return",
";",
"internVal",
"=",
"value",
";",
"setInputValueAttr",
"(",
"value",
")",
";",
"ignoreChange",
"=",
"true",
";",
"try",
"{",
"refresh",
"(",
"input",
".",
"getElement",
"(",
")",
".",
"getId",
"(",
")",
",",
"doubleToNiceStr",
"(",
"value",
")",
")",
";",
"}",
"finally",
"{",
"ignoreChange",
"=",
"false",
";",
"}",
"if",
"(",
"fireEvents",
")",
"ValueChangeEvent",
".",
"fire",
"(",
"this",
",",
"value",
")",
";",
"}"
] |
Sets the value of the slider to the given value
@param value the new value of the slider, must be in the range of the slider
|
[
"Sets",
"the",
"value",
"of",
"the",
"slider",
"to",
"the",
"given",
"value"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSlider.java#L481-L494
|
10,731
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.addHeaderText
|
public JQMListItem addHeaderText(int n, String html) {
Element e = Document.get().createHElement(n);
e.setInnerHTML(html);
attachChild(e);
return this;
}
|
java
|
public JQMListItem addHeaderText(int n, String html) {
Element e = Document.get().createHElement(n);
e.setInnerHTML(html);
attachChild(e);
return this;
}
|
[
"public",
"JQMListItem",
"addHeaderText",
"(",
"int",
"n",
",",
"String",
"html",
")",
"{",
"Element",
"e",
"=",
"Document",
".",
"get",
"(",
")",
".",
"createHElement",
"(",
"n",
")",
";",
"e",
".",
"setInnerHTML",
"(",
"html",
")",
";",
"attachChild",
"(",
"e",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a header element containing the given text.
@param n - the Hn element to use, e.g. if n is 2 then a {@code <h2>} element is created.
@param html - the value to set as the inner html of the {@code <hn>} element.
|
[
"Adds",
"a",
"header",
"element",
"containing",
"the",
"given",
"text",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L173-L178
|
10,732
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.addText
|
public JQMListItem addText(String html) {
Element e = Document.get().createPElement();
e.setInnerHTML(html);
attachChild(e);
return this;
}
|
java
|
public JQMListItem addText(String html) {
Element e = Document.get().createPElement();
e.setInnerHTML(html);
attachChild(e);
return this;
}
|
[
"public",
"JQMListItem",
"addText",
"(",
"String",
"html",
")",
"{",
"Element",
"e",
"=",
"Document",
".",
"get",
"(",
")",
".",
"createPElement",
"(",
")",
";",
"e",
".",
"setInnerHTML",
"(",
"html",
")",
";",
"attachChild",
"(",
"e",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a paragraph element containing the given text.
@param html - the value to set as the inner html of the p element.
|
[
"Adds",
"a",
"paragraph",
"element",
"containing",
"the",
"given",
"text",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L185-L190
|
10,733
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.addDiv
|
public JQMListItem addDiv(String html) {
Element e = Document.get().createDivElement();
e.setInnerHTML(html);
attachChild(e);
return this;
}
|
java
|
public JQMListItem addDiv(String html) {
Element e = Document.get().createDivElement();
e.setInnerHTML(html);
attachChild(e);
return this;
}
|
[
"public",
"JQMListItem",
"addDiv",
"(",
"String",
"html",
")",
"{",
"Element",
"e",
"=",
"Document",
".",
"get",
"(",
")",
".",
"createDivElement",
"(",
")",
";",
"e",
".",
"setInnerHTML",
"(",
"html",
")",
";",
"attachChild",
"(",
"e",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a div element containing the given text.
@param html - the value to set as the inner html of the div element.
|
[
"Adds",
"a",
"div",
"element",
"containing",
"the",
"given",
"text",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L197-L202
|
10,734
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.removeImage
|
public JQMListItem removeImage() {
if (imageElem != null) {
imageElem.removeFromParent();
imageElem = null;
}
getElement().removeClassName(STYLE_UI_LI_HAS_THUMB);
return this;
}
|
java
|
public JQMListItem removeImage() {
if (imageElem != null) {
imageElem.removeFromParent();
imageElem = null;
}
getElement().removeClassName(STYLE_UI_LI_HAS_THUMB);
return this;
}
|
[
"public",
"JQMListItem",
"removeImage",
"(",
")",
"{",
"if",
"(",
"imageElem",
"!=",
"null",
")",
"{",
"imageElem",
".",
"removeFromParent",
"(",
")",
";",
"imageElem",
"=",
"null",
";",
"}",
"getElement",
"(",
")",
".",
"removeClassName",
"(",
"STYLE_UI_LI_HAS_THUMB",
")",
";",
"return",
"this",
";",
"}"
] |
Removes the value of the image element if any. It is safe to call this
method regardless of if an image has been set or not.
|
[
"Removes",
"the",
"value",
"of",
"the",
"image",
"element",
"if",
"any",
".",
"It",
"is",
"safe",
"to",
"call",
"this",
"method",
"regardless",
"of",
"if",
"an",
"image",
"has",
"been",
"set",
"or",
"not",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L320-L327
|
10,735
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.removeHref
|
public JQMListItem removeHref() {
if (anchor == null) return this;
if (anchorPanel != null) {
List<Widget> lst = new ArrayList<Widget>();
for (int i = anchorPanel.getWidgetCount() - 1; i >= 0; i--) {
Widget w = anchorPanel.getWidget(i);
anchorPanel.remove(i);
lst.add(0, w);
}
remove(anchorPanel);
cleanUpLI();
for (Widget w : lst) this.add(w);
} else {
moveAnchorChildrenToThis();
getElement().removeChild(anchor);
}
anchor = null;
anchorPanel = null;
setSplitHref(null);
return this;
}
|
java
|
public JQMListItem removeHref() {
if (anchor == null) return this;
if (anchorPanel != null) {
List<Widget> lst = new ArrayList<Widget>();
for (int i = anchorPanel.getWidgetCount() - 1; i >= 0; i--) {
Widget w = anchorPanel.getWidget(i);
anchorPanel.remove(i);
lst.add(0, w);
}
remove(anchorPanel);
cleanUpLI();
for (Widget w : lst) this.add(w);
} else {
moveAnchorChildrenToThis();
getElement().removeChild(anchor);
}
anchor = null;
anchorPanel = null;
setSplitHref(null);
return this;
}
|
[
"public",
"JQMListItem",
"removeHref",
"(",
")",
"{",
"if",
"(",
"anchor",
"==",
"null",
")",
"return",
"this",
";",
"if",
"(",
"anchorPanel",
"!=",
"null",
")",
"{",
"List",
"<",
"Widget",
">",
"lst",
"=",
"new",
"ArrayList",
"<",
"Widget",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"anchorPanel",
".",
"getWidgetCount",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"Widget",
"w",
"=",
"anchorPanel",
".",
"getWidget",
"(",
"i",
")",
";",
"anchorPanel",
".",
"remove",
"(",
"i",
")",
";",
"lst",
".",
"add",
"(",
"0",
",",
"w",
")",
";",
"}",
"remove",
"(",
"anchorPanel",
")",
";",
"cleanUpLI",
"(",
")",
";",
"for",
"(",
"Widget",
"w",
":",
"lst",
")",
"this",
".",
"(",
"w",
")",
";",
"}",
"else",
"{",
"moveAnchorChildrenToThis",
"(",
")",
";",
"getElement",
"(",
")",
".",
"removeChild",
"(",
"anchor",
")",
";",
"}",
"anchor",
"=",
"null",
";",
"anchorPanel",
"=",
"null",
";",
"setSplitHref",
"(",
"null",
")",
";",
"return",
"this",
";",
"}"
] |
Remove the url from this list item changing the item into a read only
item.
|
[
"Remove",
"the",
"url",
"from",
"this",
"list",
"item",
"changing",
"the",
"item",
"into",
"a",
"read",
"only",
"item",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L333-L354
|
10,736
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.setAside
|
public void setAside(String text) {
if (text == null)
throw new RuntimeException("Cannot set aside to null. Call removeAside() if you wanted to remove the aside text");
if (asideElem == null)
createAndAttachAsideElem();
asideElem.setInnerText(text);
}
|
java
|
public void setAside(String text) {
if (text == null)
throw new RuntimeException("Cannot set aside to null. Call removeAside() if you wanted to remove the aside text");
if (asideElem == null)
createAndAttachAsideElem();
asideElem.setInnerText(text);
}
|
[
"public",
"void",
"setAside",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Cannot set aside to null. Call removeAside() if you wanted to remove the aside text\"",
")",
";",
"if",
"(",
"asideElem",
"==",
"null",
")",
"createAndAttachAsideElem",
"(",
")",
";",
"asideElem",
".",
"setInnerText",
"(",
"text",
")",
";",
"}"
] |
Sets the content of the aside. The aside is supplemental content that
is positioned to the right of the main content.
|
[
"Sets",
"the",
"content",
"of",
"the",
"aside",
".",
"The",
"aside",
"is",
"supplemental",
"content",
"that",
"is",
"positioned",
"to",
"the",
"right",
"of",
"the",
"main",
"content",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L376-L383
|
10,737
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.setText
|
@Override
public void setText(String text) {
if (text == null) {
if (headerElem != null) {
removeChild(headerElem);
headerElem = null;
}
return;
}
if (headerElem == null) {
headerElem = Document.get().createHElement(3);
attachChild(headerElem);
}
headerElem.setInnerText(text);
}
|
java
|
@Override
public void setText(String text) {
if (text == null) {
if (headerElem != null) {
removeChild(headerElem);
headerElem = null;
}
return;
}
if (headerElem == null) {
headerElem = Document.get().createHElement(3);
attachChild(headerElem);
}
headerElem.setInnerText(text);
}
|
[
"@",
"Override",
"public",
"void",
"setText",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"if",
"(",
"headerElem",
"!=",
"null",
")",
"{",
"removeChild",
"(",
"headerElem",
")",
";",
"headerElem",
"=",
"null",
";",
"}",
"return",
";",
"}",
"if",
"(",
"headerElem",
"==",
"null",
")",
"{",
"headerElem",
"=",
"Document",
".",
"get",
"(",
")",
".",
"createHElement",
"(",
"3",
")",
";",
"attachChild",
"(",
"headerElem",
")",
";",
"}",
"headerElem",
".",
"setInnerText",
"(",
"text",
")",
";",
"}"
] |
Sets the content of the "main" text to the given value.
|
[
"Sets",
"the",
"content",
"of",
"the",
"main",
"text",
"to",
"the",
"given",
"value",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L561-L576
|
10,738
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.setHref
|
public void setHref(String url) {
if (url == null)
throw new RuntimeException("Cannot set URL to null. Call removeUrl() if you wanted to remove the URL");
if (anchor == null) {
if (controlGroupRoot != null) {
//!!! following code is semi-working, it's not reconstructed item correctly
remove(controlGroupRoot);
anchor = Document.get().createAnchorElement();
anchor.setAttribute("href", url);
moveThisChildrenToAnchor();
cleanUpLI();
prepareAnchorForControlGroup();
getElement().appendChild(anchor);
checkAnchorPanel();
} else {
// need to make anchor and move children to it
anchor = Document.get().createAnchorElement();
moveThisChildrenToAnchor();
getElement().appendChild(anchor);
}
addItemActivationHandlers();
}
anchor.setAttribute("href", url);
}
|
java
|
public void setHref(String url) {
if (url == null)
throw new RuntimeException("Cannot set URL to null. Call removeUrl() if you wanted to remove the URL");
if (anchor == null) {
if (controlGroupRoot != null) {
//!!! following code is semi-working, it's not reconstructed item correctly
remove(controlGroupRoot);
anchor = Document.get().createAnchorElement();
anchor.setAttribute("href", url);
moveThisChildrenToAnchor();
cleanUpLI();
prepareAnchorForControlGroup();
getElement().appendChild(anchor);
checkAnchorPanel();
} else {
// need to make anchor and move children to it
anchor = Document.get().createAnchorElement();
moveThisChildrenToAnchor();
getElement().appendChild(anchor);
}
addItemActivationHandlers();
}
anchor.setAttribute("href", url);
}
|
[
"public",
"void",
"setHref",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Cannot set URL to null. Call removeUrl() if you wanted to remove the URL\"",
")",
";",
"if",
"(",
"anchor",
"==",
"null",
")",
"{",
"if",
"(",
"controlGroupRoot",
"!=",
"null",
")",
"{",
"//!!! following code is semi-working, it's not reconstructed item correctly",
"remove",
"(",
"controlGroupRoot",
")",
";",
"anchor",
"=",
"Document",
".",
"get",
"(",
")",
".",
"createAnchorElement",
"(",
")",
";",
"anchor",
".",
"setAttribute",
"(",
"\"href\"",
",",
"url",
")",
";",
"moveThisChildrenToAnchor",
"(",
")",
";",
"cleanUpLI",
"(",
")",
";",
"prepareAnchorForControlGroup",
"(",
")",
";",
"getElement",
"(",
")",
".",
"appendChild",
"(",
"anchor",
")",
";",
"checkAnchorPanel",
"(",
")",
";",
"}",
"else",
"{",
"// need to make anchor and move children to it",
"anchor",
"=",
"Document",
".",
"get",
"(",
")",
".",
"createAnchorElement",
"(",
")",
";",
"moveThisChildrenToAnchor",
"(",
")",
";",
"getElement",
"(",
")",
".",
"appendChild",
"(",
"anchor",
")",
";",
"}",
"addItemActivationHandlers",
"(",
")",
";",
"}",
"anchor",
".",
"setAttribute",
"(",
"\"href\"",
",",
"url",
")",
";",
"}"
] |
Sets the url to link to for this item. If this item was a read only
item it automatically becomes linkable.
|
[
"Sets",
"the",
"url",
"to",
"link",
"to",
"for",
"this",
"item",
".",
"If",
"this",
"item",
"was",
"a",
"read",
"only",
"item",
"it",
"automatically",
"becomes",
"linkable",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L590-L613
|
10,739
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.setControlGroup
|
public void setControlGroup(boolean value, boolean linkable) {
if (value) {
createControlGroup(linkable);
} else if (controlGroup != null) {
if (anchorPanel != null) remove(anchorPanel);
else if (anchor != null) getElement().removeChild(anchor);
anchor = null;
anchorPanel = null;
setSplitHref(null);
controlGroupRoot = null;
controlGroup = null;
checkBoxInput = null;
}
}
|
java
|
public void setControlGroup(boolean value, boolean linkable) {
if (value) {
createControlGroup(linkable);
} else if (controlGroup != null) {
if (anchorPanel != null) remove(anchorPanel);
else if (anchor != null) getElement().removeChild(anchor);
anchor = null;
anchorPanel = null;
setSplitHref(null);
controlGroupRoot = null;
controlGroup = null;
checkBoxInput = null;
}
}
|
[
"public",
"void",
"setControlGroup",
"(",
"boolean",
"value",
",",
"boolean",
"linkable",
")",
"{",
"if",
"(",
"value",
")",
"{",
"createControlGroup",
"(",
"linkable",
")",
";",
"}",
"else",
"if",
"(",
"controlGroup",
"!=",
"null",
")",
"{",
"if",
"(",
"anchorPanel",
"!=",
"null",
")",
"remove",
"(",
"anchorPanel",
")",
";",
"else",
"if",
"(",
"anchor",
"!=",
"null",
")",
"getElement",
"(",
")",
".",
"removeChild",
"(",
"anchor",
")",
";",
"anchor",
"=",
"null",
";",
"anchorPanel",
"=",
"null",
";",
"setSplitHref",
"(",
"null",
")",
";",
"controlGroupRoot",
"=",
"null",
";",
"controlGroup",
"=",
"null",
";",
"checkBoxInput",
"=",
"null",
";",
"}",
"}"
] |
true - prepare and allow to add widgets to this list box item.
@param linkable - if true <a> will be forcefully created, so row will be clickable.
|
[
"true",
"-",
"prepare",
"and",
"allow",
"to",
"add",
"widgets",
"to",
"this",
"list",
"box",
"item",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L747-L760
|
10,740
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.setTransition
|
@Override
public void setTransition(Transition transition) {
if (anchor == null) {
if (transition != null) {
setUrl("#");
} else {
return;
}
}
if (anchor != null) JQMCommon.setTransition(anchor, transition);
}
|
java
|
@Override
public void setTransition(Transition transition) {
if (anchor == null) {
if (transition != null) {
setUrl("#");
} else {
return;
}
}
if (anchor != null) JQMCommon.setTransition(anchor, transition);
}
|
[
"@",
"Override",
"public",
"void",
"setTransition",
"(",
"Transition",
"transition",
")",
"{",
"if",
"(",
"anchor",
"==",
"null",
")",
"{",
"if",
"(",
"transition",
"!=",
"null",
")",
"{",
"setUrl",
"(",
"\"#\"",
")",
";",
"}",
"else",
"{",
"return",
";",
"}",
"}",
"if",
"(",
"anchor",
"!=",
"null",
")",
"JQMCommon",
".",
"setTransition",
"(",
"anchor",
",",
"transition",
")",
";",
"}"
] |
Sets the transition to be used by this list item when loading the URL.
|
[
"Sets",
"the",
"transition",
"to",
"be",
"used",
"by",
"this",
"list",
"item",
"when",
"loading",
"the",
"URL",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L970-L980
|
10,741
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
|
JQMListItem.setSplitTransition
|
public void setSplitTransition(Transition transition) {
if (split == null) {
if (transition != null) {
setSplitHref("#");
} else {
return;
}
}
if (split != null) JQMCommon.setTransition(split, transition);
}
|
java
|
public void setSplitTransition(Transition transition) {
if (split == null) {
if (transition != null) {
setSplitHref("#");
} else {
return;
}
}
if (split != null) JQMCommon.setTransition(split, transition);
}
|
[
"public",
"void",
"setSplitTransition",
"(",
"Transition",
"transition",
")",
"{",
"if",
"(",
"split",
"==",
"null",
")",
"{",
"if",
"(",
"transition",
"!=",
"null",
")",
"{",
"setSplitHref",
"(",
"\"#\"",
")",
";",
"}",
"else",
"{",
"return",
";",
"}",
"}",
"if",
"(",
"split",
"!=",
"null",
")",
"JQMCommon",
".",
"setTransition",
"(",
"split",
",",
"transition",
")",
";",
"}"
] |
Sets the transition to be used by this list item split part when loading the URL.
|
[
"Sets",
"the",
"transition",
"to",
"be",
"used",
"by",
"this",
"list",
"item",
"split",
"part",
"when",
"loading",
"the",
"URL",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L1046-L1055
|
10,742
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.setContainerId
|
@Override
public void setContainerId(String containerId) {
if (getId() == null) {
super.setContainerId(containerId);
JQMContext.attachAndEnhance(this);
} else if (! containerId.equals(getId())) {
throw new IllegalStateException("Attempt to change JQMPage with containerId '" + getId() + "' to '" + containerId + "' failed - once set, it cannot be changed.");
}
}
|
java
|
@Override
public void setContainerId(String containerId) {
if (getId() == null) {
super.setContainerId(containerId);
JQMContext.attachAndEnhance(this);
} else if (! containerId.equals(getId())) {
throw new IllegalStateException("Attempt to change JQMPage with containerId '" + getId() + "' to '" + containerId + "' failed - once set, it cannot be changed.");
}
}
|
[
"@",
"Override",
"public",
"void",
"setContainerId",
"(",
"String",
"containerId",
")",
"{",
"if",
"(",
"getId",
"(",
")",
"==",
"null",
")",
"{",
"super",
".",
"setContainerId",
"(",
"containerId",
")",
";",
"JQMContext",
".",
"attachAndEnhance",
"(",
"this",
")",
";",
"}",
"else",
"if",
"(",
"!",
"containerId",
".",
"equals",
"(",
"getId",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Attempt to change JQMPage with containerId '\"",
"+",
"getId",
"(",
")",
"+",
"\"' to '\"",
"+",
"containerId",
"+",
"\"' failed - once set, it cannot be changed.\"",
")",
";",
"}",
"}"
] |
Sets the containerId so it can be referenced by name. This can only be set once. All subsequent attempts on this
instance will result in an IllegalStateException.
@param containerId
|
[
"Sets",
"the",
"containerId",
"so",
"it",
"can",
"be",
"referenced",
"by",
"name",
".",
"This",
"can",
"only",
"be",
"set",
"once",
".",
"All",
"subsequent",
"attempts",
"on",
"this",
"instance",
"will",
"result",
"in",
"an",
"IllegalStateException",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L151-L159
|
10,743
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.addLogical
|
protected void addLogical(Widget child) {
// Detach new child.
child.removeFromParent();
// Logical attach.
getChildren().add(child);
// Adopt.
adopt(child);
}
|
java
|
protected void addLogical(Widget child) {
// Detach new child.
child.removeFromParent();
// Logical attach.
getChildren().add(child);
// Adopt.
adopt(child);
}
|
[
"protected",
"void",
"addLogical",
"(",
"Widget",
"child",
")",
"{",
"// Detach new child.",
"child",
".",
"removeFromParent",
"(",
")",
";",
"// Logical attach.",
"getChildren",
"(",
")",
".",
"add",
"(",
"child",
")",
";",
"// Adopt.",
"adopt",
"(",
"child",
")",
";",
"}"
] |
Logical add operation. If you do this you are responsible for adding it
to the DOM yourself.
@param child
the child widget to be added
|
[
"Logical",
"add",
"operation",
".",
"If",
"you",
"do",
"this",
"you",
"are",
"responsible",
"for",
"adding",
"it",
"to",
"the",
"DOM",
"yourself",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L193-L202
|
10,744
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.removeLogical
|
protected boolean removeLogical(Widget w) {
// Validate.
if (w.getParent() != this) {
return false;
}
// Orphan.
try {
orphan(w);
} finally {
// Logical detach.
getChildren().remove(w);
}
return true;
}
|
java
|
protected boolean removeLogical(Widget w) {
// Validate.
if (w.getParent() != this) {
return false;
}
// Orphan.
try {
orphan(w);
} finally {
// Logical detach.
getChildren().remove(w);
}
return true;
}
|
[
"protected",
"boolean",
"removeLogical",
"(",
"Widget",
"w",
")",
"{",
"// Validate.",
"if",
"(",
"w",
".",
"getParent",
"(",
")",
"!=",
"this",
")",
"{",
"return",
"false",
";",
"}",
"// Orphan.",
"try",
"{",
"orphan",
"(",
"w",
")",
";",
"}",
"finally",
"{",
"// Logical detach.",
"getChildren",
"(",
")",
".",
"remove",
"(",
"w",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
Logical remove operation. If you do this you are responsible for removing it
from the DOM yourself.
@param w - the child widget to be removed
|
[
"Logical",
"remove",
"operation",
".",
"If",
"you",
"do",
"this",
"you",
"are",
"responsible",
"for",
"removing",
"it",
"from",
"the",
"DOM",
"yourself",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L210-L223
|
10,745
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.add
|
@Override
public void add(Widget widget) {
if (widget instanceof HasJqmHeader) {
setHeader((HasJqmHeader) widget);
return;
} else if (widget instanceof HasJqmFooter) {
setFooter((HasJqmFooter) widget);
return;
} else if (widget instanceof JQMContent) {
throw new RuntimeException("Do not add content widgets here, call createContent() instead");
}
getPrimaryContent().add(widget);
// if page is already enhanced then we need to enhance the content manually
// if (enhanced) triggerCreate();
}
|
java
|
@Override
public void add(Widget widget) {
if (widget instanceof HasJqmHeader) {
setHeader((HasJqmHeader) widget);
return;
} else if (widget instanceof HasJqmFooter) {
setFooter((HasJqmFooter) widget);
return;
} else if (widget instanceof JQMContent) {
throw new RuntimeException("Do not add content widgets here, call createContent() instead");
}
getPrimaryContent().add(widget);
// if page is already enhanced then we need to enhance the content manually
// if (enhanced) triggerCreate();
}
|
[
"@",
"Override",
"public",
"void",
"add",
"(",
"Widget",
"widget",
")",
"{",
"if",
"(",
"widget",
"instanceof",
"HasJqmHeader",
")",
"{",
"setHeader",
"(",
"(",
"HasJqmHeader",
")",
"widget",
")",
";",
"return",
";",
"}",
"else",
"if",
"(",
"widget",
"instanceof",
"HasJqmFooter",
")",
"{",
"setFooter",
"(",
"(",
"HasJqmFooter",
")",
"widget",
")",
";",
"return",
";",
"}",
"else",
"if",
"(",
"widget",
"instanceof",
"JQMContent",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Do not add content widgets here, call createContent() instead\"",
")",
";",
"}",
"getPrimaryContent",
"(",
")",
".",
"add",
"(",
"widget",
")",
";",
"// if page is already enhanced then we need to enhance the content manually",
"// if (enhanced) triggerCreate();",
"}"
] |
Adds a widget to the primary content container of this page.
@param widget the widget to add to the primary content
|
[
"Adds",
"a",
"widget",
"to",
"the",
"primary",
"content",
"container",
"of",
"this",
"page",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L242-L257
|
10,746
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.createContent
|
public JQMContent createContent() {
JQMContent content = new JQMContent();
Element elt = getElement();
add(content, elt);
return content;
}
|
java
|
public JQMContent createContent() {
JQMContent content = new JQMContent();
Element elt = getElement();
add(content, elt);
return content;
}
|
[
"public",
"JQMContent",
"createContent",
"(",
")",
"{",
"JQMContent",
"content",
"=",
"new",
"JQMContent",
"(",
")",
";",
"Element",
"elt",
"=",
"getElement",
"(",
")",
";",
"add",
"(",
"content",
",",
"elt",
")",
";",
"return",
"content",
";",
"}"
] |
Creates a content container on this page and returns it. Content can
then be added to this secondary container. There is no limit to the
number of secondary content containers that can be created.
|
[
"Creates",
"a",
"content",
"container",
"on",
"this",
"page",
"and",
"returns",
"it",
".",
"Content",
"can",
"then",
"be",
"added",
"to",
"this",
"secondary",
"container",
".",
"There",
"is",
"no",
"limit",
"to",
"the",
"number",
"of",
"secondary",
"content",
"containers",
"that",
"can",
"be",
"created",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L354-L359
|
10,747
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.prepareTransparentGoing
|
private static void prepareTransparentGoing(boolean add, String transparentPageId) {
Element p = Document.get().getBody();
if (p != null) {
String s = JQM4GWT_DLG_TRANSPARENT_GOING_PREFIX + transparentPageId;
if (add) {
p.addClassName(JQM4GWT_DLG_TRANSPARENT_GOING);
p.addClassName(s);
} else {
p.removeClassName(s);
String ss = JQMCommon.getStyleStartsWith(p, JQM4GWT_DLG_TRANSPARENT_GOING_PREFIX);
// checking for "opened dialog chain" case
if (Empty.is(ss)) p.removeClassName(JQM4GWT_DLG_TRANSPARENT_GOING);
}
}
}
|
java
|
private static void prepareTransparentGoing(boolean add, String transparentPageId) {
Element p = Document.get().getBody();
if (p != null) {
String s = JQM4GWT_DLG_TRANSPARENT_GOING_PREFIX + transparentPageId;
if (add) {
p.addClassName(JQM4GWT_DLG_TRANSPARENT_GOING);
p.addClassName(s);
} else {
p.removeClassName(s);
String ss = JQMCommon.getStyleStartsWith(p, JQM4GWT_DLG_TRANSPARENT_GOING_PREFIX);
// checking for "opened dialog chain" case
if (Empty.is(ss)) p.removeClassName(JQM4GWT_DLG_TRANSPARENT_GOING);
}
}
}
|
[
"private",
"static",
"void",
"prepareTransparentGoing",
"(",
"boolean",
"add",
",",
"String",
"transparentPageId",
")",
"{",
"Element",
"p",
"=",
"Document",
".",
"get",
"(",
")",
".",
"getBody",
"(",
")",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"{",
"String",
"s",
"=",
"JQM4GWT_DLG_TRANSPARENT_GOING_PREFIX",
"+",
"transparentPageId",
";",
"if",
"(",
"add",
")",
"{",
"p",
".",
"addClassName",
"(",
"JQM4GWT_DLG_TRANSPARENT_GOING",
")",
";",
"p",
".",
"addClassName",
"(",
"s",
")",
";",
"}",
"else",
"{",
"p",
".",
"removeClassName",
"(",
"s",
")",
";",
"String",
"ss",
"=",
"JQMCommon",
".",
"getStyleStartsWith",
"(",
"p",
",",
"JQM4GWT_DLG_TRANSPARENT_GOING_PREFIX",
")",
";",
"// checking for \"opened dialog chain\" case",
"if",
"(",
"Empty",
".",
"is",
"(",
"ss",
")",
")",
"p",
".",
"removeClassName",
"(",
"JQM4GWT_DLG_TRANSPARENT_GOING",
")",
";",
"}",
"}",
"}"
] |
GOING means from beforeShow till afterHide.
|
[
"GOING",
"means",
"from",
"beforeShow",
"till",
"afterHide",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L477-L491
|
10,748
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.setFooter
|
public void setFooter(HasJqmFooter footer) {
removeFooter();
this.footer = footer;
if (this.footer == null) return;
addLogical(footer.getFooterStage());
getElement().appendChild(footer.getJqmFooter().getElement());
}
|
java
|
public void setFooter(HasJqmFooter footer) {
removeFooter();
this.footer = footer;
if (this.footer == null) return;
addLogical(footer.getFooterStage());
getElement().appendChild(footer.getJqmFooter().getElement());
}
|
[
"public",
"void",
"setFooter",
"(",
"HasJqmFooter",
"footer",
")",
"{",
"removeFooter",
"(",
")",
";",
"this",
".",
"footer",
"=",
"footer",
";",
"if",
"(",
"this",
".",
"footer",
"==",
"null",
")",
"return",
";",
"addLogical",
"(",
"footer",
".",
"getFooterStage",
"(",
")",
")",
";",
"getElement",
"(",
")",
".",
"appendChild",
"(",
"footer",
".",
"getJqmFooter",
"(",
")",
".",
"getElement",
"(",
")",
")",
";",
"}"
] |
Sets the footer element, overriding an existing footer if any.
|
[
"Sets",
"the",
"footer",
"element",
"overriding",
"an",
"existing",
"footer",
"if",
"any",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L745-L752
|
10,749
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.setHeader
|
public void setHeader(HasJqmHeader header) {
removeHeader();
this.header = header;
if (this.header == null) return;
addLogical(header.getHeaderStage());
if (panel == null) {
getElement().insertBefore(header.getJqmHeader().getElement(), getElement().getFirstChild());
} else {
getElement().insertAfter(header.getJqmHeader().getElement(), panel.getElement());
}
}
|
java
|
public void setHeader(HasJqmHeader header) {
removeHeader();
this.header = header;
if (this.header == null) return;
addLogical(header.getHeaderStage());
if (panel == null) {
getElement().insertBefore(header.getJqmHeader().getElement(), getElement().getFirstChild());
} else {
getElement().insertAfter(header.getJqmHeader().getElement(), panel.getElement());
}
}
|
[
"public",
"void",
"setHeader",
"(",
"HasJqmHeader",
"header",
")",
"{",
"removeHeader",
"(",
")",
";",
"this",
".",
"header",
"=",
"header",
";",
"if",
"(",
"this",
".",
"header",
"==",
"null",
")",
"return",
";",
"addLogical",
"(",
"header",
".",
"getHeaderStage",
"(",
")",
")",
";",
"if",
"(",
"panel",
"==",
"null",
")",
"{",
"getElement",
"(",
")",
".",
"insertBefore",
"(",
"header",
".",
"getJqmHeader",
"(",
")",
".",
"getElement",
"(",
")",
",",
"getElement",
"(",
")",
".",
"getFirstChild",
"(",
")",
")",
";",
"}",
"else",
"{",
"getElement",
"(",
")",
".",
"insertAfter",
"(",
"header",
".",
"getJqmHeader",
"(",
")",
".",
"getElement",
"(",
")",
",",
"panel",
".",
"getElement",
"(",
")",
")",
";",
"}",
"}"
] |
Sets the header element, overriding an existing header if any.
|
[
"Sets",
"the",
"header",
"element",
"overriding",
"an",
"existing",
"header",
"if",
"any",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L776-L788
|
10,750
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.setContentAddStyleNames
|
public void setContentAddStyleNames(String value) {
if (value == null || value.isEmpty()) return;
JQMCommon.addStyleNames(content, value);
}
|
java
|
public void setContentAddStyleNames(String value) {
if (value == null || value.isEmpty()) return;
JQMCommon.addStyleNames(content, value);
}
|
[
"public",
"void",
"setContentAddStyleNames",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"JQMCommon",
".",
"addStyleNames",
"(",
"content",
",",
"value",
")",
";",
"}"
] |
Additional class names can be added directly to content div for better custom styling.
The same idea as UiBinder's embedded addStyleNames functionality.
<br> Example:
<pre><jqm:JQMPage contentAddStyleNames="aaa bbb ccc"/></pre>
|
[
"Additional",
"class",
"names",
"can",
"be",
"added",
"directly",
"to",
"content",
"div",
"for",
"better",
"custom",
"styling",
".",
"The",
"same",
"idea",
"as",
"UiBinder",
"s",
"embedded",
"addStyleNames",
"functionality",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L833-L836
|
10,751
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.setContentHeightPercent
|
public void setContentHeightPercent(double contentHeightPercent) {
double oldVal = this.contentHeightPercent;
this.contentHeightPercent = contentHeightPercent;
if (oldVal != this.contentHeightPercent && content != null && content.isAttached()) {
recalcContentHeightPercent();
centerContent();
initWindowResize();
}
}
|
java
|
public void setContentHeightPercent(double contentHeightPercent) {
double oldVal = this.contentHeightPercent;
this.contentHeightPercent = contentHeightPercent;
if (oldVal != this.contentHeightPercent && content != null && content.isAttached()) {
recalcContentHeightPercent();
centerContent();
initWindowResize();
}
}
|
[
"public",
"void",
"setContentHeightPercent",
"(",
"double",
"contentHeightPercent",
")",
"{",
"double",
"oldVal",
"=",
"this",
".",
"contentHeightPercent",
";",
"this",
".",
"contentHeightPercent",
"=",
"contentHeightPercent",
";",
"if",
"(",
"oldVal",
"!=",
"this",
".",
"contentHeightPercent",
"&&",
"content",
"!=",
"null",
"&&",
"content",
".",
"isAttached",
"(",
")",
")",
"{",
"recalcContentHeightPercent",
"(",
")",
";",
"centerContent",
"(",
")",
";",
"initWindowResize",
"(",
")",
";",
"}",
"}"
] |
Defines content band's height as percent of available content area's height.
|
[
"Defines",
"content",
"band",
"s",
"height",
"as",
"percent",
"of",
"available",
"content",
"area",
"s",
"height",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L889-L897
|
10,752
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
|
JQMPage.restoreRolePage
|
public void restoreRolePage() {
JQMCommon.setDataRole(this, "page");
JQMCommon.setDataDialog(this, false);
removeStyleName(STYLE_UI_DIALOG);
Element elt = getElement();
Element dlgContain = JQMCommon.findChild(elt, UI_DIALOG_CONTAIN);
if (dlgContain != null) {
JQMCommon.moveChildren(dlgContain, elt);
elt.removeChild(dlgContain);
}
JQMHeader h = getHeader();
if (h != null) {
Element btn = JQMCommon.findChild(h.getElement(), "ui-btn-icon-notext");
if (btn != null && "#".equals(JQMCommon.getAttribute(btn, "href"))
&& (DataIcon.DELETE == JQMCommon.getIcon(btn)
|| DataIcon.DELETE == JQMCommon.getStyleIcon(btn))) {
h.getElement().removeChild(btn);
}
}
}
|
java
|
public void restoreRolePage() {
JQMCommon.setDataRole(this, "page");
JQMCommon.setDataDialog(this, false);
removeStyleName(STYLE_UI_DIALOG);
Element elt = getElement();
Element dlgContain = JQMCommon.findChild(elt, UI_DIALOG_CONTAIN);
if (dlgContain != null) {
JQMCommon.moveChildren(dlgContain, elt);
elt.removeChild(dlgContain);
}
JQMHeader h = getHeader();
if (h != null) {
Element btn = JQMCommon.findChild(h.getElement(), "ui-btn-icon-notext");
if (btn != null && "#".equals(JQMCommon.getAttribute(btn, "href"))
&& (DataIcon.DELETE == JQMCommon.getIcon(btn)
|| DataIcon.DELETE == JQMCommon.getStyleIcon(btn))) {
h.getElement().removeChild(btn);
}
}
}
|
[
"public",
"void",
"restoreRolePage",
"(",
")",
"{",
"JQMCommon",
".",
"setDataRole",
"(",
"this",
",",
"\"page\"",
")",
";",
"JQMCommon",
".",
"setDataDialog",
"(",
"this",
",",
"false",
")",
";",
"removeStyleName",
"(",
"STYLE_UI_DIALOG",
")",
";",
"Element",
"elt",
"=",
"getElement",
"(",
")",
";",
"Element",
"dlgContain",
"=",
"JQMCommon",
".",
"findChild",
"(",
"elt",
",",
"UI_DIALOG_CONTAIN",
")",
";",
"if",
"(",
"dlgContain",
"!=",
"null",
")",
"{",
"JQMCommon",
".",
"moveChildren",
"(",
"dlgContain",
",",
"elt",
")",
";",
"elt",
".",
"removeChild",
"(",
"dlgContain",
")",
";",
"}",
"JQMHeader",
"h",
"=",
"getHeader",
"(",
")",
";",
"if",
"(",
"h",
"!=",
"null",
")",
"{",
"Element",
"btn",
"=",
"JQMCommon",
".",
"findChild",
"(",
"h",
".",
"getElement",
"(",
")",
",",
"\"ui-btn-icon-notext\"",
")",
";",
"if",
"(",
"btn",
"!=",
"null",
"&&",
"\"#\"",
".",
"equals",
"(",
"JQMCommon",
".",
"getAttribute",
"(",
"btn",
",",
"\"href\"",
")",
")",
"&&",
"(",
"DataIcon",
".",
"DELETE",
"==",
"JQMCommon",
".",
"getIcon",
"(",
"btn",
")",
"||",
"DataIcon",
".",
"DELETE",
"==",
"JQMCommon",
".",
"getStyleIcon",
"(",
"btn",
")",
")",
")",
"{",
"h",
".",
"getElement",
"(",
")",
".",
"removeChild",
"(",
"btn",
")",
";",
"}",
"}",
"}"
] |
There is no "correct" way to restore page after it was called as dialog,
so this method is ugly hack, but it's useful and working.
|
[
"There",
"is",
"no",
"correct",
"way",
"to",
"restore",
"page",
"after",
"it",
"was",
"called",
"as",
"dialog",
"so",
"this",
"method",
"is",
"ugly",
"hack",
"but",
"it",
"s",
"useful",
"and",
"working",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L1203-L1222
|
10,753
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java
|
JQMRadioset.addRadio
|
public JQMRadio addRadio(String value, String text) {
JQMRadio radio = new JQMRadio(value, text);
addRadio(radio);
return radio;
}
|
java
|
public JQMRadio addRadio(String value, String text) {
JQMRadio radio = new JQMRadio(value, text);
addRadio(radio);
return radio;
}
|
[
"public",
"JQMRadio",
"addRadio",
"(",
"String",
"value",
",",
"String",
"text",
")",
"{",
"JQMRadio",
"radio",
"=",
"new",
"JQMRadio",
"(",
"value",
",",
"text",
")",
";",
"addRadio",
"(",
"radio",
")",
";",
"return",
"radio",
";",
"}"
] |
Adds a new radio button to this radioset using the given value and text.
Returns a JQMRadio instance which can be used to change the value and
label of the radio button.
@param value
the value to associate with this radio option. This will be
the value returned by methods that query the selected value.
@param text
the label to show for this radio option.
@return a JQMRadio instance to adjust the added radio button
|
[
"Adds",
"a",
"new",
"radio",
"button",
"to",
"this",
"radioset",
"using",
"the",
"given",
"value",
"and",
"text",
".",
"Returns",
"a",
"JQMRadio",
"instance",
"which",
"can",
"be",
"used",
"to",
"change",
"the",
"value",
"and",
"label",
"of",
"the",
"radio",
"button",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java#L218-L222
|
10,754
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java
|
JQMRadioset.addRadio
|
@UiChild(tagname = "radio")
public void addRadio(JQMRadio radio) {
radio.setName(fieldset.getId());
radios.add(radio);
radio.setTheme(theme);
fieldset.add(radio.getInput());
fieldset.add(radio.getLabel());
}
|
java
|
@UiChild(tagname = "radio")
public void addRadio(JQMRadio radio) {
radio.setName(fieldset.getId());
radios.add(radio);
radio.setTheme(theme);
fieldset.add(radio.getInput());
fieldset.add(radio.getLabel());
}
|
[
"@",
"UiChild",
"(",
"tagname",
"=",
"\"radio\"",
")",
"public",
"void",
"addRadio",
"(",
"JQMRadio",
"radio",
")",
"{",
"radio",
".",
"setName",
"(",
"fieldset",
".",
"getId",
"(",
")",
")",
";",
"radios",
".",
"add",
"(",
"radio",
")",
";",
"radio",
".",
"setTheme",
"(",
"theme",
")",
";",
"fieldset",
".",
"add",
"(",
"radio",
".",
"getInput",
"(",
")",
")",
";",
"fieldset",
".",
"add",
"(",
"radio",
".",
"getLabel",
"(",
")",
")",
";",
"}"
] |
UiBinder call method to add a radio button
@param radio
|
[
"UiBinder",
"call",
"method",
"to",
"add",
"a",
"radio",
"button"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java#L229-L237
|
10,755
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java
|
JQMRadioset.getValueForId
|
private String getValueForId(String id) {
for (int k = 0; k < fieldset.getWidgetCount(); k++) {
Widget widget = fieldset.getWidget(k);
if (id.equals(widget.getElement().getAttribute("id")))
return widget.getElement().getAttribute("value");
}
return null;
}
|
java
|
private String getValueForId(String id) {
for (int k = 0; k < fieldset.getWidgetCount(); k++) {
Widget widget = fieldset.getWidget(k);
if (id.equals(widget.getElement().getAttribute("id")))
return widget.getElement().getAttribute("value");
}
return null;
}
|
[
"private",
"String",
"getValueForId",
"(",
"String",
"id",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"fieldset",
".",
"getWidgetCount",
"(",
")",
";",
"k",
"++",
")",
"{",
"Widget",
"widget",
"=",
"fieldset",
".",
"getWidget",
"(",
"k",
")",
";",
"if",
"(",
"id",
".",
"equals",
"(",
"widget",
".",
"getElement",
"(",
")",
".",
"getAttribute",
"(",
"\"id\"",
")",
")",
")",
"return",
"widget",
".",
"getElement",
"(",
")",
".",
"getAttribute",
"(",
"\"value\"",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the value of the button that has the given id
@return the value of the button with the given id
|
[
"Returns",
"the",
"value",
"of",
"the",
"button",
"that",
"has",
"the",
"given",
"id"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java#L341-L348
|
10,756
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java
|
JQMRadioset.setValue
|
@Override
public void setValue(String value, boolean fireEvents) {
String oldValue = fireEvents ? getValue() : null;
boolean changed = false;
for (JQMRadio r : radios) { // first we have to uncheck already checked radios (UI refresh issue)
TextBox radio = r.getInput();
if (!isChecked(radio)) continue;
boolean checked = value != null && value.equals(radio.getValue()) ? true : false;
if (!checked) {
setChecked(radio, false);
changed = true;
}
}
for (JQMRadio r : radios) {
TextBox radio = r.getInput();
boolean checked = value != null && value.equals(radio.getValue()) ? true : false;
if (isChecked(radio) != checked) {
setChecked(radio, checked);
changed = true;
}
}
if (fireEvents && changed) {
String newValue = getValue();
boolean eq = newValue == oldValue || newValue != null && newValue.equals(oldValue);
if (!eq) {
SelectionEvent.fire(this, newValue);
ValueChangeEvent.fire(this, newValue);
}
}
}
|
java
|
@Override
public void setValue(String value, boolean fireEvents) {
String oldValue = fireEvents ? getValue() : null;
boolean changed = false;
for (JQMRadio r : radios) { // first we have to uncheck already checked radios (UI refresh issue)
TextBox radio = r.getInput();
if (!isChecked(radio)) continue;
boolean checked = value != null && value.equals(radio.getValue()) ? true : false;
if (!checked) {
setChecked(radio, false);
changed = true;
}
}
for (JQMRadio r : radios) {
TextBox radio = r.getInput();
boolean checked = value != null && value.equals(radio.getValue()) ? true : false;
if (isChecked(radio) != checked) {
setChecked(radio, checked);
changed = true;
}
}
if (fireEvents && changed) {
String newValue = getValue();
boolean eq = newValue == oldValue || newValue != null && newValue.equals(oldValue);
if (!eq) {
SelectionEvent.fire(this, newValue);
ValueChangeEvent.fire(this, newValue);
}
}
}
|
[
"@",
"Override",
"public",
"void",
"setValue",
"(",
"String",
"value",
",",
"boolean",
"fireEvents",
")",
"{",
"String",
"oldValue",
"=",
"fireEvents",
"?",
"getValue",
"(",
")",
":",
"null",
";",
"boolean",
"changed",
"=",
"false",
";",
"for",
"(",
"JQMRadio",
"r",
":",
"radios",
")",
"{",
"// first we have to uncheck already checked radios (UI refresh issue)",
"TextBox",
"radio",
"=",
"r",
".",
"getInput",
"(",
")",
";",
"if",
"(",
"!",
"isChecked",
"(",
"radio",
")",
")",
"continue",
";",
"boolean",
"checked",
"=",
"value",
"!=",
"null",
"&&",
"value",
".",
"equals",
"(",
"radio",
".",
"getValue",
"(",
")",
")",
"?",
"true",
":",
"false",
";",
"if",
"(",
"!",
"checked",
")",
"{",
"setChecked",
"(",
"radio",
",",
"false",
")",
";",
"changed",
"=",
"true",
";",
"}",
"}",
"for",
"(",
"JQMRadio",
"r",
":",
"radios",
")",
"{",
"TextBox",
"radio",
"=",
"r",
".",
"getInput",
"(",
")",
";",
"boolean",
"checked",
"=",
"value",
"!=",
"null",
"&&",
"value",
".",
"equals",
"(",
"radio",
".",
"getValue",
"(",
")",
")",
"?",
"true",
":",
"false",
";",
"if",
"(",
"isChecked",
"(",
"radio",
")",
"!=",
"checked",
")",
"{",
"setChecked",
"(",
"radio",
",",
"checked",
")",
";",
"changed",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"fireEvents",
"&&",
"changed",
")",
"{",
"String",
"newValue",
"=",
"getValue",
"(",
")",
";",
"boolean",
"eq",
"=",
"newValue",
"==",
"oldValue",
"||",
"newValue",
"!=",
"null",
"&&",
"newValue",
".",
"equals",
"(",
"oldValue",
")",
";",
"if",
"(",
"!",
"eq",
")",
"{",
"SelectionEvent",
".",
"fire",
"(",
"this",
",",
"newValue",
")",
";",
"ValueChangeEvent",
".",
"fire",
"(",
"this",
",",
"newValue",
")",
";",
"}",
"}",
"}"
] |
Sets the currently selected radio to the given value.
|
[
"Sets",
"the",
"currently",
"selected",
"radio",
"to",
"the",
"given",
"value",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java#L429-L458
|
10,757
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/button/JQMButton.java
|
JQMButton.setPosOnBand
|
public void setPosOnBand(PosOnBand value) {
if (value == null) {
getElement().removeClassName(STYLE_UI_BTN_RIGHT);
getElement().removeClassName(STYLE_UI_BTN_LEFT);
} else {
switch (value) {
case LEFT:
getElement().addClassName(STYLE_UI_BTN_LEFT);
break;
case RIGHT:
getElement().addClassName(STYLE_UI_BTN_RIGHT);
break;
}
}
}
|
java
|
public void setPosOnBand(PosOnBand value) {
if (value == null) {
getElement().removeClassName(STYLE_UI_BTN_RIGHT);
getElement().removeClassName(STYLE_UI_BTN_LEFT);
} else {
switch (value) {
case LEFT:
getElement().addClassName(STYLE_UI_BTN_LEFT);
break;
case RIGHT:
getElement().addClassName(STYLE_UI_BTN_RIGHT);
break;
}
}
}
|
[
"public",
"void",
"setPosOnBand",
"(",
"PosOnBand",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"getElement",
"(",
")",
".",
"removeClassName",
"(",
"STYLE_UI_BTN_RIGHT",
")",
";",
"getElement",
"(",
")",
".",
"removeClassName",
"(",
"STYLE_UI_BTN_LEFT",
")",
";",
"}",
"else",
"{",
"switch",
"(",
"value",
")",
"{",
"case",
"LEFT",
":",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"STYLE_UI_BTN_LEFT",
")",
";",
"break",
";",
"case",
"RIGHT",
":",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"STYLE_UI_BTN_RIGHT",
")",
";",
"break",
";",
"}",
"}",
"}"
] |
Works in case of this button placed on Header, Popup, ...
|
[
"Works",
"in",
"case",
"of",
"this",
"button",
"placed",
"on",
"Header",
"Popup",
"..."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/button/JQMButton.java#L817-L831
|
10,758
|
mattbertolini/Hermes
|
src/main/java/com/mattbertolini/hermes/MessagesProxy.java
|
MessagesProxy.instantiateCustomPluralRuleClass
|
private PluralRule instantiateCustomPluralRuleClass(Class<? extends PluralRule> clazz) {
PluralRule retVal;
try {
String pluralClassName = clazz.getName() + "_" + this.getLocale().getLanguage();
try {
Class<?> pClass = Class.forName(pluralClassName);
retVal = (PluralRule) pClass.newInstance();
} catch (ClassNotFoundException e) {
retVal = clazz.newInstance();
}
} catch (InstantiationException e) {
throw new RuntimeException("Could not instantiate custom PluralRule class. "
+ "Make sure the class is not an abstract class or interface and has a default constructor.", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Could not instantiate custom Plural Rule class.", e);
}
return retVal;
}
|
java
|
private PluralRule instantiateCustomPluralRuleClass(Class<? extends PluralRule> clazz) {
PluralRule retVal;
try {
String pluralClassName = clazz.getName() + "_" + this.getLocale().getLanguage();
try {
Class<?> pClass = Class.forName(pluralClassName);
retVal = (PluralRule) pClass.newInstance();
} catch (ClassNotFoundException e) {
retVal = clazz.newInstance();
}
} catch (InstantiationException e) {
throw new RuntimeException("Could not instantiate custom PluralRule class. "
+ "Make sure the class is not an abstract class or interface and has a default constructor.", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Could not instantiate custom Plural Rule class.", e);
}
return retVal;
}
|
[
"private",
"PluralRule",
"instantiateCustomPluralRuleClass",
"(",
"Class",
"<",
"?",
"extends",
"PluralRule",
">",
"clazz",
")",
"{",
"PluralRule",
"retVal",
";",
"try",
"{",
"String",
"pluralClassName",
"=",
"clazz",
".",
"getName",
"(",
")",
"+",
"\"_\"",
"+",
"this",
".",
"getLocale",
"(",
")",
".",
"getLanguage",
"(",
")",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"pClass",
"=",
"Class",
".",
"forName",
"(",
"pluralClassName",
")",
";",
"retVal",
"=",
"(",
"PluralRule",
")",
"pClass",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"retVal",
"=",
"clazz",
".",
"newInstance",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Could not instantiate custom PluralRule class. \"",
"+",
"\"Make sure the class is not an abstract class or interface and has a default constructor.\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Could not instantiate custom Plural Rule class.\"",
",",
"e",
")",
";",
"}",
"return",
"retVal",
";",
"}"
] |
Instantiates the plural rule class given inside the PluralCount
annotation. The pluralRule class that is instantiated is based on the
language originally given to the library. If that language is not found,
defaults to the given class.
@param clazz The PluralRule class
@return An instantiated PluralRule class
|
[
"Instantiates",
"the",
"plural",
"rule",
"class",
"given",
"inside",
"the",
"PluralCount",
"annotation",
".",
"The",
"pluralRule",
"class",
"that",
"is",
"instantiated",
"is",
"based",
"on",
"the",
"language",
"originally",
"given",
"to",
"the",
"library",
".",
"If",
"that",
"language",
"is",
"not",
"found",
"defaults",
"to",
"the",
"given",
"class",
"."
] |
2f99ac6c358bef39bccfde93185bd72ac7de7201
|
https://github.com/mattbertolini/Hermes/blob/2f99ac6c358bef39bccfde93185bd72ac7de7201/src/main/java/com/mattbertolini/hermes/MessagesProxy.java#L186-L203
|
10,759
|
yandex-qatools/hamcrest-pojo-matcher-generator
|
feature-matcher-generator/src/main/java/ru/yandex/qatools/processors/matcher/gen/MatcherFactoryGenerator.java
|
MatcherFactoryGenerator.write
|
private static Consumer<JavaFile> write(ProcessingEnvironment processingEnv) {
return file -> {
try {
file.writeTo(processingEnv.getFiler());
} catch (IOException e) {
JavaFileObject obj = file.toJavaFileObject();
throw new ProcessingException("Can't write", obj.getName(), obj.getKind(), e);
}
};
}
|
java
|
private static Consumer<JavaFile> write(ProcessingEnvironment processingEnv) {
return file -> {
try {
file.writeTo(processingEnv.getFiler());
} catch (IOException e) {
JavaFileObject obj = file.toJavaFileObject();
throw new ProcessingException("Can't write", obj.getName(), obj.getKind(), e);
}
};
}
|
[
"private",
"static",
"Consumer",
"<",
"JavaFile",
">",
"write",
"(",
"ProcessingEnvironment",
"processingEnv",
")",
"{",
"return",
"file",
"->",
"{",
"try",
"{",
"file",
".",
"writeTo",
"(",
"processingEnv",
".",
"getFiler",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"JavaFileObject",
"obj",
"=",
"file",
".",
"toJavaFileObject",
"(",
")",
";",
"throw",
"new",
"ProcessingException",
"(",
"\"Can't write\"",
",",
"obj",
".",
"getName",
"(",
")",
",",
"obj",
".",
"getKind",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
";",
"}"
] |
Consumer which writes classes as java files
|
[
"Consumer",
"which",
"writes",
"classes",
"as",
"java",
"files"
] |
6794227006d2bf572c1e68300c7bc3dc6c3d4998
|
https://github.com/yandex-qatools/hamcrest-pojo-matcher-generator/blob/6794227006d2bf572c1e68300c7bc3dc6c3d4998/feature-matcher-generator/src/main/java/ru/yandex/qatools/processors/matcher/gen/MatcherFactoryGenerator.java#L113-L122
|
10,760
|
yandex-qatools/hamcrest-pojo-matcher-generator
|
feature-matcher-generator/src/main/java/ru/yandex/qatools/processors/matcher/gen/MatcherFactoryGenerator.java
|
MatcherFactoryGenerator.asFields
|
private static Stream<Element> asFields(Element element) {
switch (element.getKind()) {
case FIELD:
return Stream.of(element);
case CLASS:
return element.getEnclosedElements().stream().flatMap(MatcherFactoryGenerator::asFields);
}
return Stream.empty();
}
|
java
|
private static Stream<Element> asFields(Element element) {
switch (element.getKind()) {
case FIELD:
return Stream.of(element);
case CLASS:
return element.getEnclosedElements().stream().flatMap(MatcherFactoryGenerator::asFields);
}
return Stream.empty();
}
|
[
"private",
"static",
"Stream",
"<",
"Element",
">",
"asFields",
"(",
"Element",
"element",
")",
"{",
"switch",
"(",
"element",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"FIELD",
":",
"return",
"Stream",
".",
"of",
"(",
"element",
")",
";",
"case",
"CLASS",
":",
"return",
"element",
".",
"getEnclosedElements",
"(",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",
"MatcherFactoryGenerator",
"::",
"asFields",
")",
";",
"}",
"return",
"Stream",
".",
"empty",
"(",
")",
";",
"}"
] |
Recursively adds to stream all fields of class of fields of nested class
@param element class/field element
@return stream with fields we want to process
|
[
"Recursively",
"adds",
"to",
"stream",
"all",
"fields",
"of",
"class",
"of",
"fields",
"of",
"nested",
"class"
] |
6794227006d2bf572c1e68300c7bc3dc6c3d4998
|
https://github.com/yandex-qatools/hamcrest-pojo-matcher-generator/blob/6794227006d2bf572c1e68300c7bc3dc6c3d4998/feature-matcher-generator/src/main/java/ru/yandex/qatools/processors/matcher/gen/MatcherFactoryGenerator.java#L130-L138
|
10,761
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMNavBar.java
|
JQMNavBar.addActivePersist
|
@UiChild(limit = 1, tagname = "buttonActivePersist")
public void addActivePersist(final JQMButton button) {
if (button == null) return;
addActive(button);
button.getElement().addClassName("ui-state-persist");
}
|
java
|
@UiChild(limit = 1, tagname = "buttonActivePersist")
public void addActivePersist(final JQMButton button) {
if (button == null) return;
addActive(button);
button.getElement().addClassName("ui-state-persist");
}
|
[
"@",
"UiChild",
"(",
"limit",
"=",
"1",
",",
"tagname",
"=",
"\"buttonActivePersist\"",
")",
"public",
"void",
"addActivePersist",
"(",
"final",
"JQMButton",
"button",
")",
"{",
"if",
"(",
"button",
"==",
"null",
")",
"return",
";",
"addActive",
"(",
"button",
")",
";",
"button",
".",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"\"ui-state-persist\"",
")",
";",
"}"
] |
Restore the button's active state each time the page is shown while it exists in the DOM.
|
[
"Restore",
"the",
"button",
"s",
"active",
"state",
"each",
"time",
"the",
"page",
"is",
"shown",
"while",
"it",
"exists",
"in",
"the",
"DOM",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMNavBar.java#L100-L105
|
10,762
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMNavBar.java
|
JQMNavBar.setIconPos
|
public void setIconPos(IconPos pos) {
if (pos == null) {
JQMCommon.setIconPos(this, pos);
} else {
IconPos oldPos = getIconPos();
JQMCommon.setIconPos(this, pos);
for (int i = 0; i < buttons.size(); i++) {
JQMButton btn = buttons.get(i);
IconPos p = btn.getIconPos();
if (p == null || oldPos == null || p.equals(oldPos)) btn.setIconPos(pos);
}
}
}
|
java
|
public void setIconPos(IconPos pos) {
if (pos == null) {
JQMCommon.setIconPos(this, pos);
} else {
IconPos oldPos = getIconPos();
JQMCommon.setIconPos(this, pos);
for (int i = 0; i < buttons.size(); i++) {
JQMButton btn = buttons.get(i);
IconPos p = btn.getIconPos();
if (p == null || oldPos == null || p.equals(oldPos)) btn.setIconPos(pos);
}
}
}
|
[
"public",
"void",
"setIconPos",
"(",
"IconPos",
"pos",
")",
"{",
"if",
"(",
"pos",
"==",
"null",
")",
"{",
"JQMCommon",
".",
"setIconPos",
"(",
"this",
",",
"pos",
")",
";",
"}",
"else",
"{",
"IconPos",
"oldPos",
"=",
"getIconPos",
"(",
")",
";",
"JQMCommon",
".",
"setIconPos",
"(",
"this",
",",
"pos",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buttons",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"JQMButton",
"btn",
"=",
"buttons",
".",
"get",
"(",
"i",
")",
";",
"IconPos",
"p",
"=",
"btn",
".",
"getIconPos",
"(",
")",
";",
"if",
"(",
"p",
"==",
"null",
"||",
"oldPos",
"==",
"null",
"||",
"p",
".",
"equals",
"(",
"oldPos",
")",
")",
"btn",
".",
"setIconPos",
"(",
"pos",
")",
";",
"}",
"}",
"}"
] |
Sets the position of the icon. If you desire an icon only button then
set the position to IconPos.NOTEXT
|
[
"Sets",
"the",
"position",
"of",
"the",
"icon",
".",
"If",
"you",
"desire",
"an",
"icon",
"only",
"button",
"then",
"set",
"the",
"position",
"to",
"IconPos",
".",
"NOTEXT"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMNavBar.java#L139-L151
|
10,763
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/layout/JQMTable.java
|
JQMTable.rebase
|
private void rebase() {
for (int k = 0; k < flow.getWidgetCount(); k++) {
Widget widget = flow.getWidget(k);
String cellStyleName = getCellStyleName(k);
removeAllCellStyles(widget.getElement());
prepareCellPercentStyle(k, widget);
widget.getElement().addClassName(cellStyleName);
}
}
|
java
|
private void rebase() {
for (int k = 0; k < flow.getWidgetCount(); k++) {
Widget widget = flow.getWidget(k);
String cellStyleName = getCellStyleName(k);
removeAllCellStyles(widget.getElement());
prepareCellPercentStyle(k, widget);
widget.getElement().addClassName(cellStyleName);
}
}
|
[
"private",
"void",
"rebase",
"(",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"flow",
".",
"getWidgetCount",
"(",
")",
";",
"k",
"++",
")",
"{",
"Widget",
"widget",
"=",
"flow",
".",
"getWidget",
"(",
"k",
")",
";",
"String",
"cellStyleName",
"=",
"getCellStyleName",
"(",
"k",
")",
";",
"removeAllCellStyles",
"(",
"widget",
".",
"getElement",
"(",
")",
")",
";",
"prepareCellPercentStyle",
"(",
"k",
",",
"widget",
")",
";",
"widget",
".",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"cellStyleName",
")",
";",
"}",
"}"
] |
Update the stylesheets of all cells
|
[
"Update",
"the",
"stylesheets",
"of",
"all",
"cells"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/layout/JQMTable.java#L214-L222
|
10,764
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java
|
JQMCommon.isRealHidden
|
public static boolean isRealHidden(Widget widget) {
if (widget == null || !widget.isAttached()) return true;
Element elt = widget.getElement();
return !UIObject.isVisible(elt) || Mobile.isHidden(elt);
}
|
java
|
public static boolean isRealHidden(Widget widget) {
if (widget == null || !widget.isAttached()) return true;
Element elt = widget.getElement();
return !UIObject.isVisible(elt) || Mobile.isHidden(elt);
}
|
[
"public",
"static",
"boolean",
"isRealHidden",
"(",
"Widget",
"widget",
")",
"{",
"if",
"(",
"widget",
"==",
"null",
"||",
"!",
"widget",
".",
"isAttached",
"(",
")",
")",
"return",
"true",
";",
"Element",
"elt",
"=",
"widget",
".",
"getElement",
"(",
")",
";",
"return",
"!",
"UIObject",
".",
"isVisible",
"(",
"elt",
")",
"||",
"Mobile",
".",
"isHidden",
"(",
"elt",
")",
";",
"}"
] |
Expensive, based on jQuery, realistic visibility check.
|
[
"Expensive",
"based",
"on",
"jQuery",
"realistic",
"visibility",
"check",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java#L94-L98
|
10,765
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java
|
JQMCommon.hyphenToCamelCase
|
public static String hyphenToCamelCase(String hyphenStr) {
if (hyphenStr == null || hyphenStr.isEmpty()) return hyphenStr;
int p = hyphenStr.indexOf('-');
if (p == -1) return hyphenStr;
StringBuilder sb = new StringBuilder(hyphenStr);
do {
int i = p + 1;
if (i < sb.length()) {
sb.setCharAt(i, Character.toUpperCase(sb.charAt(i)));
}
sb.deleteCharAt(p);
p = sb.indexOf("-", p);
if (p == -1) break;
} while (true);
return sb.toString();
}
|
java
|
public static String hyphenToCamelCase(String hyphenStr) {
if (hyphenStr == null || hyphenStr.isEmpty()) return hyphenStr;
int p = hyphenStr.indexOf('-');
if (p == -1) return hyphenStr;
StringBuilder sb = new StringBuilder(hyphenStr);
do {
int i = p + 1;
if (i < sb.length()) {
sb.setCharAt(i, Character.toUpperCase(sb.charAt(i)));
}
sb.deleteCharAt(p);
p = sb.indexOf("-", p);
if (p == -1) break;
} while (true);
return sb.toString();
}
|
[
"public",
"static",
"String",
"hyphenToCamelCase",
"(",
"String",
"hyphenStr",
")",
"{",
"if",
"(",
"hyphenStr",
"==",
"null",
"||",
"hyphenStr",
".",
"isEmpty",
"(",
")",
")",
"return",
"hyphenStr",
";",
"int",
"p",
"=",
"hyphenStr",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"p",
"==",
"-",
"1",
")",
"return",
"hyphenStr",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"hyphenStr",
")",
";",
"do",
"{",
"int",
"i",
"=",
"p",
"+",
"1",
";",
"if",
"(",
"i",
"<",
"sb",
".",
"length",
"(",
")",
")",
"{",
"sb",
".",
"setCharAt",
"(",
"i",
",",
"Character",
".",
"toUpperCase",
"(",
"sb",
".",
"charAt",
"(",
"i",
")",
")",
")",
";",
"}",
"sb",
".",
"deleteCharAt",
"(",
"p",
")",
";",
"p",
"=",
"sb",
".",
"indexOf",
"(",
"\"-\"",
",",
"p",
")",
";",
"if",
"(",
"p",
"==",
"-",
"1",
")",
"break",
";",
"}",
"while",
"(",
"true",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Converts aaa-bbb-ccc to aaaBbbCcc
|
[
"Converts",
"aaa",
"-",
"bbb",
"-",
"ccc",
"to",
"aaaBbbCcc"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java#L103-L119
|
10,766
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java
|
JQMCommon.moveChildren
|
public static void moveChildren(Element from, Element to) {
if (from == null || to == null || from == to) return;
for (int k = from.getChildCount() - 1; k >= 0; k--) {
Node node = from.getChild(k);
from.removeChild(node);
to.insertFirst(node);
}
}
|
java
|
public static void moveChildren(Element from, Element to) {
if (from == null || to == null || from == to) return;
for (int k = from.getChildCount() - 1; k >= 0; k--) {
Node node = from.getChild(k);
from.removeChild(node);
to.insertFirst(node);
}
}
|
[
"public",
"static",
"void",
"moveChildren",
"(",
"Element",
"from",
",",
"Element",
"to",
")",
"{",
"if",
"(",
"from",
"==",
"null",
"||",
"to",
"==",
"null",
"||",
"from",
"==",
"to",
")",
"return",
";",
"for",
"(",
"int",
"k",
"=",
"from",
".",
"getChildCount",
"(",
")",
"-",
"1",
";",
"k",
">=",
"0",
";",
"k",
"--",
")",
"{",
"Node",
"node",
"=",
"from",
".",
"getChild",
"(",
"k",
")",
";",
"from",
".",
"removeChild",
"(",
"node",
")",
";",
"to",
".",
"insertFirst",
"(",
"node",
")",
";",
"}",
"}"
] |
Moves all children of "from" element onto "to" element.
|
[
"Moves",
"all",
"children",
"of",
"from",
"element",
"onto",
"to",
"element",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMCommon.java#L168-L175
|
10,767
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/JQMContext.java
|
JQMContext.render
|
public static void render(String id) {
if (id == null || id.isEmpty()) {
throw new IllegalArgumentException("render() for empty id is not possible");
}
renderImpl(id);
}
|
java
|
public static void render(String id) {
if (id == null || id.isEmpty()) {
throw new IllegalArgumentException("render() for empty id is not possible");
}
renderImpl(id);
}
|
[
"public",
"static",
"void",
"render",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"id",
"==",
"null",
"||",
"id",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"render() for empty id is not possible\"",
")",
";",
"}",
"renderImpl",
"(",
"id",
")",
";",
"}"
] |
Ask JQuery Mobile to "render" the child elements of the element with the given id.
|
[
"Ask",
"JQuery",
"Mobile",
"to",
"render",
"the",
"child",
"elements",
"of",
"the",
"element",
"with",
"the",
"given",
"id",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMContext.java#L179-L184
|
10,768
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/StrUtils.java
|
StrUtils.getDigitsOnly
|
public static String getDigitsOnly(String s) {
if (isEmpty(s)) return s;
String rslt = s.trim();
if (isEmpty(rslt)) return rslt;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < rslt.length(); i++) {
char ch = rslt.charAt(i);
if (Character.isDigit(ch)) sb.append(ch);
}
return sb.toString();
}
|
java
|
public static String getDigitsOnly(String s) {
if (isEmpty(s)) return s;
String rslt = s.trim();
if (isEmpty(rslt)) return rslt;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < rslt.length(); i++) {
char ch = rslt.charAt(i);
if (Character.isDigit(ch)) sb.append(ch);
}
return sb.toString();
}
|
[
"public",
"static",
"String",
"getDigitsOnly",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"s",
")",
")",
"return",
"s",
";",
"String",
"rslt",
"=",
"s",
".",
"trim",
"(",
")",
";",
"if",
"(",
"isEmpty",
"(",
"rslt",
")",
")",
"return",
"rslt",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rslt",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"ch",
"=",
"rslt",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"Character",
".",
"isDigit",
"(",
"ch",
")",
")",
"sb",
".",
"append",
"(",
"ch",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns only digits from specified string
|
[
"Returns",
"only",
"digits",
"from",
"specified",
"string"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/StrUtils.java#L124-L134
|
10,769
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/StrUtils.java
|
StrUtils.isDigitsOnly
|
public static boolean isDigitsOnly(String s) {
if (isEmpty(s)) return false;
String rslt = s.trim();
if (isEmpty(rslt)) return false;
for (int i = 0; i < rslt.length(); i++) {
char ch = rslt.charAt(i);
if (!Character.isDigit(ch)) return false;
}
return true;
}
|
java
|
public static boolean isDigitsOnly(String s) {
if (isEmpty(s)) return false;
String rslt = s.trim();
if (isEmpty(rslt)) return false;
for (int i = 0; i < rslt.length(); i++) {
char ch = rslt.charAt(i);
if (!Character.isDigit(ch)) return false;
}
return true;
}
|
[
"public",
"static",
"boolean",
"isDigitsOnly",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"s",
")",
")",
"return",
"false",
";",
"String",
"rslt",
"=",
"s",
".",
"trim",
"(",
")",
";",
"if",
"(",
"isEmpty",
"(",
"rslt",
")",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rslt",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"ch",
"=",
"rslt",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"Character",
".",
"isDigit",
"(",
"ch",
")",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Returns true if specified string contains only digits
|
[
"Returns",
"true",
"if",
"specified",
"string",
"contains",
"only",
"digits"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/StrUtils.java#L137-L146
|
10,770
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMCheckset.java
|
JQMCheckset.isSelected
|
public boolean isSelected(String id) {
for (JQMCheckbox box : checks) {
if (id.equals(box.getId()))
return box.isChecked();
}
return false;
}
|
java
|
public boolean isSelected(String id) {
for (JQMCheckbox box : checks) {
if (id.equals(box.getId()))
return box.isChecked();
}
return false;
}
|
[
"public",
"boolean",
"isSelected",
"(",
"String",
"id",
")",
"{",
"for",
"(",
"JQMCheckbox",
"box",
":",
"checks",
")",
"{",
"if",
"(",
"id",
".",
"equals",
"(",
"box",
".",
"getId",
"(",
")",
")",
")",
"return",
"box",
".",
"isChecked",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Returns true if the checkbox with the given id is selected.
@param id - the id of the checkbox to test
|
[
"Returns",
"true",
"if",
"the",
"checkbox",
"with",
"the",
"given",
"id",
"is",
"selected",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMCheckset.java#L339-L345
|
10,771
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSearch.java
|
JQMSearch.initChangeHandler
|
private void initChangeHandler() {
JQMChangeHandler handler = new JQMChangeHandler() {
@Override
public void onEvent(JQMEvent<?> event) {
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), input);
}};
JQMHandlerRegistration.registerJQueryHandler(new WidgetHandlerCounter() {
@Override
public int getHandlerCountForWidget(GwtEvent.Type<?> type) {
return getHandlerCount(type);
}
}, this, handler, JQMComponentEvents.CHANGE,
JQMEventFactory.getType(JQMComponentEvents.CHANGE, JQMChangeHandler.class));
}
|
java
|
private void initChangeHandler() {
JQMChangeHandler handler = new JQMChangeHandler() {
@Override
public void onEvent(JQMEvent<?> event) {
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), input);
}};
JQMHandlerRegistration.registerJQueryHandler(new WidgetHandlerCounter() {
@Override
public int getHandlerCountForWidget(GwtEvent.Type<?> type) {
return getHandlerCount(type);
}
}, this, handler, JQMComponentEvents.CHANGE,
JQMEventFactory.getType(JQMComponentEvents.CHANGE, JQMChangeHandler.class));
}
|
[
"private",
"void",
"initChangeHandler",
"(",
")",
"{",
"JQMChangeHandler",
"handler",
"=",
"new",
"JQMChangeHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onEvent",
"(",
"JQMEvent",
"<",
"?",
">",
"event",
")",
"{",
"DomEvent",
".",
"fireNativeEvent",
"(",
"Document",
".",
"get",
"(",
")",
".",
"createChangeEvent",
"(",
")",
",",
"input",
")",
";",
"}",
"}",
";",
"JQMHandlerRegistration",
".",
"registerJQueryHandler",
"(",
"new",
"WidgetHandlerCounter",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"getHandlerCountForWidget",
"(",
"GwtEvent",
".",
"Type",
"<",
"?",
">",
"type",
")",
"{",
"return",
"getHandlerCount",
"(",
"type",
")",
";",
"}",
"}",
",",
"this",
",",
"handler",
",",
"JQMComponentEvents",
".",
"CHANGE",
",",
"JQMEventFactory",
".",
"getType",
"(",
"JQMComponentEvents",
".",
"CHANGE",
",",
"JQMChangeHandler",
".",
"class",
")",
")",
";",
"}"
] |
Standard GWT ChangeEvent is not working for search input, that's why we have to activate
it manually by listening jQuery change event.
|
[
"Standard",
"GWT",
"ChangeEvent",
"is",
"not",
"working",
"for",
"search",
"input",
"that",
"s",
"why",
"we",
"have",
"to",
"activate",
"it",
"manually",
"by",
"listening",
"jQuery",
"change",
"event",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMSearch.java#L59-L72
|
10,772
|
mattbertolini/Hermes
|
src/main/java/com/mattbertolini/hermes/Hermes.java
|
Hermes.getPropertiesFile
|
private static <T> InputStream getPropertiesFile(Class<T> clazz, ULocale locale) {
String localeStr = "";
if(locale != null) {
localeStr = '_' + locale.getName();
}
String filePath = clazz.getName().replace(DOT, SLASH) + localeStr + PROPERTIES_EXT;
return clazz.getClassLoader().getResourceAsStream(filePath);
}
|
java
|
private static <T> InputStream getPropertiesFile(Class<T> clazz, ULocale locale) {
String localeStr = "";
if(locale != null) {
localeStr = '_' + locale.getName();
}
String filePath = clazz.getName().replace(DOT, SLASH) + localeStr + PROPERTIES_EXT;
return clazz.getClassLoader().getResourceAsStream(filePath);
}
|
[
"private",
"static",
"<",
"T",
">",
"InputStream",
"getPropertiesFile",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"ULocale",
"locale",
")",
"{",
"String",
"localeStr",
"=",
"\"\"",
";",
"if",
"(",
"locale",
"!=",
"null",
")",
"{",
"localeStr",
"=",
"'",
"'",
"+",
"locale",
".",
"getName",
"(",
")",
";",
"}",
"String",
"filePath",
"=",
"clazz",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"DOT",
",",
"SLASH",
")",
"+",
"localeStr",
"+",
"PROPERTIES_EXT",
";",
"return",
"clazz",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"filePath",
")",
";",
"}"
] |
Get the properties file associated with the given interface and locale
as an InputStream. Use the return value in an InputStream reader to load
the properties file data into a Properties object.
@param clazz The Class representing one of the i18n interface.
@param locale The locale to get the properties for.
@return Returns an InputStream of the file data suitable for loading
into a Properties object or null if no properties file for the file
path is found.
|
[
"Get",
"the",
"properties",
"file",
"associated",
"with",
"the",
"given",
"interface",
"and",
"locale",
"as",
"an",
"InputStream",
".",
"Use",
"the",
"return",
"value",
"in",
"an",
"InputStream",
"reader",
"to",
"load",
"the",
"properties",
"file",
"data",
"into",
"a",
"Properties",
"object",
"."
] |
2f99ac6c358bef39bccfde93185bd72ac7de7201
|
https://github.com/mattbertolini/Hermes/blob/2f99ac6c358bef39bccfde93185bd72ac7de7201/src/main/java/com/mattbertolini/hermes/Hermes.java#L146-L153
|
10,773
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMFlip.java
|
JQMFlip.getValue
|
@Override
public String getValue() {
switch (getSelectedIndex()) {
case 0:
if (internVal == null) return null;
internVal = getValue1();
return internVal;
case 1:
internVal = getValue2();
return internVal;
default:
return null;
}
}
|
java
|
@Override
public String getValue() {
switch (getSelectedIndex()) {
case 0:
if (internVal == null) return null;
internVal = getValue1();
return internVal;
case 1:
internVal = getValue2();
return internVal;
default:
return null;
}
}
|
[
"@",
"Override",
"public",
"String",
"getValue",
"(",
")",
"{",
"switch",
"(",
"getSelectedIndex",
"(",
")",
")",
"{",
"case",
"0",
":",
"if",
"(",
"internVal",
"==",
"null",
")",
"return",
"null",
";",
"internVal",
"=",
"getValue1",
"(",
")",
";",
"return",
"internVal",
";",
"case",
"1",
":",
"internVal",
"=",
"getValue2",
"(",
")",
";",
"return",
"internVal",
";",
"default",
":",
"return",
"null",
";",
"}",
"}"
] |
Returns the currently selected value or null if there is no currently
selected button
|
[
"Returns",
"the",
"currently",
"selected",
"value",
"or",
"null",
"if",
"there",
"is",
"no",
"currently",
"selected",
"button"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMFlip.java#L210-L223
|
10,774
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMFlip.java
|
JQMFlip.setValue
|
@Override
public void setValue(String value, boolean fireEvents) {
int newIdx = value == null ? 0 : value.equals(getValue1()) ? 0
: value.equals(getValue2()) ? 1 : 0;
int oldIdx = getSelectedIndex();
String oldVal = fireEvents ? getValue() : null;
internVal = value;
if (oldIdx != newIdx) {
inSetValue = true;
try {
setSelectedIndex(newIdx);
} finally {
inSetValue = false;
}
}
if (fireEvents) {
boolean eq = internVal == oldVal || internVal != null && internVal.equals(oldVal);
if (!eq) ValueChangeEvent.fire(this, internVal);
}
}
|
java
|
@Override
public void setValue(String value, boolean fireEvents) {
int newIdx = value == null ? 0 : value.equals(getValue1()) ? 0
: value.equals(getValue2()) ? 1 : 0;
int oldIdx = getSelectedIndex();
String oldVal = fireEvents ? getValue() : null;
internVal = value;
if (oldIdx != newIdx) {
inSetValue = true;
try {
setSelectedIndex(newIdx);
} finally {
inSetValue = false;
}
}
if (fireEvents) {
boolean eq = internVal == oldVal || internVal != null && internVal.equals(oldVal);
if (!eq) ValueChangeEvent.fire(this, internVal);
}
}
|
[
"@",
"Override",
"public",
"void",
"setValue",
"(",
"String",
"value",
",",
"boolean",
"fireEvents",
")",
"{",
"int",
"newIdx",
"=",
"value",
"==",
"null",
"?",
"0",
":",
"value",
".",
"equals",
"(",
"getValue1",
"(",
")",
")",
"?",
"0",
":",
"value",
".",
"equals",
"(",
"getValue2",
"(",
")",
")",
"?",
"1",
":",
"0",
";",
"int",
"oldIdx",
"=",
"getSelectedIndex",
"(",
")",
";",
"String",
"oldVal",
"=",
"fireEvents",
"?",
"getValue",
"(",
")",
":",
"null",
";",
"internVal",
"=",
"value",
";",
"if",
"(",
"oldIdx",
"!=",
"newIdx",
")",
"{",
"inSetValue",
"=",
"true",
";",
"try",
"{",
"setSelectedIndex",
"(",
"newIdx",
")",
";",
"}",
"finally",
"{",
"inSetValue",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"fireEvents",
")",
"{",
"boolean",
"eq",
"=",
"internVal",
"==",
"oldVal",
"||",
"internVal",
"!=",
"null",
"&&",
"internVal",
".",
"equals",
"(",
"oldVal",
")",
";",
"if",
"(",
"!",
"eq",
")",
"ValueChangeEvent",
".",
"fire",
"(",
"this",
",",
"internVal",
")",
";",
"}",
"}"
] |
Sets the currently selected value.
@param fireEvents - if false then ValueChangeEvent won't be raised (though ChangeEvent will be raised anyway).
|
[
"Sets",
"the",
"currently",
"selected",
"value",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMFlip.java#L299-L319
|
10,775
|
jqm4gwt/jqm4gwt
|
library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMFlip.java
|
JQMFlip.setTrackTheme
|
public void setTrackTheme(String value) {
// data-track-theme is not available for flipswitch, so we have to hack it
trackTheme = value != null ? value.trim() : value;
refreshTrackTheme();
}
|
java
|
public void setTrackTheme(String value) {
// data-track-theme is not available for flipswitch, so we have to hack it
trackTheme = value != null ? value.trim() : value;
refreshTrackTheme();
}
|
[
"public",
"void",
"setTrackTheme",
"(",
"String",
"value",
")",
"{",
"// data-track-theme is not available for flipswitch, so we have to hack it",
"trackTheme",
"=",
"value",
"!=",
"null",
"?",
"value",
".",
"trim",
"(",
")",
":",
"value",
";",
"refreshTrackTheme",
"(",
")",
";",
"}"
] |
Sets the theme for the track button
|
[
"Sets",
"the",
"theme",
"for",
"the",
"track",
"button"
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMFlip.java#L404-L408
|
10,776
|
jqm4gwt/jqm4gwt
|
plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/ColumnDefEx.java
|
ColumnDefEx.setDefaultContentType
|
public void setDefaultContentType(DefaultContentType value) {
defaultContentType = value;
if (defaultContentType != null) {
setData("");
searchable = false;
orderable = false;
}
}
|
java
|
public void setDefaultContentType(DefaultContentType value) {
defaultContentType = value;
if (defaultContentType != null) {
setData("");
searchable = false;
orderable = false;
}
}
|
[
"public",
"void",
"setDefaultContentType",
"(",
"DefaultContentType",
"value",
")",
"{",
"defaultContentType",
"=",
"value",
";",
"if",
"(",
"defaultContentType",
"!=",
"null",
")",
"{",
"setData",
"(",
"\"\"",
")",
";",
"searchable",
"=",
"false",
";",
"orderable",
"=",
"false",
";",
"}",
"}"
] |
Set default, static, content for a column - predefined widgets, defaultContent will be used
for innerHtml if defined.
|
[
"Set",
"default",
"static",
"content",
"for",
"a",
"column",
"-",
"predefined",
"widgets",
"defaultContent",
"will",
"be",
"used",
"for",
"innerHtml",
"if",
"defined",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/ColumnDefEx.java#L131-L138
|
10,777
|
jqm4gwt/jqm4gwt
|
plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/ColumnDefEx.java
|
ColumnDefEx.calcDefaultContent
|
public String calcDefaultContent() {
if (defaultContentType == null) return defaultContent;
String s;
switch (defaultContentType) {
case BUTTON:
s = "<button data-role='none'>";
if (!Empty.is(defaultContent)) s += defaultContent;
return s + "</button>";
case CHECKBOX:
case CHECKBOX_ROWSELECT:
s = "<input type='checkbox' data-role='none'";
if (DefaultContentType.CHECKBOX_ROWSELECT.equals(defaultContentType)) {
s += " class='" + JsDataTable.CHECKBOX_ROWSEL + "'";
}
if (!Empty.is(defaultContent)) {
s += ">" + defaultContent + "</input>";
} else {
s += "></input>";
}
return s;
case ROW_DETAILS:
return "";
default:
return defaultContent;
}
}
|
java
|
public String calcDefaultContent() {
if (defaultContentType == null) return defaultContent;
String s;
switch (defaultContentType) {
case BUTTON:
s = "<button data-role='none'>";
if (!Empty.is(defaultContent)) s += defaultContent;
return s + "</button>";
case CHECKBOX:
case CHECKBOX_ROWSELECT:
s = "<input type='checkbox' data-role='none'";
if (DefaultContentType.CHECKBOX_ROWSELECT.equals(defaultContentType)) {
s += " class='" + JsDataTable.CHECKBOX_ROWSEL + "'";
}
if (!Empty.is(defaultContent)) {
s += ">" + defaultContent + "</input>";
} else {
s += "></input>";
}
return s;
case ROW_DETAILS:
return "";
default:
return defaultContent;
}
}
|
[
"public",
"String",
"calcDefaultContent",
"(",
")",
"{",
"if",
"(",
"defaultContentType",
"==",
"null",
")",
"return",
"defaultContent",
";",
"String",
"s",
";",
"switch",
"(",
"defaultContentType",
")",
"{",
"case",
"BUTTON",
":",
"s",
"=",
"\"<button data-role='none'>\"",
";",
"if",
"(",
"!",
"Empty",
".",
"is",
"(",
"defaultContent",
")",
")",
"s",
"+=",
"defaultContent",
";",
"return",
"s",
"+",
"\"</button>\"",
";",
"case",
"CHECKBOX",
":",
"case",
"CHECKBOX_ROWSELECT",
":",
"s",
"=",
"\"<input type='checkbox' data-role='none'\"",
";",
"if",
"(",
"DefaultContentType",
".",
"CHECKBOX_ROWSELECT",
".",
"equals",
"(",
"defaultContentType",
")",
")",
"{",
"s",
"+=",
"\" class='\"",
"+",
"JsDataTable",
".",
"CHECKBOX_ROWSEL",
"+",
"\"'\"",
";",
"}",
"if",
"(",
"!",
"Empty",
".",
"is",
"(",
"defaultContent",
")",
")",
"{",
"s",
"+=",
"\">\"",
"+",
"defaultContent",
"+",
"\"</input>\"",
";",
"}",
"else",
"{",
"s",
"+=",
"\"></input>\"",
";",
"}",
"return",
"s",
";",
"case",
"ROW_DETAILS",
":",
"return",
"\"\"",
";",
"default",
":",
"return",
"defaultContent",
";",
"}",
"}"
] |
Combines both defaultContentType and defaultContent and generates proper content.
|
[
"Combines",
"both",
"defaultContentType",
"and",
"defaultContent",
"and",
"generates",
"proper",
"content",
"."
] |
cf59958e9ba6d4b70f42507b2c77f10c2465085b
|
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/plugins/datatables/src/main/java/com/sksamuel/jqm4gwt/plugins/datatables/ColumnDefEx.java#L146-L174
|
10,778
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/FieldOfMultiple.java
|
FieldOfMultiple.satisfies
|
@Override
public boolean satisfies(Match match, int... ind)
{
assertIndLength(ind);
// Collect values of the element group
Set values = new HashSet();
for (BioPAXElement gen : con1.generate(match, ind))
{
values.addAll(pa1.getValueFromBean(gen));
}
// If emptiness is desired, check that
if (value == EMPTY) return values.isEmpty();
// If cannot be empty, check it
if (oper == Operation.NOT_EMPTY_AND_NOT_INTERSECT && values.isEmpty()) return false;
// If the second element is desired value, check that
else if (value == USE_SECOND_ARG)
{
BioPAXElement q = match.get(ind[1]);
return oper == Operation.INTERSECT ? values.contains(q) : !values.contains(q);
}
// If element group is compared to preset value, but the value is actually a collection,
// then iterate the collection, see if any of them matches
else if (value instanceof Collection)
{
Collection query = (Collection) value;
values.retainAll(query);
if (oper == Operation.INTERSECT) return !values.isEmpty();
else return values.isEmpty();
}
// If two set of elements should share a field value, check that
else if (pa2 != null)
{
// Collect values of the second group
Set others = new HashSet();
for (BioPAXElement gen : con2.generate(match, ind))
{
others.addAll(pa2.getValueFromBean(gen));
}
switch (oper)
{
case INTERSECT:
others.retainAll(values);
return !others.isEmpty();
case NOT_INTERSECT:
others.retainAll(values);
return others.isEmpty();
case NOT_EMPTY_AND_NOT_INTERSECT:
if (others.isEmpty()) return false;
others.retainAll(values);
return others.isEmpty();
default: throw new RuntimeException("Unhandled operation: " + oper);
}
}
// Check if the element field values contain the parameter value
else if (oper == Operation.INTERSECT) return values.contains(value);
else return !values.contains(value);
}
|
java
|
@Override
public boolean satisfies(Match match, int... ind)
{
assertIndLength(ind);
// Collect values of the element group
Set values = new HashSet();
for (BioPAXElement gen : con1.generate(match, ind))
{
values.addAll(pa1.getValueFromBean(gen));
}
// If emptiness is desired, check that
if (value == EMPTY) return values.isEmpty();
// If cannot be empty, check it
if (oper == Operation.NOT_EMPTY_AND_NOT_INTERSECT && values.isEmpty()) return false;
// If the second element is desired value, check that
else if (value == USE_SECOND_ARG)
{
BioPAXElement q = match.get(ind[1]);
return oper == Operation.INTERSECT ? values.contains(q) : !values.contains(q);
}
// If element group is compared to preset value, but the value is actually a collection,
// then iterate the collection, see if any of them matches
else if (value instanceof Collection)
{
Collection query = (Collection) value;
values.retainAll(query);
if (oper == Operation.INTERSECT) return !values.isEmpty();
else return values.isEmpty();
}
// If two set of elements should share a field value, check that
else if (pa2 != null)
{
// Collect values of the second group
Set others = new HashSet();
for (BioPAXElement gen : con2.generate(match, ind))
{
others.addAll(pa2.getValueFromBean(gen));
}
switch (oper)
{
case INTERSECT:
others.retainAll(values);
return !others.isEmpty();
case NOT_INTERSECT:
others.retainAll(values);
return others.isEmpty();
case NOT_EMPTY_AND_NOT_INTERSECT:
if (others.isEmpty()) return false;
others.retainAll(values);
return others.isEmpty();
default: throw new RuntimeException("Unhandled operation: " + oper);
}
}
// Check if the element field values contain the parameter value
else if (oper == Operation.INTERSECT) return values.contains(value);
else return !values.contains(value);
}
|
[
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"assertIndLength",
"(",
"ind",
")",
";",
"// Collect values of the element group",
"Set",
"values",
"=",
"new",
"HashSet",
"(",
")",
";",
"for",
"(",
"BioPAXElement",
"gen",
":",
"con1",
".",
"generate",
"(",
"match",
",",
"ind",
")",
")",
"{",
"values",
".",
"addAll",
"(",
"pa1",
".",
"getValueFromBean",
"(",
"gen",
")",
")",
";",
"}",
"// If emptiness is desired, check that",
"if",
"(",
"value",
"==",
"EMPTY",
")",
"return",
"values",
".",
"isEmpty",
"(",
")",
";",
"// If cannot be empty, check it",
"if",
"(",
"oper",
"==",
"Operation",
".",
"NOT_EMPTY_AND_NOT_INTERSECT",
"&&",
"values",
".",
"isEmpty",
"(",
")",
")",
"return",
"false",
";",
"// If the second element is desired value, check that",
"else",
"if",
"(",
"value",
"==",
"USE_SECOND_ARG",
")",
"{",
"BioPAXElement",
"q",
"=",
"match",
".",
"get",
"(",
"ind",
"[",
"1",
"]",
")",
";",
"return",
"oper",
"==",
"Operation",
".",
"INTERSECT",
"?",
"values",
".",
"contains",
"(",
"q",
")",
":",
"!",
"values",
".",
"contains",
"(",
"q",
")",
";",
"}",
"// If element group is compared to preset value, but the value is actually a collection,",
"// then iterate the collection, see if any of them matches",
"else",
"if",
"(",
"value",
"instanceof",
"Collection",
")",
"{",
"Collection",
"query",
"=",
"(",
"Collection",
")",
"value",
";",
"values",
".",
"retainAll",
"(",
"query",
")",
";",
"if",
"(",
"oper",
"==",
"Operation",
".",
"INTERSECT",
")",
"return",
"!",
"values",
".",
"isEmpty",
"(",
")",
";",
"else",
"return",
"values",
".",
"isEmpty",
"(",
")",
";",
"}",
"// If two set of elements should share a field value, check that",
"else",
"if",
"(",
"pa2",
"!=",
"null",
")",
"{",
"// Collect values of the second group",
"Set",
"others",
"=",
"new",
"HashSet",
"(",
")",
";",
"for",
"(",
"BioPAXElement",
"gen",
":",
"con2",
".",
"generate",
"(",
"match",
",",
"ind",
")",
")",
"{",
"others",
".",
"addAll",
"(",
"pa2",
".",
"getValueFromBean",
"(",
"gen",
")",
")",
";",
"}",
"switch",
"(",
"oper",
")",
"{",
"case",
"INTERSECT",
":",
"others",
".",
"retainAll",
"(",
"values",
")",
";",
"return",
"!",
"others",
".",
"isEmpty",
"(",
")",
";",
"case",
"NOT_INTERSECT",
":",
"others",
".",
"retainAll",
"(",
"values",
")",
";",
"return",
"others",
".",
"isEmpty",
"(",
")",
";",
"case",
"NOT_EMPTY_AND_NOT_INTERSECT",
":",
"if",
"(",
"others",
".",
"isEmpty",
"(",
")",
")",
"return",
"false",
";",
"others",
".",
"retainAll",
"(",
"values",
")",
";",
"return",
"others",
".",
"isEmpty",
"(",
")",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Unhandled operation: \"",
"+",
"oper",
")",
";",
"}",
"}",
"// Check if the element field values contain the parameter value",
"else",
"if",
"(",
"oper",
"==",
"Operation",
".",
"INTERSECT",
")",
"return",
"values",
".",
"contains",
"(",
"value",
")",
";",
"else",
"return",
"!",
"values",
".",
"contains",
"(",
"value",
")",
";",
"}"
] |
Checks if the generated elements from the first mapped element has either the desired value,
or has some value in common with the elements generated from second mapped element.
@param match current pattern match
@param ind mapped indices
@return true if a value match is found
|
[
"Checks",
"if",
"the",
"generated",
"elements",
"from",
"the",
"first",
"mapped",
"element",
"has",
"either",
"the",
"desired",
"value",
"or",
"has",
"some",
"value",
"in",
"common",
"with",
"the",
"elements",
"generated",
"from",
"second",
"mapped",
"element",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/FieldOfMultiple.java#L83-L148
|
10,779
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/PhysicalEntityWrapper.java
|
PhysicalEntityWrapper.initUpperEquivalent
|
protected void initUpperEquivalent()
{
this.upperEquivalent = new HashSet<Node>();
for (PhysicalEntity eq : pe.getMemberPhysicalEntityOf())
{
Node node = (Node) graph.getGraphObject(eq);
if (node != null) this.upperEquivalent.add(node);
}
upperEquivalentInited = true;
}
|
java
|
protected void initUpperEquivalent()
{
this.upperEquivalent = new HashSet<Node>();
for (PhysicalEntity eq : pe.getMemberPhysicalEntityOf())
{
Node node = (Node) graph.getGraphObject(eq);
if (node != null) this.upperEquivalent.add(node);
}
upperEquivalentInited = true;
}
|
[
"protected",
"void",
"initUpperEquivalent",
"(",
")",
"{",
"this",
".",
"upperEquivalent",
"=",
"new",
"HashSet",
"<",
"Node",
">",
"(",
")",
";",
"for",
"(",
"PhysicalEntity",
"eq",
":",
"pe",
".",
"getMemberPhysicalEntityOf",
"(",
")",
")",
"{",
"Node",
"node",
"=",
"(",
"Node",
")",
"graph",
".",
"getGraphObject",
"(",
"eq",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"this",
".",
"upperEquivalent",
".",
"add",
"(",
"node",
")",
";",
"}",
"upperEquivalentInited",
"=",
"true",
";",
"}"
] |
Finds homology parent.
|
[
"Finds",
"homology",
"parent",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/PhysicalEntityWrapper.java#L135-L146
|
10,780
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/PhysicalEntityWrapper.java
|
PhysicalEntityWrapper.initLowerEquivalent
|
protected void initLowerEquivalent()
{
this.lowerEquivalent = new HashSet<Node>();
for (PhysicalEntity eq : pe.getMemberPhysicalEntity())
{
Node node = (Node) graph.getGraphObject(eq);
if (node != null) this.lowerEquivalent.add(node);
}
lowerEquivalentInited = true;
}
|
java
|
protected void initLowerEquivalent()
{
this.lowerEquivalent = new HashSet<Node>();
for (PhysicalEntity eq : pe.getMemberPhysicalEntity())
{
Node node = (Node) graph.getGraphObject(eq);
if (node != null) this.lowerEquivalent.add(node);
}
lowerEquivalentInited = true;
}
|
[
"protected",
"void",
"initLowerEquivalent",
"(",
")",
"{",
"this",
".",
"lowerEquivalent",
"=",
"new",
"HashSet",
"<",
"Node",
">",
"(",
")",
";",
"for",
"(",
"PhysicalEntity",
"eq",
":",
"pe",
".",
"getMemberPhysicalEntity",
"(",
")",
")",
"{",
"Node",
"node",
"=",
"(",
"Node",
")",
"graph",
".",
"getGraphObject",
"(",
"eq",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"this",
".",
"lowerEquivalent",
".",
"add",
"(",
"node",
")",
";",
"}",
"lowerEquivalentInited",
"=",
"true",
";",
"}"
] |
Finds member nodes if this is a homology node
|
[
"Finds",
"member",
"nodes",
"if",
"this",
"is",
"a",
"homology",
"node"
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3undirected/PhysicalEntityWrapper.java#L151-L162
|
10,781
|
BioPAX/Paxtools
|
paxtools-core/src/main/java/org/biopax/paxtools/controller/ShallowCopy.java
|
ShallowCopy.copy
|
public <T extends BioPAXElement> T copy(Model model, T source, String newID)
{
T copy = copy(source, newID);
model.add(copy);
return copy;
}
|
java
|
public <T extends BioPAXElement> T copy(Model model, T source, String newID)
{
T copy = copy(source, newID);
model.add(copy);
return copy;
}
|
[
"public",
"<",
"T",
"extends",
"BioPAXElement",
">",
"T",
"copy",
"(",
"Model",
"model",
",",
"T",
"source",
",",
"String",
"newID",
")",
"{",
"T",
"copy",
"=",
"copy",
"(",
"source",
",",
"newID",
")",
";",
"model",
".",
"add",
"(",
"copy",
")",
";",
"return",
"copy",
";",
"}"
] |
Creates a copy of the BioPAX object with all its properties
are the same, and also adds it to a model.
@param <T> BioPAX type/class of the source and copy elements
@param model target biopax model
@param source a biopax object to copy
@param newID new (copy) biopax object's URI
@return copy of the source biopax element
|
[
"Creates",
"a",
"copy",
"of",
"the",
"BioPAX",
"object",
"with",
"all",
"its",
"properties",
"are",
"the",
"same",
"and",
"also",
"adds",
"it",
"to",
"a",
"model",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/ShallowCopy.java#L63-L68
|
10,782
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
|
ConstraintAdapter.satisfies
|
@Override
public boolean satisfies(Match match, int... ind)
{
return generate(match, ind).contains(match.get(ind[ind.length - 1]));
}
|
java
|
@Override
public boolean satisfies(Match match, int... ind)
{
return generate(match, ind).contains(match.get(ind[ind.length - 1]));
}
|
[
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"return",
"generate",
"(",
"match",
",",
"ind",
")",
".",
"contains",
"(",
"match",
".",
"get",
"(",
"ind",
"[",
"ind",
".",
"length",
"-",
"1",
"]",
")",
")",
";",
"}"
] |
Use this method only if constraint canGenerate, and satisfaction criteria is that simple.
@param match current pattern match
@param ind mapped indices
@return true if the match satisfies this constraint
|
[
"Use",
"this",
"method",
"only",
"if",
"constraint",
"canGenerate",
"and",
"satisfaction",
"criteria",
"is",
"that",
"simple",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L90-L94
|
10,783
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
|
ConstraintAdapter.getCatalysisDirection
|
protected ConversionDirectionType getCatalysisDirection(Control cont)
{
if (cont instanceof Catalysis)
{
CatalysisDirectionType catDir = ((Catalysis) cont).getCatalysisDirection();
if (catDir == CatalysisDirectionType.LEFT_TO_RIGHT)
{
return ConversionDirectionType.LEFT_TO_RIGHT;
}
else if (catDir == CatalysisDirectionType.RIGHT_TO_LEFT)
{
return ConversionDirectionType.RIGHT_TO_LEFT;
}
}
return null;
}
|
java
|
protected ConversionDirectionType getCatalysisDirection(Control cont)
{
if (cont instanceof Catalysis)
{
CatalysisDirectionType catDir = ((Catalysis) cont).getCatalysisDirection();
if (catDir == CatalysisDirectionType.LEFT_TO_RIGHT)
{
return ConversionDirectionType.LEFT_TO_RIGHT;
}
else if (catDir == CatalysisDirectionType.RIGHT_TO_LEFT)
{
return ConversionDirectionType.RIGHT_TO_LEFT;
}
}
return null;
}
|
[
"protected",
"ConversionDirectionType",
"getCatalysisDirection",
"(",
"Control",
"cont",
")",
"{",
"if",
"(",
"cont",
"instanceof",
"Catalysis",
")",
"{",
"CatalysisDirectionType",
"catDir",
"=",
"(",
"(",
"Catalysis",
")",
"cont",
")",
".",
"getCatalysisDirection",
"(",
")",
";",
"if",
"(",
"catDir",
"==",
"CatalysisDirectionType",
".",
"LEFT_TO_RIGHT",
")",
"{",
"return",
"ConversionDirectionType",
".",
"LEFT_TO_RIGHT",
";",
"}",
"else",
"if",
"(",
"catDir",
"==",
"CatalysisDirectionType",
".",
"RIGHT_TO_LEFT",
")",
"{",
"return",
"ConversionDirectionType",
".",
"RIGHT_TO_LEFT",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Gets the direction of the Control, if exists.
@param cont Control to get its direction
@return the direction of the Control
|
[
"Gets",
"the",
"direction",
"of",
"the",
"Control",
"if",
"exists",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L205-L221
|
10,784
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
|
ConstraintAdapter.getControlChain
|
protected List<Control> getControlChain(Control control, Interaction inter)
{
LinkedList<Control> list = new LinkedList<Control>();
list.add(control);
boolean found = search(list, inter);
if (!found) throw new RuntimeException("No link from Control to Conversion.");
return list;
}
|
java
|
protected List<Control> getControlChain(Control control, Interaction inter)
{
LinkedList<Control> list = new LinkedList<Control>();
list.add(control);
boolean found = search(list, inter);
if (!found) throw new RuntimeException("No link from Control to Conversion.");
return list;
}
|
[
"protected",
"List",
"<",
"Control",
">",
"getControlChain",
"(",
"Control",
"control",
",",
"Interaction",
"inter",
")",
"{",
"LinkedList",
"<",
"Control",
">",
"list",
"=",
"new",
"LinkedList",
"<",
"Control",
">",
"(",
")",
";",
"list",
".",
"add",
"(",
"control",
")",
";",
"boolean",
"found",
"=",
"search",
"(",
"list",
",",
"inter",
")",
";",
"if",
"(",
"!",
"found",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"No link from Control to Conversion.\"",
")",
";",
"return",
"list",
";",
"}"
] |
Gets the chain of Control, staring from the given Control, leading to the given Interaction.
Use this method only if you are sure that there is a link from the control to conversion.
Otherwise a RuntimeException is thrown. This assumes that there is only one control chain
towards the interaction. It not, then one of the chains will be returned.
@param control top level Control
@param inter target Interaction
@return Control chain controlling the Interaction
|
[
"Gets",
"the",
"chain",
"of",
"Control",
"staring",
"from",
"the",
"given",
"Control",
"leading",
"to",
"the",
"given",
"Interaction",
".",
"Use",
"this",
"method",
"only",
"if",
"you",
"are",
"sure",
"that",
"there",
"is",
"a",
"link",
"from",
"the",
"control",
"to",
"conversion",
".",
"Otherwise",
"a",
"RuntimeException",
"is",
"thrown",
".",
"This",
"assumes",
"that",
"there",
"is",
"only",
"one",
"control",
"chain",
"towards",
"the",
"interaction",
".",
"It",
"not",
"then",
"one",
"of",
"the",
"chains",
"will",
"be",
"returned",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L233-L243
|
10,785
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
|
ConstraintAdapter.search
|
private boolean search(LinkedList<Control> list, Interaction inter)
{
if (list.getLast().getControlled().contains(inter)) return true;
for (Process process : list.getLast().getControlled())
{
if (process instanceof Control)
{
// prevent searching in cycles
if (list.contains(process)) continue;
list.add((Control) process);
if (search(list, inter)) return true;
else list.removeLast();
}
}
return false;
}
|
java
|
private boolean search(LinkedList<Control> list, Interaction inter)
{
if (list.getLast().getControlled().contains(inter)) return true;
for (Process process : list.getLast().getControlled())
{
if (process instanceof Control)
{
// prevent searching in cycles
if (list.contains(process)) continue;
list.add((Control) process);
if (search(list, inter)) return true;
else list.removeLast();
}
}
return false;
}
|
[
"private",
"boolean",
"search",
"(",
"LinkedList",
"<",
"Control",
">",
"list",
",",
"Interaction",
"inter",
")",
"{",
"if",
"(",
"list",
".",
"getLast",
"(",
")",
".",
"getControlled",
"(",
")",
".",
"contains",
"(",
"inter",
")",
")",
"return",
"true",
";",
"for",
"(",
"Process",
"process",
":",
"list",
".",
"getLast",
"(",
")",
".",
"getControlled",
"(",
")",
")",
"{",
"if",
"(",
"process",
"instanceof",
"Control",
")",
"{",
"// prevent searching in cycles",
"if",
"(",
"list",
".",
"contains",
"(",
"process",
")",
")",
"continue",
";",
"list",
".",
"add",
"(",
"(",
"Control",
")",
"process",
")",
";",
"if",
"(",
"search",
"(",
"list",
",",
"inter",
")",
")",
"return",
"true",
";",
"else",
"list",
".",
"removeLast",
"(",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks if the control chain is actually controlling the Interaction.
@param list the Control chain
@param inter target Interaction
@return true if the chain controls the Interaction
|
[
"Checks",
"if",
"the",
"control",
"chain",
"is",
"actually",
"controlling",
"the",
"Interaction",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L251-L268
|
10,786
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
|
ConstraintAdapter.getConvParticipants
|
protected Set<PhysicalEntity> getConvParticipants(Conversion conv, RelType type)
{
ConversionDirectionType dir = getDirection(conv);
if (dir == ConversionDirectionType.REVERSIBLE)
{
HashSet<PhysicalEntity> set = new HashSet<PhysicalEntity>(conv.getLeft());
set.addAll(conv.getRight());
return set;
}
else if (dir == ConversionDirectionType.RIGHT_TO_LEFT)
{
return type == RelType.INPUT ? conv.getRight() : conv.getLeft();
}
else return type == RelType.OUTPUT ? conv.getRight() : conv.getLeft();
}
|
java
|
protected Set<PhysicalEntity> getConvParticipants(Conversion conv, RelType type)
{
ConversionDirectionType dir = getDirection(conv);
if (dir == ConversionDirectionType.REVERSIBLE)
{
HashSet<PhysicalEntity> set = new HashSet<PhysicalEntity>(conv.getLeft());
set.addAll(conv.getRight());
return set;
}
else if (dir == ConversionDirectionType.RIGHT_TO_LEFT)
{
return type == RelType.INPUT ? conv.getRight() : conv.getLeft();
}
else return type == RelType.OUTPUT ? conv.getRight() : conv.getLeft();
}
|
[
"protected",
"Set",
"<",
"PhysicalEntity",
">",
"getConvParticipants",
"(",
"Conversion",
"conv",
",",
"RelType",
"type",
")",
"{",
"ConversionDirectionType",
"dir",
"=",
"getDirection",
"(",
"conv",
")",
";",
"if",
"(",
"dir",
"==",
"ConversionDirectionType",
".",
"REVERSIBLE",
")",
"{",
"HashSet",
"<",
"PhysicalEntity",
">",
"set",
"=",
"new",
"HashSet",
"<",
"PhysicalEntity",
">",
"(",
"conv",
".",
"getLeft",
"(",
")",
")",
";",
"set",
".",
"addAll",
"(",
"conv",
".",
"getRight",
"(",
")",
")",
";",
"return",
"set",
";",
"}",
"else",
"if",
"(",
"dir",
"==",
"ConversionDirectionType",
".",
"RIGHT_TO_LEFT",
")",
"{",
"return",
"type",
"==",
"RelType",
".",
"INPUT",
"?",
"conv",
".",
"getRight",
"(",
")",
":",
"conv",
".",
"getLeft",
"(",
")",
";",
"}",
"else",
"return",
"type",
"==",
"RelType",
".",
"OUTPUT",
"?",
"conv",
".",
"getRight",
"(",
")",
":",
"conv",
".",
"getLeft",
"(",
")",
";",
"}"
] |
Gets input ot output participants of the Conversion.
@param conv Conversion to get participants
@param type input or output
@return related participants
|
[
"Gets",
"input",
"ot",
"output",
"participants",
"of",
"the",
"Conversion",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L276-L291
|
10,787
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
|
ConstraintAdapter.findDirectionInPathways
|
protected ConversionDirectionType findDirectionInPathways(Conversion conv)
{
Set<StepDirection> dirs = new HashSet<StepDirection>();
for (PathwayStep step : conv.getStepProcessOf())
{
if (step instanceof BiochemicalPathwayStep)
{
StepDirection dir = ((BiochemicalPathwayStep) step).getStepDirection();
if (dir != null) dirs.add(dir);
}
}
if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE;
else if (!dirs.isEmpty())
{
return dirs.iterator().next() == StepDirection.LEFT_TO_RIGHT ?
ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT;
}
else return null;
}
|
java
|
protected ConversionDirectionType findDirectionInPathways(Conversion conv)
{
Set<StepDirection> dirs = new HashSet<StepDirection>();
for (PathwayStep step : conv.getStepProcessOf())
{
if (step instanceof BiochemicalPathwayStep)
{
StepDirection dir = ((BiochemicalPathwayStep) step).getStepDirection();
if (dir != null) dirs.add(dir);
}
}
if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE;
else if (!dirs.isEmpty())
{
return dirs.iterator().next() == StepDirection.LEFT_TO_RIGHT ?
ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT;
}
else return null;
}
|
[
"protected",
"ConversionDirectionType",
"findDirectionInPathways",
"(",
"Conversion",
"conv",
")",
"{",
"Set",
"<",
"StepDirection",
">",
"dirs",
"=",
"new",
"HashSet",
"<",
"StepDirection",
">",
"(",
")",
";",
"for",
"(",
"PathwayStep",
"step",
":",
"conv",
".",
"getStepProcessOf",
"(",
")",
")",
"{",
"if",
"(",
"step",
"instanceof",
"BiochemicalPathwayStep",
")",
"{",
"StepDirection",
"dir",
"=",
"(",
"(",
"BiochemicalPathwayStep",
")",
"step",
")",
".",
"getStepDirection",
"(",
")",
";",
"if",
"(",
"dir",
"!=",
"null",
")",
"dirs",
".",
"add",
"(",
"dir",
")",
";",
"}",
"}",
"if",
"(",
"dirs",
".",
"size",
"(",
")",
">",
"1",
")",
"return",
"ConversionDirectionType",
".",
"REVERSIBLE",
";",
"else",
"if",
"(",
"!",
"dirs",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"dirs",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
"==",
"StepDirection",
".",
"LEFT_TO_RIGHT",
"?",
"ConversionDirectionType",
".",
"LEFT_TO_RIGHT",
":",
"ConversionDirectionType",
".",
"RIGHT_TO_LEFT",
";",
"}",
"else",
"return",
"null",
";",
"}"
] |
Searches pathways that contains this conversion for the possible directions. If both
directions exist, then the result is reversible.
@param conv the conversion
@return direction inferred from pathway membership
|
[
"Searches",
"pathways",
"that",
"contains",
"this",
"conversion",
"for",
"the",
"possible",
"directions",
".",
"If",
"both",
"directions",
"exist",
"then",
"the",
"result",
"is",
"reversible",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L299-L317
|
10,788
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
|
ConstraintAdapter.findDirectionInCatalysis
|
protected ConversionDirectionType findDirectionInCatalysis(Conversion conv)
{
Set<ConversionDirectionType> dirs = new HashSet<ConversionDirectionType>();
for (Control control : conv.getControlledOf())
{
ConversionDirectionType dir = getCatalysisDirection(control);
if (dir != null) dirs.add(dir);
}
if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE;
else if (!dirs.isEmpty()) return dirs.iterator().next();
else return null;
}
|
java
|
protected ConversionDirectionType findDirectionInCatalysis(Conversion conv)
{
Set<ConversionDirectionType> dirs = new HashSet<ConversionDirectionType>();
for (Control control : conv.getControlledOf())
{
ConversionDirectionType dir = getCatalysisDirection(control);
if (dir != null) dirs.add(dir);
}
if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE;
else if (!dirs.isEmpty()) return dirs.iterator().next();
else return null;
}
|
[
"protected",
"ConversionDirectionType",
"findDirectionInCatalysis",
"(",
"Conversion",
"conv",
")",
"{",
"Set",
"<",
"ConversionDirectionType",
">",
"dirs",
"=",
"new",
"HashSet",
"<",
"ConversionDirectionType",
">",
"(",
")",
";",
"for",
"(",
"Control",
"control",
":",
"conv",
".",
"getControlledOf",
"(",
")",
")",
"{",
"ConversionDirectionType",
"dir",
"=",
"getCatalysisDirection",
"(",
"control",
")",
";",
"if",
"(",
"dir",
"!=",
"null",
")",
"dirs",
".",
"add",
"(",
"dir",
")",
";",
"}",
"if",
"(",
"dirs",
".",
"size",
"(",
")",
">",
"1",
")",
"return",
"ConversionDirectionType",
".",
"REVERSIBLE",
";",
"else",
"if",
"(",
"!",
"dirs",
".",
"isEmpty",
"(",
")",
")",
"return",
"dirs",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"else",
"return",
"null",
";",
"}"
] |
Searches the controlling catalysis for possible direction of the conversion.
@param conv the conversion
@return direction inferred from catalysis objects
|
[
"Searches",
"the",
"controlling",
"catalysis",
"for",
"possible",
"direction",
"of",
"the",
"conversion",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L331-L342
|
10,789
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/UbiquitousIDMiner.java
|
UbiquitousIDMiner.getValue
|
@Override
public String getValue(Match m, int col)
{
assert col == 0;
return getRelatedIDs((SmallMoleculeReference) m.get("SMR", getPattern()));
}
|
java
|
@Override
public String getValue(Match m, int col)
{
assert col == 0;
return getRelatedIDs((SmallMoleculeReference) m.get("SMR", getPattern()));
}
|
[
"@",
"Override",
"public",
"String",
"getValue",
"(",
"Match",
"m",
",",
"int",
"col",
")",
"{",
"assert",
"col",
"==",
"0",
";",
"return",
"getRelatedIDs",
"(",
"(",
"SmallMoleculeReference",
")",
"m",
".",
"get",
"(",
"\"SMR\"",
",",
"getPattern",
"(",
")",
")",
")",
";",
"}"
] |
Gets the ids of the small molecule reference and its physical entities.
@param m current match
@param col current column
@return ubique IDs
|
[
"Gets",
"the",
"ids",
"of",
"the",
"small",
"molecule",
"reference",
"and",
"its",
"physical",
"entities",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/UbiquitousIDMiner.java#L75-L81
|
10,790
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/UbiquitousIDMiner.java
|
UbiquitousIDMiner.getRelatedIDs
|
private String getRelatedIDs(SmallMoleculeReference smr)
{
String ids = smr.getUri();
for (Object o : new PathAccessor(
"SmallMoleculeReference/entityReferenceOf").getValueFromBean(smr))
{
SimplePhysicalEntity spe = (SimplePhysicalEntity) o;
ids += "\n" + spe.getUri();
}
return ids;
}
|
java
|
private String getRelatedIDs(SmallMoleculeReference smr)
{
String ids = smr.getUri();
for (Object o : new PathAccessor(
"SmallMoleculeReference/entityReferenceOf").getValueFromBean(smr))
{
SimplePhysicalEntity spe = (SimplePhysicalEntity) o;
ids += "\n" + spe.getUri();
}
return ids;
}
|
[
"private",
"String",
"getRelatedIDs",
"(",
"SmallMoleculeReference",
"smr",
")",
"{",
"String",
"ids",
"=",
"smr",
".",
"getUri",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"new",
"PathAccessor",
"(",
"\"SmallMoleculeReference/entityReferenceOf\"",
")",
".",
"getValueFromBean",
"(",
"smr",
")",
")",
"{",
"SimplePhysicalEntity",
"spe",
"=",
"(",
"SimplePhysicalEntity",
")",
"o",
";",
"ids",
"+=",
"\"\\n\"",
"+",
"spe",
".",
"getUri",
"(",
")",
";",
"}",
"return",
"ids",
";",
"}"
] |
Gets IDs of the small molecule reference and its physical entities.
@param smr small molecule reference
@return related IDs
|
[
"Gets",
"IDs",
"of",
"the",
"small",
"molecule",
"reference",
"and",
"its",
"physical",
"entities",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/UbiquitousIDMiner.java#L88-L99
|
10,791
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/DifferentialModificationUtil.java
|
DifferentialModificationUtil.getChangedModifications
|
public static Set<ModificationFeature>[] getChangedModifications(PhysicalEntity before,
PhysicalEntity after)
{
Set<Modification> set1 = collectFeatures(before);
Set<Modification> set2 = collectFeatures(after);
Set<Modification> temp = new HashSet<Modification>(set1);
set1.removeAll(set2);
set2.removeAll(temp);
// Remove common features that can be deemed semantically equivalent
Set<Modification> furtherRemove = new HashSet<Modification>();
for (Modification m1 : set1)
{
for (Modification m2 : set2)
{
if (furtherRemove.contains(m2)) continue;
if (m1.getKey().equals(m2.getKey()))
{
furtherRemove.add(m1);
furtherRemove.add(m2);
break;
}
}
}
set1.removeAll(furtherRemove);
set2.removeAll(furtherRemove);
return new Set[]{collectFeatures(set2), collectFeatures(set1)};
}
|
java
|
public static Set<ModificationFeature>[] getChangedModifications(PhysicalEntity before,
PhysicalEntity after)
{
Set<Modification> set1 = collectFeatures(before);
Set<Modification> set2 = collectFeatures(after);
Set<Modification> temp = new HashSet<Modification>(set1);
set1.removeAll(set2);
set2.removeAll(temp);
// Remove common features that can be deemed semantically equivalent
Set<Modification> furtherRemove = new HashSet<Modification>();
for (Modification m1 : set1)
{
for (Modification m2 : set2)
{
if (furtherRemove.contains(m2)) continue;
if (m1.getKey().equals(m2.getKey()))
{
furtherRemove.add(m1);
furtherRemove.add(m2);
break;
}
}
}
set1.removeAll(furtherRemove);
set2.removeAll(furtherRemove);
return new Set[]{collectFeatures(set2), collectFeatures(set1)};
}
|
[
"public",
"static",
"Set",
"<",
"ModificationFeature",
">",
"[",
"]",
"getChangedModifications",
"(",
"PhysicalEntity",
"before",
",",
"PhysicalEntity",
"after",
")",
"{",
"Set",
"<",
"Modification",
">",
"set1",
"=",
"collectFeatures",
"(",
"before",
")",
";",
"Set",
"<",
"Modification",
">",
"set2",
"=",
"collectFeatures",
"(",
"after",
")",
";",
"Set",
"<",
"Modification",
">",
"temp",
"=",
"new",
"HashSet",
"<",
"Modification",
">",
"(",
"set1",
")",
";",
"set1",
".",
"removeAll",
"(",
"set2",
")",
";",
"set2",
".",
"removeAll",
"(",
"temp",
")",
";",
"// Remove common features that can be deemed semantically equivalent",
"Set",
"<",
"Modification",
">",
"furtherRemove",
"=",
"new",
"HashSet",
"<",
"Modification",
">",
"(",
")",
";",
"for",
"(",
"Modification",
"m1",
":",
"set1",
")",
"{",
"for",
"(",
"Modification",
"m2",
":",
"set2",
")",
"{",
"if",
"(",
"furtherRemove",
".",
"contains",
"(",
"m2",
")",
")",
"continue",
";",
"if",
"(",
"m1",
".",
"getKey",
"(",
")",
".",
"equals",
"(",
"m2",
".",
"getKey",
"(",
")",
")",
")",
"{",
"furtherRemove",
".",
"add",
"(",
"m1",
")",
";",
"furtherRemove",
".",
"add",
"(",
"m2",
")",
";",
"break",
";",
"}",
"}",
"}",
"set1",
".",
"removeAll",
"(",
"furtherRemove",
")",
";",
"set2",
".",
"removeAll",
"(",
"furtherRemove",
")",
";",
"return",
"new",
"Set",
"[",
"]",
"{",
"collectFeatures",
"(",
"set2",
")",
",",
"collectFeatures",
"(",
"set1",
")",
"}",
";",
"}"
] |
Gets the differential features.
@param before first entity
@param after second entity
@return array of differential features. index 0: gained features, index 1: lost features
|
[
"Gets",
"the",
"differential",
"features",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/DifferentialModificationUtil.java#L23-L56
|
10,792
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/DirectedRelationMiner.java
|
DirectedRelationMiner.writeResult
|
@Override
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out)
throws IOException
{
writeResultAsSIF(matches, out, true, getSourceLabel(), getTargetLabel());
}
|
java
|
@Override
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out)
throws IOException
{
writeResultAsSIF(matches, out, true, getSourceLabel(), getTargetLabel());
}
|
[
"@",
"Override",
"public",
"void",
"writeResult",
"(",
"Map",
"<",
"BioPAXElement",
",",
"List",
"<",
"Match",
">",
">",
"matches",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"writeResultAsSIF",
"(",
"matches",
",",
"out",
",",
"true",
",",
"getSourceLabel",
"(",
")",
",",
"getTargetLabel",
"(",
")",
")",
";",
"}"
] |
Writes the result as "A B", where A and B are gene symbols, and whitespace is tab.
@param matches pattern search result
@param out output stream
|
[
"Writes",
"the",
"result",
"as",
"A",
"B",
"where",
"A",
"and",
"B",
"are",
"gene",
"symbols",
"and",
"whitespace",
"is",
"tab",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/DirectedRelationMiner.java#L63-L68
|
10,793
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java
|
ConBox.nameEquals
|
public static Constraint nameEquals(String... name)
{
return new Field("Named/name", Field.Operation.INTERSECT,
new HashSet<String>(Arrays.asList(name)));
}
|
java
|
public static Constraint nameEquals(String... name)
{
return new Field("Named/name", Field.Operation.INTERSECT,
new HashSet<String>(Arrays.asList(name)));
}
|
[
"public",
"static",
"Constraint",
"nameEquals",
"(",
"String",
"...",
"name",
")",
"{",
"return",
"new",
"Field",
"(",
"\"Named/name\"",
",",
"Field",
".",
"Operation",
".",
"INTERSECT",
",",
"new",
"HashSet",
"<",
"String",
">",
"(",
"Arrays",
".",
"asList",
"(",
"name",
")",
")",
")",
";",
"}"
] |
Filters Named to contain a name from the input set.
@param name name to require
@return constraint
|
[
"Filters",
"Named",
"to",
"contain",
"a",
"name",
"from",
"the",
"input",
"set",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java#L345-L349
|
10,794
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java
|
ConBox.differentialActivity
|
public static Constraint differentialActivity(boolean activating)
{
if (activating) return new AND(new MappedConst(new ActivityConstraint(true), 1), new MappedConst(new ActivityConstraint(false), 0));
else return new AND(new MappedConst(new ActivityConstraint(true), 0), new MappedConst(new ActivityConstraint(false), 1));
}
|
java
|
public static Constraint differentialActivity(boolean activating)
{
if (activating) return new AND(new MappedConst(new ActivityConstraint(true), 1), new MappedConst(new ActivityConstraint(false), 0));
else return new AND(new MappedConst(new ActivityConstraint(true), 0), new MappedConst(new ActivityConstraint(false), 1));
}
|
[
"public",
"static",
"Constraint",
"differentialActivity",
"(",
"boolean",
"activating",
")",
"{",
"if",
"(",
"activating",
")",
"return",
"new",
"AND",
"(",
"new",
"MappedConst",
"(",
"new",
"ActivityConstraint",
"(",
"true",
")",
",",
"1",
")",
",",
"new",
"MappedConst",
"(",
"new",
"ActivityConstraint",
"(",
"false",
")",
",",
"0",
")",
")",
";",
"else",
"return",
"new",
"AND",
"(",
"new",
"MappedConst",
"(",
"new",
"ActivityConstraint",
"(",
"true",
")",
",",
"0",
")",
",",
"new",
"MappedConst",
"(",
"new",
"ActivityConstraint",
"(",
"false",
")",
",",
"1",
")",
")",
";",
"}"
] |
Gets a constraint to ensure that ensures only one of the two PhysicalEntities has an
activity. Size of this constraint is 2.
@param activating true/false (TODO explain)
@return constraint to make sure only one of the PhysicalEntity has an activity
|
[
"Gets",
"a",
"constraint",
"to",
"ensure",
"that",
"ensures",
"only",
"one",
"of",
"the",
"two",
"PhysicalEntities",
"has",
"an",
"activity",
".",
"Size",
"of",
"this",
"constraint",
"is",
"2",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java#L368-L372
|
10,795
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java
|
ConBox.isHuman
|
public static Constraint isHuman()
{
return new OR(
new MappedConst(new Field("SequenceEntityReference/organism/displayName",
Field.Operation.INTERSECT, "Homo sapiens"), 0),
new MappedConst(new Field("PhysicalEntity/entityReference/organism/displayName",
Field.Operation.INTERSECT, "Homo sapiens"), 0));
}
|
java
|
public static Constraint isHuman()
{
return new OR(
new MappedConst(new Field("SequenceEntityReference/organism/displayName",
Field.Operation.INTERSECT, "Homo sapiens"), 0),
new MappedConst(new Field("PhysicalEntity/entityReference/organism/displayName",
Field.Operation.INTERSECT, "Homo sapiens"), 0));
}
|
[
"public",
"static",
"Constraint",
"isHuman",
"(",
")",
"{",
"return",
"new",
"OR",
"(",
"new",
"MappedConst",
"(",
"new",
"Field",
"(",
"\"SequenceEntityReference/organism/displayName\"",
",",
"Field",
".",
"Operation",
".",
"INTERSECT",
",",
"\"Homo sapiens\"",
")",
",",
"0",
")",
",",
"new",
"MappedConst",
"(",
"new",
"Field",
"(",
"\"PhysicalEntity/entityReference/organism/displayName\"",
",",
"Field",
".",
"Operation",
".",
"INTERSECT",
",",
"\"Homo sapiens\"",
")",
",",
"0",
")",
")",
";",
"}"
] |
Makes sure the EntityReference or the PhysicalEntity belongs to human. Please note that this
check depends on the display name of the related BioSource object to be "Homo sapiens". If
that is not the case, the constraint won't work.
@return constraint to make sure the EntityReference or the PhysicalEntity belongs to human
|
[
"Makes",
"sure",
"the",
"EntityReference",
"or",
"the",
"PhysicalEntity",
"belongs",
"to",
"human",
".",
"Please",
"note",
"that",
"this",
"check",
"depends",
"on",
"the",
"display",
"name",
"of",
"the",
"related",
"BioSource",
"object",
"to",
"be",
"Homo",
"sapiens",
".",
"If",
"that",
"is",
"not",
"the",
"case",
"the",
"constraint",
"won",
"t",
"work",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java#L417-L424
|
10,796
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java
|
ConBox.modificationConstraint
|
public static Constraint modificationConstraint(String modifTerm)
{
return new FieldOfMultiple(new MappedConst(new LinkedPE(LinkedPE.Type.TO_SPECIFIC), 0),
"PhysicalEntity/feature:ModificationFeature/modificationType/term",
Field.Operation.INTERSECT, modifTerm);
}
|
java
|
public static Constraint modificationConstraint(String modifTerm)
{
return new FieldOfMultiple(new MappedConst(new LinkedPE(LinkedPE.Type.TO_SPECIFIC), 0),
"PhysicalEntity/feature:ModificationFeature/modificationType/term",
Field.Operation.INTERSECT, modifTerm);
}
|
[
"public",
"static",
"Constraint",
"modificationConstraint",
"(",
"String",
"modifTerm",
")",
"{",
"return",
"new",
"FieldOfMultiple",
"(",
"new",
"MappedConst",
"(",
"new",
"LinkedPE",
"(",
"LinkedPE",
".",
"Type",
".",
"TO_SPECIFIC",
")",
",",
"0",
")",
",",
"\"PhysicalEntity/feature:ModificationFeature/modificationType/term\"",
",",
"Field",
".",
"Operation",
".",
"INTERSECT",
",",
"modifTerm",
")",
";",
"}"
] |
Makes sure that the PhysicalEntity or any linked PE contains the modification term. Size = 1.
@param modifTerm term to check
@return constraint to filter out PhysicalEntity not associated to a modification term
|
[
"Makes",
"sure",
"that",
"the",
"PhysicalEntity",
"or",
"any",
"linked",
"PE",
"contains",
"the",
"modification",
"term",
".",
"Size",
"=",
"1",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java#L498-L503
|
10,797
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java
|
ConBox.inSamePathway
|
public static Constraint inSamePathway()
{
String s1 = "Interaction/stepProcessOf/pathwayOrderOf";
String s2 = "Interaction/pathwayComponentOf";
return new OR(new MappedConst(new Field(s1, s1, Field.Operation.INTERSECT), 0, 1),
new MappedConst(new Field(s2, s2, Field.Operation.INTERSECT), 0, 1));
}
|
java
|
public static Constraint inSamePathway()
{
String s1 = "Interaction/stepProcessOf/pathwayOrderOf";
String s2 = "Interaction/pathwayComponentOf";
return new OR(new MappedConst(new Field(s1, s1, Field.Operation.INTERSECT), 0, 1),
new MappedConst(new Field(s2, s2, Field.Operation.INTERSECT), 0, 1));
}
|
[
"public",
"static",
"Constraint",
"inSamePathway",
"(",
")",
"{",
"String",
"s1",
"=",
"\"Interaction/stepProcessOf/pathwayOrderOf\"",
";",
"String",
"s2",
"=",
"\"Interaction/pathwayComponentOf\"",
";",
"return",
"new",
"OR",
"(",
"new",
"MappedConst",
"(",
"new",
"Field",
"(",
"s1",
",",
"s1",
",",
"Field",
".",
"Operation",
".",
"INTERSECT",
")",
",",
"0",
",",
"1",
")",
",",
"new",
"MappedConst",
"(",
"new",
"Field",
"(",
"s2",
",",
"s2",
",",
"Field",
".",
"Operation",
".",
"INTERSECT",
")",
",",
"0",
",",
"1",
")",
")",
";",
"}"
] |
Makes sure that the two interactions are members of the same pathway.
@return non-generative constraint
|
[
"Makes",
"sure",
"that",
"the",
"two",
"interactions",
"are",
"members",
"of",
"the",
"same",
"pathway",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java#L606-L612
|
10,798
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java
|
ConBox.hasDifferentCompartments
|
public static Constraint hasDifferentCompartments()
{
String acStr = "PhysicalEntity/cellularLocation/term";
return new Field(acStr, acStr, Field.Operation.NOT_EMPTY_AND_NOT_INTERSECT);
}
|
java
|
public static Constraint hasDifferentCompartments()
{
String acStr = "PhysicalEntity/cellularLocation/term";
return new Field(acStr, acStr, Field.Operation.NOT_EMPTY_AND_NOT_INTERSECT);
}
|
[
"public",
"static",
"Constraint",
"hasDifferentCompartments",
"(",
")",
"{",
"String",
"acStr",
"=",
"\"PhysicalEntity/cellularLocation/term\"",
";",
"return",
"new",
"Field",
"(",
"acStr",
",",
"acStr",
",",
"Field",
".",
"Operation",
".",
"NOT_EMPTY_AND_NOT_INTERSECT",
")",
";",
"}"
] |
Checks if two physical entities have non-empty and different compartments.
@return the constraint
|
[
"Checks",
"if",
"two",
"physical",
"entities",
"have",
"non",
"-",
"empty",
"and",
"different",
"compartments",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConBox.java#L645-L649
|
10,799
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/BFS.java
|
BFS.initMaps
|
protected void initMaps()
{
// Initialize label, maps and queue
dist = new HashMap<GraphObject, Integer>();
colors = new HashMap<GraphObject, Integer>();
queue = new LinkedList<Node>();
}
|
java
|
protected void initMaps()
{
// Initialize label, maps and queue
dist = new HashMap<GraphObject, Integer>();
colors = new HashMap<GraphObject, Integer>();
queue = new LinkedList<Node>();
}
|
[
"protected",
"void",
"initMaps",
"(",
")",
"{",
"// Initialize label, maps and queue\r",
"dist",
"=",
"new",
"HashMap",
"<",
"GraphObject",
",",
"Integer",
">",
"(",
")",
";",
"colors",
"=",
"new",
"HashMap",
"<",
"GraphObject",
",",
"Integer",
">",
"(",
")",
";",
"queue",
"=",
"new",
"LinkedList",
"<",
"Node",
">",
"(",
")",
";",
"}"
] |
Initializes maps used during query.
|
[
"Initializes",
"maps",
"used",
"during",
"query",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/BFS.java#L129-L136
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.