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
|
---|---|---|---|---|---|---|---|---|---|---|---|
8,300 |
JRebirth/JRebirth
|
org.jrebirth.af/api/src/main/java/org/jrebirth/af/api/exception/JRebirthThreadException.java
|
JRebirthThreadException.getThreadName
|
private static String getThreadName(final Type threadType) {
String threadName;
switch (threadType) {
case NOT_RUN_INTO_JAT:
threadName = "JavaFX Application Thread";
break;
case NOT_RUN_INTO_JIT:
threadName = "JRebirth Internal Thread";
break;
case NOT_RUN_INTO_JTP:
threadName = "JRebirth Thread Pool";
break;
default:
threadName = "";
}
return threadName;
}
|
java
|
private static String getThreadName(final Type threadType) {
String threadName;
switch (threadType) {
case NOT_RUN_INTO_JAT:
threadName = "JavaFX Application Thread";
break;
case NOT_RUN_INTO_JIT:
threadName = "JRebirth Internal Thread";
break;
case NOT_RUN_INTO_JTP:
threadName = "JRebirth Thread Pool";
break;
default:
threadName = "";
}
return threadName;
}
|
[
"private",
"static",
"String",
"getThreadName",
"(",
"final",
"Type",
"threadType",
")",
"{",
"String",
"threadName",
";",
"switch",
"(",
"threadType",
")",
"{",
"case",
"NOT_RUN_INTO_JAT",
":",
"threadName",
"=",
"\"JavaFX Application Thread\"",
";",
"break",
";",
"case",
"NOT_RUN_INTO_JIT",
":",
"threadName",
"=",
"\"JRebirth Internal Thread\"",
";",
"break",
";",
"case",
"NOT_RUN_INTO_JTP",
":",
"threadName",
"=",
"\"JRebirth Thread Pool\"",
";",
"break",
";",
"default",
":",
"threadName",
"=",
"\"\"",
";",
"}",
"return",
"threadName",
";",
"}"
] |
Return the concerned thread name.
@param threadType the thread type concerned
@return the thread name concerned
|
[
"Return",
"the",
"concerned",
"thread",
"name",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/api/src/main/java/org/jrebirth/af/api/exception/JRebirthThreadException.java#L67-L84
|
8,301 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java
|
ObjectParameter.parseObject
|
public Object parseObject(final ParameterEntry parameterEntry) {
Object res = null;
res = parseObjectString(this.object.getClass(), parameterEntry.getSerializedString());
// Store the parsed object directly into the entry instance
// for later access
parameterEntry.setObject(res);
return res;
}
|
java
|
public Object parseObject(final ParameterEntry parameterEntry) {
Object res = null;
res = parseObjectString(this.object.getClass(), parameterEntry.getSerializedString());
// Store the parsed object directly into the entry instance
// for later access
parameterEntry.setObject(res);
return res;
}
|
[
"public",
"Object",
"parseObject",
"(",
"final",
"ParameterEntry",
"parameterEntry",
")",
"{",
"Object",
"res",
"=",
"null",
";",
"res",
"=",
"parseObjectString",
"(",
"this",
".",
"object",
".",
"getClass",
"(",
")",
",",
"parameterEntry",
".",
"getSerializedString",
"(",
")",
")",
";",
"// Store the parsed object directly into the entry instance",
"// for later access",
"parameterEntry",
".",
"setObject",
"(",
"res",
")",
";",
"return",
"res",
";",
"}"
] |
Parse the serialized object.
@param parameterEntry the parameter entry to convert that wrap the serialized string
@return the real object
|
[
"Parse",
"the",
"serialized",
"object",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java#L103-L113
|
8,302 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java
|
ObjectParameter.parseObjectString
|
private Object parseObjectString(Class<?> objectType, final String objectString) {
Object res;
if (ResourceParams.class.isAssignableFrom(objectType)) {
// Setup the default object
if (this.object instanceof List<?>) {
ResourceParams rp = (ResourceParams) ((List<?>) this.object).get(0);
try {
rp = (ResourceParams) rp.clone();
rp.parse(objectString.split(PARAMETER_SEPARATOR_REGEX));
rp.getKey();
} catch (final CloneNotSupportedException e) {
}
res = rp;
} else {
((ResourceParams) this.object).parse(objectString.split(PARAMETER_SEPARATOR_REGEX));
// return the new value
res = this.object;
}
} else if (Class.class.isAssignableFrom(objectType)) {
res = parseClassParameter(objectString);
} else if (Enum.class.isAssignableFrom(objectType)) {
res = parseEnumParameter((Enum<?>) this.object, objectString);
} else if (File.class.isAssignableFrom(objectType)) {
res = parseFileParameter(objectString);
} else if (List.class.isAssignableFrom(objectType)) {
res = parseListParameter(objectString);
} else {
res = parsePrimitive(objectType, objectString);
}
return res;
}
|
java
|
private Object parseObjectString(Class<?> objectType, final String objectString) {
Object res;
if (ResourceParams.class.isAssignableFrom(objectType)) {
// Setup the default object
if (this.object instanceof List<?>) {
ResourceParams rp = (ResourceParams) ((List<?>) this.object).get(0);
try {
rp = (ResourceParams) rp.clone();
rp.parse(objectString.split(PARAMETER_SEPARATOR_REGEX));
rp.getKey();
} catch (final CloneNotSupportedException e) {
}
res = rp;
} else {
((ResourceParams) this.object).parse(objectString.split(PARAMETER_SEPARATOR_REGEX));
// return the new value
res = this.object;
}
} else if (Class.class.isAssignableFrom(objectType)) {
res = parseClassParameter(objectString);
} else if (Enum.class.isAssignableFrom(objectType)) {
res = parseEnumParameter((Enum<?>) this.object, objectString);
} else if (File.class.isAssignableFrom(objectType)) {
res = parseFileParameter(objectString);
} else if (List.class.isAssignableFrom(objectType)) {
res = parseListParameter(objectString);
} else {
res = parsePrimitive(objectType, objectString);
}
return res;
}
|
[
"private",
"Object",
"parseObjectString",
"(",
"Class",
"<",
"?",
">",
"objectType",
",",
"final",
"String",
"objectString",
")",
"{",
"Object",
"res",
";",
"if",
"(",
"ResourceParams",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"// Setup the default object",
"if",
"(",
"this",
".",
"object",
"instanceof",
"List",
"<",
"?",
">",
")",
"{",
"ResourceParams",
"rp",
"=",
"(",
"ResourceParams",
")",
"(",
"(",
"List",
"<",
"?",
">",
")",
"this",
".",
"object",
")",
".",
"get",
"(",
"0",
")",
";",
"try",
"{",
"rp",
"=",
"(",
"ResourceParams",
")",
"rp",
".",
"clone",
"(",
")",
";",
"rp",
".",
"parse",
"(",
"objectString",
".",
"split",
"(",
"PARAMETER_SEPARATOR_REGEX",
")",
")",
";",
"rp",
".",
"getKey",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"CloneNotSupportedException",
"e",
")",
"{",
"}",
"res",
"=",
"rp",
";",
"}",
"else",
"{",
"(",
"(",
"ResourceParams",
")",
"this",
".",
"object",
")",
".",
"parse",
"(",
"objectString",
".",
"split",
"(",
"PARAMETER_SEPARATOR_REGEX",
")",
")",
";",
"// return the new value",
"res",
"=",
"this",
".",
"object",
";",
"}",
"}",
"else",
"if",
"(",
"Class",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"parseClassParameter",
"(",
"objectString",
")",
";",
"}",
"else",
"if",
"(",
"Enum",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"parseEnumParameter",
"(",
"(",
"Enum",
"<",
"?",
">",
")",
"this",
".",
"object",
",",
"objectString",
")",
";",
"}",
"else",
"if",
"(",
"File",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"parseFileParameter",
"(",
"objectString",
")",
";",
"}",
"else",
"if",
"(",
"List",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"parseListParameter",
"(",
"objectString",
")",
";",
"}",
"else",
"{",
"res",
"=",
"parsePrimitive",
"(",
"objectType",
",",
"objectString",
")",
";",
"}",
"return",
"res",
";",
"}"
] |
Parse a string representation of an object.
@param objectType the type of the object parsed
@param objectString the serialized object
@return the real object
|
[
"Parse",
"a",
"string",
"representation",
"of",
"an",
"object",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java#L123-L153
|
8,303 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java
|
ObjectParameter.parseClassParameter
|
private Object parseClassParameter(final String serializedObject) {
Object res = null;
try {
res = Class.forName(serializedObject);
} catch (final ClassNotFoundException e) {
throw new CoreRuntimeException("Impossible to load class " + serializedObject, e);
}
return res;
}
|
java
|
private Object parseClassParameter(final String serializedObject) {
Object res = null;
try {
res = Class.forName(serializedObject);
} catch (final ClassNotFoundException e) {
throw new CoreRuntimeException("Impossible to load class " + serializedObject, e);
}
return res;
}
|
[
"private",
"Object",
"parseClassParameter",
"(",
"final",
"String",
"serializedObject",
")",
"{",
"Object",
"res",
"=",
"null",
";",
"try",
"{",
"res",
"=",
"Class",
".",
"forName",
"(",
"serializedObject",
")",
";",
"}",
"catch",
"(",
"final",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"CoreRuntimeException",
"(",
"\"Impossible to load class \"",
"+",
"serializedObject",
",",
"e",
")",
";",
"}",
"return",
"res",
";",
"}"
] |
Parse a class definition by calling Class.forName.
@param serializedObject the full class name
@return the class object
|
[
"Parse",
"a",
"class",
"definition",
"by",
"calling",
"Class",
".",
"forName",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java#L162-L170
|
8,304 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java
|
ObjectParameter.parseEnumParameter
|
@SuppressWarnings("unchecked")
private Object parseEnumParameter(final Enum<?> e, final String serializedObject) {
final Object res = Enum.valueOf(e.getClass(), serializedObject);
return res;
}
|
java
|
@SuppressWarnings("unchecked")
private Object parseEnumParameter(final Enum<?> e, final String serializedObject) {
final Object res = Enum.valueOf(e.getClass(), serializedObject);
return res;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Object",
"parseEnumParameter",
"(",
"final",
"Enum",
"<",
"?",
">",
"e",
",",
"final",
"String",
"serializedObject",
")",
"{",
"final",
"Object",
"res",
"=",
"Enum",
".",
"valueOf",
"(",
"e",
".",
"getClass",
"(",
")",
",",
"serializedObject",
")",
";",
"return",
"res",
";",
"}"
] |
Parse an Enum definition by calling Enum.valueOf.
@param serializedObject the full enumerated value
@return the class object
|
[
"Parse",
"an",
"Enum",
"definition",
"by",
"calling",
"Enum",
".",
"valueOf",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java#L179-L183
|
8,305 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java
|
ObjectParameter.parseFileParameter
|
private Object parseFileParameter(final String serializedObject) {
final File res = new File(serializedObject);
if (!res.exists()) {
throw new CoreRuntimeException("Impossible to load file " + serializedObject);
}
return res;
}
|
java
|
private Object parseFileParameter(final String serializedObject) {
final File res = new File(serializedObject);
if (!res.exists()) {
throw new CoreRuntimeException("Impossible to load file " + serializedObject);
}
return res;
}
|
[
"private",
"Object",
"parseFileParameter",
"(",
"final",
"String",
"serializedObject",
")",
"{",
"final",
"File",
"res",
"=",
"new",
"File",
"(",
"serializedObject",
")",
";",
"if",
"(",
"!",
"res",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"CoreRuntimeException",
"(",
"\"Impossible to load file \"",
"+",
"serializedObject",
")",
";",
"}",
"return",
"res",
";",
"}"
] |
Parse a file definition by using canonical path.
@param serializedObject the full file path
@return the File object
|
[
"Parse",
"a",
"file",
"definition",
"by",
"using",
"canonical",
"path",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java#L192-L198
|
8,306 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java
|
ObjectParameter.parseListParameter
|
private Object parseListParameter(final String serializedObject) {
final List<Object> res = new ArrayList<>();
final Class<?> objectType = ((List<?>) this.object).get(0).getClass();
for (final String item : serializedObject.split(";")) {
res.add(parseObjectString(objectType, item));
}
return res;
}
|
java
|
private Object parseListParameter(final String serializedObject) {
final List<Object> res = new ArrayList<>();
final Class<?> objectType = ((List<?>) this.object).get(0).getClass();
for (final String item : serializedObject.split(";")) {
res.add(parseObjectString(objectType, item));
}
return res;
}
|
[
"private",
"Object",
"parseListParameter",
"(",
"final",
"String",
"serializedObject",
")",
"{",
"final",
"List",
"<",
"Object",
">",
"res",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"Class",
"<",
"?",
">",
"objectType",
"=",
"(",
"(",
"List",
"<",
"?",
">",
")",
"this",
".",
"object",
")",
".",
"get",
"(",
"0",
")",
".",
"getClass",
"(",
")",
";",
"for",
"(",
"final",
"String",
"item",
":",
"serializedObject",
".",
"split",
"(",
"\";\"",
")",
")",
"{",
"res",
".",
"add",
"(",
"parseObjectString",
"(",
"objectType",
",",
"item",
")",
")",
";",
"}",
"return",
"res",
";",
"}"
] |
Parse a generic list.
@param serializedObject the concatenated list
@return the list object
|
[
"Parse",
"a",
"generic",
"list",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java#L207-L217
|
8,307 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java
|
ObjectParameter.parsePrimitive
|
private Object parsePrimitive(Class<?> objectType, final String serializedObject) {
Object res = null;
if (Boolean.class.isAssignableFrom(objectType)) {
res = Boolean.valueOf(serializedObject);
} else if (String.class.isAssignableFrom(objectType)) {
res = serializedObject;
} else if (Character.class.isAssignableFrom(objectType)) {
res = Character.valueOf(serializedObject.charAt(0));
} else if (Byte.class.isAssignableFrom(objectType)) {
res = Byte.parseByte(serializedObject);
} else if (Short.class.isAssignableFrom(objectType)) {
res = Short.parseShort(serializedObject);
} else if (Integer.class.isAssignableFrom(objectType)) {
res = Integer.parseInt(serializedObject);
} else if (Long.class.isAssignableFrom(objectType)) {
res = Long.parseLong(serializedObject);
} else if (Float.class.isAssignableFrom(objectType)) {
res = Float.parseFloat(serializedObject);
} else if (Double.class.isAssignableFrom(objectType)) {
res = Double.parseDouble(serializedObject);
}
return res;
}
|
java
|
private Object parsePrimitive(Class<?> objectType, final String serializedObject) {
Object res = null;
if (Boolean.class.isAssignableFrom(objectType)) {
res = Boolean.valueOf(serializedObject);
} else if (String.class.isAssignableFrom(objectType)) {
res = serializedObject;
} else if (Character.class.isAssignableFrom(objectType)) {
res = Character.valueOf(serializedObject.charAt(0));
} else if (Byte.class.isAssignableFrom(objectType)) {
res = Byte.parseByte(serializedObject);
} else if (Short.class.isAssignableFrom(objectType)) {
res = Short.parseShort(serializedObject);
} else if (Integer.class.isAssignableFrom(objectType)) {
res = Integer.parseInt(serializedObject);
} else if (Long.class.isAssignableFrom(objectType)) {
res = Long.parseLong(serializedObject);
} else if (Float.class.isAssignableFrom(objectType)) {
res = Float.parseFloat(serializedObject);
} else if (Double.class.isAssignableFrom(objectType)) {
res = Double.parseDouble(serializedObject);
}
return res;
}
|
[
"private",
"Object",
"parsePrimitive",
"(",
"Class",
"<",
"?",
">",
"objectType",
",",
"final",
"String",
"serializedObject",
")",
"{",
"Object",
"res",
"=",
"null",
";",
"if",
"(",
"Boolean",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"Boolean",
".",
"valueOf",
"(",
"serializedObject",
")",
";",
"}",
"else",
"if",
"(",
"String",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"serializedObject",
";",
"}",
"else",
"if",
"(",
"Character",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"Character",
".",
"valueOf",
"(",
"serializedObject",
".",
"charAt",
"(",
"0",
")",
")",
";",
"}",
"else",
"if",
"(",
"Byte",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"Byte",
".",
"parseByte",
"(",
"serializedObject",
")",
";",
"}",
"else",
"if",
"(",
"Short",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"Short",
".",
"parseShort",
"(",
"serializedObject",
")",
";",
"}",
"else",
"if",
"(",
"Integer",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"Integer",
".",
"parseInt",
"(",
"serializedObject",
")",
";",
"}",
"else",
"if",
"(",
"Long",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"Long",
".",
"parseLong",
"(",
"serializedObject",
")",
";",
"}",
"else",
"if",
"(",
"Float",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"Float",
".",
"parseFloat",
"(",
"serializedObject",
")",
";",
"}",
"else",
"if",
"(",
"Double",
".",
"class",
".",
"isAssignableFrom",
"(",
"objectType",
")",
")",
"{",
"res",
"=",
"Double",
".",
"parseDouble",
"(",
"serializedObject",
")",
";",
"}",
"return",
"res",
";",
"}"
] |
Parse primitive serialized object.
@param objectType the type of the object parsed
@param serializedObject the serialized string to parse
@return a new fresh instance of the object
|
[
"Parse",
"primitive",
"serialized",
"object",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java#L227-L250
|
8,308 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java
|
ParameterBuilder.searchConfigurationFiles
|
public void searchConfigurationFiles(final String wildcard, final String extension) {
// Store parameters
this.configurationFileWildcard = wildcard;
this.configurationFileExtension = extension;
// Search and analyze all properties files available
readPropertiesFiles();
}
|
java
|
public void searchConfigurationFiles(final String wildcard, final String extension) {
// Store parameters
this.configurationFileWildcard = wildcard;
this.configurationFileExtension = extension;
// Search and analyze all properties files available
readPropertiesFiles();
}
|
[
"public",
"void",
"searchConfigurationFiles",
"(",
"final",
"String",
"wildcard",
",",
"final",
"String",
"extension",
")",
"{",
"// Store parameters\r",
"this",
".",
"configurationFileWildcard",
"=",
"wildcard",
";",
"this",
".",
"configurationFileExtension",
"=",
"extension",
";",
"// Search and analyze all properties files available\r",
"readPropertiesFiles",
"(",
")",
";",
"}"
] |
Search configuration files according to the parameters provided.
@param wildcard the regex wildcard (must not be null)
@param extension the file extension without the first dot (ie: properties) (must not be null)
|
[
"Search",
"configuration",
"files",
"according",
"to",
"the",
"parameters",
"provided",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java#L79-L87
|
8,309 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java
|
ParameterBuilder.readPropertiesFile
|
private void readPropertiesFile(final String custConfFileName) {
final Properties p = new Properties();
LOGGER.log(READ_CONF_FILE, custConfFileName);
try (InputStream is = ClasspathUtility.loadInputStream(custConfFileName)) {
// Read the properties file
p.load(is);
for (final Map.Entry<Object, Object> entry : p.entrySet()) {
if (this.propertiesParametersMap.containsKey(entry.getKey())) {
LOGGER.log(UPDATE_PARAMETER, entry.getKey(), entry.getValue());
} else {
LOGGER.log(STORE_PARAMETER, entry.getKey(), entry.getValue());
}
storePropertiesParameter(entry);
}
} catch (final IOException e) {
LOGGER.error(CONF_READING_ERROR, custConfFileName);
}
}
|
java
|
private void readPropertiesFile(final String custConfFileName) {
final Properties p = new Properties();
LOGGER.log(READ_CONF_FILE, custConfFileName);
try (InputStream is = ClasspathUtility.loadInputStream(custConfFileName)) {
// Read the properties file
p.load(is);
for (final Map.Entry<Object, Object> entry : p.entrySet()) {
if (this.propertiesParametersMap.containsKey(entry.getKey())) {
LOGGER.log(UPDATE_PARAMETER, entry.getKey(), entry.getValue());
} else {
LOGGER.log(STORE_PARAMETER, entry.getKey(), entry.getValue());
}
storePropertiesParameter(entry);
}
} catch (final IOException e) {
LOGGER.error(CONF_READING_ERROR, custConfFileName);
}
}
|
[
"private",
"void",
"readPropertiesFile",
"(",
"final",
"String",
"custConfFileName",
")",
"{",
"final",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"LOGGER",
".",
"log",
"(",
"READ_CONF_FILE",
",",
"custConfFileName",
")",
";",
"try",
"(",
"InputStream",
"is",
"=",
"ClasspathUtility",
".",
"loadInputStream",
"(",
"custConfFileName",
")",
")",
"{",
"// Read the properties file\r",
"p",
".",
"load",
"(",
"is",
")",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"p",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"propertiesParametersMap",
".",
"containsKey",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
")",
"{",
"LOGGER",
".",
"log",
"(",
"UPDATE_PARAMETER",
",",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"log",
"(",
"STORE_PARAMETER",
",",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"storePropertiesParameter",
"(",
"entry",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"CONF_READING_ERROR",
",",
"custConfFileName",
")",
";",
"}",
"}"
] |
Read a customized configuration file to load parameters values.
@param custConfFileName the file to load
|
[
"Read",
"a",
"customized",
"configuration",
"file",
"to",
"load",
"parameters",
"values",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java#L118-L143
|
8,310 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java
|
ParameterBuilder.resolveVarEnv
|
private String resolveVarEnv(final String entryValue) {
String value = entryValue;
if (value != null) {
value = checkPattern(value, ENV_VAR_PATTERN1, true);
value = checkPattern(value, ENV_VAR_PATTERN2, false);
}
return value;
}
|
java
|
private String resolveVarEnv(final String entryValue) {
String value = entryValue;
if (value != null) {
value = checkPattern(value, ENV_VAR_PATTERN1, true);
value = checkPattern(value, ENV_VAR_PATTERN2, false);
}
return value;
}
|
[
"private",
"String",
"resolveVarEnv",
"(",
"final",
"String",
"entryValue",
")",
"{",
"String",
"value",
"=",
"entryValue",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"value",
"=",
"checkPattern",
"(",
"value",
",",
"ENV_VAR_PATTERN1",
",",
"true",
")",
";",
"value",
"=",
"checkPattern",
"(",
"value",
",",
"ENV_VAR_PATTERN2",
",",
"false",
")",
";",
"}",
"return",
"value",
";",
"}"
] |
Resolve any environment variable found into the string.
@param entryValue the string to check and resolve
@return the final value with environment variable resolved
|
[
"Resolve",
"any",
"environment",
"variable",
"found",
"into",
"the",
"string",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java#L162-L170
|
8,311 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java
|
ParameterBuilder.checkPattern
|
private String checkPattern(final String value, final Pattern pattern, final boolean withBrace) {
String res = value;
final Matcher matcher = pattern.matcher(value);
while (matcher.find()) {
final String envName = matcher.group(2);
if (!this.varenvMap.containsKey(envName)) {
final String envValue = System.getenv(envName);
this.varenvMap.put(envName, envValue);
}
// Check if the var env is ready
if (this.varenvMap.get(envName) != null) {
if (withBrace) {
res = res.replace("${" + envName + "}", this.varenvMap.get(envName));
} else {
res = res.replace("$" + envName, this.varenvMap.get(envName));
}
} else {
LOGGER.log(UNDEFINED_ENV_VAR, envName);
}
}
return res;
}
|
java
|
private String checkPattern(final String value, final Pattern pattern, final boolean withBrace) {
String res = value;
final Matcher matcher = pattern.matcher(value);
while (matcher.find()) {
final String envName = matcher.group(2);
if (!this.varenvMap.containsKey(envName)) {
final String envValue = System.getenv(envName);
this.varenvMap.put(envName, envValue);
}
// Check if the var env is ready
if (this.varenvMap.get(envName) != null) {
if (withBrace) {
res = res.replace("${" + envName + "}", this.varenvMap.get(envName));
} else {
res = res.replace("$" + envName, this.varenvMap.get(envName));
}
} else {
LOGGER.log(UNDEFINED_ENV_VAR, envName);
}
}
return res;
}
|
[
"private",
"String",
"checkPattern",
"(",
"final",
"String",
"value",
",",
"final",
"Pattern",
"pattern",
",",
"final",
"boolean",
"withBrace",
")",
"{",
"String",
"res",
"=",
"value",
";",
"final",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"value",
")",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"final",
"String",
"envName",
"=",
"matcher",
".",
"group",
"(",
"2",
")",
";",
"if",
"(",
"!",
"this",
".",
"varenvMap",
".",
"containsKey",
"(",
"envName",
")",
")",
"{",
"final",
"String",
"envValue",
"=",
"System",
".",
"getenv",
"(",
"envName",
")",
";",
"this",
".",
"varenvMap",
".",
"put",
"(",
"envName",
",",
"envValue",
")",
";",
"}",
"// Check if the var env is ready\r",
"if",
"(",
"this",
".",
"varenvMap",
".",
"get",
"(",
"envName",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"withBrace",
")",
"{",
"res",
"=",
"res",
".",
"replace",
"(",
"\"${\"",
"+",
"envName",
"+",
"\"}\"",
",",
"this",
".",
"varenvMap",
".",
"get",
"(",
"envName",
")",
")",
";",
"}",
"else",
"{",
"res",
"=",
"res",
".",
"replace",
"(",
"\"$\"",
"+",
"envName",
",",
"this",
".",
"varenvMap",
".",
"get",
"(",
"envName",
")",
")",
";",
"}",
"}",
"else",
"{",
"LOGGER",
".",
"log",
"(",
"UNDEFINED_ENV_VAR",
",",
"envName",
")",
";",
"}",
"}",
"return",
"res",
";",
"}"
] |
Check if the given string contains an environment variable.
@param value the string value to parse
@param pattern the regex pattern to use
@param withBrace true for ${varname}, false for $varname
@return the given string updated with right environment variable content
|
[
"Check",
"if",
"the",
"given",
"string",
"contains",
"an",
"environment",
"variable",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java#L181-L202
|
8,312 |
pmlopes/yoke
|
framework/src/main/java/com/jetdrone/vertx/yoke/YokeSecurity.java
|
YokeSecurity.getCipher
|
public static Cipher getCipher(final @NotNull Key key, int mode) {
try {
Cipher cipher = Cipher.getInstance(key.getAlgorithm());
cipher.init(mode, key);
return cipher;
} catch (NoSuchAlgorithmException | InvalidKeyException | NoSuchPaddingException e) {
throw new RuntimeException(e);
}
}
|
java
|
public static Cipher getCipher(final @NotNull Key key, int mode) {
try {
Cipher cipher = Cipher.getInstance(key.getAlgorithm());
cipher.init(mode, key);
return cipher;
} catch (NoSuchAlgorithmException | InvalidKeyException | NoSuchPaddingException e) {
throw new RuntimeException(e);
}
}
|
[
"public",
"static",
"Cipher",
"getCipher",
"(",
"final",
"@",
"NotNull",
"Key",
"key",
",",
"int",
"mode",
")",
"{",
"try",
"{",
"Cipher",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"key",
".",
"getAlgorithm",
"(",
")",
")",
";",
"cipher",
".",
"init",
"(",
"mode",
",",
"key",
")",
";",
"return",
"cipher",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"|",
"InvalidKeyException",
"|",
"NoSuchPaddingException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Creates a new Cipher
@return Cipher implementation
|
[
"Creates",
"a",
"new",
"Cipher"
] |
fe8a64036f09fb745f0644faddd46162d64faf3c
|
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/YokeSecurity.java#L32-L40
|
8,313 |
JRebirth/JRebirth
|
org.jrebirth.af/transition/src/main/java/org/jrebirth/af/transition/slicer/RandomFadingService.java
|
RandomFadingService.setNodes
|
public void setNodes(final List<? extends Node> nodesToAdd) {
for (final Node n : nodesToAdd) {
this.nodes.add(n);
}
}
|
java
|
public void setNodes(final List<? extends Node> nodesToAdd) {
for (final Node n : nodesToAdd) {
this.nodes.add(n);
}
}
|
[
"public",
"void",
"setNodes",
"(",
"final",
"List",
"<",
"?",
"extends",
"Node",
">",
"nodesToAdd",
")",
"{",
"for",
"(",
"final",
"Node",
"n",
":",
"nodesToAdd",
")",
"{",
"this",
".",
"nodes",
".",
"add",
"(",
"n",
")",
";",
"}",
"}"
] |
Set the nodes.
@param nodesToAdd the new nodes
|
[
"Set",
"the",
"nodes",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/transition/src/main/java/org/jrebirth/af/transition/slicer/RandomFadingService.java#L69-L73
|
8,314 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/demo/src/main/java/org/jrebirth/af/showcase/demo/ui/MainController.java
|
MainController.onButtonFired
|
void onButtonFired(final ActionEvent event) {
final Optional<Button> b = getTarget(event, Button.class);
final Optional<UniqueKey<? extends Model>> data = getUserData(b, StackWaves.PAGE_MODEL_KEY);
if (data.isPresent()) {
model().sendWave(StackWaves.SHOW_PAGE_MODEL,
WBuilder.waveData(StackWaves.PAGE_MODEL_KEY, data.get()),
WBuilder.waveData(StackWaves.STACK_NAME, "DemoStack"));
}
}
|
java
|
void onButtonFired(final ActionEvent event) {
final Optional<Button> b = getTarget(event, Button.class);
final Optional<UniqueKey<? extends Model>> data = getUserData(b, StackWaves.PAGE_MODEL_KEY);
if (data.isPresent()) {
model().sendWave(StackWaves.SHOW_PAGE_MODEL,
WBuilder.waveData(StackWaves.PAGE_MODEL_KEY, data.get()),
WBuilder.waveData(StackWaves.STACK_NAME, "DemoStack"));
}
}
|
[
"void",
"onButtonFired",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"final",
"Optional",
"<",
"Button",
">",
"b",
"=",
"getTarget",
"(",
"event",
",",
"Button",
".",
"class",
")",
";",
"final",
"Optional",
"<",
"UniqueKey",
"<",
"?",
"extends",
"Model",
">",
">",
"data",
"=",
"getUserData",
"(",
"b",
",",
"StackWaves",
".",
"PAGE_MODEL_KEY",
")",
";",
"if",
"(",
"data",
".",
"isPresent",
"(",
")",
")",
"{",
"model",
"(",
")",
".",
"sendWave",
"(",
"StackWaves",
".",
"SHOW_PAGE_MODEL",
",",
"WBuilder",
".",
"waveData",
"(",
"StackWaves",
".",
"PAGE_MODEL_KEY",
",",
"data",
".",
"get",
"(",
")",
")",
",",
"WBuilder",
".",
"waveData",
"(",
"StackWaves",
".",
"STACK_NAME",
",",
"\"DemoStack\"",
")",
")",
";",
"}",
"}"
] |
When a button is fired display the related ModuleModel.
@param event the action event
|
[
"When",
"a",
"button",
"is",
"fired",
"display",
"the",
"related",
"ModuleModel",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/demo/src/main/java/org/jrebirth/af/showcase/demo/ui/MainController.java#L56-L68
|
8,315 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/font/FontBuilder.java
|
FontBuilder.buildRealFont
|
private Font buildRealFont(final RealFont rFont) {
checkFontStatus(rFont);
return Font.font(transformFontName(rFont.name().name()), rFont.size());
}
|
java
|
private Font buildRealFont(final RealFont rFont) {
checkFontStatus(rFont);
return Font.font(transformFontName(rFont.name().name()), rFont.size());
}
|
[
"private",
"Font",
"buildRealFont",
"(",
"final",
"RealFont",
"rFont",
")",
"{",
"checkFontStatus",
"(",
"rFont",
")",
";",
"return",
"Font",
".",
"font",
"(",
"transformFontName",
"(",
"rFont",
".",
"name",
"(",
")",
".",
"name",
"(",
")",
")",
",",
"rFont",
".",
"size",
"(",
")",
")",
";",
"}"
] |
Build a real font with name and size.
@param rFont the real font enum
@return the javafx font
|
[
"Build",
"a",
"real",
"font",
"with",
"name",
"and",
"size",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/font/FontBuilder.java#L84-L87
|
8,316 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/font/FontBuilder.java
|
FontBuilder.buildFamilyFont
|
private Font buildFamilyFont(final FamilyFont familyFont) {
Font font = null;
if (familyFont.posture() == null && familyFont.weight() == null) {
font = Font.font(transformFontName(familyFont.family()), familyFont.size());
} else if (familyFont.posture() == null) {
font = Font.font(transformFontName(familyFont.family()), familyFont.weight(), familyFont.size());
} else if (familyFont.weight() == null) {
font = Font.font(transformFontName(familyFont.family()), familyFont.posture(), familyFont.size());
} else {
font = Font.font(transformFontName(familyFont.family()), familyFont.weight(), familyFont.posture(), familyFont.size());
}
return font;
}
|
java
|
private Font buildFamilyFont(final FamilyFont familyFont) {
Font font = null;
if (familyFont.posture() == null && familyFont.weight() == null) {
font = Font.font(transformFontName(familyFont.family()), familyFont.size());
} else if (familyFont.posture() == null) {
font = Font.font(transformFontName(familyFont.family()), familyFont.weight(), familyFont.size());
} else if (familyFont.weight() == null) {
font = Font.font(transformFontName(familyFont.family()), familyFont.posture(), familyFont.size());
} else {
font = Font.font(transformFontName(familyFont.family()), familyFont.weight(), familyFont.posture(), familyFont.size());
}
return font;
}
|
[
"private",
"Font",
"buildFamilyFont",
"(",
"final",
"FamilyFont",
"familyFont",
")",
"{",
"Font",
"font",
"=",
"null",
";",
"if",
"(",
"familyFont",
".",
"posture",
"(",
")",
"==",
"null",
"&&",
"familyFont",
".",
"weight",
"(",
")",
"==",
"null",
")",
"{",
"font",
"=",
"Font",
".",
"font",
"(",
"transformFontName",
"(",
"familyFont",
".",
"family",
"(",
")",
")",
",",
"familyFont",
".",
"size",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"familyFont",
".",
"posture",
"(",
")",
"==",
"null",
")",
"{",
"font",
"=",
"Font",
".",
"font",
"(",
"transformFontName",
"(",
"familyFont",
".",
"family",
"(",
")",
")",
",",
"familyFont",
".",
"weight",
"(",
")",
",",
"familyFont",
".",
"size",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"familyFont",
".",
"weight",
"(",
")",
"==",
"null",
")",
"{",
"font",
"=",
"Font",
".",
"font",
"(",
"transformFontName",
"(",
"familyFont",
".",
"family",
"(",
")",
")",
",",
"familyFont",
".",
"posture",
"(",
")",
",",
"familyFont",
".",
"size",
"(",
")",
")",
";",
"}",
"else",
"{",
"font",
"=",
"Font",
".",
"font",
"(",
"transformFontName",
"(",
"familyFont",
".",
"family",
"(",
")",
")",
",",
"familyFont",
".",
"weight",
"(",
")",
",",
"familyFont",
".",
"posture",
"(",
")",
",",
"familyFont",
".",
"size",
"(",
")",
")",
";",
"}",
"return",
"font",
";",
"}"
] |
Build a Family Font with name and size.
@param familyFont the family font enum
@return the javafx font
|
[
"Build",
"a",
"Family",
"Font",
"with",
"name",
"and",
"size",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/font/FontBuilder.java#L96-L108
|
8,317 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/font/FontBuilder.java
|
FontBuilder.checkFontStatus
|
private void checkFontStatus(final FontParams fontParams) {
// Try to load system fonts
final List<String> fonts = Font.getFontNames(transformFontName(fontParams.name().name()));
Font font = null;
String fontName = null;
if (fonts.isEmpty()) {
final List<String> fontPaths = fontParams instanceof RealFont && ((RealFont) fontParams).skipFontsFolder()
? Collections.singletonList("")
: ResourceParameters.FONT_FOLDER.get();
for (int i = 0; i < fontPaths.size() && font == null; i++) {
String fontPath = fontPaths.get(i);
if (!fontPath.isEmpty()) {
fontPath += Resources.PATH_SEP; // NOSONAR
}
// This variable will hold the 2 alternative font names
fontName = fontPath + transformFontName(fontParams.name().name()) + "." + fontParams.extension();
LOGGER.trace("Try to load Transformed Font {}", fontName);
font = Font.loadFont(Thread.currentThread().getContextClassLoader().getResourceAsStream(fontName), fontParams.size());
// The font name contains '_' in its file name to replace ' '
if (font == null) {
fontName = fontPath + fontParams.name().name() + "." + fontParams.extension();
LOGGER.trace("Try to load Raw Font {}", fontName);
font = Font.loadFont(Thread.currentThread().getContextClassLoader().getResourceAsStream(fontName), fontParams.size());
if (font != null) {
// Raw font has been loaded
LOGGER.info("{} Raw Font loaded", fontName);
}
} else {
// Transformed font has been loaded
LOGGER.info("{} Transformed Font loaded", fontName);
}
}
if (font == null) {
// Neither transformed nor raw font has been loaded (with or without '_')
LOGGER.error("Font : {} not found into base folder: {}", fontParams.name().name() + "." + fontParams.extension(), ResourceParameters.FONT_FOLDER.get());
}
}
}
|
java
|
private void checkFontStatus(final FontParams fontParams) {
// Try to load system fonts
final List<String> fonts = Font.getFontNames(transformFontName(fontParams.name().name()));
Font font = null;
String fontName = null;
if (fonts.isEmpty()) {
final List<String> fontPaths = fontParams instanceof RealFont && ((RealFont) fontParams).skipFontsFolder()
? Collections.singletonList("")
: ResourceParameters.FONT_FOLDER.get();
for (int i = 0; i < fontPaths.size() && font == null; i++) {
String fontPath = fontPaths.get(i);
if (!fontPath.isEmpty()) {
fontPath += Resources.PATH_SEP; // NOSONAR
}
// This variable will hold the 2 alternative font names
fontName = fontPath + transformFontName(fontParams.name().name()) + "." + fontParams.extension();
LOGGER.trace("Try to load Transformed Font {}", fontName);
font = Font.loadFont(Thread.currentThread().getContextClassLoader().getResourceAsStream(fontName), fontParams.size());
// The font name contains '_' in its file name to replace ' '
if (font == null) {
fontName = fontPath + fontParams.name().name() + "." + fontParams.extension();
LOGGER.trace("Try to load Raw Font {}", fontName);
font = Font.loadFont(Thread.currentThread().getContextClassLoader().getResourceAsStream(fontName), fontParams.size());
if (font != null) {
// Raw font has been loaded
LOGGER.info("{} Raw Font loaded", fontName);
}
} else {
// Transformed font has been loaded
LOGGER.info("{} Transformed Font loaded", fontName);
}
}
if (font == null) {
// Neither transformed nor raw font has been loaded (with or without '_')
LOGGER.error("Font : {} not found into base folder: {}", fontParams.name().name() + "." + fontParams.extension(), ResourceParameters.FONT_FOLDER.get());
}
}
}
|
[
"private",
"void",
"checkFontStatus",
"(",
"final",
"FontParams",
"fontParams",
")",
"{",
"// Try to load system fonts",
"final",
"List",
"<",
"String",
">",
"fonts",
"=",
"Font",
".",
"getFontNames",
"(",
"transformFontName",
"(",
"fontParams",
".",
"name",
"(",
")",
".",
"name",
"(",
")",
")",
")",
";",
"Font",
"font",
"=",
"null",
";",
"String",
"fontName",
"=",
"null",
";",
"if",
"(",
"fonts",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"List",
"<",
"String",
">",
"fontPaths",
"=",
"fontParams",
"instanceof",
"RealFont",
"&&",
"(",
"(",
"RealFont",
")",
"fontParams",
")",
".",
"skipFontsFolder",
"(",
")",
"?",
"Collections",
".",
"singletonList",
"(",
"\"\"",
")",
":",
"ResourceParameters",
".",
"FONT_FOLDER",
".",
"get",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fontPaths",
".",
"size",
"(",
")",
"&&",
"font",
"==",
"null",
";",
"i",
"++",
")",
"{",
"String",
"fontPath",
"=",
"fontPaths",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"!",
"fontPath",
".",
"isEmpty",
"(",
")",
")",
"{",
"fontPath",
"+=",
"Resources",
".",
"PATH_SEP",
";",
"// NOSONAR",
"}",
"// This variable will hold the 2 alternative font names",
"fontName",
"=",
"fontPath",
"+",
"transformFontName",
"(",
"fontParams",
".",
"name",
"(",
")",
".",
"name",
"(",
")",
")",
"+",
"\".\"",
"+",
"fontParams",
".",
"extension",
"(",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"Try to load Transformed Font {}\"",
",",
"fontName",
")",
";",
"font",
"=",
"Font",
".",
"loadFont",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"fontName",
")",
",",
"fontParams",
".",
"size",
"(",
")",
")",
";",
"// The font name contains '_' in its file name to replace ' '",
"if",
"(",
"font",
"==",
"null",
")",
"{",
"fontName",
"=",
"fontPath",
"+",
"fontParams",
".",
"name",
"(",
")",
".",
"name",
"(",
")",
"+",
"\".\"",
"+",
"fontParams",
".",
"extension",
"(",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"Try to load Raw Font {}\"",
",",
"fontName",
")",
";",
"font",
"=",
"Font",
".",
"loadFont",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"fontName",
")",
",",
"fontParams",
".",
"size",
"(",
")",
")",
";",
"if",
"(",
"font",
"!=",
"null",
")",
"{",
"// Raw font has been loaded",
"LOGGER",
".",
"info",
"(",
"\"{} Raw Font loaded\"",
",",
"fontName",
")",
";",
"}",
"}",
"else",
"{",
"// Transformed font has been loaded",
"LOGGER",
".",
"info",
"(",
"\"{} Transformed Font loaded\"",
",",
"fontName",
")",
";",
"}",
"}",
"if",
"(",
"font",
"==",
"null",
")",
"{",
"// Neither transformed nor raw font has been loaded (with or without '_')",
"LOGGER",
".",
"error",
"(",
"\"Font : {} not found into base folder: {}\"",
",",
"fontParams",
".",
"name",
"(",
")",
".",
"name",
"(",
")",
"+",
"\".\"",
"+",
"fontParams",
".",
"extension",
"(",
")",
",",
"ResourceParameters",
".",
"FONT_FOLDER",
".",
"get",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Load the font file.
@param fontParams the name of the font to load
|
[
"Load",
"the",
"font",
"file",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/font/FontBuilder.java#L126-L175
|
8,318 |
pmlopes/yoke
|
middleware/swagger/src/main/java/com/jetdrone/vertx/yoke/middleware/Swagger.java
|
Swagger.from
|
public static Swagger from(final Swagger router, final Object... objs) {
for (Object o : objs) {
Processor.process(router, o);
}
return router;
}
|
java
|
public static Swagger from(final Swagger router, final Object... objs) {
for (Object o : objs) {
Processor.process(router, o);
}
return router;
}
|
[
"public",
"static",
"Swagger",
"from",
"(",
"final",
"Swagger",
"router",
",",
"final",
"Object",
"...",
"objs",
")",
"{",
"for",
"(",
"Object",
"o",
":",
"objs",
")",
"{",
"Processor",
".",
"process",
"(",
"router",
",",
"o",
")",
";",
"}",
"return",
"router",
";",
"}"
] |
Builds a Swagger from an annotated Java Object
|
[
"Builds",
"a",
"Swagger",
"from",
"an",
"annotated",
"Java",
"Object"
] |
fe8a64036f09fb745f0644faddd46162d64faf3c
|
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/middleware/swagger/src/main/java/com/jetdrone/vertx/yoke/middleware/Swagger.java#L317-L323
|
8,319 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/handler/AnnotationEventHandler.java
|
AnnotationEventHandler.checkCallbackMethods
|
private void checkCallbackMethods() throws CoreException {
for (final EnumEventType eet : getAnnotationValue()) {
final String methodName = buildHandlingMethodName(eet);
final Class<?> eventClass = getAnnotationApiEventClass();
try {
this.callbackObject.getClass().getDeclaredMethod(methodName, eventClass);
} catch (NoSuchMethodException | SecurityException e) {
throw new CoreException(NO_EVENT_CALLBACK.getText(this.callbackObject.getClass().getName(), methodName, eventClass.getName()), e);
}
}
}
|
java
|
private void checkCallbackMethods() throws CoreException {
for (final EnumEventType eet : getAnnotationValue()) {
final String methodName = buildHandlingMethodName(eet);
final Class<?> eventClass = getAnnotationApiEventClass();
try {
this.callbackObject.getClass().getDeclaredMethod(methodName, eventClass);
} catch (NoSuchMethodException | SecurityException e) {
throw new CoreException(NO_EVENT_CALLBACK.getText(this.callbackObject.getClass().getName(), methodName, eventClass.getName()), e);
}
}
}
|
[
"private",
"void",
"checkCallbackMethods",
"(",
")",
"throws",
"CoreException",
"{",
"for",
"(",
"final",
"EnumEventType",
"eet",
":",
"getAnnotationValue",
"(",
")",
")",
"{",
"final",
"String",
"methodName",
"=",
"buildHandlingMethodName",
"(",
"eet",
")",
";",
"final",
"Class",
"<",
"?",
">",
"eventClass",
"=",
"getAnnotationApiEventClass",
"(",
")",
";",
"try",
"{",
"this",
".",
"callbackObject",
".",
"getClass",
"(",
")",
".",
"getDeclaredMethod",
"(",
"methodName",
",",
"eventClass",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"|",
"SecurityException",
"e",
")",
"{",
"throw",
"new",
"CoreException",
"(",
"NO_EVENT_CALLBACK",
".",
"getText",
"(",
"this",
".",
"callbackObject",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"methodName",
",",
"eventClass",
".",
"getName",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] |
For each annotation event type, check if the callback method exists.
@throws CoreException an exception if the current class doesn't have the right handling method
|
[
"For",
"each",
"annotation",
"event",
"type",
"check",
"if",
"the",
"callback",
"method",
"exists",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/handler/AnnotationEventHandler.java#L81-L96
|
8,320 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/handler/AnnotationEventHandler.java
|
AnnotationEventHandler.buildHandlingMethodName
|
private String buildHandlingMethodName(final EnumEventType annotationType) {
final StringBuilder methodName = new StringBuilder();
if (Arrays.asList(getAnnotationValue()).contains(annotationType)) {
// Lower case the first letter of the annotation name
methodName.append(this.annotation.annotationType().getSimpleName().substring(0, 1).toLowerCase());
// Don't change the case for all other letters
methodName.append(this.annotation.annotationType().getSimpleName().substring(1));
// Append if necessary the sub type if not equals to any
methodName.append(Key.Any.name().equals(annotationType.toString()) || Action.Action.name().equals(annotationType.toString()) ? "" : annotationType.name());
// Add suffix if handling method is named
final String uniqueName = getAnnotationName();
if (uniqueName.length() > 0) {
methodName.append(uniqueName);
}
}
return methodName.toString();
}
|
java
|
private String buildHandlingMethodName(final EnumEventType annotationType) {
final StringBuilder methodName = new StringBuilder();
if (Arrays.asList(getAnnotationValue()).contains(annotationType)) {
// Lower case the first letter of the annotation name
methodName.append(this.annotation.annotationType().getSimpleName().substring(0, 1).toLowerCase());
// Don't change the case for all other letters
methodName.append(this.annotation.annotationType().getSimpleName().substring(1));
// Append if necessary the sub type if not equals to any
methodName.append(Key.Any.name().equals(annotationType.toString()) || Action.Action.name().equals(annotationType.toString()) ? "" : annotationType.name());
// Add suffix if handling method is named
final String uniqueName = getAnnotationName();
if (uniqueName.length() > 0) {
methodName.append(uniqueName);
}
}
return methodName.toString();
}
|
[
"private",
"String",
"buildHandlingMethodName",
"(",
"final",
"EnumEventType",
"annotationType",
")",
"{",
"final",
"StringBuilder",
"methodName",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"Arrays",
".",
"asList",
"(",
"getAnnotationValue",
"(",
")",
")",
".",
"contains",
"(",
"annotationType",
")",
")",
"{",
"// Lower case the first letter of the annotation name",
"methodName",
".",
"append",
"(",
"this",
".",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getSimpleName",
"(",
")",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"// Don't change the case for all other letters",
"methodName",
".",
"append",
"(",
"this",
".",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getSimpleName",
"(",
")",
".",
"substring",
"(",
"1",
")",
")",
";",
"// Append if necessary the sub type if not equals to any",
"methodName",
".",
"append",
"(",
"Key",
".",
"Any",
".",
"name",
"(",
")",
".",
"equals",
"(",
"annotationType",
".",
"toString",
"(",
")",
")",
"||",
"Action",
".",
"Action",
".",
"name",
"(",
")",
".",
"equals",
"(",
"annotationType",
".",
"toString",
"(",
")",
")",
"?",
"\"\"",
":",
"annotationType",
".",
"name",
"(",
")",
")",
";",
"// Add suffix if handling method is named",
"final",
"String",
"uniqueName",
"=",
"getAnnotationName",
"(",
")",
";",
"if",
"(",
"uniqueName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"methodName",
".",
"append",
"(",
"uniqueName",
")",
";",
"}",
"}",
"return",
"methodName",
".",
"toString",
"(",
")",
";",
"}"
] |
Build the handling method name used to manage this event.
@param annotationType the custom annotation event type used to define the kind of event to manage
@return the method name to trigger into the callback object
|
[
"Build",
"the",
"handling",
"method",
"name",
"used",
"to",
"manage",
"this",
"event",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/handler/AnnotationEventHandler.java#L118-L137
|
8,321 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/handler/AnnotationEventHandler.java
|
AnnotationEventHandler.convertEventToEnum
|
private EnumEventType convertEventToEnum(final EventType<? extends Event> eventType) {
EnumEventType convertedType = null;
if (getAnnotationValue() != null && getAnnotationValue().length > 0) {
// Retrieve all annotation event types
final EnumEventType[] aTypes = getAnnotationValue()[0].getClass().getEnumConstants();
// Parse all annotation event types
for (int i = 0; i < aTypes.length && convertedType == null; i++) {
// Find the corresponding annotation event type if its javaFX event type matches
if (aTypes[i].eventType() == eventType) {
convertedType = aTypes[i];
}
}
}
return convertedType;
}
|
java
|
private EnumEventType convertEventToEnum(final EventType<? extends Event> eventType) {
EnumEventType convertedType = null;
if (getAnnotationValue() != null && getAnnotationValue().length > 0) {
// Retrieve all annotation event types
final EnumEventType[] aTypes = getAnnotationValue()[0].getClass().getEnumConstants();
// Parse all annotation event types
for (int i = 0; i < aTypes.length && convertedType == null; i++) {
// Find the corresponding annotation event type if its javaFX event type matches
if (aTypes[i].eventType() == eventType) {
convertedType = aTypes[i];
}
}
}
return convertedType;
}
|
[
"private",
"EnumEventType",
"convertEventToEnum",
"(",
"final",
"EventType",
"<",
"?",
"extends",
"Event",
">",
"eventType",
")",
"{",
"EnumEventType",
"convertedType",
"=",
"null",
";",
"if",
"(",
"getAnnotationValue",
"(",
")",
"!=",
"null",
"&&",
"getAnnotationValue",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"// Retrieve all annotation event types",
"final",
"EnumEventType",
"[",
"]",
"aTypes",
"=",
"getAnnotationValue",
"(",
")",
"[",
"0",
"]",
".",
"getClass",
"(",
")",
".",
"getEnumConstants",
"(",
")",
";",
"// Parse all annotation event types",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"aTypes",
".",
"length",
"&&",
"convertedType",
"==",
"null",
";",
"i",
"++",
")",
"{",
"// Find the corresponding annotation event type if its javaFX event type matches",
"if",
"(",
"aTypes",
"[",
"i",
"]",
".",
"eventType",
"(",
")",
"==",
"eventType",
")",
"{",
"convertedType",
"=",
"aTypes",
"[",
"i",
"]",
";",
"}",
"}",
"}",
"return",
"convertedType",
";",
"}"
] |
Convert a JavaFX event type into an annotation event type.
@param eventType the JavaFX event type
@return the Annotation event type or null if not found
|
[
"Convert",
"a",
"JavaFX",
"event",
"type",
"into",
"an",
"annotation",
"event",
"type",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/handler/AnnotationEventHandler.java#L174-L190
|
8,322 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/handler/AnnotationEventHandler.java
|
AnnotationEventHandler.callMethod
|
private void callMethod(final String methodName, final Event event) {
final Class<?> ctrlClass = this.callbackObject.getClass();
try {
final Method method = ctrlClass.getDeclaredMethod(methodName, event.getClass());
ClassUtility.callMethod(method, this.callbackObject, event);
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException | CoreException e) {
LOGGER.log(EVENT_HANDLING_IMPOSSIBLE, e);
}
}
|
java
|
private void callMethod(final String methodName, final Event event) {
final Class<?> ctrlClass = this.callbackObject.getClass();
try {
final Method method = ctrlClass.getDeclaredMethod(methodName, event.getClass());
ClassUtility.callMethod(method, this.callbackObject, event);
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException | CoreException e) {
LOGGER.log(EVENT_HANDLING_IMPOSSIBLE, e);
}
}
|
[
"private",
"void",
"callMethod",
"(",
"final",
"String",
"methodName",
",",
"final",
"Event",
"event",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"ctrlClass",
"=",
"this",
".",
"callbackObject",
".",
"getClass",
"(",
")",
";",
"try",
"{",
"final",
"Method",
"method",
"=",
"ctrlClass",
".",
"getDeclaredMethod",
"(",
"methodName",
",",
"event",
".",
"getClass",
"(",
")",
")",
";",
"ClassUtility",
".",
"callMethod",
"(",
"method",
",",
"this",
".",
"callbackObject",
",",
"event",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"|",
"SecurityException",
"|",
"IllegalArgumentException",
"|",
"CoreException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"EVENT_HANDLING_IMPOSSIBLE",
",",
"e",
")",
";",
"}",
"}"
] |
Call the method into the callback object.
@param methodName the method name to call
@param event the event to trigger
|
[
"Call",
"the",
"method",
"into",
"the",
"callback",
"object",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/handler/AnnotationEventHandler.java#L198-L210
|
8,323 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java
|
AbstractService.runTask
|
private <T> ServiceTask<T> runTask(final Wave sourceWave, final Method method, final Object[] parameterValues) {
// Allow to remove the pending task when the service is finished
sourceWave.addWaveListener(new ServiceTaskWaveListener());
// Create a new ServiceTask to handle this request and follow progression
final ServiceTaskBase<T> task = new ServiceTaskBase<>(this, method, parameterValues, sourceWave);
// Store the task into the pending map
this.pendingTasks.put(sourceWave.wUID(), task);
// Attach ServiceTask to the source wave
sourceWave.addDatas(WBuilder.waveData(JRebirthWaves.SERVICE_TASK, task));
// Bind Progress Property
if (sourceWave.containsNotNull(JRebirthWaves.PROGRESS_PROPERTY)) { // Check double call
bindProgressProperty(task, sourceWave.getData(JRebirthWaves.PROGRESS_PROPERTY).value());
}
// Bind ProgressBar
if (sourceWave.containsNotNull(JRebirthWaves.PROGRESS_BAR)) { // Check double call
bindProgressBar(task, sourceWave.getData(JRebirthWaves.PROGRESS_BAR).value());
}
// Bind Title
if (sourceWave.containsNotNull(JRebirthWaves.TASK_TITLE)) {
bindTitle(task, sourceWave.getData(JRebirthWaves.TASK_TITLE).value());
}
// Bind ProgressBar
if (sourceWave.containsNotNull(JRebirthWaves.TASK_MESSAGE)) {
bindMessage(task, sourceWave.getData(JRebirthWaves.TASK_MESSAGE).value());
}
// Call the task into the JRebirth Thread Pool
JRebirth.runIntoJTP(task);
return task;
}
|
java
|
private <T> ServiceTask<T> runTask(final Wave sourceWave, final Method method, final Object[] parameterValues) {
// Allow to remove the pending task when the service is finished
sourceWave.addWaveListener(new ServiceTaskWaveListener());
// Create a new ServiceTask to handle this request and follow progression
final ServiceTaskBase<T> task = new ServiceTaskBase<>(this, method, parameterValues, sourceWave);
// Store the task into the pending map
this.pendingTasks.put(sourceWave.wUID(), task);
// Attach ServiceTask to the source wave
sourceWave.addDatas(WBuilder.waveData(JRebirthWaves.SERVICE_TASK, task));
// Bind Progress Property
if (sourceWave.containsNotNull(JRebirthWaves.PROGRESS_PROPERTY)) { // Check double call
bindProgressProperty(task, sourceWave.getData(JRebirthWaves.PROGRESS_PROPERTY).value());
}
// Bind ProgressBar
if (sourceWave.containsNotNull(JRebirthWaves.PROGRESS_BAR)) { // Check double call
bindProgressBar(task, sourceWave.getData(JRebirthWaves.PROGRESS_BAR).value());
}
// Bind Title
if (sourceWave.containsNotNull(JRebirthWaves.TASK_TITLE)) {
bindTitle(task, sourceWave.getData(JRebirthWaves.TASK_TITLE).value());
}
// Bind ProgressBar
if (sourceWave.containsNotNull(JRebirthWaves.TASK_MESSAGE)) {
bindMessage(task, sourceWave.getData(JRebirthWaves.TASK_MESSAGE).value());
}
// Call the task into the JRebirth Thread Pool
JRebirth.runIntoJTP(task);
return task;
}
|
[
"private",
"<",
"T",
">",
"ServiceTask",
"<",
"T",
">",
"runTask",
"(",
"final",
"Wave",
"sourceWave",
",",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"parameterValues",
")",
"{",
"// Allow to remove the pending task when the service is finished",
"sourceWave",
".",
"addWaveListener",
"(",
"new",
"ServiceTaskWaveListener",
"(",
")",
")",
";",
"// Create a new ServiceTask to handle this request and follow progression",
"final",
"ServiceTaskBase",
"<",
"T",
">",
"task",
"=",
"new",
"ServiceTaskBase",
"<>",
"(",
"this",
",",
"method",
",",
"parameterValues",
",",
"sourceWave",
")",
";",
"// Store the task into the pending map",
"this",
".",
"pendingTasks",
".",
"put",
"(",
"sourceWave",
".",
"wUID",
"(",
")",
",",
"task",
")",
";",
"// Attach ServiceTask to the source wave",
"sourceWave",
".",
"addDatas",
"(",
"WBuilder",
".",
"waveData",
"(",
"JRebirthWaves",
".",
"SERVICE_TASK",
",",
"task",
")",
")",
";",
"// Bind Progress Property",
"if",
"(",
"sourceWave",
".",
"containsNotNull",
"(",
"JRebirthWaves",
".",
"PROGRESS_PROPERTY",
")",
")",
"{",
"// Check double call",
"bindProgressProperty",
"(",
"task",
",",
"sourceWave",
".",
"getData",
"(",
"JRebirthWaves",
".",
"PROGRESS_PROPERTY",
")",
".",
"value",
"(",
")",
")",
";",
"}",
"// Bind ProgressBar",
"if",
"(",
"sourceWave",
".",
"containsNotNull",
"(",
"JRebirthWaves",
".",
"PROGRESS_BAR",
")",
")",
"{",
"// Check double call",
"bindProgressBar",
"(",
"task",
",",
"sourceWave",
".",
"getData",
"(",
"JRebirthWaves",
".",
"PROGRESS_BAR",
")",
".",
"value",
"(",
")",
")",
";",
"}",
"// Bind Title",
"if",
"(",
"sourceWave",
".",
"containsNotNull",
"(",
"JRebirthWaves",
".",
"TASK_TITLE",
")",
")",
"{",
"bindTitle",
"(",
"task",
",",
"sourceWave",
".",
"getData",
"(",
"JRebirthWaves",
".",
"TASK_TITLE",
")",
".",
"value",
"(",
")",
")",
";",
"}",
"// Bind ProgressBar",
"if",
"(",
"sourceWave",
".",
"containsNotNull",
"(",
"JRebirthWaves",
".",
"TASK_MESSAGE",
")",
")",
"{",
"bindMessage",
"(",
"task",
",",
"sourceWave",
".",
"getData",
"(",
"JRebirthWaves",
".",
"TASK_MESSAGE",
")",
".",
"value",
"(",
")",
")",
";",
"}",
"// Call the task into the JRebirth Thread Pool",
"JRebirth",
".",
"runIntoJTP",
"(",
"task",
")",
";",
"return",
"task",
";",
"}"
] |
Run the wave type method.
@param sourceWave the source wave
@param parameterValues values to pass to the method
@param method method to call
@param <T> the type of the returned type
@return the service task created
|
[
"Run",
"the",
"wave",
"type",
"method",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L140-L178
|
8,324 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java
|
AbstractService.bindProgressProperty
|
private void bindProgressProperty(final ServiceTaskBase<?> task, final DoubleProperty progressProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Progress Property to " + task.getServiceHandlerName(),
() -> {
// Avoid the progress bar to display 100% at start up
task.updateProgress(0, 0);
// Bind the progress bar
progressProperty.bind(task.workDoneProperty().divide(task.totalWorkProperty()));
});
}
|
java
|
private void bindProgressProperty(final ServiceTaskBase<?> task, final DoubleProperty progressProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Progress Property to " + task.getServiceHandlerName(),
() -> {
// Avoid the progress bar to display 100% at start up
task.updateProgress(0, 0);
// Bind the progress bar
progressProperty.bind(task.workDoneProperty().divide(task.totalWorkProperty()));
});
}
|
[
"private",
"void",
"bindProgressProperty",
"(",
"final",
"ServiceTaskBase",
"<",
"?",
">",
"task",
",",
"final",
"DoubleProperty",
"progressProperty",
")",
"{",
"// Perform this binding into the JAT to respect widget and task API",
"JRebirth",
".",
"runIntoJAT",
"(",
"\"Bind Progress Property to \"",
"+",
"task",
".",
"getServiceHandlerName",
"(",
")",
",",
"(",
")",
"->",
"{",
"// Avoid the progress bar to display 100% at start up",
"task",
".",
"updateProgress",
"(",
"0",
",",
"0",
")",
";",
"// Bind the progress bar",
"progressProperty",
".",
"bind",
"(",
"task",
".",
"workDoneProperty",
"(",
")",
".",
"divide",
"(",
"task",
".",
"totalWorkProperty",
"(",
")",
")",
")",
";",
"}",
")",
";",
"}"
] |
Bind a task to a progress property to follow its progression.
@param task the service task that we need to follow the progression
@param progressBar graphical progress bar
|
[
"Bind",
"a",
"task",
"to",
"a",
"progress",
"property",
"to",
"follow",
"its",
"progression",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L186-L197
|
8,325 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java
|
AbstractService.bindProgressBar
|
private void bindProgressBar(final ServiceTaskBase<?> task, final ProgressBar progressBar) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind ProgressBar to " + task.getServiceHandlerName(),
() -> {
// Avoid the progress bar to display 100% at start up
task.updateProgress(0, 0);
// Bind the progress bar
progressBar.progressProperty().bind(task.workDoneProperty().divide(task.totalWorkProperty()));
});
}
|
java
|
private void bindProgressBar(final ServiceTaskBase<?> task, final ProgressBar progressBar) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind ProgressBar to " + task.getServiceHandlerName(),
() -> {
// Avoid the progress bar to display 100% at start up
task.updateProgress(0, 0);
// Bind the progress bar
progressBar.progressProperty().bind(task.workDoneProperty().divide(task.totalWorkProperty()));
});
}
|
[
"private",
"void",
"bindProgressBar",
"(",
"final",
"ServiceTaskBase",
"<",
"?",
">",
"task",
",",
"final",
"ProgressBar",
"progressBar",
")",
"{",
"// Perform this binding into the JAT to respect widget and task API",
"JRebirth",
".",
"runIntoJAT",
"(",
"\"Bind ProgressBar to \"",
"+",
"task",
".",
"getServiceHandlerName",
"(",
")",
",",
"(",
")",
"->",
"{",
"// Avoid the progress bar to display 100% at start up",
"task",
".",
"updateProgress",
"(",
"0",
",",
"0",
")",
";",
"// Bind the progress bar",
"progressBar",
".",
"progressProperty",
"(",
")",
".",
"bind",
"(",
"task",
".",
"workDoneProperty",
"(",
")",
".",
"divide",
"(",
"task",
".",
"totalWorkProperty",
"(",
")",
")",
")",
";",
"}",
")",
";",
"}"
] |
Bind a task to a progress bar widget to follow its progression.
@param task the service task that we need to follow the progression
@param progressBar graphical progress bar
|
[
"Bind",
"a",
"task",
"to",
"a",
"progress",
"bar",
"widget",
"to",
"follow",
"its",
"progression",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L205-L216
|
8,326 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java
|
AbstractService.bindTitle
|
private void bindTitle(final ServiceTask<?> task, final StringProperty titleProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Title for " + task.getServiceHandlerName(),
// Bind the task title
() -> titleProperty.bind(task.titleProperty()));
}
|
java
|
private void bindTitle(final ServiceTask<?> task, final StringProperty titleProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Title for " + task.getServiceHandlerName(),
// Bind the task title
() -> titleProperty.bind(task.titleProperty()));
}
|
[
"private",
"void",
"bindTitle",
"(",
"final",
"ServiceTask",
"<",
"?",
">",
"task",
",",
"final",
"StringProperty",
"titleProperty",
")",
"{",
"// Perform this binding into the JAT to respect widget and task API",
"JRebirth",
".",
"runIntoJAT",
"(",
"\"Bind Title for \"",
"+",
"task",
".",
"getServiceHandlerName",
"(",
")",
",",
"// Bind the task title",
"(",
")",
"->",
"titleProperty",
".",
"bind",
"(",
"task",
".",
"titleProperty",
"(",
")",
")",
")",
";",
"}"
] |
Bind a task to a string property that will display the task title.
@param task the service task that we need to follow the progression
@param titleProperty the title presenter
|
[
"Bind",
"a",
"task",
"to",
"a",
"string",
"property",
"that",
"will",
"display",
"the",
"task",
"title",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L224-L230
|
8,327 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java
|
AbstractService.bindMessage
|
private void bindMessage(final ServiceTask<?> task, final StringProperty messageProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Message for " + task.getServiceHandlerName(),
// Bind the task title
() -> messageProperty.bind(task.messageProperty()));
}
|
java
|
private void bindMessage(final ServiceTask<?> task, final StringProperty messageProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Message for " + task.getServiceHandlerName(),
// Bind the task title
() -> messageProperty.bind(task.messageProperty()));
}
|
[
"private",
"void",
"bindMessage",
"(",
"final",
"ServiceTask",
"<",
"?",
">",
"task",
",",
"final",
"StringProperty",
"messageProperty",
")",
"{",
"// Perform this binding into the JAT to respect widget and task API",
"JRebirth",
".",
"runIntoJAT",
"(",
"\"Bind Message for \"",
"+",
"task",
".",
"getServiceHandlerName",
"(",
")",
",",
"// Bind the task title",
"(",
")",
"->",
"messageProperty",
".",
"bind",
"(",
"task",
".",
"messageProperty",
"(",
")",
")",
")",
";",
"}"
] |
Bind a task to a string property that will display the task message.
@param task the service task that we need to follow the progression
@param messageProperty the message presenter
|
[
"Bind",
"a",
"task",
"to",
"a",
"string",
"property",
"that",
"will",
"display",
"the",
"task",
"message",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L238-L244
|
8,328 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java
|
AbstractService.updateProgress
|
public void updateProgress(final Wave wave, final double workDone, final double totalWork, final double progressIncrement) {
if (wave.get(JRebirthWaves.SERVICE_TASK).checkProgressRatio(workDone, totalWork, progressIncrement)) {
// Increase the task progression
JRebirth.runIntoJAT("ServiceTask Workdone (dbl) " + workDone + RATIO_SEPARATOR + totalWork,
() -> wave.get(JRebirthWaves.SERVICE_TASK).updateProgress(workDone, totalWork));
}
}
|
java
|
public void updateProgress(final Wave wave, final double workDone, final double totalWork, final double progressIncrement) {
if (wave.get(JRebirthWaves.SERVICE_TASK).checkProgressRatio(workDone, totalWork, progressIncrement)) {
// Increase the task progression
JRebirth.runIntoJAT("ServiceTask Workdone (dbl) " + workDone + RATIO_SEPARATOR + totalWork,
() -> wave.get(JRebirthWaves.SERVICE_TASK).updateProgress(workDone, totalWork));
}
}
|
[
"public",
"void",
"updateProgress",
"(",
"final",
"Wave",
"wave",
",",
"final",
"double",
"workDone",
",",
"final",
"double",
"totalWork",
",",
"final",
"double",
"progressIncrement",
")",
"{",
"if",
"(",
"wave",
".",
"get",
"(",
"JRebirthWaves",
".",
"SERVICE_TASK",
")",
".",
"checkProgressRatio",
"(",
"workDone",
",",
"totalWork",
",",
"progressIncrement",
")",
")",
"{",
"// Increase the task progression",
"JRebirth",
".",
"runIntoJAT",
"(",
"\"ServiceTask Workdone (dbl) \"",
"+",
"workDone",
"+",
"RATIO_SEPARATOR",
"+",
"totalWork",
",",
"(",
")",
"->",
"wave",
".",
"get",
"(",
"JRebirthWaves",
".",
"SERVICE_TASK",
")",
".",
"updateProgress",
"(",
"workDone",
",",
"totalWork",
")",
")",
";",
"}",
"}"
] |
Update the progress of the service task related to the given wave.
@param wave the wave that trigger the service task call
@param workDone the amount of overall work done
@param totalWork the amount of total work to do
@param progressIncrement the value increment used to filter useless progress event
|
[
"Update",
"the",
"progress",
"of",
"the",
"service",
"task",
"related",
"to",
"the",
"given",
"wave",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L330-L338
|
8,329 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java
|
AbstractController.getSource
|
protected <T> Optional<T> getSource(Event event, Class<T> type) {
return getValue(event, event::getSource, type);
}
|
java
|
protected <T> Optional<T> getSource(Event event, Class<T> type) {
return getValue(event, event::getSource, type);
}
|
[
"protected",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"getSource",
"(",
"Event",
"event",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getValue",
"(",
"event",
",",
"event",
"::",
"getSource",
",",
"type",
")",
";",
"}"
] |
Gets the source.
@param event the event
@param type the cls
@param <T> the generic type
@return the source
|
[
"Gets",
"the",
"source",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java#L333-L335
|
8,330 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java
|
AbstractController.getTarget
|
protected <T> Optional<T> getTarget(Event event, Class<T> type) {
return getValue(event, event::getTarget, type);
}
|
java
|
protected <T> Optional<T> getTarget(Event event, Class<T> type) {
return getValue(event, event::getTarget, type);
}
|
[
"protected",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"getTarget",
"(",
"Event",
"event",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getValue",
"(",
"event",
",",
"event",
"::",
"getTarget",
",",
"type",
")",
";",
"}"
] |
Gets the target.
@param event the event
@param type the cls
@param <T> the generic type
@return the target
|
[
"Gets",
"the",
"target",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java#L347-L349
|
8,331 |
pmlopes/yoke
|
framework/src/main/java/com/jetdrone/vertx/yoke/engine/StringPlaceholderEngine.java
|
StringPlaceholderEngine.render
|
@Override
public void render(final String file, final Map<String, Object> context, final Handler<AsyncResult<Buffer>> handler) {
// verify if the file is still fresh in the cache
read(prefix + file, new AsyncResultHandler<String>() {
@Override
public void handle(AsyncResult<String> asyncResult) {
if (asyncResult.failed()) {
handler.handle(new YokeAsyncResult<Buffer>(asyncResult.cause()));
} else {
try {
handler.handle(new YokeAsyncResult<>(parseStringValue(asyncResult.result(), context, new HashSet<String>())));
} catch (IllegalArgumentException iae) {
handler.handle(new YokeAsyncResult<Buffer>(iae));
}
}
}
});
}
|
java
|
@Override
public void render(final String file, final Map<String, Object> context, final Handler<AsyncResult<Buffer>> handler) {
// verify if the file is still fresh in the cache
read(prefix + file, new AsyncResultHandler<String>() {
@Override
public void handle(AsyncResult<String> asyncResult) {
if (asyncResult.failed()) {
handler.handle(new YokeAsyncResult<Buffer>(asyncResult.cause()));
} else {
try {
handler.handle(new YokeAsyncResult<>(parseStringValue(asyncResult.result(), context, new HashSet<String>())));
} catch (IllegalArgumentException iae) {
handler.handle(new YokeAsyncResult<Buffer>(iae));
}
}
}
});
}
|
[
"@",
"Override",
"public",
"void",
"render",
"(",
"final",
"String",
"file",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"context",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Buffer",
">",
">",
"handler",
")",
"{",
"// verify if the file is still fresh in the cache",
"read",
"(",
"prefix",
"+",
"file",
",",
"new",
"AsyncResultHandler",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"AsyncResult",
"<",
"String",
">",
"asyncResult",
")",
"{",
"if",
"(",
"asyncResult",
".",
"failed",
"(",
")",
")",
"{",
"handler",
".",
"handle",
"(",
"new",
"YokeAsyncResult",
"<",
"Buffer",
">",
"(",
"asyncResult",
".",
"cause",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"try",
"{",
"handler",
".",
"handle",
"(",
"new",
"YokeAsyncResult",
"<>",
"(",
"parseStringValue",
"(",
"asyncResult",
".",
"result",
"(",
")",
",",
"context",
",",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
")",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"iae",
")",
"{",
"handler",
".",
"handle",
"(",
"new",
"YokeAsyncResult",
"<",
"Buffer",
">",
"(",
"iae",
")",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"}"
] |
An interpreter for strings with named placeholders.
For example given the string "hello ${myName}" and the map <code>
Map<String, Object> map = new HashMap<>();
map.put("myName", "world");
</code>
the call returns "hello world"
It replaces every occurrence of a named placeholder with its given value
in the map. If there is a named place holder which is not found in the
map then the string will retain that placeholder. Likewise, if there is
an entry in the map that does not have its respective placeholder, it is
ignored.
|
[
"An",
"interpreter",
"for",
"strings",
"with",
"named",
"placeholders",
"."
] |
fe8a64036f09fb745f0644faddd46162d64faf3c
|
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/engine/StringPlaceholderEngine.java#L72-L89
|
8,332 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java
|
AbstractView.buildErrorNode
|
private void buildErrorNode(final CoreException ce) {
final TextArea ta = TextAreaBuilder.create()
.text(ce.getMessage())
.build();
this.errorNode = PaneBuilder.create().children(ta).build();
}
|
java
|
private void buildErrorNode(final CoreException ce) {
final TextArea ta = TextAreaBuilder.create()
.text(ce.getMessage())
.build();
this.errorNode = PaneBuilder.create().children(ta).build();
}
|
[
"private",
"void",
"buildErrorNode",
"(",
"final",
"CoreException",
"ce",
")",
"{",
"final",
"TextArea",
"ta",
"=",
"TextAreaBuilder",
".",
"create",
"(",
")",
".",
"text",
"(",
"ce",
".",
"getMessage",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"this",
".",
"errorNode",
"=",
"PaneBuilder",
".",
"create",
"(",
")",
".",
"children",
"(",
"ta",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Build the errorNode to display the error taht occured.
@param ce the CoreException to display
|
[
"Build",
"the",
"errorNode",
"to",
"display",
"the",
"error",
"taht",
"occured",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java#L143-L148
|
8,333 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java
|
AbstractView.processViewAnnotation
|
private void processViewAnnotation() {
// Find the AutoHandler annotation if any because it's optional
final AutoHandler ah = ClassUtility.getLastClassAnnotation(this.getClass(), AutoHandler.class);
// Use the annotation value to define the callbackObject : View or Controller
// When controller is null always use the view as callbackObject
if (ah != null && ah.value() == CallbackObject.View || controller() == null) {
this.callbackObject = this;
} else {
// by default use the controller object as callback object
this.callbackObject = this.controller();
}
// Find the RootNodeId annotation
final RootNodeId rni = ClassUtility.getLastClassAnnotation(this.getClass(), RootNodeId.class);
if (rni != null) {
node().setId(rni.value().isEmpty() ? this.getClass().getSimpleName() : rni.value());
}
// Find the RootNodeClass annotation
final RootNodeClass rnc = ClassUtility.getLastClassAnnotation(this.getClass(), RootNodeClass.class);
if (rnc != null && rnc.value().length > 0) {
for (final String styleClass : rnc.value()) {
if (styleClass != null && !styleClass.isEmpty()) {
node().getStyleClass().add(styleClass);
}
}
}
// Process Event Handler Annotation
// For each View class annotation we will attach an event handler to the root node
for (final Annotation a : this.getClass().getAnnotations()) {
// Manage only JRebirth OnXxxxx annotations
if (a.annotationType().getName().startsWith(BASE_ANNOTATION_NAME)) {
try {
// Process the annotation if the node is not null
if (node() != null && controller() instanceof AbstractController) {
addHandler(node(), a);
}
} catch (IllegalArgumentException | CoreException e) {
LOGGER.log(UIMessages.VIEW_ANNO_PROCESSING_FAILURE, e, this.getClass().getName());
}
}
}
}
|
java
|
private void processViewAnnotation() {
// Find the AutoHandler annotation if any because it's optional
final AutoHandler ah = ClassUtility.getLastClassAnnotation(this.getClass(), AutoHandler.class);
// Use the annotation value to define the callbackObject : View or Controller
// When controller is null always use the view as callbackObject
if (ah != null && ah.value() == CallbackObject.View || controller() == null) {
this.callbackObject = this;
} else {
// by default use the controller object as callback object
this.callbackObject = this.controller();
}
// Find the RootNodeId annotation
final RootNodeId rni = ClassUtility.getLastClassAnnotation(this.getClass(), RootNodeId.class);
if (rni != null) {
node().setId(rni.value().isEmpty() ? this.getClass().getSimpleName() : rni.value());
}
// Find the RootNodeClass annotation
final RootNodeClass rnc = ClassUtility.getLastClassAnnotation(this.getClass(), RootNodeClass.class);
if (rnc != null && rnc.value().length > 0) {
for (final String styleClass : rnc.value()) {
if (styleClass != null && !styleClass.isEmpty()) {
node().getStyleClass().add(styleClass);
}
}
}
// Process Event Handler Annotation
// For each View class annotation we will attach an event handler to the root node
for (final Annotation a : this.getClass().getAnnotations()) {
// Manage only JRebirth OnXxxxx annotations
if (a.annotationType().getName().startsWith(BASE_ANNOTATION_NAME)) {
try {
// Process the annotation if the node is not null
if (node() != null && controller() instanceof AbstractController) {
addHandler(node(), a);
}
} catch (IllegalArgumentException | CoreException e) {
LOGGER.log(UIMessages.VIEW_ANNO_PROCESSING_FAILURE, e, this.getClass().getName());
}
}
}
}
|
[
"private",
"void",
"processViewAnnotation",
"(",
")",
"{",
"// Find the AutoHandler annotation if any because it's optional",
"final",
"AutoHandler",
"ah",
"=",
"ClassUtility",
".",
"getLastClassAnnotation",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"AutoHandler",
".",
"class",
")",
";",
"// Use the annotation value to define the callbackObject : View or Controller",
"// When controller is null always use the view as callbackObject",
"if",
"(",
"ah",
"!=",
"null",
"&&",
"ah",
".",
"value",
"(",
")",
"==",
"CallbackObject",
".",
"View",
"||",
"controller",
"(",
")",
"==",
"null",
")",
"{",
"this",
".",
"callbackObject",
"=",
"this",
";",
"}",
"else",
"{",
"// by default use the controller object as callback object",
"this",
".",
"callbackObject",
"=",
"this",
".",
"controller",
"(",
")",
";",
"}",
"// Find the RootNodeId annotation",
"final",
"RootNodeId",
"rni",
"=",
"ClassUtility",
".",
"getLastClassAnnotation",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"RootNodeId",
".",
"class",
")",
";",
"if",
"(",
"rni",
"!=",
"null",
")",
"{",
"node",
"(",
")",
".",
"setId",
"(",
"rni",
".",
"value",
"(",
")",
".",
"isEmpty",
"(",
")",
"?",
"this",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
":",
"rni",
".",
"value",
"(",
")",
")",
";",
"}",
"// Find the RootNodeClass annotation",
"final",
"RootNodeClass",
"rnc",
"=",
"ClassUtility",
".",
"getLastClassAnnotation",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"RootNodeClass",
".",
"class",
")",
";",
"if",
"(",
"rnc",
"!=",
"null",
"&&",
"rnc",
".",
"value",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"final",
"String",
"styleClass",
":",
"rnc",
".",
"value",
"(",
")",
")",
"{",
"if",
"(",
"styleClass",
"!=",
"null",
"&&",
"!",
"styleClass",
".",
"isEmpty",
"(",
")",
")",
"{",
"node",
"(",
")",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"styleClass",
")",
";",
"}",
"}",
"}",
"// Process Event Handler Annotation",
"// For each View class annotation we will attach an event handler to the root node",
"for",
"(",
"final",
"Annotation",
"a",
":",
"this",
".",
"getClass",
"(",
")",
".",
"getAnnotations",
"(",
")",
")",
"{",
"// Manage only JRebirth OnXxxxx annotations",
"if",
"(",
"a",
".",
"annotationType",
"(",
")",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"BASE_ANNOTATION_NAME",
")",
")",
"{",
"try",
"{",
"// Process the annotation if the node is not null",
"if",
"(",
"node",
"(",
")",
"!=",
"null",
"&&",
"controller",
"(",
")",
"instanceof",
"AbstractController",
")",
"{",
"addHandler",
"(",
"node",
"(",
")",
",",
"a",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalArgumentException",
"|",
"CoreException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"UIMessages",
".",
"VIEW_ANNO_PROCESSING_FAILURE",
",",
"e",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Process view annotation.
This will define if callback action will the view itself or its dedicated controller
|
[
"Process",
"view",
"annotation",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java#L180-L226
|
8,334 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java
|
AbstractView.processFields
|
private void processFields() throws CoreException {
final Class<?> currentClass = this.getClass();
// Parse view properties
for (final Field f : currentClass.getDeclaredFields()) {
// Only Node and Animation properties are eligible
if (Node.class.isAssignableFrom(f.getType()) || Animation.class.isAssignableFrom(f.getType())) {
// If a property was private, it must set to accessible = false after processing action
boolean needToHide = false;
// For private properties, set them accessible temporary
if (!f.isAccessible()) {
f.setAccessible(true);
needToHide = true;
}
// Process all existing annotation for the current field
processAnnotations(f);
// Reset the property visibility
if (needToHide && f.isAccessible()) {
f.setAccessible(false);
}
}
}
}
|
java
|
private void processFields() throws CoreException {
final Class<?> currentClass = this.getClass();
// Parse view properties
for (final Field f : currentClass.getDeclaredFields()) {
// Only Node and Animation properties are eligible
if (Node.class.isAssignableFrom(f.getType()) || Animation.class.isAssignableFrom(f.getType())) {
// If a property was private, it must set to accessible = false after processing action
boolean needToHide = false;
// For private properties, set them accessible temporary
if (!f.isAccessible()) {
f.setAccessible(true);
needToHide = true;
}
// Process all existing annotation for the current field
processAnnotations(f);
// Reset the property visibility
if (needToHide && f.isAccessible()) {
f.setAccessible(false);
}
}
}
}
|
[
"private",
"void",
"processFields",
"(",
")",
"throws",
"CoreException",
"{",
"final",
"Class",
"<",
"?",
">",
"currentClass",
"=",
"this",
".",
"getClass",
"(",
")",
";",
"// Parse view properties",
"for",
"(",
"final",
"Field",
"f",
":",
"currentClass",
".",
"getDeclaredFields",
"(",
")",
")",
"{",
"// Only Node and Animation properties are eligible",
"if",
"(",
"Node",
".",
"class",
".",
"isAssignableFrom",
"(",
"f",
".",
"getType",
"(",
")",
")",
"||",
"Animation",
".",
"class",
".",
"isAssignableFrom",
"(",
"f",
".",
"getType",
"(",
")",
")",
")",
"{",
"// If a property was private, it must set to accessible = false after processing action",
"boolean",
"needToHide",
"=",
"false",
";",
"// For private properties, set them accessible temporary",
"if",
"(",
"!",
"f",
".",
"isAccessible",
"(",
")",
")",
"{",
"f",
".",
"setAccessible",
"(",
"true",
")",
";",
"needToHide",
"=",
"true",
";",
"}",
"// Process all existing annotation for the current field",
"processAnnotations",
"(",
"f",
")",
";",
"// Reset the property visibility",
"if",
"(",
"needToHide",
"&&",
"f",
".",
"isAccessible",
"(",
")",
")",
"{",
"f",
".",
"setAccessible",
"(",
"false",
")",
";",
"}",
"}",
"}",
"}"
] |
Process all fields' annotations to auto-link them with event handler.
@throws CoreException if annotation processing fails
|
[
"Process",
"all",
"fields",
"annotations",
"to",
"auto",
"-",
"link",
"them",
"with",
"event",
"handler",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java#L233-L260
|
8,335 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java
|
AbstractView.processAnnotations
|
private void processAnnotations(final Field property) throws CoreException {
// For each field annotation we will attach an event handler
for (final Annotation a : property.getAnnotations()) {
if (EventTarget.class.isAssignableFrom(property.getType())) {
// Manage only JRebirth OnXxxxx annotations
if (a.annotationType().getName().startsWith(BASE_ANNOTATION_NAME)) {
try {
// Retrieve the property value
final EventTarget target = (EventTarget) property.get(this);
// Process the annotation if the node is not null
if (target != null && controller() instanceof AbstractController) {
addHandler(target, a);
}
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.log(UIMessages.NODE_ANNO_PROCESSING_FAILURE, e, this.getClass().getName(), property.getName());
}
}
// Manage only JRebirth OnFinished annotations
} else if (Animation.class.isAssignableFrom(property.getType())
&& OnFinished.class.getName().equals(a.annotationType().getName())) {
try {
// Retrieve the property value
final Animation animation = (Animation) property.get(this);
// Process the annotation if the node is not null
if (animation != null && controller() instanceof AbstractController) {
addHandler(animation, a);
}
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.log(UIMessages.ANIM_ANNO_PROCESSING_FAILURE, e, this.getClass().getName(), property.getName());
}
}
}
}
|
java
|
private void processAnnotations(final Field property) throws CoreException {
// For each field annotation we will attach an event handler
for (final Annotation a : property.getAnnotations()) {
if (EventTarget.class.isAssignableFrom(property.getType())) {
// Manage only JRebirth OnXxxxx annotations
if (a.annotationType().getName().startsWith(BASE_ANNOTATION_NAME)) {
try {
// Retrieve the property value
final EventTarget target = (EventTarget) property.get(this);
// Process the annotation if the node is not null
if (target != null && controller() instanceof AbstractController) {
addHandler(target, a);
}
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.log(UIMessages.NODE_ANNO_PROCESSING_FAILURE, e, this.getClass().getName(), property.getName());
}
}
// Manage only JRebirth OnFinished annotations
} else if (Animation.class.isAssignableFrom(property.getType())
&& OnFinished.class.getName().equals(a.annotationType().getName())) {
try {
// Retrieve the property value
final Animation animation = (Animation) property.get(this);
// Process the annotation if the node is not null
if (animation != null && controller() instanceof AbstractController) {
addHandler(animation, a);
}
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.log(UIMessages.ANIM_ANNO_PROCESSING_FAILURE, e, this.getClass().getName(), property.getName());
}
}
}
}
|
[
"private",
"void",
"processAnnotations",
"(",
"final",
"Field",
"property",
")",
"throws",
"CoreException",
"{",
"// For each field annotation we will attach an event handler",
"for",
"(",
"final",
"Annotation",
"a",
":",
"property",
".",
"getAnnotations",
"(",
")",
")",
"{",
"if",
"(",
"EventTarget",
".",
"class",
".",
"isAssignableFrom",
"(",
"property",
".",
"getType",
"(",
")",
")",
")",
"{",
"// Manage only JRebirth OnXxxxx annotations",
"if",
"(",
"a",
".",
"annotationType",
"(",
")",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"BASE_ANNOTATION_NAME",
")",
")",
"{",
"try",
"{",
"// Retrieve the property value",
"final",
"EventTarget",
"target",
"=",
"(",
"EventTarget",
")",
"property",
".",
"get",
"(",
"this",
")",
";",
"// Process the annotation if the node is not null",
"if",
"(",
"target",
"!=",
"null",
"&&",
"controller",
"(",
")",
"instanceof",
"AbstractController",
")",
"{",
"addHandler",
"(",
"target",
",",
"a",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalArgumentException",
"|",
"IllegalAccessException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"UIMessages",
".",
"NODE_ANNO_PROCESSING_FAILURE",
",",
"e",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"property",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"// Manage only JRebirth OnFinished annotations",
"}",
"else",
"if",
"(",
"Animation",
".",
"class",
".",
"isAssignableFrom",
"(",
"property",
".",
"getType",
"(",
")",
")",
"&&",
"OnFinished",
".",
"class",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"a",
".",
"annotationType",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"try",
"{",
"// Retrieve the property value",
"final",
"Animation",
"animation",
"=",
"(",
"Animation",
")",
"property",
".",
"get",
"(",
"this",
")",
";",
"// Process the annotation if the node is not null",
"if",
"(",
"animation",
"!=",
"null",
"&&",
"controller",
"(",
")",
"instanceof",
"AbstractController",
")",
"{",
"addHandler",
"(",
"animation",
",",
"a",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalArgumentException",
"|",
"IllegalAccessException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"UIMessages",
".",
"ANIM_ANNO_PROCESSING_FAILURE",
",",
"e",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"property",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Process all OnXxxx Annotation to attach event handler on this field.
@param property the field to analyze
@throws CoreException if annotation processing fails
|
[
"Process",
"all",
"OnXxxx",
"Annotation",
"to",
"attach",
"event",
"handler",
"on",
"this",
"field",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java#L269-L312
|
8,336 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java
|
AbstractView.addHandler
|
private void addHandler(final EventTarget target, final Annotation annotation) throws CoreException {
// Build the auto event handler for this annotation
final AnnotationEventHandler<Event> aeh = new AnnotationEventHandler<>(this.callbackObject, annotation);
for (final EnumEventType eet : (EnumEventType[]) ClassUtility.getAnnotationAttribute(annotation, "value")) {
if (target instanceof Node) {
((Node) target).addEventHandler(eet.eventType(), aeh);
} else if (target instanceof MenuItem) {
if (eet.eventType() == ActionEvent.ACTION) {
((MenuItem) target).addEventHandler(ActionEvent.ACTION, new AnnotationEventHandler<>(this.callbackObject, annotation));
} else {
((MenuItem) target).setOnMenuValidation(aeh);
}
} else if (target instanceof Window) {
((Window) target).addEventHandler(eet.eventType(), aeh);
}
}
}
|
java
|
private void addHandler(final EventTarget target, final Annotation annotation) throws CoreException {
// Build the auto event handler for this annotation
final AnnotationEventHandler<Event> aeh = new AnnotationEventHandler<>(this.callbackObject, annotation);
for (final EnumEventType eet : (EnumEventType[]) ClassUtility.getAnnotationAttribute(annotation, "value")) {
if (target instanceof Node) {
((Node) target).addEventHandler(eet.eventType(), aeh);
} else if (target instanceof MenuItem) {
if (eet.eventType() == ActionEvent.ACTION) {
((MenuItem) target).addEventHandler(ActionEvent.ACTION, new AnnotationEventHandler<>(this.callbackObject, annotation));
} else {
((MenuItem) target).setOnMenuValidation(aeh);
}
} else if (target instanceof Window) {
((Window) target).addEventHandler(eet.eventType(), aeh);
}
}
}
|
[
"private",
"void",
"addHandler",
"(",
"final",
"EventTarget",
"target",
",",
"final",
"Annotation",
"annotation",
")",
"throws",
"CoreException",
"{",
"// Build the auto event handler for this annotation",
"final",
"AnnotationEventHandler",
"<",
"Event",
">",
"aeh",
"=",
"new",
"AnnotationEventHandler",
"<>",
"(",
"this",
".",
"callbackObject",
",",
"annotation",
")",
";",
"for",
"(",
"final",
"EnumEventType",
"eet",
":",
"(",
"EnumEventType",
"[",
"]",
")",
"ClassUtility",
".",
"getAnnotationAttribute",
"(",
"annotation",
",",
"\"value\"",
")",
")",
"{",
"if",
"(",
"target",
"instanceof",
"Node",
")",
"{",
"(",
"(",
"Node",
")",
"target",
")",
".",
"addEventHandler",
"(",
"eet",
".",
"eventType",
"(",
")",
",",
"aeh",
")",
";",
"}",
"else",
"if",
"(",
"target",
"instanceof",
"MenuItem",
")",
"{",
"if",
"(",
"eet",
".",
"eventType",
"(",
")",
"==",
"ActionEvent",
".",
"ACTION",
")",
"{",
"(",
"(",
"MenuItem",
")",
"target",
")",
".",
"addEventHandler",
"(",
"ActionEvent",
".",
"ACTION",
",",
"new",
"AnnotationEventHandler",
"<>",
"(",
"this",
".",
"callbackObject",
",",
"annotation",
")",
")",
";",
"}",
"else",
"{",
"(",
"(",
"MenuItem",
")",
"target",
")",
".",
"setOnMenuValidation",
"(",
"aeh",
")",
";",
"}",
"}",
"else",
"if",
"(",
"target",
"instanceof",
"Window",
")",
"{",
"(",
"(",
"Window",
")",
"target",
")",
".",
"addEventHandler",
"(",
"eet",
".",
"eventType",
"(",
")",
",",
"aeh",
")",
";",
"}",
"}",
"}"
] |
Add an event handler on the given node according to annotation OnXxxxx.
@param target the graphical node, must be not null (is a subtype of EventTarget)
@param annotation the OnXxxx annotation
@throws CoreException if an error occurred while linking the event handler
|
[
"Add",
"an",
"event",
"handler",
"on",
"the",
"given",
"node",
"according",
"to",
"annotation",
"OnXxxxx",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java#L322-L343
|
8,337 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java
|
AbstractView.addHandler
|
private void addHandler(final Animation animation, final Annotation annotation) throws CoreException {
// Build the auto event handler for this annotation
final AnnotationEventHandler<ActionEvent> aeh = new AnnotationEventHandler<>(this.callbackObject, annotation);
// Only on event type
animation.setOnFinished(aeh);
}
|
java
|
private void addHandler(final Animation animation, final Annotation annotation) throws CoreException {
// Build the auto event handler for this annotation
final AnnotationEventHandler<ActionEvent> aeh = new AnnotationEventHandler<>(this.callbackObject, annotation);
// Only on event type
animation.setOnFinished(aeh);
}
|
[
"private",
"void",
"addHandler",
"(",
"final",
"Animation",
"animation",
",",
"final",
"Annotation",
"annotation",
")",
"throws",
"CoreException",
"{",
"// Build the auto event handler for this annotation",
"final",
"AnnotationEventHandler",
"<",
"ActionEvent",
">",
"aeh",
"=",
"new",
"AnnotationEventHandler",
"<>",
"(",
"this",
".",
"callbackObject",
",",
"annotation",
")",
";",
"// Only on event type",
"animation",
".",
"setOnFinished",
"(",
"aeh",
")",
";",
"}"
] |
Add an event handler on the given animation according to annotation OnFinished.
@param animation the animation, must be not null
@param annotation the OnXxxx annotation (only OnFinished is supported)
@throws CoreException if an error occurred while linking the event handler
|
[
"Add",
"an",
"event",
"handler",
"on",
"the",
"given",
"animation",
"according",
"to",
"annotation",
"OnFinished",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java#L353-L360
|
8,338 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java
|
AbstractView.buildController
|
@SuppressWarnings("unchecked")
protected C buildController() throws CoreException {
// Build the controller by reflection excluding NullController
return (C) ClassUtility.findAndBuildGenericType(this.getClass(), Controller.class, NullController.class, this);
}
|
java
|
@SuppressWarnings("unchecked")
protected C buildController() throws CoreException {
// Build the controller by reflection excluding NullController
return (C) ClassUtility.findAndBuildGenericType(this.getClass(), Controller.class, NullController.class, this);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"C",
"buildController",
"(",
")",
"throws",
"CoreException",
"{",
"// Build the controller by reflection excluding NullController",
"return",
"(",
"C",
")",
"ClassUtility",
".",
"findAndBuildGenericType",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"Controller",
".",
"class",
",",
"NullController",
".",
"class",
",",
"this",
")",
";",
"}"
] |
Build the view controller.
@throws CoreException if introspection fails
|
[
"Build",
"the",
"view",
"controller",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java#L399-L404
|
8,339 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/MultiMap.java
|
MultiMap.add
|
public boolean add(final K key, final V value) {
if (!this.map.containsKey(key)) {
this.map.put(key, new ArrayList<V>());
}
return this.map.get(key).add(value);
}
|
java
|
public boolean add(final K key, final V value) {
if (!this.map.containsKey(key)) {
this.map.put(key, new ArrayList<V>());
}
return this.map.get(key).add(value);
}
|
[
"public",
"boolean",
"add",
"(",
"final",
"K",
"key",
",",
"final",
"V",
"value",
")",
"{",
"if",
"(",
"!",
"this",
".",
"map",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"this",
".",
"map",
".",
"put",
"(",
"key",
",",
"new",
"ArrayList",
"<",
"V",
">",
"(",
")",
")",
";",
"}",
"return",
"this",
".",
"map",
".",
"get",
"(",
"key",
")",
".",
"add",
"(",
"value",
")",
";",
"}"
] |
Add a new entry.
@param key the key of the entry
@param value the value of the entry
@return true if the operation has succeeded
|
[
"Add",
"a",
"new",
"entry",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/MultiMap.java#L80-L85
|
8,340 |
pmlopes/yoke
|
framework/src/main/java/com/jetdrone/vertx/yoke/Yoke.java
|
Yoke.listen
|
public Yoke listen(final @NotNull HttpServer server) {
server.requestHandler(new Handler<HttpServerRequest>() {
@Override
public void handle(HttpServerRequest req) {
// the context map is shared with all middlewares
final YokeRequest request = requestWrapper.wrap(req, new Context(defaultContext), engineMap, store);
// add x-powered-by header is enabled
Boolean poweredBy = request.get("x-powered-by");
if (poweredBy != null && poweredBy) {
request.response().putHeader("x-powered-by", "yoke");
}
new Handler<Object>() {
int currentMiddleware = -1;
@Override
public void handle(Object error) {
if (error == null) {
currentMiddleware++;
if (currentMiddleware < middlewareList.size()) {
final MountedMiddleware mountedMiddleware = middlewareList.get(currentMiddleware);
if (!mountedMiddleware.enabled) {
// the middleware is disabled
handle(null);
} else {
if (request.path().startsWith(mountedMiddleware.mount)) {
mountedMiddleware.middleware.handle(request, this);
} else {
// the middleware was not mounted on this uri, skip to the next entry
handle(null);
}
}
} else {
HttpServerResponse response = request.response();
// reached the end and no handler was able to answer the request
response.setStatusCode(404);
response.setStatusMessage(HttpResponseStatus.valueOf(404).reasonPhrase());
if (errorHandler != null) {
errorHandler.handle(request, null);
} else {
response.end(HttpResponseStatus.valueOf(404).reasonPhrase());
}
}
} else {
request.put("error", error);
if (errorHandler != null) {
errorHandler.handle(request, null);
} else {
HttpServerResponse response = request.response();
int errorCode;
// if the error was set on the response use it
if (response.getStatusCode() >= 400) {
errorCode = response.getStatusCode();
} else {
// if it was set as the error object use it
if (error instanceof Number) {
errorCode = ((Number) error).intValue();
} else if (error instanceof YokeException) {
errorCode = ((YokeException) error).getErrorCode().intValue();
} else if (error instanceof JsonObject) {
errorCode = ((JsonObject) error).getInteger("errorCode", 500);
} else if (error instanceof Map) {
Integer tmp = (Integer) ((Map) error).get("errorCode");
errorCode = tmp != null ? tmp : 500;
} else {
// default error code
errorCode = 500;
}
}
response.setStatusCode(errorCode);
response.setStatusMessage(HttpResponseStatus.valueOf(errorCode).reasonPhrase());
response.end(HttpResponseStatus.valueOf(errorCode).reasonPhrase());
}
}
}
}.handle(null);
}
});
return this;
}
|
java
|
public Yoke listen(final @NotNull HttpServer server) {
server.requestHandler(new Handler<HttpServerRequest>() {
@Override
public void handle(HttpServerRequest req) {
// the context map is shared with all middlewares
final YokeRequest request = requestWrapper.wrap(req, new Context(defaultContext), engineMap, store);
// add x-powered-by header is enabled
Boolean poweredBy = request.get("x-powered-by");
if (poweredBy != null && poweredBy) {
request.response().putHeader("x-powered-by", "yoke");
}
new Handler<Object>() {
int currentMiddleware = -1;
@Override
public void handle(Object error) {
if (error == null) {
currentMiddleware++;
if (currentMiddleware < middlewareList.size()) {
final MountedMiddleware mountedMiddleware = middlewareList.get(currentMiddleware);
if (!mountedMiddleware.enabled) {
// the middleware is disabled
handle(null);
} else {
if (request.path().startsWith(mountedMiddleware.mount)) {
mountedMiddleware.middleware.handle(request, this);
} else {
// the middleware was not mounted on this uri, skip to the next entry
handle(null);
}
}
} else {
HttpServerResponse response = request.response();
// reached the end and no handler was able to answer the request
response.setStatusCode(404);
response.setStatusMessage(HttpResponseStatus.valueOf(404).reasonPhrase());
if (errorHandler != null) {
errorHandler.handle(request, null);
} else {
response.end(HttpResponseStatus.valueOf(404).reasonPhrase());
}
}
} else {
request.put("error", error);
if (errorHandler != null) {
errorHandler.handle(request, null);
} else {
HttpServerResponse response = request.response();
int errorCode;
// if the error was set on the response use it
if (response.getStatusCode() >= 400) {
errorCode = response.getStatusCode();
} else {
// if it was set as the error object use it
if (error instanceof Number) {
errorCode = ((Number) error).intValue();
} else if (error instanceof YokeException) {
errorCode = ((YokeException) error).getErrorCode().intValue();
} else if (error instanceof JsonObject) {
errorCode = ((JsonObject) error).getInteger("errorCode", 500);
} else if (error instanceof Map) {
Integer tmp = (Integer) ((Map) error).get("errorCode");
errorCode = tmp != null ? tmp : 500;
} else {
// default error code
errorCode = 500;
}
}
response.setStatusCode(errorCode);
response.setStatusMessage(HttpResponseStatus.valueOf(errorCode).reasonPhrase());
response.end(HttpResponseStatus.valueOf(errorCode).reasonPhrase());
}
}
}
}.handle(null);
}
});
return this;
}
|
[
"public",
"Yoke",
"listen",
"(",
"final",
"@",
"NotNull",
"HttpServer",
"server",
")",
"{",
"server",
".",
"requestHandler",
"(",
"new",
"Handler",
"<",
"HttpServerRequest",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"HttpServerRequest",
"req",
")",
"{",
"// the context map is shared with all middlewares",
"final",
"YokeRequest",
"request",
"=",
"requestWrapper",
".",
"wrap",
"(",
"req",
",",
"new",
"Context",
"(",
"defaultContext",
")",
",",
"engineMap",
",",
"store",
")",
";",
"// add x-powered-by header is enabled",
"Boolean",
"poweredBy",
"=",
"request",
".",
"get",
"(",
"\"x-powered-by\"",
")",
";",
"if",
"(",
"poweredBy",
"!=",
"null",
"&&",
"poweredBy",
")",
"{",
"request",
".",
"response",
"(",
")",
".",
"putHeader",
"(",
"\"x-powered-by\"",
",",
"\"yoke\"",
")",
";",
"}",
"new",
"Handler",
"<",
"Object",
">",
"(",
")",
"{",
"int",
"currentMiddleware",
"=",
"-",
"1",
";",
"@",
"Override",
"public",
"void",
"handle",
"(",
"Object",
"error",
")",
"{",
"if",
"(",
"error",
"==",
"null",
")",
"{",
"currentMiddleware",
"++",
";",
"if",
"(",
"currentMiddleware",
"<",
"middlewareList",
".",
"size",
"(",
")",
")",
"{",
"final",
"MountedMiddleware",
"mountedMiddleware",
"=",
"middlewareList",
".",
"get",
"(",
"currentMiddleware",
")",
";",
"if",
"(",
"!",
"mountedMiddleware",
".",
"enabled",
")",
"{",
"// the middleware is disabled",
"handle",
"(",
"null",
")",
";",
"}",
"else",
"{",
"if",
"(",
"request",
".",
"path",
"(",
")",
".",
"startsWith",
"(",
"mountedMiddleware",
".",
"mount",
")",
")",
"{",
"mountedMiddleware",
".",
"middleware",
".",
"handle",
"(",
"request",
",",
"this",
")",
";",
"}",
"else",
"{",
"// the middleware was not mounted on this uri, skip to the next entry",
"handle",
"(",
"null",
")",
";",
"}",
"}",
"}",
"else",
"{",
"HttpServerResponse",
"response",
"=",
"request",
".",
"response",
"(",
")",
";",
"// reached the end and no handler was able to answer the request",
"response",
".",
"setStatusCode",
"(",
"404",
")",
";",
"response",
".",
"setStatusMessage",
"(",
"HttpResponseStatus",
".",
"valueOf",
"(",
"404",
")",
".",
"reasonPhrase",
"(",
")",
")",
";",
"if",
"(",
"errorHandler",
"!=",
"null",
")",
"{",
"errorHandler",
".",
"handle",
"(",
"request",
",",
"null",
")",
";",
"}",
"else",
"{",
"response",
".",
"end",
"(",
"HttpResponseStatus",
".",
"valueOf",
"(",
"404",
")",
".",
"reasonPhrase",
"(",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"request",
".",
"put",
"(",
"\"error\"",
",",
"error",
")",
";",
"if",
"(",
"errorHandler",
"!=",
"null",
")",
"{",
"errorHandler",
".",
"handle",
"(",
"request",
",",
"null",
")",
";",
"}",
"else",
"{",
"HttpServerResponse",
"response",
"=",
"request",
".",
"response",
"(",
")",
";",
"int",
"errorCode",
";",
"// if the error was set on the response use it",
"if",
"(",
"response",
".",
"getStatusCode",
"(",
")",
">=",
"400",
")",
"{",
"errorCode",
"=",
"response",
".",
"getStatusCode",
"(",
")",
";",
"}",
"else",
"{",
"// if it was set as the error object use it",
"if",
"(",
"error",
"instanceof",
"Number",
")",
"{",
"errorCode",
"=",
"(",
"(",
"Number",
")",
"error",
")",
".",
"intValue",
"(",
")",
";",
"}",
"else",
"if",
"(",
"error",
"instanceof",
"YokeException",
")",
"{",
"errorCode",
"=",
"(",
"(",
"YokeException",
")",
"error",
")",
".",
"getErrorCode",
"(",
")",
".",
"intValue",
"(",
")",
";",
"}",
"else",
"if",
"(",
"error",
"instanceof",
"JsonObject",
")",
"{",
"errorCode",
"=",
"(",
"(",
"JsonObject",
")",
"error",
")",
".",
"getInteger",
"(",
"\"errorCode\"",
",",
"500",
")",
";",
"}",
"else",
"if",
"(",
"error",
"instanceof",
"Map",
")",
"{",
"Integer",
"tmp",
"=",
"(",
"Integer",
")",
"(",
"(",
"Map",
")",
"error",
")",
".",
"get",
"(",
"\"errorCode\"",
")",
";",
"errorCode",
"=",
"tmp",
"!=",
"null",
"?",
"tmp",
":",
"500",
";",
"}",
"else",
"{",
"// default error code",
"errorCode",
"=",
"500",
";",
"}",
"}",
"response",
".",
"setStatusCode",
"(",
"errorCode",
")",
";",
"response",
".",
"setStatusMessage",
"(",
"HttpResponseStatus",
".",
"valueOf",
"(",
"errorCode",
")",
".",
"reasonPhrase",
"(",
")",
")",
";",
"response",
".",
"end",
"(",
"HttpResponseStatus",
".",
"valueOf",
"(",
"errorCode",
")",
".",
"reasonPhrase",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
".",
"handle",
"(",
"null",
")",
";",
"}",
"}",
")",
";",
"return",
"this",
";",
"}"
] |
Starts listening at a already created server.
@param server
@return {Yoke}
|
[
"Starts",
"listening",
"at",
"a",
"already",
"created",
"server",
"."
] |
fe8a64036f09fb745f0644faddd46162d64faf3c
|
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/Yoke.java#L457-L540
|
8,341 |
pmlopes/yoke
|
framework/src/main/java/com/jetdrone/vertx/yoke/Yoke.java
|
Yoke.deploy
|
public Yoke deploy(final @NotNull JsonArray config, final Handler<Object> handler) {
if (config.size() == 0) {
if (handler == null) {
return this;
} else {
handler.handle(null);
return this;
}
}
// wait for all deployments before calling the real handler
Handler<AsyncResult<String>> waitFor = new Handler<AsyncResult<String>>() {
private int latch = config.size();
private boolean handled = false;
@Override
public void handle(AsyncResult<String> event) {
latch--;
if (handler != null) {
if (!handled && (event.failed() || latch == 0)) {
handled = true;
handler.handle(event.failed() ? event.cause() : null);
}
}
}
};
for (Object o : config) {
JsonObject json = (JsonObject) o;
vertx.deployVerticle(json.getString("verticle"), new DeploymentOptions(json), waitFor);
}
return this;
}
|
java
|
public Yoke deploy(final @NotNull JsonArray config, final Handler<Object> handler) {
if (config.size() == 0) {
if (handler == null) {
return this;
} else {
handler.handle(null);
return this;
}
}
// wait for all deployments before calling the real handler
Handler<AsyncResult<String>> waitFor = new Handler<AsyncResult<String>>() {
private int latch = config.size();
private boolean handled = false;
@Override
public void handle(AsyncResult<String> event) {
latch--;
if (handler != null) {
if (!handled && (event.failed() || latch == 0)) {
handled = true;
handler.handle(event.failed() ? event.cause() : null);
}
}
}
};
for (Object o : config) {
JsonObject json = (JsonObject) o;
vertx.deployVerticle(json.getString("verticle"), new DeploymentOptions(json), waitFor);
}
return this;
}
|
[
"public",
"Yoke",
"deploy",
"(",
"final",
"@",
"NotNull",
"JsonArray",
"config",
",",
"final",
"Handler",
"<",
"Object",
">",
"handler",
")",
"{",
"if",
"(",
"config",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"handler",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"else",
"{",
"handler",
".",
"handle",
"(",
"null",
")",
";",
"return",
"this",
";",
"}",
"}",
"// wait for all deployments before calling the real handler",
"Handler",
"<",
"AsyncResult",
"<",
"String",
">",
">",
"waitFor",
"=",
"new",
"Handler",
"<",
"AsyncResult",
"<",
"String",
">",
">",
"(",
")",
"{",
"private",
"int",
"latch",
"=",
"config",
".",
"size",
"(",
")",
";",
"private",
"boolean",
"handled",
"=",
"false",
";",
"@",
"Override",
"public",
"void",
"handle",
"(",
"AsyncResult",
"<",
"String",
">",
"event",
")",
"{",
"latch",
"--",
";",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"handled",
"&&",
"(",
"event",
".",
"failed",
"(",
")",
"||",
"latch",
"==",
"0",
")",
")",
"{",
"handled",
"=",
"true",
";",
"handler",
".",
"handle",
"(",
"event",
".",
"failed",
"(",
")",
"?",
"event",
".",
"cause",
"(",
")",
":",
"null",
")",
";",
"}",
"}",
"}",
"}",
";",
"for",
"(",
"Object",
"o",
":",
"config",
")",
"{",
"JsonObject",
"json",
"=",
"(",
"JsonObject",
")",
"o",
";",
"vertx",
".",
"deployVerticle",
"(",
"json",
".",
"getString",
"(",
"\"verticle\"",
")",
",",
"new",
"DeploymentOptions",
"(",
"json",
")",
",",
"waitFor",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Deploys required middleware from a config json element. The handler is only called once all middleware is
deployed or in error. The order of deployment is not guaranteed since all deploy functions are called
concurrently and do not wait for the previous result before deploying the next item.
The current format for the config is either a single item or an array:
<pre>
{
module: String, // the name of the module
verticle: String, // the name of the verticle (either verticle or module must be present)
instances: Number, // how many instances, default 1
worker: Boolean, // is it a worker verticle? default false
multiThreaded: Boolean, // is it a multiThreaded verticle? default false
config: JsonObject // any config you need to pass to the module/verticle
}
</pre>
@param config either a json object or a json array.
@param handler A handler that is called once all middleware is deployed or on error.
|
[
"Deploys",
"required",
"middleware",
"from",
"a",
"config",
"json",
"element",
".",
"The",
"handler",
"is",
"only",
"called",
"once",
"all",
"middleware",
"is",
"deployed",
"or",
"in",
"error",
".",
"The",
"order",
"of",
"deployment",
"is",
"not",
"guaranteed",
"since",
"all",
"deploy",
"functions",
"are",
"called",
"concurrently",
"and",
"do",
"not",
"wait",
"for",
"the",
"previous",
"result",
"before",
"deploying",
"the",
"next",
"item",
"."
] |
fe8a64036f09fb745f0644faddd46162d64faf3c
|
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/Yoke.java#L583-L618
|
8,342 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/AbstractReady.java
|
AbstractReady.getKeyPart
|
@SuppressWarnings("unchecked")
public <KP extends Object> KP getKeyPart(final Class<KP> keyPartClass) {
return (KP) getListKeyPart().stream()
.filter(kp -> kp != null && keyPartClass.isAssignableFrom(kp.getClass()))
.findFirst()
.get();
}
|
java
|
@SuppressWarnings("unchecked")
public <KP extends Object> KP getKeyPart(final Class<KP> keyPartClass) {
return (KP) getListKeyPart().stream()
.filter(kp -> kp != null && keyPartClass.isAssignableFrom(kp.getClass()))
.findFirst()
.get();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"KP",
"extends",
"Object",
">",
"KP",
"getKeyPart",
"(",
"final",
"Class",
"<",
"KP",
">",
"keyPartClass",
")",
"{",
"return",
"(",
"KP",
")",
"getListKeyPart",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"kp",
"->",
"kp",
"!=",
"null",
"&&",
"keyPartClass",
".",
"isAssignableFrom",
"(",
"kp",
".",
"getClass",
"(",
")",
")",
")",
".",
"findFirst",
"(",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Return the first object assignable from te given class.
@param keyPartClass the class used to search the first instance
@return the first instance found or raise a NoSuchElementException
|
[
"Return",
"the",
"first",
"object",
"assignable",
"from",
"te",
"given",
"class",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/AbstractReady.java#L153-L159
|
8,343 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/AbstractBaseParams.java
|
AbstractBaseParams.readDouble
|
protected double readDouble(final String doubleString, final double min, final double max) {
return Math.max(Math.min(Double.parseDouble(doubleString), max), min);
}
|
java
|
protected double readDouble(final String doubleString, final double min, final double max) {
return Math.max(Math.min(Double.parseDouble(doubleString), max), min);
}
|
[
"protected",
"double",
"readDouble",
"(",
"final",
"String",
"doubleString",
",",
"final",
"double",
"min",
",",
"final",
"double",
"max",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"Math",
".",
"min",
"(",
"Double",
".",
"parseDouble",
"(",
"doubleString",
")",
",",
"max",
")",
",",
"min",
")",
";",
"}"
] |
Read a double string value.
@param doubleString the double value
@param min the minimum value allowed
@param max the maximum value allowed
@return the value parsed according to its range
|
[
"Read",
"a",
"double",
"string",
"value",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/AbstractBaseParams.java#L153-L155
|
8,344 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/AbstractBaseParams.java
|
AbstractBaseParams.readInteger
|
protected int readInteger(final String intString, final int min, final int max) {
return Math.max(Math.min(Integer.parseInt(intString), max), min);
}
|
java
|
protected int readInteger(final String intString, final int min, final int max) {
return Math.max(Math.min(Integer.parseInt(intString), max), min);
}
|
[
"protected",
"int",
"readInteger",
"(",
"final",
"String",
"intString",
",",
"final",
"int",
"min",
",",
"final",
"int",
"max",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"Math",
".",
"min",
"(",
"Integer",
".",
"parseInt",
"(",
"intString",
")",
",",
"max",
")",
",",
"min",
")",
";",
"}"
] |
Read ab integer string value.
@param intString the integer value
@param min the minimum value allowed
@param max the maximum value allowed
@return the value parsed according to its range
|
[
"Read",
"ab",
"integer",
"string",
"value",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/AbstractBaseParams.java#L166-L168
|
8,345 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/basic/TaskTrackerService.java
|
TaskTrackerService.trackTask
|
public void trackTask(final ServiceTaskBase<?> task) {
LOGGER.trace("track a Task");
this.serviceTasks.add(task);
task.setOnCancelled(this.workerHandler);
task.setOnSucceeded(this.workerHandler);
task.setOnFailed(this.workerHandler);
}
|
java
|
public void trackTask(final ServiceTaskBase<?> task) {
LOGGER.trace("track a Task");
this.serviceTasks.add(task);
task.setOnCancelled(this.workerHandler);
task.setOnSucceeded(this.workerHandler);
task.setOnFailed(this.workerHandler);
}
|
[
"public",
"void",
"trackTask",
"(",
"final",
"ServiceTaskBase",
"<",
"?",
">",
"task",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"track a Task\"",
")",
";",
"this",
".",
"serviceTasks",
".",
"add",
"(",
"task",
")",
";",
"task",
".",
"setOnCancelled",
"(",
"this",
".",
"workerHandler",
")",
";",
"task",
".",
"setOnSucceeded",
"(",
"this",
".",
"workerHandler",
")",
";",
"task",
".",
"setOnFailed",
"(",
"this",
".",
"workerHandler",
")",
";",
"}"
] |
Track a task progression.
@param task the task to track
|
[
"Track",
"a",
"task",
"progression",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/basic/TaskTrackerService.java#L71-L80
|
8,346 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.addSubSlide
|
private void addSubSlide(final Node defaultSubSlide) {
this.subSlides.add(model().getStepPosition(), defaultSubSlide);
this.slideContent.getChildren().add(defaultSubSlide);
StackPane.setAlignment(defaultSubSlide, Pos.CENTER);
}
|
java
|
private void addSubSlide(final Node defaultSubSlide) {
this.subSlides.add(model().getStepPosition(), defaultSubSlide);
this.slideContent.getChildren().add(defaultSubSlide);
StackPane.setAlignment(defaultSubSlide, Pos.CENTER);
}
|
[
"private",
"void",
"addSubSlide",
"(",
"final",
"Node",
"defaultSubSlide",
")",
"{",
"this",
".",
"subSlides",
".",
"add",
"(",
"model",
"(",
")",
".",
"getStepPosition",
"(",
")",
",",
"defaultSubSlide",
")",
";",
"this",
".",
"slideContent",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"defaultSubSlide",
")",
";",
"StackPane",
".",
"setAlignment",
"(",
"defaultSubSlide",
",",
"Pos",
".",
"CENTER",
")",
";",
"}"
] |
Add a subslide node.
@param defaultSubSlide the subslide node
|
[
"Add",
"a",
"subslide",
"node",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L220-L227
|
8,347 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.getHeaderPanel
|
protected Node getHeaderPanel() {
final Pane headerPane = PaneBuilder.create()
.styleClass("header")
.layoutX(0.0)
.layoutY(0.0)
.minWidth(1024)
.prefWidth(1024)
.build();
// sp.getStyleClass().add("header");
final Label primaryTitle = LabelBuilder.create()
// .styleClass("slideTitle")
.font(PrezFonts.SLIDE_TITLE.get())
.textFill(PrezColors.SLIDE_TITLE.get())
.text(model().getSlide().getTitle().replaceAll("\\\\n", "\n").replaceAll("\\\\t", "\t"))
.layoutX(40)
.layoutY(45)
// .style("-fx-background-color:#CCCB20")
.build();
this.secondaryTitle = LabelBuilder.create()
// .styleClass("slideTitle")
.font(PrezFonts.SLIDE_SUB_TITLE.get())
.textFill(PrezColors.SLIDE_TITLE.get())
// .scaleX(1.5)
// .scaleY(1.5)
.layoutX(450)
.layoutY(14)
.minWidth(450)
// .style("-fx-background-color:#E53B20")
.alignment(Pos.CENTER_RIGHT)
.textAlignment(TextAlignment.RIGHT)
.build();
final ImageView breizhcamp = ImageViewBuilder.create()
.layoutX(680.0)
.layoutY(-14.0)
.scaleX(0.6)
.scaleY(0.6)
.image(PrezImages.HEADER_LOGO.get())
.build();
final Polyline pl = PolylineBuilder.create()
.strokeWidth(3)
.stroke(Color.BLACK)
.points(684.0, 12.0, 946.0, 12.0, 946.0, 107.0)
.build();
this.rectangle = RectangleBuilder.create()
.layoutX(108.0)
.layoutY(95.0)
.width(0.0) // 60.0
.height(14.0)
.fill(Color.web("1C9A9A"))
.build();
this.circle = CircleBuilder.create()
.scaleX(0)
.scaleY(0)
.layoutX(18 + 54)
.layoutY(18 + 54)
.radius(54)
.fill(Color.web("444442"))
.build();
this.pageLabel = LabelBuilder.create()
.layoutX(970)
.layoutY(18.0)
.text(String.valueOf(model().getSlide().getPage()))
.font(PrezFonts.PAGE.get())
.rotate(90.0)
.build();
// final FlowPane fp = FlowPaneBuilder.create()
// .orientation(Orientation.HORIZONTAL)
// .alignment(Pos.BASELINE_CENTER)
// .children(this.secondaryTitle)
// // .style("-fx-background-color:#CCCCCC")
// .build();
headerPane.getChildren().addAll(this.circle, primaryTitle, breizhcamp, this.secondaryTitle, pl, this.rectangle, this.pageLabel);
// AnchorPane.setLeftAnchor(primaryTitle, 40.0);
// AnchorPane.setTopAnchor(primaryTitle, 45.0);
//
// AnchorPane.setRightAnchor(this.secondaryTitle, 80.0);
// AnchorPane.setTopAnchor(primaryTitle, 20.0);
// ap.setStyle("-fx-background-color:#002266");
// sp.setStyle("-fx-background-color:#663366");
// StackPane.setAlignment(ap, Pos.BOTTOM_CENTER);
// sp.getChildren().add(ap);
return headerPane;
}
|
java
|
protected Node getHeaderPanel() {
final Pane headerPane = PaneBuilder.create()
.styleClass("header")
.layoutX(0.0)
.layoutY(0.0)
.minWidth(1024)
.prefWidth(1024)
.build();
// sp.getStyleClass().add("header");
final Label primaryTitle = LabelBuilder.create()
// .styleClass("slideTitle")
.font(PrezFonts.SLIDE_TITLE.get())
.textFill(PrezColors.SLIDE_TITLE.get())
.text(model().getSlide().getTitle().replaceAll("\\\\n", "\n").replaceAll("\\\\t", "\t"))
.layoutX(40)
.layoutY(45)
// .style("-fx-background-color:#CCCB20")
.build();
this.secondaryTitle = LabelBuilder.create()
// .styleClass("slideTitle")
.font(PrezFonts.SLIDE_SUB_TITLE.get())
.textFill(PrezColors.SLIDE_TITLE.get())
// .scaleX(1.5)
// .scaleY(1.5)
.layoutX(450)
.layoutY(14)
.minWidth(450)
// .style("-fx-background-color:#E53B20")
.alignment(Pos.CENTER_RIGHT)
.textAlignment(TextAlignment.RIGHT)
.build();
final ImageView breizhcamp = ImageViewBuilder.create()
.layoutX(680.0)
.layoutY(-14.0)
.scaleX(0.6)
.scaleY(0.6)
.image(PrezImages.HEADER_LOGO.get())
.build();
final Polyline pl = PolylineBuilder.create()
.strokeWidth(3)
.stroke(Color.BLACK)
.points(684.0, 12.0, 946.0, 12.0, 946.0, 107.0)
.build();
this.rectangle = RectangleBuilder.create()
.layoutX(108.0)
.layoutY(95.0)
.width(0.0) // 60.0
.height(14.0)
.fill(Color.web("1C9A9A"))
.build();
this.circle = CircleBuilder.create()
.scaleX(0)
.scaleY(0)
.layoutX(18 + 54)
.layoutY(18 + 54)
.radius(54)
.fill(Color.web("444442"))
.build();
this.pageLabel = LabelBuilder.create()
.layoutX(970)
.layoutY(18.0)
.text(String.valueOf(model().getSlide().getPage()))
.font(PrezFonts.PAGE.get())
.rotate(90.0)
.build();
// final FlowPane fp = FlowPaneBuilder.create()
// .orientation(Orientation.HORIZONTAL)
// .alignment(Pos.BASELINE_CENTER)
// .children(this.secondaryTitle)
// // .style("-fx-background-color:#CCCCCC")
// .build();
headerPane.getChildren().addAll(this.circle, primaryTitle, breizhcamp, this.secondaryTitle, pl, this.rectangle, this.pageLabel);
// AnchorPane.setLeftAnchor(primaryTitle, 40.0);
// AnchorPane.setTopAnchor(primaryTitle, 45.0);
//
// AnchorPane.setRightAnchor(this.secondaryTitle, 80.0);
// AnchorPane.setTopAnchor(primaryTitle, 20.0);
// ap.setStyle("-fx-background-color:#002266");
// sp.setStyle("-fx-background-color:#663366");
// StackPane.setAlignment(ap, Pos.BOTTOM_CENTER);
// sp.getChildren().add(ap);
return headerPane;
}
|
[
"protected",
"Node",
"getHeaderPanel",
"(",
")",
"{",
"final",
"Pane",
"headerPane",
"=",
"PaneBuilder",
".",
"create",
"(",
")",
".",
"styleClass",
"(",
"\"header\"",
")",
".",
"layoutX",
"(",
"0.0",
")",
".",
"layoutY",
"(",
"0.0",
")",
".",
"minWidth",
"(",
"1024",
")",
".",
"prefWidth",
"(",
"1024",
")",
".",
"build",
"(",
")",
";",
"// sp.getStyleClass().add(\"header\");",
"final",
"Label",
"primaryTitle",
"=",
"LabelBuilder",
".",
"create",
"(",
")",
"// .styleClass(\"slideTitle\")",
".",
"font",
"(",
"PrezFonts",
".",
"SLIDE_TITLE",
".",
"get",
"(",
")",
")",
".",
"textFill",
"(",
"PrezColors",
".",
"SLIDE_TITLE",
".",
"get",
"(",
")",
")",
".",
"text",
"(",
"model",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"getTitle",
"(",
")",
".",
"replaceAll",
"(",
"\"\\\\\\\\n\"",
",",
"\"\\n\"",
")",
".",
"replaceAll",
"(",
"\"\\\\\\\\t\"",
",",
"\"\\t\"",
")",
")",
".",
"layoutX",
"(",
"40",
")",
".",
"layoutY",
"(",
"45",
")",
"// .style(\"-fx-background-color:#CCCB20\")",
".",
"build",
"(",
")",
";",
"this",
".",
"secondaryTitle",
"=",
"LabelBuilder",
".",
"create",
"(",
")",
"// .styleClass(\"slideTitle\")",
".",
"font",
"(",
"PrezFonts",
".",
"SLIDE_SUB_TITLE",
".",
"get",
"(",
")",
")",
".",
"textFill",
"(",
"PrezColors",
".",
"SLIDE_TITLE",
".",
"get",
"(",
")",
")",
"// .scaleX(1.5)",
"// .scaleY(1.5)",
".",
"layoutX",
"(",
"450",
")",
".",
"layoutY",
"(",
"14",
")",
".",
"minWidth",
"(",
"450",
")",
"// .style(\"-fx-background-color:#E53B20\")",
".",
"alignment",
"(",
"Pos",
".",
"CENTER_RIGHT",
")",
".",
"textAlignment",
"(",
"TextAlignment",
".",
"RIGHT",
")",
".",
"build",
"(",
")",
";",
"final",
"ImageView",
"breizhcamp",
"=",
"ImageViewBuilder",
".",
"create",
"(",
")",
".",
"layoutX",
"(",
"680.0",
")",
".",
"layoutY",
"(",
"-",
"14.0",
")",
".",
"scaleX",
"(",
"0.6",
")",
".",
"scaleY",
"(",
"0.6",
")",
".",
"image",
"(",
"PrezImages",
".",
"HEADER_LOGO",
".",
"get",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"final",
"Polyline",
"pl",
"=",
"PolylineBuilder",
".",
"create",
"(",
")",
".",
"strokeWidth",
"(",
"3",
")",
".",
"stroke",
"(",
"Color",
".",
"BLACK",
")",
".",
"points",
"(",
"684.0",
",",
"12.0",
",",
"946.0",
",",
"12.0",
",",
"946.0",
",",
"107.0",
")",
".",
"build",
"(",
")",
";",
"this",
".",
"rectangle",
"=",
"RectangleBuilder",
".",
"create",
"(",
")",
".",
"layoutX",
"(",
"108.0",
")",
".",
"layoutY",
"(",
"95.0",
")",
".",
"width",
"(",
"0.0",
")",
"// 60.0",
".",
"height",
"(",
"14.0",
")",
".",
"fill",
"(",
"Color",
".",
"web",
"(",
"\"1C9A9A\"",
")",
")",
".",
"build",
"(",
")",
";",
"this",
".",
"circle",
"=",
"CircleBuilder",
".",
"create",
"(",
")",
".",
"scaleX",
"(",
"0",
")",
".",
"scaleY",
"(",
"0",
")",
".",
"layoutX",
"(",
"18",
"+",
"54",
")",
".",
"layoutY",
"(",
"18",
"+",
"54",
")",
".",
"radius",
"(",
"54",
")",
".",
"fill",
"(",
"Color",
".",
"web",
"(",
"\"444442\"",
")",
")",
".",
"build",
"(",
")",
";",
"this",
".",
"pageLabel",
"=",
"LabelBuilder",
".",
"create",
"(",
")",
".",
"layoutX",
"(",
"970",
")",
".",
"layoutY",
"(",
"18.0",
")",
".",
"text",
"(",
"String",
".",
"valueOf",
"(",
"model",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"getPage",
"(",
")",
")",
")",
".",
"font",
"(",
"PrezFonts",
".",
"PAGE",
".",
"get",
"(",
")",
")",
".",
"rotate",
"(",
"90.0",
")",
".",
"build",
"(",
")",
";",
"// final FlowPane fp = FlowPaneBuilder.create()",
"// .orientation(Orientation.HORIZONTAL)",
"// .alignment(Pos.BASELINE_CENTER)",
"// .children(this.secondaryTitle)",
"// // .style(\"-fx-background-color:#CCCCCC\")",
"// .build();",
"headerPane",
".",
"getChildren",
"(",
")",
".",
"addAll",
"(",
"this",
".",
"circle",
",",
"primaryTitle",
",",
"breizhcamp",
",",
"this",
".",
"secondaryTitle",
",",
"pl",
",",
"this",
".",
"rectangle",
",",
"this",
".",
"pageLabel",
")",
";",
"// AnchorPane.setLeftAnchor(primaryTitle, 40.0);",
"// AnchorPane.setTopAnchor(primaryTitle, 45.0);",
"//",
"// AnchorPane.setRightAnchor(this.secondaryTitle, 80.0);",
"// AnchorPane.setTopAnchor(primaryTitle, 20.0);",
"// ap.setStyle(\"-fx-background-color:#002266\");",
"// sp.setStyle(\"-fx-background-color:#663366\");",
"// StackPane.setAlignment(ap, Pos.BOTTOM_CENTER);",
"// sp.getChildren().add(ap);",
"return",
"headerPane",
";",
"}"
] |
Build and return the header panel.
@return the header panel
|
[
"Build",
"and",
"return",
"the",
"header",
"panel",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L288-L385
|
8,348 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.bindNode
|
protected void bindNode(final Node node) {
node.scaleXProperty().bind(bindWidth());
node.scaleYProperty().bind(bindHeight());
}
|
java
|
protected void bindNode(final Node node) {
node.scaleXProperty().bind(bindWidth());
node.scaleYProperty().bind(bindHeight());
}
|
[
"protected",
"void",
"bindNode",
"(",
"final",
"Node",
"node",
")",
"{",
"node",
".",
"scaleXProperty",
"(",
")",
".",
"bind",
"(",
"bindWidth",
"(",
")",
")",
";",
"node",
".",
"scaleYProperty",
"(",
")",
".",
"bind",
"(",
"bindHeight",
"(",
")",
")",
";",
"}"
] |
Bind node's scale properties to stage size.
@param node the bound node
|
[
"Bind",
"node",
"s",
"scale",
"properties",
"to",
"stage",
"size",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L392-L395
|
8,349 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.bindHeight
|
protected NumberBinding bindHeight() {
return Bindings.divide(model().localFacade().globalFacade().application().stage().heightProperty(), 768);
}
|
java
|
protected NumberBinding bindHeight() {
return Bindings.divide(model().localFacade().globalFacade().application().stage().heightProperty(), 768);
}
|
[
"protected",
"NumberBinding",
"bindHeight",
"(",
")",
"{",
"return",
"Bindings",
".",
"divide",
"(",
"model",
"(",
")",
".",
"localFacade",
"(",
")",
".",
"globalFacade",
"(",
")",
".",
"application",
"(",
")",
".",
"stage",
"(",
")",
".",
"heightProperty",
"(",
")",
",",
"768",
")",
";",
"}"
] |
Returns the height ratio.
@return the height ratio
|
[
"Returns",
"the",
"height",
"ratio",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L402-L404
|
8,350 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.bindWidth
|
protected NumberBinding bindWidth() {
return Bindings.divide(model().localFacade().globalFacade().application().stage().widthProperty(), 1024);
}
|
java
|
protected NumberBinding bindWidth() {
return Bindings.divide(model().localFacade().globalFacade().application().stage().widthProperty(), 1024);
}
|
[
"protected",
"NumberBinding",
"bindWidth",
"(",
")",
"{",
"return",
"Bindings",
".",
"divide",
"(",
"model",
"(",
")",
".",
"localFacade",
"(",
")",
".",
"globalFacade",
"(",
")",
".",
"application",
"(",
")",
".",
"stage",
"(",
")",
".",
"widthProperty",
"(",
")",
",",
"1024",
")",
";",
"}"
] |
Returns the width ratio.
@return the width ratio
|
[
"Returns",
"the",
"width",
"ratio",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L411-L413
|
8,351 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.getFooterPanel
|
protected Node getFooterPanel() {
this.pageLabel = LabelBuilder.create()
.text(String.valueOf(model().getSlide().getPage()))
.font(PrezFonts.PAGE.get())
.build();
final AnchorPane ap = AnchorPaneBuilder.create()
.children(this.pageLabel)
.build();
AnchorPane.setRightAnchor(this.pageLabel, 20.0);
final StackPane sp = StackPaneBuilder.create()
.styleClass("footer")
.prefHeight(35.0)
.minHeight(Region.USE_PREF_SIZE)
.maxHeight(Region.USE_PREF_SIZE)
.children(ap)
.build();
StackPane.setAlignment(ap, Pos.CENTER_RIGHT);
return sp;
}
|
java
|
protected Node getFooterPanel() {
this.pageLabel = LabelBuilder.create()
.text(String.valueOf(model().getSlide().getPage()))
.font(PrezFonts.PAGE.get())
.build();
final AnchorPane ap = AnchorPaneBuilder.create()
.children(this.pageLabel)
.build();
AnchorPane.setRightAnchor(this.pageLabel, 20.0);
final StackPane sp = StackPaneBuilder.create()
.styleClass("footer")
.prefHeight(35.0)
.minHeight(Region.USE_PREF_SIZE)
.maxHeight(Region.USE_PREF_SIZE)
.children(ap)
.build();
StackPane.setAlignment(ap, Pos.CENTER_RIGHT);
return sp;
}
|
[
"protected",
"Node",
"getFooterPanel",
"(",
")",
"{",
"this",
".",
"pageLabel",
"=",
"LabelBuilder",
".",
"create",
"(",
")",
".",
"text",
"(",
"String",
".",
"valueOf",
"(",
"model",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"getPage",
"(",
")",
")",
")",
".",
"font",
"(",
"PrezFonts",
".",
"PAGE",
".",
"get",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"final",
"AnchorPane",
"ap",
"=",
"AnchorPaneBuilder",
".",
"create",
"(",
")",
".",
"children",
"(",
"this",
".",
"pageLabel",
")",
".",
"build",
"(",
")",
";",
"AnchorPane",
".",
"setRightAnchor",
"(",
"this",
".",
"pageLabel",
",",
"20.0",
")",
";",
"final",
"StackPane",
"sp",
"=",
"StackPaneBuilder",
".",
"create",
"(",
")",
".",
"styleClass",
"(",
"\"footer\"",
")",
".",
"prefHeight",
"(",
"35.0",
")",
".",
"minHeight",
"(",
"Region",
".",
"USE_PREF_SIZE",
")",
".",
"maxHeight",
"(",
"Region",
".",
"USE_PREF_SIZE",
")",
".",
"children",
"(",
"ap",
")",
".",
"build",
"(",
")",
";",
"StackPane",
".",
"setAlignment",
"(",
"ap",
",",
"Pos",
".",
"CENTER_RIGHT",
")",
";",
"return",
"sp",
";",
"}"
] |
Build and return the footer panel.
@return the footer panel
|
[
"Build",
"and",
"return",
"the",
"footer",
"panel",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L427-L449
|
8,352 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.buildDefaultContent
|
protected VBox buildDefaultContent(final SlideContent slideContent) {
final VBox vbox = new VBox();
// vbox.getStyleClass().add("content");
// Link the class style of this slide content
if (model().getSlide().getStyle() != null) {
vbox.getStyleClass().add(model().getSlide().getStyle());
}
if (slideContent != null) {
// Add all slide item into the vbox panel
for (final SlideItem item : slideContent.getItem()) {
addSlideItem(vbox, item);
}
// Manage the secondary title if any
if (slideContent.getTitle() != null) {
this.secondaryTitle.setText(slideContent.getTitle());
}
}
return vbox;
}
|
java
|
protected VBox buildDefaultContent(final SlideContent slideContent) {
final VBox vbox = new VBox();
// vbox.getStyleClass().add("content");
// Link the class style of this slide content
if (model().getSlide().getStyle() != null) {
vbox.getStyleClass().add(model().getSlide().getStyle());
}
if (slideContent != null) {
// Add all slide item into the vbox panel
for (final SlideItem item : slideContent.getItem()) {
addSlideItem(vbox, item);
}
// Manage the secondary title if any
if (slideContent.getTitle() != null) {
this.secondaryTitle.setText(slideContent.getTitle());
}
}
return vbox;
}
|
[
"protected",
"VBox",
"buildDefaultContent",
"(",
"final",
"SlideContent",
"slideContent",
")",
"{",
"final",
"VBox",
"vbox",
"=",
"new",
"VBox",
"(",
")",
";",
"// vbox.getStyleClass().add(\"content\");",
"// Link the class style of this slide content",
"if",
"(",
"model",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"getStyle",
"(",
")",
"!=",
"null",
")",
"{",
"vbox",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"model",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"getStyle",
"(",
")",
")",
";",
"}",
"if",
"(",
"slideContent",
"!=",
"null",
")",
"{",
"// Add all slide item into the vbox panel",
"for",
"(",
"final",
"SlideItem",
"item",
":",
"slideContent",
".",
"getItem",
"(",
")",
")",
"{",
"addSlideItem",
"(",
"vbox",
",",
"item",
")",
";",
"}",
"// Manage the secondary title if any",
"if",
"(",
"slideContent",
".",
"getTitle",
"(",
")",
"!=",
"null",
")",
"{",
"this",
".",
"secondaryTitle",
".",
"setText",
"(",
"slideContent",
".",
"getTitle",
"(",
")",
")",
";",
"}",
"}",
"return",
"vbox",
";",
"}"
] |
Build the default content slide.
@param slideContent the content of the slide to build
@return the vbox with default content items
|
[
"Build",
"the",
"default",
"content",
"slide",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L458-L480
|
8,353 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.addSlideItem
|
protected void addSlideItem(final VBox vbox, final SlideItem item) {
Node node = null;
if (item.isLink()) {
final Hyperlink link = HyperlinkBuilder.create()
.opacity(1.0)
.text(item.getValue())
.build();
link.getStyleClass().add("link" + item.getLevel());
link.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent e) {
final ClipboardContent content = new ClipboardContent();
content.putString("http://" + ((Hyperlink) e.getSource()).getText());
Clipboard.getSystemClipboard().setContent(content);
}
});
node = link;
} else if (item.isHtml()) {
final WebView web = WebViewBuilder.create()
.fontScale(1.4)
// .effect(ReflectionBuilder.create().fraction(0.4).build())
.build();
web.getEngine().loadContent(item.getValue());
VBox.setVgrow(web, Priority.NEVER);
node = web; // StackPaneBuilder.create().children(web).style("-fx-border-width:2;-fx-border-color:#000000").build();
} else if (item.getImage() != null) {
final Image image = Resources.create(new RelImage(item.getImage())).get();
final ImageView imageViewer = ImageViewBuilder.create()
.styleClass(ITEM_CLASS_PREFIX + item.getLevel())
.image(image)
// .effect(ReflectionBuilder.create().fraction(0.9).build())
.build();
node = imageViewer;
} else {
final Text text = TextBuilder.create()
.styleClass(ITEM_CLASS_PREFIX + item.getLevel())
.text(item.getValue() == null ? "" : item.getValue())
.build();
node = text;
}
if (item.getStyle() != null) {
node.getStyleClass().add(item.getStyle());
}
if (item.getScale() != 1.0) {
node.setScaleX(item.getScale());
node.setScaleY(item.getScale());
}
vbox.getChildren().add(node);
}
|
java
|
protected void addSlideItem(final VBox vbox, final SlideItem item) {
Node node = null;
if (item.isLink()) {
final Hyperlink link = HyperlinkBuilder.create()
.opacity(1.0)
.text(item.getValue())
.build();
link.getStyleClass().add("link" + item.getLevel());
link.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent e) {
final ClipboardContent content = new ClipboardContent();
content.putString("http://" + ((Hyperlink) e.getSource()).getText());
Clipboard.getSystemClipboard().setContent(content);
}
});
node = link;
} else if (item.isHtml()) {
final WebView web = WebViewBuilder.create()
.fontScale(1.4)
// .effect(ReflectionBuilder.create().fraction(0.4).build())
.build();
web.getEngine().loadContent(item.getValue());
VBox.setVgrow(web, Priority.NEVER);
node = web; // StackPaneBuilder.create().children(web).style("-fx-border-width:2;-fx-border-color:#000000").build();
} else if (item.getImage() != null) {
final Image image = Resources.create(new RelImage(item.getImage())).get();
final ImageView imageViewer = ImageViewBuilder.create()
.styleClass(ITEM_CLASS_PREFIX + item.getLevel())
.image(image)
// .effect(ReflectionBuilder.create().fraction(0.9).build())
.build();
node = imageViewer;
} else {
final Text text = TextBuilder.create()
.styleClass(ITEM_CLASS_PREFIX + item.getLevel())
.text(item.getValue() == null ? "" : item.getValue())
.build();
node = text;
}
if (item.getStyle() != null) {
node.getStyleClass().add(item.getStyle());
}
if (item.getScale() != 1.0) {
node.setScaleX(item.getScale());
node.setScaleY(item.getScale());
}
vbox.getChildren().add(node);
}
|
[
"protected",
"void",
"addSlideItem",
"(",
"final",
"VBox",
"vbox",
",",
"final",
"SlideItem",
"item",
")",
"{",
"Node",
"node",
"=",
"null",
";",
"if",
"(",
"item",
".",
"isLink",
"(",
")",
")",
"{",
"final",
"Hyperlink",
"link",
"=",
"HyperlinkBuilder",
".",
"create",
"(",
")",
".",
"opacity",
"(",
"1.0",
")",
".",
"text",
"(",
"item",
".",
"getValue",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"link",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"\"link\"",
"+",
"item",
".",
"getLevel",
"(",
")",
")",
";",
"link",
".",
"setOnAction",
"(",
"new",
"EventHandler",
"<",
"ActionEvent",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"final",
"ActionEvent",
"e",
")",
"{",
"final",
"ClipboardContent",
"content",
"=",
"new",
"ClipboardContent",
"(",
")",
";",
"content",
".",
"putString",
"(",
"\"http://\"",
"+",
"(",
"(",
"Hyperlink",
")",
"e",
".",
"getSource",
"(",
")",
")",
".",
"getText",
"(",
")",
")",
";",
"Clipboard",
".",
"getSystemClipboard",
"(",
")",
".",
"setContent",
"(",
"content",
")",
";",
"}",
"}",
")",
";",
"node",
"=",
"link",
";",
"}",
"else",
"if",
"(",
"item",
".",
"isHtml",
"(",
")",
")",
"{",
"final",
"WebView",
"web",
"=",
"WebViewBuilder",
".",
"create",
"(",
")",
".",
"fontScale",
"(",
"1.4",
")",
"// .effect(ReflectionBuilder.create().fraction(0.4).build())",
".",
"build",
"(",
")",
";",
"web",
".",
"getEngine",
"(",
")",
".",
"loadContent",
"(",
"item",
".",
"getValue",
"(",
")",
")",
";",
"VBox",
".",
"setVgrow",
"(",
"web",
",",
"Priority",
".",
"NEVER",
")",
";",
"node",
"=",
"web",
";",
"// StackPaneBuilder.create().children(web).style(\"-fx-border-width:2;-fx-border-color:#000000\").build();",
"}",
"else",
"if",
"(",
"item",
".",
"getImage",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"Image",
"image",
"=",
"Resources",
".",
"create",
"(",
"new",
"RelImage",
"(",
"item",
".",
"getImage",
"(",
")",
")",
")",
".",
"get",
"(",
")",
";",
"final",
"ImageView",
"imageViewer",
"=",
"ImageViewBuilder",
".",
"create",
"(",
")",
".",
"styleClass",
"(",
"ITEM_CLASS_PREFIX",
"+",
"item",
".",
"getLevel",
"(",
")",
")",
".",
"image",
"(",
"image",
")",
"// .effect(ReflectionBuilder.create().fraction(0.9).build())",
".",
"build",
"(",
")",
";",
"node",
"=",
"imageViewer",
";",
"}",
"else",
"{",
"final",
"Text",
"text",
"=",
"TextBuilder",
".",
"create",
"(",
")",
".",
"styleClass",
"(",
"ITEM_CLASS_PREFIX",
"+",
"item",
".",
"getLevel",
"(",
")",
")",
".",
"text",
"(",
"item",
".",
"getValue",
"(",
")",
"==",
"null",
"?",
"\"\"",
":",
"item",
".",
"getValue",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"node",
"=",
"text",
";",
"}",
"if",
"(",
"item",
".",
"getStyle",
"(",
")",
"!=",
"null",
")",
"{",
"node",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"item",
".",
"getStyle",
"(",
")",
")",
";",
"}",
"if",
"(",
"item",
".",
"getScale",
"(",
")",
"!=",
"1.0",
")",
"{",
"node",
".",
"setScaleX",
"(",
"item",
".",
"getScale",
"(",
")",
")",
";",
"node",
".",
"setScaleY",
"(",
"item",
".",
"getScale",
"(",
")",
")",
";",
"}",
"vbox",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"node",
")",
";",
"}"
] |
Add a slide item by managing level.
@param vbox the layout node
@param item the slide item to add
|
[
"Add",
"a",
"slide",
"item",
"by",
"managing",
"level",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L488-L552
|
8,354 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.showSlideStep
|
public void showSlideStep(final SlideStep slideStep) {
if (this.subSlides.size() >= model().getStepPosition() || this.subSlides.get(model().getStepPosition()) == null) {
addSubSlide(buildDefaultContent(model().getContent(slideStep)));
}
final Node nextSlide = this.subSlides.get(model().getStepPosition());
if (this.currentSubSlide == null || nextSlide == null) {
// No Animation
this.currentSubSlide = nextSlide;
} else {
performStepAnimation(nextSlide);
}
}
|
java
|
public void showSlideStep(final SlideStep slideStep) {
if (this.subSlides.size() >= model().getStepPosition() || this.subSlides.get(model().getStepPosition()) == null) {
addSubSlide(buildDefaultContent(model().getContent(slideStep)));
}
final Node nextSlide = this.subSlides.get(model().getStepPosition());
if (this.currentSubSlide == null || nextSlide == null) {
// No Animation
this.currentSubSlide = nextSlide;
} else {
performStepAnimation(nextSlide);
}
}
|
[
"public",
"void",
"showSlideStep",
"(",
"final",
"SlideStep",
"slideStep",
")",
"{",
"if",
"(",
"this",
".",
"subSlides",
".",
"size",
"(",
")",
">=",
"model",
"(",
")",
".",
"getStepPosition",
"(",
")",
"||",
"this",
".",
"subSlides",
".",
"get",
"(",
"model",
"(",
")",
".",
"getStepPosition",
"(",
")",
")",
"==",
"null",
")",
"{",
"addSubSlide",
"(",
"buildDefaultContent",
"(",
"model",
"(",
")",
".",
"getContent",
"(",
"slideStep",
")",
")",
")",
";",
"}",
"final",
"Node",
"nextSlide",
"=",
"this",
".",
"subSlides",
".",
"get",
"(",
"model",
"(",
")",
".",
"getStepPosition",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"currentSubSlide",
"==",
"null",
"||",
"nextSlide",
"==",
"null",
")",
"{",
"// No Animation",
"this",
".",
"currentSubSlide",
"=",
"nextSlide",
";",
"}",
"else",
"{",
"performStepAnimation",
"(",
"nextSlide",
")",
";",
"}",
"}"
] |
Show the slide step store which match with XML file.
@param slideStep the slide step to show
|
[
"Show",
"the",
"slide",
"step",
"store",
"which",
"match",
"with",
"XML",
"file",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L559-L573
|
8,355 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.showCustomSlideStep
|
protected void showCustomSlideStep(final Node node) {
addSubSlide(node);
final Node nextSlide = this.subSlides.get(model().getStepPosition());
if (this.currentSubSlide == null || nextSlide == null) {
// No Animation
this.currentSubSlide = nextSlide;
} else {
performStepAnimation(nextSlide);
}
}
|
java
|
protected void showCustomSlideStep(final Node node) {
addSubSlide(node);
final Node nextSlide = this.subSlides.get(model().getStepPosition());
if (this.currentSubSlide == null || nextSlide == null) {
// No Animation
this.currentSubSlide = nextSlide;
} else {
performStepAnimation(nextSlide);
}
}
|
[
"protected",
"void",
"showCustomSlideStep",
"(",
"final",
"Node",
"node",
")",
"{",
"addSubSlide",
"(",
"node",
")",
";",
"final",
"Node",
"nextSlide",
"=",
"this",
".",
"subSlides",
".",
"get",
"(",
"model",
"(",
")",
".",
"getStepPosition",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"currentSubSlide",
"==",
"null",
"||",
"nextSlide",
"==",
"null",
")",
"{",
"// No Animation",
"this",
".",
"currentSubSlide",
"=",
"nextSlide",
";",
"}",
"else",
"{",
"performStepAnimation",
"(",
"nextSlide",
")",
";",
"}",
"}"
] |
Show a programmatic built node as a sub slide.
@param node the node built programmatically
|
[
"Show",
"a",
"programmatic",
"built",
"node",
"as",
"a",
"sub",
"slide",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L580-L591
|
8,356 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
|
AbstractTemplateView.performStepAnimation
|
private void performStepAnimation(final Node nextSlide) {
// setSlideLocked(true);
this.slideStepAnimation = ParallelTransitionBuilder.create()
.onFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent event) {
AbstractTemplateView.this.currentSubSlide = nextSlide;
// AbstractTemplateView.this.setSlideLocked(false);
}
})
.children(
SequentialTransitionBuilder.create()
.node(this.currentSubSlide)
.children(
TranslateTransitionBuilder.create()
.duration(Duration.millis(400))
.fromY(0)
.toY(-700)
// .fromZ(-10)
.build(),
TimelineBuilder.create()
.keyFrames(
new KeyFrame(
Duration.millis(0),
new KeyValue(
this.currentSubSlide.visibleProperty(),
true)),
new KeyFrame(
Duration.millis(1),
new KeyValue(
this.currentSubSlide.visibleProperty(),
false)))
.build())
.build(),
SequentialTransitionBuilder.create()
.node(nextSlide)
.children(
TimelineBuilder.create()
.keyFrames(
new KeyFrame(
Duration.millis(0),
new KeyValue(
nextSlide.visibleProperty(),
false)),
new KeyFrame(
Duration.millis(1),
new KeyValue(
nextSlide.visibleProperty(),
true)))
.build(),
TranslateTransitionBuilder.create()
.duration(Duration.millis(400))
.fromY(700)
.toY(0)
// .fromZ(-10)
.build())
.build())
.build();
this.slideStepAnimation.play();
}
|
java
|
private void performStepAnimation(final Node nextSlide) {
// setSlideLocked(true);
this.slideStepAnimation = ParallelTransitionBuilder.create()
.onFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent event) {
AbstractTemplateView.this.currentSubSlide = nextSlide;
// AbstractTemplateView.this.setSlideLocked(false);
}
})
.children(
SequentialTransitionBuilder.create()
.node(this.currentSubSlide)
.children(
TranslateTransitionBuilder.create()
.duration(Duration.millis(400))
.fromY(0)
.toY(-700)
// .fromZ(-10)
.build(),
TimelineBuilder.create()
.keyFrames(
new KeyFrame(
Duration.millis(0),
new KeyValue(
this.currentSubSlide.visibleProperty(),
true)),
new KeyFrame(
Duration.millis(1),
new KeyValue(
this.currentSubSlide.visibleProperty(),
false)))
.build())
.build(),
SequentialTransitionBuilder.create()
.node(nextSlide)
.children(
TimelineBuilder.create()
.keyFrames(
new KeyFrame(
Duration.millis(0),
new KeyValue(
nextSlide.visibleProperty(),
false)),
new KeyFrame(
Duration.millis(1),
new KeyValue(
nextSlide.visibleProperty(),
true)))
.build(),
TranslateTransitionBuilder.create()
.duration(Duration.millis(400))
.fromY(700)
.toY(0)
// .fromZ(-10)
.build())
.build())
.build();
this.slideStepAnimation.play();
}
|
[
"private",
"void",
"performStepAnimation",
"(",
"final",
"Node",
"nextSlide",
")",
"{",
"// setSlideLocked(true);",
"this",
".",
"slideStepAnimation",
"=",
"ParallelTransitionBuilder",
".",
"create",
"(",
")",
".",
"onFinished",
"(",
"new",
"EventHandler",
"<",
"ActionEvent",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"final",
"ActionEvent",
"event",
")",
"{",
"AbstractTemplateView",
".",
"this",
".",
"currentSubSlide",
"=",
"nextSlide",
";",
"// AbstractTemplateView.this.setSlideLocked(false);",
"}",
"}",
")",
".",
"children",
"(",
"SequentialTransitionBuilder",
".",
"create",
"(",
")",
".",
"node",
"(",
"this",
".",
"currentSubSlide",
")",
".",
"children",
"(",
"TranslateTransitionBuilder",
".",
"create",
"(",
")",
".",
"duration",
"(",
"Duration",
".",
"millis",
"(",
"400",
")",
")",
".",
"fromY",
"(",
"0",
")",
".",
"toY",
"(",
"-",
"700",
")",
"// .fromZ(-10)",
".",
"build",
"(",
")",
",",
"TimelineBuilder",
".",
"create",
"(",
")",
".",
"keyFrames",
"(",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"0",
")",
",",
"new",
"KeyValue",
"(",
"this",
".",
"currentSubSlide",
".",
"visibleProperty",
"(",
")",
",",
"true",
")",
")",
",",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"1",
")",
",",
"new",
"KeyValue",
"(",
"this",
".",
"currentSubSlide",
".",
"visibleProperty",
"(",
")",
",",
"false",
")",
")",
")",
".",
"build",
"(",
")",
")",
".",
"build",
"(",
")",
",",
"SequentialTransitionBuilder",
".",
"create",
"(",
")",
".",
"node",
"(",
"nextSlide",
")",
".",
"children",
"(",
"TimelineBuilder",
".",
"create",
"(",
")",
".",
"keyFrames",
"(",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"0",
")",
",",
"new",
"KeyValue",
"(",
"nextSlide",
".",
"visibleProperty",
"(",
")",
",",
"false",
")",
")",
",",
"new",
"KeyFrame",
"(",
"Duration",
".",
"millis",
"(",
"1",
")",
",",
"new",
"KeyValue",
"(",
"nextSlide",
".",
"visibleProperty",
"(",
")",
",",
"true",
")",
")",
")",
".",
"build",
"(",
")",
",",
"TranslateTransitionBuilder",
".",
"create",
"(",
")",
".",
"duration",
"(",
"Duration",
".",
"millis",
"(",
"400",
")",
")",
".",
"fromY",
"(",
"700",
")",
".",
"toY",
"(",
"0",
")",
"// .fromZ(-10)",
".",
"build",
"(",
")",
")",
".",
"build",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"this",
".",
"slideStepAnimation",
".",
"play",
"(",
")",
";",
"}"
] |
Create an Launch the animation between two sub slides.
@param nextSlide the next subSlide to show
|
[
"Create",
"an",
"Launch",
"the",
"animation",
"between",
"two",
"sub",
"slides",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L610-L675
|
8,357 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/facade/JRebirthEventBase.java
|
JRebirthEventBase.parseString
|
private void parseString(final String eventSerialized) {
final StringTokenizer st = new StringTokenizer(eventSerialized, ClassUtility.SEPARATOR);
if (st.countTokens() >= 5) {
sequence(Integer.parseInt(st.nextToken()))
.eventType(JRebirthEventType.valueOf(st.nextToken()))
.source(st.nextToken())
.target(st.nextToken())
.eventData(st.nextToken());
}
}
|
java
|
private void parseString(final String eventSerialized) {
final StringTokenizer st = new StringTokenizer(eventSerialized, ClassUtility.SEPARATOR);
if (st.countTokens() >= 5) {
sequence(Integer.parseInt(st.nextToken()))
.eventType(JRebirthEventType.valueOf(st.nextToken()))
.source(st.nextToken())
.target(st.nextToken())
.eventData(st.nextToken());
}
}
|
[
"private",
"void",
"parseString",
"(",
"final",
"String",
"eventSerialized",
")",
"{",
"final",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"eventSerialized",
",",
"ClassUtility",
".",
"SEPARATOR",
")",
";",
"if",
"(",
"st",
".",
"countTokens",
"(",
")",
">=",
"5",
")",
"{",
"sequence",
"(",
"Integer",
".",
"parseInt",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
")",
".",
"eventType",
"(",
"JRebirthEventType",
".",
"valueOf",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
")",
".",
"source",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
".",
"target",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
".",
"eventData",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
";",
"}",
"}"
] |
Parse the serialized string.
@param eventSerialized the serialized string
|
[
"Parse",
"the",
"serialized",
"string",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/facade/JRebirthEventBase.java#L181-L190
|
8,358 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/color/ColorBuilder.java
|
ColorBuilder.buildHSBColor
|
private Color buildHSBColor(final HSBColor hsbColor) {
Color color = null;
if (hsbColor.opacity() >= 1.0) {
color = Color.hsb(hsbColor.hue(), hsbColor.saturation(), hsbColor.brightness());
} else {
color = Color.hsb(hsbColor.hue(), hsbColor.saturation(), hsbColor.brightness(), hsbColor.opacity());
}
return color;
}
|
java
|
private Color buildHSBColor(final HSBColor hsbColor) {
Color color = null;
if (hsbColor.opacity() >= 1.0) {
color = Color.hsb(hsbColor.hue(), hsbColor.saturation(), hsbColor.brightness());
} else {
color = Color.hsb(hsbColor.hue(), hsbColor.saturation(), hsbColor.brightness(), hsbColor.opacity());
}
return color;
}
|
[
"private",
"Color",
"buildHSBColor",
"(",
"final",
"HSBColor",
"hsbColor",
")",
"{",
"Color",
"color",
"=",
"null",
";",
"if",
"(",
"hsbColor",
".",
"opacity",
"(",
")",
">=",
"1.0",
")",
"{",
"color",
"=",
"Color",
".",
"hsb",
"(",
"hsbColor",
".",
"hue",
"(",
")",
",",
"hsbColor",
".",
"saturation",
"(",
")",
",",
"hsbColor",
".",
"brightness",
"(",
")",
")",
";",
"}",
"else",
"{",
"color",
"=",
"Color",
".",
"hsb",
"(",
"hsbColor",
".",
"hue",
"(",
")",
",",
"hsbColor",
".",
"saturation",
"(",
")",
",",
"hsbColor",
".",
"brightness",
"(",
")",
",",
"hsbColor",
".",
"opacity",
"(",
")",
")",
";",
"}",
"return",
"color",
";",
"}"
] |
Build an HSB color.
@param hsbColor the hsb color enum
@return the javafx color
|
[
"Build",
"an",
"HSB",
"color",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/color/ColorBuilder.java#L116-L124
|
8,359 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/color/ColorBuilder.java
|
ColorBuilder.buildGrayColor
|
private Color buildGrayColor(final GrayColor gColor) {
Color color = null;
if (gColor.opacity() >= 1.0) {
color = Color.gray(gColor.gray());
} else {
color = Color.gray(gColor.gray(), gColor.opacity());
}
return color;
}
|
java
|
private Color buildGrayColor(final GrayColor gColor) {
Color color = null;
if (gColor.opacity() >= 1.0) {
color = Color.gray(gColor.gray());
} else {
color = Color.gray(gColor.gray(), gColor.opacity());
}
return color;
}
|
[
"private",
"Color",
"buildGrayColor",
"(",
"final",
"GrayColor",
"gColor",
")",
"{",
"Color",
"color",
"=",
"null",
";",
"if",
"(",
"gColor",
".",
"opacity",
"(",
")",
">=",
"1.0",
")",
"{",
"color",
"=",
"Color",
".",
"gray",
"(",
"gColor",
".",
"gray",
"(",
")",
")",
";",
"}",
"else",
"{",
"color",
"=",
"Color",
".",
"gray",
"(",
"gColor",
".",
"gray",
"(",
")",
",",
"gColor",
".",
"opacity",
"(",
")",
")",
";",
"}",
"return",
"color",
";",
"}"
] |
Build a Gray color.
@param gColor the gray color enum
@return the javafx color
|
[
"Build",
"a",
"Gray",
"color",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/color/ColorBuilder.java#L133-L141
|
8,360 |
JRebirth/JRebirth
|
org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneView.java
|
TabbedPaneView.buildButtonBar
|
private Pane buildButtonBar(final boolean isHorizontal) {
if (isHorizontal) {
this.box = new HBox();
this.box.setMaxWidth(Region.USE_COMPUTED_SIZE);
this.box.getStyleClass().add("HorizontalTabbedPane");
} else {
this.box = new VBox();
this.box.setMaxHeight(Region.USE_COMPUTED_SIZE);
this.box.getStyleClass().add("VerticalTabbedPane");
}
switch (model().object().orientation()) {
case top:
this.box.getStyleClass().add("Top");
((HBox) this.box).setAlignment(Pos.BOTTOM_LEFT);
break;
case bottom:
this.box.getStyleClass().add("Bottom");
((HBox) this.box).setAlignment(Pos.TOP_RIGHT);
break;
case left:
this.box.getStyleClass().add("Left");
((VBox) this.box).setAlignment(Pos.TOP_RIGHT);
break;
case right:
this.box.getStyleClass().add("Right");
((VBox) this.box).setAlignment(Pos.TOP_LEFT);
break;
}
return this.box;
}
|
java
|
private Pane buildButtonBar(final boolean isHorizontal) {
if (isHorizontal) {
this.box = new HBox();
this.box.setMaxWidth(Region.USE_COMPUTED_SIZE);
this.box.getStyleClass().add("HorizontalTabbedPane");
} else {
this.box = new VBox();
this.box.setMaxHeight(Region.USE_COMPUTED_SIZE);
this.box.getStyleClass().add("VerticalTabbedPane");
}
switch (model().object().orientation()) {
case top:
this.box.getStyleClass().add("Top");
((HBox) this.box).setAlignment(Pos.BOTTOM_LEFT);
break;
case bottom:
this.box.getStyleClass().add("Bottom");
((HBox) this.box).setAlignment(Pos.TOP_RIGHT);
break;
case left:
this.box.getStyleClass().add("Left");
((VBox) this.box).setAlignment(Pos.TOP_RIGHT);
break;
case right:
this.box.getStyleClass().add("Right");
((VBox) this.box).setAlignment(Pos.TOP_LEFT);
break;
}
return this.box;
}
|
[
"private",
"Pane",
"buildButtonBar",
"(",
"final",
"boolean",
"isHorizontal",
")",
"{",
"if",
"(",
"isHorizontal",
")",
"{",
"this",
".",
"box",
"=",
"new",
"HBox",
"(",
")",
";",
"this",
".",
"box",
".",
"setMaxWidth",
"(",
"Region",
".",
"USE_COMPUTED_SIZE",
")",
";",
"this",
".",
"box",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"\"HorizontalTabbedPane\"",
")",
";",
"}",
"else",
"{",
"this",
".",
"box",
"=",
"new",
"VBox",
"(",
")",
";",
"this",
".",
"box",
".",
"setMaxHeight",
"(",
"Region",
".",
"USE_COMPUTED_SIZE",
")",
";",
"this",
".",
"box",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"\"VerticalTabbedPane\"",
")",
";",
"}",
"switch",
"(",
"model",
"(",
")",
".",
"object",
"(",
")",
".",
"orientation",
"(",
")",
")",
"{",
"case",
"top",
":",
"this",
".",
"box",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"\"Top\"",
")",
";",
"(",
"(",
"HBox",
")",
"this",
".",
"box",
")",
".",
"setAlignment",
"(",
"Pos",
".",
"BOTTOM_LEFT",
")",
";",
"break",
";",
"case",
"bottom",
":",
"this",
".",
"box",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"\"Bottom\"",
")",
";",
"(",
"(",
"HBox",
")",
"this",
".",
"box",
")",
".",
"setAlignment",
"(",
"Pos",
".",
"TOP_RIGHT",
")",
";",
"break",
";",
"case",
"left",
":",
"this",
".",
"box",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"\"Left\"",
")",
";",
"(",
"(",
"VBox",
")",
"this",
".",
"box",
")",
".",
"setAlignment",
"(",
"Pos",
".",
"TOP_RIGHT",
")",
";",
"break",
";",
"case",
"right",
":",
"this",
".",
"box",
".",
"getStyleClass",
"(",
")",
".",
"add",
"(",
"\"Right\"",
")",
";",
"(",
"(",
"VBox",
")",
"this",
".",
"box",
")",
".",
"setAlignment",
"(",
"Pos",
".",
"TOP_LEFT",
")",
";",
"break",
";",
"}",
"return",
"this",
".",
"box",
";",
"}"
] |
Builds the button bar.
@param isHorizontal the is horizontal
@return the pane
|
[
"Builds",
"the",
"button",
"bar",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneView.java#L151-L186
|
8,361 |
JRebirth/JRebirth
|
org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneView.java
|
TabbedPaneView.addTab
|
public SequentialTransition addTab(int idx, final Dockable tab) {
final SequentialTransition seq = new SequentialTransition();
final ToggleButton b = new ToggleButton(tab.name());// , new ImageView(model().getBehavior(DockableBehavior.class).modelIcon()));
b.setToggleGroup(this.group);
// b.getStyleClass().clear();
b.setUserData(tab);
final ToggleButton oldButton = this.buttonByTab.put(tab.name(), b);
final int previousIndex = this.box.getChildren().indexOf(oldButton);
if (previousIndex >= 0 && previousIndex < idx) {
idx++;
}
selectTab(tab);
controller().initTabEventHandler(b);
if (idx < 0 || idx > this.box.getChildren().size()) {
idx = this.box.getChildren().size();
}
b.setScaleX(0.0);
this.box.getChildren().add(idx, b);
if (this.box instanceof HBox) {
HBox.setMargin(b, new Insets(0, 1, 0, 0));
} else if (this.box instanceof VBox) {
VBox.setMargin(b, new Insets(1, 0, 0, 0));
}
final ScaleTransition st = new ScaleTransition(Duration.millis(600));
st.setNode(b);
st.setFromX(0.0);
st.setToX(1.0);
seq.getChildren().add(st);
return seq;
}
|
java
|
public SequentialTransition addTab(int idx, final Dockable tab) {
final SequentialTransition seq = new SequentialTransition();
final ToggleButton b = new ToggleButton(tab.name());// , new ImageView(model().getBehavior(DockableBehavior.class).modelIcon()));
b.setToggleGroup(this.group);
// b.getStyleClass().clear();
b.setUserData(tab);
final ToggleButton oldButton = this.buttonByTab.put(tab.name(), b);
final int previousIndex = this.box.getChildren().indexOf(oldButton);
if (previousIndex >= 0 && previousIndex < idx) {
idx++;
}
selectTab(tab);
controller().initTabEventHandler(b);
if (idx < 0 || idx > this.box.getChildren().size()) {
idx = this.box.getChildren().size();
}
b.setScaleX(0.0);
this.box.getChildren().add(idx, b);
if (this.box instanceof HBox) {
HBox.setMargin(b, new Insets(0, 1, 0, 0));
} else if (this.box instanceof VBox) {
VBox.setMargin(b, new Insets(1, 0, 0, 0));
}
final ScaleTransition st = new ScaleTransition(Duration.millis(600));
st.setNode(b);
st.setFromX(0.0);
st.setToX(1.0);
seq.getChildren().add(st);
return seq;
}
|
[
"public",
"SequentialTransition",
"addTab",
"(",
"int",
"idx",
",",
"final",
"Dockable",
"tab",
")",
"{",
"final",
"SequentialTransition",
"seq",
"=",
"new",
"SequentialTransition",
"(",
")",
";",
"final",
"ToggleButton",
"b",
"=",
"new",
"ToggleButton",
"(",
"tab",
".",
"name",
"(",
")",
")",
";",
"// , new ImageView(model().getBehavior(DockableBehavior.class).modelIcon()));",
"b",
".",
"setToggleGroup",
"(",
"this",
".",
"group",
")",
";",
"// b.getStyleClass().clear();",
"b",
".",
"setUserData",
"(",
"tab",
")",
";",
"final",
"ToggleButton",
"oldButton",
"=",
"this",
".",
"buttonByTab",
".",
"put",
"(",
"tab",
".",
"name",
"(",
")",
",",
"b",
")",
";",
"final",
"int",
"previousIndex",
"=",
"this",
".",
"box",
".",
"getChildren",
"(",
")",
".",
"indexOf",
"(",
"oldButton",
")",
";",
"if",
"(",
"previousIndex",
">=",
"0",
"&&",
"previousIndex",
"<",
"idx",
")",
"{",
"idx",
"++",
";",
"}",
"selectTab",
"(",
"tab",
")",
";",
"controller",
"(",
")",
".",
"initTabEventHandler",
"(",
"b",
")",
";",
"if",
"(",
"idx",
"<",
"0",
"||",
"idx",
">",
"this",
".",
"box",
".",
"getChildren",
"(",
")",
".",
"size",
"(",
")",
")",
"{",
"idx",
"=",
"this",
".",
"box",
".",
"getChildren",
"(",
")",
".",
"size",
"(",
")",
";",
"}",
"b",
".",
"setScaleX",
"(",
"0.0",
")",
";",
"this",
".",
"box",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"idx",
",",
"b",
")",
";",
"if",
"(",
"this",
".",
"box",
"instanceof",
"HBox",
")",
"{",
"HBox",
".",
"setMargin",
"(",
"b",
",",
"new",
"Insets",
"(",
"0",
",",
"1",
",",
"0",
",",
"0",
")",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"box",
"instanceof",
"VBox",
")",
"{",
"VBox",
".",
"setMargin",
"(",
"b",
",",
"new",
"Insets",
"(",
"1",
",",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"}",
"final",
"ScaleTransition",
"st",
"=",
"new",
"ScaleTransition",
"(",
"Duration",
".",
"millis",
"(",
"600",
")",
")",
";",
"st",
".",
"setNode",
"(",
"b",
")",
";",
"st",
".",
"setFromX",
"(",
"0.0",
")",
";",
"st",
".",
"setToX",
"(",
"1.0",
")",
";",
"seq",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"st",
")",
";",
"return",
"seq",
";",
"}"
] |
Adds the tab.
@param idx the idx
@param tab the tab
|
[
"Adds",
"the",
"tab",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneView.java#L194-L234
|
8,362 |
JRebirth/JRebirth
|
org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneView.java
|
TabbedPaneView.selectTab
|
void selectTab(final Dockable t) {
// Remove all previously displayed children
this.stackPane.getChildren().clear();
//
this.stackPane.getChildren().add(model().getModel(t.modelKey()).node());
}
|
java
|
void selectTab(final Dockable t) {
// Remove all previously displayed children
this.stackPane.getChildren().clear();
//
this.stackPane.getChildren().add(model().getModel(t.modelKey()).node());
}
|
[
"void",
"selectTab",
"(",
"final",
"Dockable",
"t",
")",
"{",
"// Remove all previously displayed children",
"this",
".",
"stackPane",
".",
"getChildren",
"(",
")",
".",
"clear",
"(",
")",
";",
"//",
"this",
".",
"stackPane",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"model",
"(",
")",
".",
"getModel",
"(",
"t",
".",
"modelKey",
"(",
")",
")",
".",
"node",
"(",
")",
")",
";",
"}"
] |
Select tab.
@param t the t
|
[
"Select",
"tab",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneView.java#L258-L263
|
8,363 |
JRebirth/JRebirth
|
org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneView.java
|
TabbedPaneView.removeMarker
|
public int removeMarker() {
System.out.println("Remove Marker");
final int idx = getBox().getChildren().indexOf(this.marker);
getBox().getChildren().remove(this.marker);
return idx;
}
|
java
|
public int removeMarker() {
System.out.println("Remove Marker");
final int idx = getBox().getChildren().indexOf(this.marker);
getBox().getChildren().remove(this.marker);
return idx;
}
|
[
"public",
"int",
"removeMarker",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Remove Marker\"",
")",
";",
"final",
"int",
"idx",
"=",
"getBox",
"(",
")",
".",
"getChildren",
"(",
")",
".",
"indexOf",
"(",
"this",
".",
"marker",
")",
";",
"getBox",
"(",
")",
".",
"getChildren",
"(",
")",
".",
"remove",
"(",
"this",
".",
"marker",
")",
";",
"return",
"idx",
";",
"}"
] |
Removes the marker.
@return the int
|
[
"Removes",
"the",
"marker",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneView.java#L340-L345
|
8,364 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/command/ProcessEventCommand.java
|
ProcessEventCommand.createBallModel
|
private void createBallModel(final JRebirthEvent event) {
switch (event.eventType()) {
case CREATE_APPLICATION:
case CREATE_NOTIFIER:
case CREATE_GLOBAL_FACADE:
case CREATE_COMMAND_FACADE:
case CREATE_SERVICE_FACADE:
case CREATE_UI_FACADE:
case CREATE_COMMAND:
case CREATE_SERVICE:
case CREATE_MODEL:
case CREATE_VIEW:
case CREATE_CONTROLLER:
// final BallModel ballModel = getModel(BallModel.class, event);
callCommand(CreateBallCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
break;
case CREATE_WAVE:
default:
}
}
|
java
|
private void createBallModel(final JRebirthEvent event) {
switch (event.eventType()) {
case CREATE_APPLICATION:
case CREATE_NOTIFIER:
case CREATE_GLOBAL_FACADE:
case CREATE_COMMAND_FACADE:
case CREATE_SERVICE_FACADE:
case CREATE_UI_FACADE:
case CREATE_COMMAND:
case CREATE_SERVICE:
case CREATE_MODEL:
case CREATE_VIEW:
case CREATE_CONTROLLER:
// final BallModel ballModel = getModel(BallModel.class, event);
callCommand(CreateBallCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
break;
case CREATE_WAVE:
default:
}
}
|
[
"private",
"void",
"createBallModel",
"(",
"final",
"JRebirthEvent",
"event",
")",
"{",
"switch",
"(",
"event",
".",
"eventType",
"(",
")",
")",
"{",
"case",
"CREATE_APPLICATION",
":",
"case",
"CREATE_NOTIFIER",
":",
"case",
"CREATE_GLOBAL_FACADE",
":",
"case",
"CREATE_COMMAND_FACADE",
":",
"case",
"CREATE_SERVICE_FACADE",
":",
"case",
"CREATE_UI_FACADE",
":",
"case",
"CREATE_COMMAND",
":",
"case",
"CREATE_SERVICE",
":",
"case",
"CREATE_MODEL",
":",
"case",
"CREATE_VIEW",
":",
"case",
"CREATE_CONTROLLER",
":",
"// final BallModel ballModel = getModel(BallModel.class, event);\r",
"callCommand",
"(",
"CreateBallCommand",
".",
"class",
",",
"WBuilder",
".",
"waveData",
"(",
"EditorWaves",
".",
"EVENT",
",",
"event",
")",
")",
";",
"break",
";",
"case",
"CREATE_WAVE",
":",
"default",
":",
"}",
"}"
] |
Create a ballModel instance.
@param event the create event
|
[
"Create",
"a",
"ballModel",
"instance",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/command/ProcessEventCommand.java#L55-L75
|
8,365 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/command/ProcessEventCommand.java
|
ProcessEventCommand.accessBallModel
|
private void accessBallModel(final JRebirthEvent event) {
switch (event.eventType()) {
case ACCESS_COMMAND:
case ACCESS_CONTROLLER:
case ACCESS_MODEL:
case ACCESS_SERVICE:
case ACCESS_VIEW:
// final BallModel ballModel = getModel(BallModel.class, event);
callCommand(AccessBallCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
break;
default:
}
}
|
java
|
private void accessBallModel(final JRebirthEvent event) {
switch (event.eventType()) {
case ACCESS_COMMAND:
case ACCESS_CONTROLLER:
case ACCESS_MODEL:
case ACCESS_SERVICE:
case ACCESS_VIEW:
// final BallModel ballModel = getModel(BallModel.class, event);
callCommand(AccessBallCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
break;
default:
}
}
|
[
"private",
"void",
"accessBallModel",
"(",
"final",
"JRebirthEvent",
"event",
")",
"{",
"switch",
"(",
"event",
".",
"eventType",
"(",
")",
")",
"{",
"case",
"ACCESS_COMMAND",
":",
"case",
"ACCESS_CONTROLLER",
":",
"case",
"ACCESS_MODEL",
":",
"case",
"ACCESS_SERVICE",
":",
"case",
"ACCESS_VIEW",
":",
"// final BallModel ballModel = getModel(BallModel.class, event);\r",
"callCommand",
"(",
"AccessBallCommand",
".",
"class",
",",
"WBuilder",
".",
"waveData",
"(",
"EditorWaves",
".",
"EVENT",
",",
"event",
")",
")",
";",
"break",
";",
"default",
":",
"}",
"}"
] |
Access to a ballModel instance.
@param event the access event
|
[
"Access",
"to",
"a",
"ballModel",
"instance",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/command/ProcessEventCommand.java#L82-L94
|
8,366 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/command/ProcessEventCommand.java
|
ProcessEventCommand.destroyBallModel
|
private void destroyBallModel(final JRebirthEvent event) {
switch (event.eventType()) {
case DESTROY_COMMAND:
case DESTROY_SERVICE:
case DESTROY_MODEL:
case DESTROY_VIEW:
case DESTROY_CONTROLLER:
// final BallModel ballModel = getModel(BallModel.class, event);
callCommand(DestroyBallCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
break;
case DESTROY_WAVE:
default:
}
}
|
java
|
private void destroyBallModel(final JRebirthEvent event) {
switch (event.eventType()) {
case DESTROY_COMMAND:
case DESTROY_SERVICE:
case DESTROY_MODEL:
case DESTROY_VIEW:
case DESTROY_CONTROLLER:
// final BallModel ballModel = getModel(BallModel.class, event);
callCommand(DestroyBallCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
break;
case DESTROY_WAVE:
default:
}
}
|
[
"private",
"void",
"destroyBallModel",
"(",
"final",
"JRebirthEvent",
"event",
")",
"{",
"switch",
"(",
"event",
".",
"eventType",
"(",
")",
")",
"{",
"case",
"DESTROY_COMMAND",
":",
"case",
"DESTROY_SERVICE",
":",
"case",
"DESTROY_MODEL",
":",
"case",
"DESTROY_VIEW",
":",
"case",
"DESTROY_CONTROLLER",
":",
"// final BallModel ballModel = getModel(BallModel.class, event);\r",
"callCommand",
"(",
"DestroyBallCommand",
".",
"class",
",",
"WBuilder",
".",
"waveData",
"(",
"EditorWaves",
".",
"EVENT",
",",
"event",
")",
")",
";",
"break",
";",
"case",
"DESTROY_WAVE",
":",
"default",
":",
"}",
"}"
] |
Destroy a ball model.
@param event the destroy event
|
[
"Destroy",
"a",
"ball",
"model",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/command/ProcessEventCommand.java#L101-L115
|
8,367 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/key/MultitonKey.java
|
MultitonKey.buildObjectKey
|
private String buildObjectKey(final Object object) {
String objectKey = null;
final Class<?> objectClass = object.getClass();
final KeyGenerator typeGenerator = objectClass.getAnnotation(KeyGenerator.class);
if (typeGenerator == null) {
objectKey = generateAggregatedKey(object);
} else {
objectKey = generateTypeKey(object, typeGenerator);
}
// If no Type keyGenerator neither Method Generator were used, use the default toString method
if (objectKey == null) {
objectKey = object.toString();
}
return objectKey;
}
|
java
|
private String buildObjectKey(final Object object) {
String objectKey = null;
final Class<?> objectClass = object.getClass();
final KeyGenerator typeGenerator = objectClass.getAnnotation(KeyGenerator.class);
if (typeGenerator == null) {
objectKey = generateAggregatedKey(object);
} else {
objectKey = generateTypeKey(object, typeGenerator);
}
// If no Type keyGenerator neither Method Generator were used, use the default toString method
if (objectKey == null) {
objectKey = object.toString();
}
return objectKey;
}
|
[
"private",
"String",
"buildObjectKey",
"(",
"final",
"Object",
"object",
")",
"{",
"String",
"objectKey",
"=",
"null",
";",
"final",
"Class",
"<",
"?",
">",
"objectClass",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"final",
"KeyGenerator",
"typeGenerator",
"=",
"objectClass",
".",
"getAnnotation",
"(",
"KeyGenerator",
".",
"class",
")",
";",
"if",
"(",
"typeGenerator",
"==",
"null",
")",
"{",
"objectKey",
"=",
"generateAggregatedKey",
"(",
"object",
")",
";",
"}",
"else",
"{",
"objectKey",
"=",
"generateTypeKey",
"(",
"object",
",",
"typeGenerator",
")",
";",
"}",
"// If no Type keyGenerator neither Method Generator were used, use the default toString method\r",
"if",
"(",
"objectKey",
"==",
"null",
")",
"{",
"objectKey",
"=",
"object",
".",
"toString",
"(",
")",
";",
"}",
"return",
"objectKey",
";",
"}"
] |
Generate the string key for an object.
@param object the object which is part of the global key
@return the unique string for this object
|
[
"Generate",
"the",
"string",
"key",
"for",
"an",
"object",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/key/MultitonKey.java#L93-L111
|
8,368 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/key/MultitonKey.java
|
MultitonKey.generateTypeKey
|
private String generateTypeKey(final Object object, final KeyGenerator typeGenerator) {
String objectKey = null;
Method method = null;
try {
method = object.getClass().getMethod(typeGenerator.value());
objectKey = (String) method.invoke(object);
} catch (final NoSuchMethodException e) {
LOGGER.log(METHOD_NOT_FOUND, typeGenerator.value(), object.getClass().getSimpleName(), e);
} catch (final SecurityException e) {
LOGGER.log(NO_KEY_GENERATOR_METHOD, typeGenerator.value(), object.getClass().getSimpleName(), e);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
LOGGER.log(KEY_GENERATOR_FAILURE, typeGenerator.value(), object.getClass().getSimpleName(), e);
}
return objectKey;
}
|
java
|
private String generateTypeKey(final Object object, final KeyGenerator typeGenerator) {
String objectKey = null;
Method method = null;
try {
method = object.getClass().getMethod(typeGenerator.value());
objectKey = (String) method.invoke(object);
} catch (final NoSuchMethodException e) {
LOGGER.log(METHOD_NOT_FOUND, typeGenerator.value(), object.getClass().getSimpleName(), e);
} catch (final SecurityException e) {
LOGGER.log(NO_KEY_GENERATOR_METHOD, typeGenerator.value(), object.getClass().getSimpleName(), e);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
LOGGER.log(KEY_GENERATOR_FAILURE, typeGenerator.value(), object.getClass().getSimpleName(), e);
}
return objectKey;
}
|
[
"private",
"String",
"generateTypeKey",
"(",
"final",
"Object",
"object",
",",
"final",
"KeyGenerator",
"typeGenerator",
")",
"{",
"String",
"objectKey",
"=",
"null",
";",
"Method",
"method",
"=",
"null",
";",
"try",
"{",
"method",
"=",
"object",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"typeGenerator",
".",
"value",
"(",
")",
")",
";",
"objectKey",
"=",
"(",
"String",
")",
"method",
".",
"invoke",
"(",
"object",
")",
";",
"}",
"catch",
"(",
"final",
"NoSuchMethodException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"METHOD_NOT_FOUND",
",",
"typeGenerator",
".",
"value",
"(",
")",
",",
"object",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"SecurityException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"NO_KEY_GENERATOR_METHOD",
",",
"typeGenerator",
".",
"value",
"(",
")",
",",
"object",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"IllegalArgumentException",
"|",
"InvocationTargetException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"KEY_GENERATOR_FAILURE",
",",
"typeGenerator",
".",
"value",
"(",
")",
",",
"object",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"objectKey",
";",
"}"
] |
Generate Type key by using the class-level annotation.
@param object the source object
@param typeGenerator the annotation that expressed how generate the string unique key
@return the unique key or null if an error occurred
|
[
"Generate",
"Type",
"key",
"by",
"using",
"the",
"class",
"-",
"level",
"annotation",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/key/MultitonKey.java#L121-L136
|
8,369 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/key/MultitonKey.java
|
MultitonKey.generateAggregatedKey
|
private String generateAggregatedKey(final Object object) {
// Store the aggregated key
final StringBuilder sb = new StringBuilder();
KeyGenerator methodGenerator;
// Search for method annotation
for (final Method m : object.getClass().getMethods()) {
methodGenerator = m.getAnnotation(KeyGenerator.class);
if (methodGenerator != null) {
Object returnedValue = null;
try {
returnedValue = m.invoke(object);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
LOGGER.log(METHOD_KEY_GENERATOR_FAILURE, m.getName(), object.getClass().getSimpleName(), e);
}
if (returnedValue == null) {
// returned value is null
LOGGER.log(NULL_METHOD_KEY, m.getName(), object.getClass().getSimpleName());
} else {
sb.append(convertMethodKeyObject(methodGenerator, returnedValue));
}
}
}
return sb.toString().isEmpty() ? null : sb.toString();
}
|
java
|
private String generateAggregatedKey(final Object object) {
// Store the aggregated key
final StringBuilder sb = new StringBuilder();
KeyGenerator methodGenerator;
// Search for method annotation
for (final Method m : object.getClass().getMethods()) {
methodGenerator = m.getAnnotation(KeyGenerator.class);
if (methodGenerator != null) {
Object returnedValue = null;
try {
returnedValue = m.invoke(object);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
LOGGER.log(METHOD_KEY_GENERATOR_FAILURE, m.getName(), object.getClass().getSimpleName(), e);
}
if (returnedValue == null) {
// returned value is null
LOGGER.log(NULL_METHOD_KEY, m.getName(), object.getClass().getSimpleName());
} else {
sb.append(convertMethodKeyObject(methodGenerator, returnedValue));
}
}
}
return sb.toString().isEmpty() ? null : sb.toString();
}
|
[
"private",
"String",
"generateAggregatedKey",
"(",
"final",
"Object",
"object",
")",
"{",
"// Store the aggregated key\r",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"KeyGenerator",
"methodGenerator",
";",
"// Search for method annotation\r",
"for",
"(",
"final",
"Method",
"m",
":",
"object",
".",
"getClass",
"(",
")",
".",
"getMethods",
"(",
")",
")",
"{",
"methodGenerator",
"=",
"m",
".",
"getAnnotation",
"(",
"KeyGenerator",
".",
"class",
")",
";",
"if",
"(",
"methodGenerator",
"!=",
"null",
")",
"{",
"Object",
"returnedValue",
"=",
"null",
";",
"try",
"{",
"returnedValue",
"=",
"m",
".",
"invoke",
"(",
"object",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"IllegalArgumentException",
"|",
"InvocationTargetException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"METHOD_KEY_GENERATOR_FAILURE",
",",
"m",
".",
"getName",
"(",
")",
",",
"object",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"e",
")",
";",
"}",
"if",
"(",
"returnedValue",
"==",
"null",
")",
"{",
"// returned value is null\r",
"LOGGER",
".",
"log",
"(",
"NULL_METHOD_KEY",
",",
"m",
".",
"getName",
"(",
")",
",",
"object",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"convertMethodKeyObject",
"(",
"methodGenerator",
",",
"returnedValue",
")",
")",
";",
"}",
"}",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Generate unique key by using the method-level annotations.
@param object the source object
@return the unique key or null if an error occurred or no method annotation was found
|
[
"Generate",
"unique",
"key",
"by",
"using",
"the",
"method",
"-",
"level",
"annotations",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/key/MultitonKey.java#L145-L172
|
8,370 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/image/ImageSlideModel.java
|
ImageSlideModel.getTitle
|
public String getTitle() {
return getSlide().getContent() == null || getSlide().getContent().isEmpty() || getSlide().getContent().get(0).getTitle() == null ? null
: getSlide().getContent().get(0).getTitle().replaceAll("\\\\n", "\n");
}
|
java
|
public String getTitle() {
return getSlide().getContent() == null || getSlide().getContent().isEmpty() || getSlide().getContent().get(0).getTitle() == null ? null
: getSlide().getContent().get(0).getTitle().replaceAll("\\\\n", "\n");
}
|
[
"public",
"String",
"getTitle",
"(",
")",
"{",
"return",
"getSlide",
"(",
")",
".",
"getContent",
"(",
")",
"==",
"null",
"||",
"getSlide",
"(",
")",
".",
"getContent",
"(",
")",
".",
"isEmpty",
"(",
")",
"||",
"getSlide",
"(",
")",
".",
"getContent",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getTitle",
"(",
")",
"==",
"null",
"?",
"null",
":",
"getSlide",
"(",
")",
".",
"getContent",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getTitle",
"(",
")",
".",
"replaceAll",
"(",
"\"\\\\\\\\n\"",
",",
"\"\\n\"",
")",
";",
"}"
] |
Return the splash title.
@return the title
|
[
"Return",
"the",
"splash",
"title",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/image/ImageSlideModel.java#L52-L55
|
8,371 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/exception/ServiceException.java
|
ServiceException.getExplanation
|
public String getExplanation() {
final StringBuilder sb = new StringBuilder();
if (getMessage() != null) {
sb.append(getMessage());
}
if (getCause() != null) {
sb.append(getCause().getClass().getSimpleName());
}
return sb.toString();
}
|
java
|
public String getExplanation() {
final StringBuilder sb = new StringBuilder();
if (getMessage() != null) {
sb.append(getMessage());
}
if (getCause() != null) {
sb.append(getCause().getClass().getSimpleName());
}
return sb.toString();
}
|
[
"public",
"String",
"getExplanation",
"(",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"getMessage",
"(",
")",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"getMessage",
"(",
")",
")",
";",
"}",
"if",
"(",
"getCause",
"(",
")",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"getCause",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Return the explanation of the exception.
@return the exception explanation
|
[
"Return",
"the",
"explanation",
"of",
"the",
"exception",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/exception/ServiceException.java#L68-L78
|
8,372 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/fxml/AbstractFXMLObjectModel.java
|
AbstractFXMLObjectModel.fxmlPreInitialize
|
protected void fxmlPreInitialize() {
// Define fxml path and resource bundle path according to key parts provided
// If an FXMLItem is provided, simply map it to the internal item handle
if (!getListKeyPart().isEmpty() && getListKeyPart().get(0) instanceof FXMLItem) {
this.fxmlItem = (FXMLItem) getListKeyPart().get(0);
// if the first key part is a string that begins with fxml:
} else if (!getListKeyPart().isEmpty() && getListKeyPart().get(0).toString().startsWith(KEYPART_FXML_PREFIX)) {
// Use the string provided and append FXML extension
final String baseName = getListKeyPart().get(0).toString().substring(KEYPART_FXML_PREFIX.length());
this.fxmlPath = baseName.replaceAll(FXML.DOT_SEPARATOR, FXML.PATH_SEPARATOR) + FXML.FXML_EXT;
// if the second key part is a string that begins with rb:
if (getListKeyPart().size() > 1 && getListKeyPart().get(1).toString().startsWith(KEYPART_RB_PREFIX)) {
this.resourcePath = getListKeyPart().get(1).toString().substring(KEYPART_RB_PREFIX.length()).replaceAll(FXML.DOT_SEPARATOR, FXML.PATH_SEPARATOR);
} else {
// Otherwise use the same base name as fxml file
this.resourcePath = baseName;
}
} else {
// Otherwise use the current class name to define the fxml and resource bundle file names
String baseName = this.getClass().getCanonicalName();
// Remove the Model suffix if any
baseName = baseName.substring(0, baseName.lastIndexOf(Model.class.getSimpleName()));
// Replace . by / for the fxml loader
baseName = baseName.replaceAll(FXML.DOT_SEPARATOR, FXML.PATH_SEPARATOR);
this.fxmlPath = baseName + FXML.FXML_EXT;
this.resourcePath = baseName;
}
}
|
java
|
protected void fxmlPreInitialize() {
// Define fxml path and resource bundle path according to key parts provided
// If an FXMLItem is provided, simply map it to the internal item handle
if (!getListKeyPart().isEmpty() && getListKeyPart().get(0) instanceof FXMLItem) {
this.fxmlItem = (FXMLItem) getListKeyPart().get(0);
// if the first key part is a string that begins with fxml:
} else if (!getListKeyPart().isEmpty() && getListKeyPart().get(0).toString().startsWith(KEYPART_FXML_PREFIX)) {
// Use the string provided and append FXML extension
final String baseName = getListKeyPart().get(0).toString().substring(KEYPART_FXML_PREFIX.length());
this.fxmlPath = baseName.replaceAll(FXML.DOT_SEPARATOR, FXML.PATH_SEPARATOR) + FXML.FXML_EXT;
// if the second key part is a string that begins with rb:
if (getListKeyPart().size() > 1 && getListKeyPart().get(1).toString().startsWith(KEYPART_RB_PREFIX)) {
this.resourcePath = getListKeyPart().get(1).toString().substring(KEYPART_RB_PREFIX.length()).replaceAll(FXML.DOT_SEPARATOR, FXML.PATH_SEPARATOR);
} else {
// Otherwise use the same base name as fxml file
this.resourcePath = baseName;
}
} else {
// Otherwise use the current class name to define the fxml and resource bundle file names
String baseName = this.getClass().getCanonicalName();
// Remove the Model suffix if any
baseName = baseName.substring(0, baseName.lastIndexOf(Model.class.getSimpleName()));
// Replace . by / for the fxml loader
baseName = baseName.replaceAll(FXML.DOT_SEPARATOR, FXML.PATH_SEPARATOR);
this.fxmlPath = baseName + FXML.FXML_EXT;
this.resourcePath = baseName;
}
}
|
[
"protected",
"void",
"fxmlPreInitialize",
"(",
")",
"{",
"// Define fxml path and resource bundle path according to key parts provided",
"// If an FXMLItem is provided, simply map it to the internal item handle",
"if",
"(",
"!",
"getListKeyPart",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"getListKeyPart",
"(",
")",
".",
"get",
"(",
"0",
")",
"instanceof",
"FXMLItem",
")",
"{",
"this",
".",
"fxmlItem",
"=",
"(",
"FXMLItem",
")",
"getListKeyPart",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"// if the first key part is a string that begins with fxml:",
"}",
"else",
"if",
"(",
"!",
"getListKeyPart",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"getListKeyPart",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"toString",
"(",
")",
".",
"startsWith",
"(",
"KEYPART_FXML_PREFIX",
")",
")",
"{",
"// Use the string provided and append FXML extension",
"final",
"String",
"baseName",
"=",
"getListKeyPart",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"toString",
"(",
")",
".",
"substring",
"(",
"KEYPART_FXML_PREFIX",
".",
"length",
"(",
")",
")",
";",
"this",
".",
"fxmlPath",
"=",
"baseName",
".",
"replaceAll",
"(",
"FXML",
".",
"DOT_SEPARATOR",
",",
"FXML",
".",
"PATH_SEPARATOR",
")",
"+",
"FXML",
".",
"FXML_EXT",
";",
"// if the second key part is a string that begins with rb:",
"if",
"(",
"getListKeyPart",
"(",
")",
".",
"size",
"(",
")",
">",
"1",
"&&",
"getListKeyPart",
"(",
")",
".",
"get",
"(",
"1",
")",
".",
"toString",
"(",
")",
".",
"startsWith",
"(",
"KEYPART_RB_PREFIX",
")",
")",
"{",
"this",
".",
"resourcePath",
"=",
"getListKeyPart",
"(",
")",
".",
"get",
"(",
"1",
")",
".",
"toString",
"(",
")",
".",
"substring",
"(",
"KEYPART_RB_PREFIX",
".",
"length",
"(",
")",
")",
".",
"replaceAll",
"(",
"FXML",
".",
"DOT_SEPARATOR",
",",
"FXML",
".",
"PATH_SEPARATOR",
")",
";",
"}",
"else",
"{",
"// Otherwise use the same base name as fxml file",
"this",
".",
"resourcePath",
"=",
"baseName",
";",
"}",
"}",
"else",
"{",
"// Otherwise use the current class name to define the fxml and resource bundle file names",
"String",
"baseName",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
";",
"// Remove the Model suffix if any",
"baseName",
"=",
"baseName",
".",
"substring",
"(",
"0",
",",
"baseName",
".",
"lastIndexOf",
"(",
"Model",
".",
"class",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"// Replace . by / for the fxml loader",
"baseName",
"=",
"baseName",
".",
"replaceAll",
"(",
"FXML",
".",
"DOT_SEPARATOR",
",",
"FXML",
".",
"PATH_SEPARATOR",
")",
";",
"this",
".",
"fxmlPath",
"=",
"baseName",
"+",
"FXML",
".",
"FXML_EXT",
";",
"this",
".",
"resourcePath",
"=",
"baseName",
";",
"}",
"}"
] |
Pre init.
|
[
"Pre",
"init",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/fxml/AbstractFXMLObjectModel.java#L125-L162
|
8,373 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractBaseModel.java
|
AbstractBaseModel.attachParentListener
|
protected void attachParentListener() {
final AutoRelease ar = ClassUtility.getLastClassAnnotation(this.getClass(), AutoRelease.class);
// Only manage automatic release when the annotation exists with true value
if (ar != null && ar.value() && node() != null) { // TODO check rootnode null when using NullView
// Allow to release the model if the root business object doesn't exist anymore
node().parentProperty().addListener(new ChangeListener<Node>() {
@Override
public void changed(final ObservableValue<? extends Node> observable, final Node oldValue, final Node newValue) {
if (newValue != null) {
AbstractBaseModel.this.hasBeenAttached = true;
}
if (newValue == null && AbstractBaseModel.this.hasBeenAttached) {
AbstractBaseModel.this.hasBeenAttached = false;
release();
node().parentProperty().removeListener(this);
}
}
});
}
}
|
java
|
protected void attachParentListener() {
final AutoRelease ar = ClassUtility.getLastClassAnnotation(this.getClass(), AutoRelease.class);
// Only manage automatic release when the annotation exists with true value
if (ar != null && ar.value() && node() != null) { // TODO check rootnode null when using NullView
// Allow to release the model if the root business object doesn't exist anymore
node().parentProperty().addListener(new ChangeListener<Node>() {
@Override
public void changed(final ObservableValue<? extends Node> observable, final Node oldValue, final Node newValue) {
if (newValue != null) {
AbstractBaseModel.this.hasBeenAttached = true;
}
if (newValue == null && AbstractBaseModel.this.hasBeenAttached) {
AbstractBaseModel.this.hasBeenAttached = false;
release();
node().parentProperty().removeListener(this);
}
}
});
}
}
|
[
"protected",
"void",
"attachParentListener",
"(",
")",
"{",
"final",
"AutoRelease",
"ar",
"=",
"ClassUtility",
".",
"getLastClassAnnotation",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"AutoRelease",
".",
"class",
")",
";",
"// Only manage automatic release when the annotation exists with true value",
"if",
"(",
"ar",
"!=",
"null",
"&&",
"ar",
".",
"value",
"(",
")",
"&&",
"node",
"(",
")",
"!=",
"null",
")",
"{",
"// TODO check rootnode null when using NullView",
"// Allow to release the model if the root business object doesn't exist anymore",
"node",
"(",
")",
".",
"parentProperty",
"(",
")",
".",
"addListener",
"(",
"new",
"ChangeListener",
"<",
"Node",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"changed",
"(",
"final",
"ObservableValue",
"<",
"?",
"extends",
"Node",
">",
"observable",
",",
"final",
"Node",
"oldValue",
",",
"final",
"Node",
"newValue",
")",
"{",
"if",
"(",
"newValue",
"!=",
"null",
")",
"{",
"AbstractBaseModel",
".",
"this",
".",
"hasBeenAttached",
"=",
"true",
";",
"}",
"if",
"(",
"newValue",
"==",
"null",
"&&",
"AbstractBaseModel",
".",
"this",
".",
"hasBeenAttached",
")",
"{",
"AbstractBaseModel",
".",
"this",
".",
"hasBeenAttached",
"=",
"false",
";",
"release",
"(",
")",
";",
"node",
"(",
")",
".",
"parentProperty",
"(",
")",
".",
"removeListener",
"(",
"this",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"}"
] |
Attach a custom listener that will release the mode when the rootNode is removed from its parent.
|
[
"Attach",
"a",
"custom",
"listener",
"that",
"will",
"release",
"the",
"mode",
"when",
"the",
"rootNode",
"is",
"removed",
"from",
"its",
"parent",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractBaseModel.java#L230-L254
|
8,374 |
inloop/easygcm
|
easygcm-lib/src/main/java/eu/inloop/easygcm/EasyInstanceIDListenerService.java
|
EasyInstanceIDListenerService.onTokenRefresh
|
@Override
public void onTokenRefresh() {
EasyGcm.Logger.d("Received token refresh broadcast");
EasyGcm.removeRegistrationId(getApplicationContext());
if (GcmUtils.checkCanAndShouldRegister(getApplicationContext())) {
startService(GcmRegistrationService.createGcmRegistrationIntent(this));
}
}
|
java
|
@Override
public void onTokenRefresh() {
EasyGcm.Logger.d("Received token refresh broadcast");
EasyGcm.removeRegistrationId(getApplicationContext());
if (GcmUtils.checkCanAndShouldRegister(getApplicationContext())) {
startService(GcmRegistrationService.createGcmRegistrationIntent(this));
}
}
|
[
"@",
"Override",
"public",
"void",
"onTokenRefresh",
"(",
")",
"{",
"EasyGcm",
".",
"Logger",
".",
"d",
"(",
"\"Received token refresh broadcast\"",
")",
";",
"EasyGcm",
".",
"removeRegistrationId",
"(",
"getApplicationContext",
"(",
")",
")",
";",
"if",
"(",
"GcmUtils",
".",
"checkCanAndShouldRegister",
"(",
"getApplicationContext",
"(",
")",
")",
")",
"{",
"startService",
"(",
"GcmRegistrationService",
".",
"createGcmRegistrationIntent",
"(",
"this",
")",
")",
";",
"}",
"}"
] |
Called if InstanceID token is updated. This may occur if the security of
the previous token had been compromised. This call is initiated by the
InstanceID provider.
|
[
"Called",
"if",
"InstanceID",
"token",
"is",
"updated",
".",
"This",
"may",
"occur",
"if",
"the",
"security",
"of",
"the",
"previous",
"token",
"had",
"been",
"compromised",
".",
"This",
"call",
"is",
"initiated",
"by",
"the",
"InstanceID",
"provider",
"."
] |
d06bbff11e52b956c3a7b1a2dc4f9799f20cf2c6
|
https://github.com/inloop/easygcm/blob/d06bbff11e52b956c3a7b1a2dc4f9799f20cf2c6/easygcm-lib/src/main/java/eu/inloop/easygcm/EasyInstanceIDListenerService.java#L30-L39
|
8,375 |
amigold/FunDapter
|
library/src/com/ami/fundapter/BindDictionary.java
|
BindDictionary.addBaseField
|
public BaseField<T> addBaseField(int viewResId) {
BaseField<T> field = new BaseField<T>(viewResId);
mBaseFields.add(field);
return field;
}
|
java
|
public BaseField<T> addBaseField(int viewResId) {
BaseField<T> field = new BaseField<T>(viewResId);
mBaseFields.add(field);
return field;
}
|
[
"public",
"BaseField",
"<",
"T",
">",
"addBaseField",
"(",
"int",
"viewResId",
")",
"{",
"BaseField",
"<",
"T",
">",
"field",
"=",
"new",
"BaseField",
"<",
"T",
">",
"(",
"viewResId",
")",
";",
"mBaseFields",
".",
"add",
"(",
"field",
")",
";",
"return",
"field",
";",
"}"
] |
Base field methods
|
[
"Base",
"field",
"methods"
] |
fb33241f265901d73276608689077d4310278eaf
|
https://github.com/amigold/FunDapter/blob/fb33241f265901d73276608689077d4310278eaf/library/src/com/ami/fundapter/BindDictionary.java#L135-L142
|
8,376 |
amigold/FunDapter
|
library/src/com/ami/fundapter/BindDictionary.java
|
BindDictionary.addCheckableField
|
public CheckableField<T> addCheckableField(int viewResId,
BooleanExtractor<T> isCheckedExtractor) {
CheckableField<T> field = new CheckableField<T>(viewResId, isCheckedExtractor);
mCheckableFields.add(field);
return field;
}
|
java
|
public CheckableField<T> addCheckableField(int viewResId,
BooleanExtractor<T> isCheckedExtractor) {
CheckableField<T> field = new CheckableField<T>(viewResId, isCheckedExtractor);
mCheckableFields.add(field);
return field;
}
|
[
"public",
"CheckableField",
"<",
"T",
">",
"addCheckableField",
"(",
"int",
"viewResId",
",",
"BooleanExtractor",
"<",
"T",
">",
"isCheckedExtractor",
")",
"{",
"CheckableField",
"<",
"T",
">",
"field",
"=",
"new",
"CheckableField",
"<",
"T",
">",
"(",
"viewResId",
",",
"isCheckedExtractor",
")",
";",
"mCheckableFields",
".",
"add",
"(",
"field",
")",
";",
"return",
"field",
";",
"}"
] |
Checkable field methods
|
[
"Checkable",
"field",
"methods"
] |
fb33241f265901d73276608689077d4310278eaf
|
https://github.com/amigold/FunDapter/blob/fb33241f265901d73276608689077d4310278eaf/library/src/com/ami/fundapter/BindDictionary.java#L153-L161
|
8,377 |
amigold/FunDapter
|
library/src/com/ami/fundapter/BindDictionary.java
|
BindDictionary.addStaticImageField
|
public StaticImageField<T> addStaticImageField(int viewResId,
StaticImageLoader<T> staticImageLoader) {
StaticImageField<T> field = new StaticImageField<T>(viewResId, staticImageLoader);
mStaticImageFields.add(field);
return field;
}
|
java
|
public StaticImageField<T> addStaticImageField(int viewResId,
StaticImageLoader<T> staticImageLoader) {
StaticImageField<T> field = new StaticImageField<T>(viewResId, staticImageLoader);
mStaticImageFields.add(field);
return field;
}
|
[
"public",
"StaticImageField",
"<",
"T",
">",
"addStaticImageField",
"(",
"int",
"viewResId",
",",
"StaticImageLoader",
"<",
"T",
">",
"staticImageLoader",
")",
"{",
"StaticImageField",
"<",
"T",
">",
"field",
"=",
"new",
"StaticImageField",
"<",
"T",
">",
"(",
"viewResId",
",",
"staticImageLoader",
")",
";",
"mStaticImageFields",
".",
"add",
"(",
"field",
")",
";",
"return",
"field",
";",
"}"
] |
static image field methods
|
[
"static",
"image",
"field",
"methods"
] |
fb33241f265901d73276608689077d4310278eaf
|
https://github.com/amigold/FunDapter/blob/fb33241f265901d73276608689077d4310278eaf/library/src/com/ami/fundapter/BindDictionary.java#L172-L180
|
8,378 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/i18n/MessageBuilder.java
|
MessageBuilder.readPropertiesFile
|
private void readPropertiesFile(final String rbFilename) {
final File rbFile = new File(rbFilename);
final String rbName = rbFile.getName().substring(0, rbFile.getName().lastIndexOf(".properties"));
if (rbName == null || rbName.isEmpty()) {
LOGGER.error(JRebirthMarkers.MESSAGE, "Resource Bundle must be not null and not empty");
} else {
LOGGER.info(JRebirthMarkers.MESSAGE, "Store ResourceBundle : {} ", rbName);
try {
this.resourceBundles.add(ResourceBundle.getBundle(rbName));
} catch (final MissingResourceException e) {
LOGGER.error(JRebirthMarkers.MESSAGE, "{} Resource Bundle not found", rbName);
}
}
}
|
java
|
private void readPropertiesFile(final String rbFilename) {
final File rbFile = new File(rbFilename);
final String rbName = rbFile.getName().substring(0, rbFile.getName().lastIndexOf(".properties"));
if (rbName == null || rbName.isEmpty()) {
LOGGER.error(JRebirthMarkers.MESSAGE, "Resource Bundle must be not null and not empty");
} else {
LOGGER.info(JRebirthMarkers.MESSAGE, "Store ResourceBundle : {} ", rbName);
try {
this.resourceBundles.add(ResourceBundle.getBundle(rbName));
} catch (final MissingResourceException e) {
LOGGER.error(JRebirthMarkers.MESSAGE, "{} Resource Bundle not found", rbName);
}
}
}
|
[
"private",
"void",
"readPropertiesFile",
"(",
"final",
"String",
"rbFilename",
")",
"{",
"final",
"File",
"rbFile",
"=",
"new",
"File",
"(",
"rbFilename",
")",
";",
"final",
"String",
"rbName",
"=",
"rbFile",
".",
"getName",
"(",
")",
".",
"substring",
"(",
"0",
",",
"rbFile",
".",
"getName",
"(",
")",
".",
"lastIndexOf",
"(",
"\".properties\"",
")",
")",
";",
"if",
"(",
"rbName",
"==",
"null",
"||",
"rbName",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOGGER",
".",
"error",
"(",
"JRebirthMarkers",
".",
"MESSAGE",
",",
"\"Resource Bundle must be not null and not empty\"",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"info",
"(",
"JRebirthMarkers",
".",
"MESSAGE",
",",
"\"Store ResourceBundle : {} \"",
",",
"rbName",
")",
";",
"try",
"{",
"this",
".",
"resourceBundles",
".",
"add",
"(",
"ResourceBundle",
".",
"getBundle",
"(",
"rbName",
")",
")",
";",
"}",
"catch",
"(",
"final",
"MissingResourceException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"JRebirthMarkers",
".",
"MESSAGE",
",",
"\"{} Resource Bundle not found\"",
",",
"rbName",
")",
";",
"}",
"}",
"}"
] |
Read a customized Message file to load all translated messages.
@param rbFilename the resource bundle file to load
|
[
"Read",
"a",
"customized",
"Message",
"file",
"to",
"load",
"all",
"translated",
"messages",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/i18n/MessageBuilder.java#L120-L137
|
8,379 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/i18n/MessageBuilder.java
|
MessageBuilder.findMessage
|
private String findMessage(final String messageKey) {
String message = null;
try {
if (!this.resourceBundles.isEmpty()) {
for (int i = this.resourceBundles.size() - 1; i >= 0 && message == null; i--) {
if (this.resourceBundles.get(i).containsKey(messageKey)) {
message = this.resourceBundles.get(i).getString(messageKey);
}
}
}
} catch (final MissingResourceException e) {
LOGGER.error("Message key not found into resource bundle", e);
}
return message;
}
|
java
|
private String findMessage(final String messageKey) {
String message = null;
try {
if (!this.resourceBundles.isEmpty()) {
for (int i = this.resourceBundles.size() - 1; i >= 0 && message == null; i--) {
if (this.resourceBundles.get(i).containsKey(messageKey)) {
message = this.resourceBundles.get(i).getString(messageKey);
}
}
}
} catch (final MissingResourceException e) {
LOGGER.error("Message key not found into resource bundle", e);
}
return message;
}
|
[
"private",
"String",
"findMessage",
"(",
"final",
"String",
"messageKey",
")",
"{",
"String",
"message",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"!",
"this",
".",
"resourceBundles",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"resourceBundles",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
"&&",
"message",
"==",
"null",
";",
"i",
"--",
")",
"{",
"if",
"(",
"this",
".",
"resourceBundles",
".",
"get",
"(",
"i",
")",
".",
"containsKey",
"(",
"messageKey",
")",
")",
"{",
"message",
"=",
"this",
".",
"resourceBundles",
".",
"get",
"(",
"i",
")",
".",
"getString",
"(",
"messageKey",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"final",
"MissingResourceException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Message key not found into resource bundle\"",
",",
"e",
")",
";",
"}",
"return",
"message",
";",
"}"
] |
Retrieved the message mapped with the given key.
Perform the search by iterating over all resource bundles available in reverse order.
@param messageKey the key of the message to translate
@return the translated message or null
|
[
"Retrieved",
"the",
"message",
"mapped",
"with",
"the",
"given",
"key",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/i18n/MessageBuilder.java#L193-L210
|
8,380 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java
|
ObjectUtility.equalsOrBothNull
|
public static boolean equalsOrBothNull(final Object object1, final Object object2) {
return object1 == null && object2 == null || object1 != null && object1.equals(object2);
}
|
java
|
public static boolean equalsOrBothNull(final Object object1, final Object object2) {
return object1 == null && object2 == null || object1 != null && object1.equals(object2);
}
|
[
"public",
"static",
"boolean",
"equalsOrBothNull",
"(",
"final",
"Object",
"object1",
",",
"final",
"Object",
"object2",
")",
"{",
"return",
"object1",
"==",
"null",
"&&",
"object2",
"==",
"null",
"||",
"object1",
"!=",
"null",
"&&",
"object1",
".",
"equals",
"(",
"object2",
")",
";",
"}"
] |
Return true if the object are equals or both null.
@param object1 first object to compare
@param object2 second object to compare
@return true if the object are equals or both null
|
[
"Return",
"true",
"if",
"the",
"object",
"are",
"equals",
"or",
"both",
"null",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java#L49-L51
|
8,381 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java
|
ObjectUtility.lowerFirstChar
|
public static String lowerFirstChar(final String upperCasedString) {
return upperCasedString.substring(0, 1).toLowerCase(Locale.getDefault()) + upperCasedString.substring(1);
}
|
java
|
public static String lowerFirstChar(final String upperCasedString) {
return upperCasedString.substring(0, 1).toLowerCase(Locale.getDefault()) + upperCasedString.substring(1);
}
|
[
"public",
"static",
"String",
"lowerFirstChar",
"(",
"final",
"String",
"upperCasedString",
")",
"{",
"return",
"upperCasedString",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"getDefault",
"(",
")",
")",
"+",
"upperCasedString",
".",
"substring",
"(",
"1",
")",
";",
"}"
] |
Lower case te first char of a string.
@param upperCasedString the string to modify
@return a new string with a first character lower cased
|
[
"Lower",
"case",
"te",
"first",
"char",
"of",
"a",
"string",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java#L72-L74
|
8,382 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java
|
ObjectUtility.checkAllMethodReturnTrue
|
public static boolean checkAllMethodReturnTrue(final Object instance, final List<Method> methods) {
boolean res = true;
if (!methods.isEmpty()) {
for (final Method method : methods) {
Object returnValue;
try {
returnValue = method.invoke(instance);
res &= returnValue instanceof Boolean && ((Boolean) returnValue).booleanValue();
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
res = false;
}
}
}
return res;
}
|
java
|
public static boolean checkAllMethodReturnTrue(final Object instance, final List<Method> methods) {
boolean res = true;
if (!methods.isEmpty()) {
for (final Method method : methods) {
Object returnValue;
try {
returnValue = method.invoke(instance);
res &= returnValue instanceof Boolean && ((Boolean) returnValue).booleanValue();
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
res = false;
}
}
}
return res;
}
|
[
"public",
"static",
"boolean",
"checkAllMethodReturnTrue",
"(",
"final",
"Object",
"instance",
",",
"final",
"List",
"<",
"Method",
">",
"methods",
")",
"{",
"boolean",
"res",
"=",
"true",
";",
"if",
"(",
"!",
"methods",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"Method",
"method",
":",
"methods",
")",
"{",
"Object",
"returnValue",
";",
"try",
"{",
"returnValue",
"=",
"method",
".",
"invoke",
"(",
"instance",
")",
";",
"res",
"&=",
"returnValue",
"instanceof",
"Boolean",
"&&",
"(",
"(",
"Boolean",
")",
"returnValue",
")",
".",
"booleanValue",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"IllegalArgumentException",
"|",
"InvocationTargetException",
"e",
")",
"{",
"res",
"=",
"false",
";",
"}",
"}",
"}",
"return",
"res",
";",
"}"
] |
Check if all given methods return true or if the list is empty.
@param instance the context object
@param methods the list of method to check
@return true if all method return true or if the list is empty
|
[
"Check",
"if",
"all",
"given",
"methods",
"return",
"true",
"or",
"if",
"the",
"list",
"is",
"empty",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java#L95-L110
|
8,383 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/stack/SlideStackModel.java
|
SlideStackModel.buildSlideTransition
|
private ParallelTransition buildSlideTransition(final boolean isReverse, final SlideModel<SlideStep> previousSlideModel, final SlideModel<SlideStep> selectedSlideModel) {
final ParallelTransition slideAnimation = ParallelTransitionBuilder.create().build();
if (previousSlideModel != null) {
final Animation a = isReverse ? previousSlideModel.getShowAnimation() : previousSlideModel.getHideAnimation();
if (a != null) {
slideAnimation.getChildren().add(a);
}
}
if (this.selectedSlideModel != null) {
final Animation a = isReverse ? this.selectedSlideModel.getHideAnimation() : this.selectedSlideModel.getShowAnimation();
if (a != null) {
slideAnimation.getChildren().add(a);
}
}
final SlideModel<SlideStep> csm = selectedSlideModel;
// final SlideModel<SlideStep> psm = previousSlideModel;
slideAnimation.setOnFinished(new javafx.event.EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent arg0) {
// // Hide previous slide
// if (psm != null) {
// getView().getRootNode().getChildren().removeAll(psm.getRootNode());
// }
// FIX ME NOT APPROPRIATED !!!
if (previousSlideModel instanceof AbstractBaseModel) {
((AbstractBaseModel<?>) previousSlideModel).doHideView(null);
}
if (selectedSlideModel instanceof AbstractBaseModel) {
((AbstractBaseModel<?>) selectedSlideModel).doShowView(null);
}
// Hide all other slides
if (csm != null) {
Node node;
for (int i = view().node().getChildren().size() - 1; i >= 0; i--) {
node = view().node().getChildren().get(i);
if (csm.node() != node) {
view().node().getChildren().remove(node);
}
}
}
}
});
return slideAnimation;
}
|
java
|
private ParallelTransition buildSlideTransition(final boolean isReverse, final SlideModel<SlideStep> previousSlideModel, final SlideModel<SlideStep> selectedSlideModel) {
final ParallelTransition slideAnimation = ParallelTransitionBuilder.create().build();
if (previousSlideModel != null) {
final Animation a = isReverse ? previousSlideModel.getShowAnimation() : previousSlideModel.getHideAnimation();
if (a != null) {
slideAnimation.getChildren().add(a);
}
}
if (this.selectedSlideModel != null) {
final Animation a = isReverse ? this.selectedSlideModel.getHideAnimation() : this.selectedSlideModel.getShowAnimation();
if (a != null) {
slideAnimation.getChildren().add(a);
}
}
final SlideModel<SlideStep> csm = selectedSlideModel;
// final SlideModel<SlideStep> psm = previousSlideModel;
slideAnimation.setOnFinished(new javafx.event.EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent arg0) {
// // Hide previous slide
// if (psm != null) {
// getView().getRootNode().getChildren().removeAll(psm.getRootNode());
// }
// FIX ME NOT APPROPRIATED !!!
if (previousSlideModel instanceof AbstractBaseModel) {
((AbstractBaseModel<?>) previousSlideModel).doHideView(null);
}
if (selectedSlideModel instanceof AbstractBaseModel) {
((AbstractBaseModel<?>) selectedSlideModel).doShowView(null);
}
// Hide all other slides
if (csm != null) {
Node node;
for (int i = view().node().getChildren().size() - 1; i >= 0; i--) {
node = view().node().getChildren().get(i);
if (csm.node() != node) {
view().node().getChildren().remove(node);
}
}
}
}
});
return slideAnimation;
}
|
[
"private",
"ParallelTransition",
"buildSlideTransition",
"(",
"final",
"boolean",
"isReverse",
",",
"final",
"SlideModel",
"<",
"SlideStep",
">",
"previousSlideModel",
",",
"final",
"SlideModel",
"<",
"SlideStep",
">",
"selectedSlideModel",
")",
"{",
"final",
"ParallelTransition",
"slideAnimation",
"=",
"ParallelTransitionBuilder",
".",
"create",
"(",
")",
".",
"build",
"(",
")",
";",
"if",
"(",
"previousSlideModel",
"!=",
"null",
")",
"{",
"final",
"Animation",
"a",
"=",
"isReverse",
"?",
"previousSlideModel",
".",
"getShowAnimation",
"(",
")",
":",
"previousSlideModel",
".",
"getHideAnimation",
"(",
")",
";",
"if",
"(",
"a",
"!=",
"null",
")",
"{",
"slideAnimation",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"a",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"selectedSlideModel",
"!=",
"null",
")",
"{",
"final",
"Animation",
"a",
"=",
"isReverse",
"?",
"this",
".",
"selectedSlideModel",
".",
"getHideAnimation",
"(",
")",
":",
"this",
".",
"selectedSlideModel",
".",
"getShowAnimation",
"(",
")",
";",
"if",
"(",
"a",
"!=",
"null",
")",
"{",
"slideAnimation",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"a",
")",
";",
"}",
"}",
"final",
"SlideModel",
"<",
"SlideStep",
">",
"csm",
"=",
"selectedSlideModel",
";",
"// final SlideModel<SlideStep> psm = previousSlideModel;",
"slideAnimation",
".",
"setOnFinished",
"(",
"new",
"javafx",
".",
"event",
".",
"EventHandler",
"<",
"ActionEvent",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"final",
"ActionEvent",
"arg0",
")",
"{",
"// // Hide previous slide",
"// if (psm != null) {",
"// getView().getRootNode().getChildren().removeAll(psm.getRootNode());",
"// }",
"// FIX ME NOT APPROPRIATED !!!",
"if",
"(",
"previousSlideModel",
"instanceof",
"AbstractBaseModel",
")",
"{",
"(",
"(",
"AbstractBaseModel",
"<",
"?",
">",
")",
"previousSlideModel",
")",
".",
"doHideView",
"(",
"null",
")",
";",
"}",
"if",
"(",
"selectedSlideModel",
"instanceof",
"AbstractBaseModel",
")",
"{",
"(",
"(",
"AbstractBaseModel",
"<",
"?",
">",
")",
"selectedSlideModel",
")",
".",
"doShowView",
"(",
"null",
")",
";",
"}",
"// Hide all other slides",
"if",
"(",
"csm",
"!=",
"null",
")",
"{",
"Node",
"node",
";",
"for",
"(",
"int",
"i",
"=",
"view",
"(",
")",
".",
"node",
"(",
")",
".",
"getChildren",
"(",
")",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"node",
"=",
"view",
"(",
")",
".",
"node",
"(",
")",
".",
"getChildren",
"(",
")",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"csm",
".",
"node",
"(",
")",
"!=",
"node",
")",
"{",
"view",
"(",
")",
".",
"node",
"(",
")",
".",
"getChildren",
"(",
")",
".",
"remove",
"(",
"node",
")",
";",
"}",
"}",
"}",
"}",
"}",
")",
";",
"return",
"slideAnimation",
";",
"}"
] |
Get the animation to use between slides.
@param isReverse true for reverse mode
@param previousSlideModel the previous slide model
@param selectedSlideModel the current slide model
@return the animation to show
|
[
"Get",
"the",
"animation",
"to",
"use",
"between",
"slides",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/stack/SlideStackModel.java#L210-L258
|
8,384 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/stack/SlideStackModel.java
|
SlideStackModel.next
|
public void next(final boolean skipSlideStep) {
synchronized (this) {
// Try to display the next slide step first
// If no slide step is remaining, display the next slide
if (skipSlideStep || this.selectedSlideModel.nextStep() && this.slidePosition < getPresentationService().getPresentation().getSlides().getSlide().size() - 1) {
this.slidePosition = Math.min(this.slidePosition + 1, getPresentationService().getPresentation().getSlides().getSlide().size() - 1);
displaySlide(getPresentationService().getPresentation().getSlides().getSlide().get(this.slidePosition), false);
}
}
}
|
java
|
public void next(final boolean skipSlideStep) {
synchronized (this) {
// Try to display the next slide step first
// If no slide step is remaining, display the next slide
if (skipSlideStep || this.selectedSlideModel.nextStep() && this.slidePosition < getPresentationService().getPresentation().getSlides().getSlide().size() - 1) {
this.slidePosition = Math.min(this.slidePosition + 1, getPresentationService().getPresentation().getSlides().getSlide().size() - 1);
displaySlide(getPresentationService().getPresentation().getSlides().getSlide().get(this.slidePosition), false);
}
}
}
|
[
"public",
"void",
"next",
"(",
"final",
"boolean",
"skipSlideStep",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"// Try to display the next slide step first",
"// If no slide step is remaining, display the next slide",
"if",
"(",
"skipSlideStep",
"||",
"this",
".",
"selectedSlideModel",
".",
"nextStep",
"(",
")",
"&&",
"this",
".",
"slidePosition",
"<",
"getPresentationService",
"(",
")",
".",
"getPresentation",
"(",
")",
".",
"getSlides",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"size",
"(",
")",
"-",
"1",
")",
"{",
"this",
".",
"slidePosition",
"=",
"Math",
".",
"min",
"(",
"this",
".",
"slidePosition",
"+",
"1",
",",
"getPresentationService",
"(",
")",
".",
"getPresentation",
"(",
")",
".",
"getSlides",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"displaySlide",
"(",
"getPresentationService",
"(",
")",
".",
"getPresentation",
"(",
")",
".",
"getSlides",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"get",
"(",
"this",
".",
"slidePosition",
")",
",",
"false",
")",
";",
"}",
"}",
"}"
] |
Got to next slide.
|
[
"Got",
"to",
"next",
"slide",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/stack/SlideStackModel.java#L296-L305
|
8,385 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/stack/SlideStackModel.java
|
SlideStackModel.previous
|
public void previous(final boolean skipSlideStep) {
synchronized (this) {
// Try to display the previous slide step first
// If no slide step is remaining, display the previous slide
if (skipSlideStep || this.selectedSlideModel.previousStep() && this.slidePosition > 0) {
this.slidePosition = Math.max(this.slidePosition - 1, 0);
displaySlide(getPresentationService().getPresentation().getSlides().getSlide().get(this.slidePosition), !skipSlideStep);
}
}
}
|
java
|
public void previous(final boolean skipSlideStep) {
synchronized (this) {
// Try to display the previous slide step first
// If no slide step is remaining, display the previous slide
if (skipSlideStep || this.selectedSlideModel.previousStep() && this.slidePosition > 0) {
this.slidePosition = Math.max(this.slidePosition - 1, 0);
displaySlide(getPresentationService().getPresentation().getSlides().getSlide().get(this.slidePosition), !skipSlideStep);
}
}
}
|
[
"public",
"void",
"previous",
"(",
"final",
"boolean",
"skipSlideStep",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"// Try to display the previous slide step first",
"// If no slide step is remaining, display the previous slide",
"if",
"(",
"skipSlideStep",
"||",
"this",
".",
"selectedSlideModel",
".",
"previousStep",
"(",
")",
"&&",
"this",
".",
"slidePosition",
">",
"0",
")",
"{",
"this",
".",
"slidePosition",
"=",
"Math",
".",
"max",
"(",
"this",
".",
"slidePosition",
"-",
"1",
",",
"0",
")",
";",
"displaySlide",
"(",
"getPresentationService",
"(",
")",
".",
"getPresentation",
"(",
")",
".",
"getSlides",
"(",
")",
".",
"getSlide",
"(",
")",
".",
"get",
"(",
"this",
".",
"slidePosition",
")",
",",
"!",
"skipSlideStep",
")",
";",
"}",
"}",
"}"
] |
Go to previous slide.
|
[
"Go",
"to",
"previous",
"slide",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/stack/SlideStackModel.java#L310-L319
|
8,386 |
JRebirth/JRebirth
|
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/stack/SlideStackModel.java
|
SlideStackModel.showSlideMenu
|
public void showSlideMenu() {
synchronized (this) {
if (!this.menuShown.getAndSet(true)) {
final SlideMenuModel smm = getModel(Key.create(SlideMenuModel.class, this.selectedSlide));
StackPane.setAlignment(smm.node(), Pos.CENTER);
view().node().getChildren().add(smm.node());
smm.node().parentProperty().addListener((observable, oldValue, newValue) -> {
if (newValue == null) {
this.menuShown.set(false);
}
});
}
}
}
|
java
|
public void showSlideMenu() {
synchronized (this) {
if (!this.menuShown.getAndSet(true)) {
final SlideMenuModel smm = getModel(Key.create(SlideMenuModel.class, this.selectedSlide));
StackPane.setAlignment(smm.node(), Pos.CENTER);
view().node().getChildren().add(smm.node());
smm.node().parentProperty().addListener((observable, oldValue, newValue) -> {
if (newValue == null) {
this.menuShown.set(false);
}
});
}
}
}
|
[
"public",
"void",
"showSlideMenu",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"this",
".",
"menuShown",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"final",
"SlideMenuModel",
"smm",
"=",
"getModel",
"(",
"Key",
".",
"create",
"(",
"SlideMenuModel",
".",
"class",
",",
"this",
".",
"selectedSlide",
")",
")",
";",
"StackPane",
".",
"setAlignment",
"(",
"smm",
".",
"node",
"(",
")",
",",
"Pos",
".",
"CENTER",
")",
";",
"view",
"(",
")",
".",
"node",
"(",
")",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"smm",
".",
"node",
"(",
")",
")",
";",
"smm",
".",
"node",
"(",
")",
".",
"parentProperty",
"(",
")",
".",
"addListener",
"(",
"(",
"observable",
",",
"oldValue",
",",
"newValue",
")",
"->",
"{",
"if",
"(",
"newValue",
"==",
"null",
")",
"{",
"this",
".",
"menuShown",
".",
"set",
"(",
"false",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"}"
] |
Display the slide menu to navigate.
|
[
"Display",
"the",
"slide",
"menu",
"to",
"navigate",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/stack/SlideStackModel.java#L329-L344
|
8,387 |
pmlopes/yoke
|
framework/src/main/java/com/jetdrone/vertx/yoke/core/impl/DefaultRequestWrapper.java
|
DefaultRequestWrapper.wrap
|
@Override
public YokeRequest wrap(HttpServerRequest request, Context context, Map<String, Engine> engines, SessionStore store) {
return new YokeRequest(request, new YokeResponse(request.response(), context, engines), context, store);
}
|
java
|
@Override
public YokeRequest wrap(HttpServerRequest request, Context context, Map<String, Engine> engines, SessionStore store) {
return new YokeRequest(request, new YokeResponse(request.response(), context, engines), context, store);
}
|
[
"@",
"Override",
"public",
"YokeRequest",
"wrap",
"(",
"HttpServerRequest",
"request",
",",
"Context",
"context",
",",
"Map",
"<",
"String",
",",
"Engine",
">",
"engines",
",",
"SessionStore",
"store",
")",
"{",
"return",
"new",
"YokeRequest",
"(",
"request",
",",
"new",
"YokeResponse",
"(",
"request",
".",
"response",
"(",
")",
",",
"context",
",",
"engines",
")",
",",
"context",
",",
"store",
")",
";",
"}"
] |
Default implementation of the request wrapper
|
[
"Default",
"implementation",
"of",
"the",
"request",
"wrapper"
] |
fe8a64036f09fb745f0644faddd46162d64faf3c
|
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/core/impl/DefaultRequestWrapper.java#L18-L21
|
8,388 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/service/impl/LoadEdtFileServiceImpl.java
|
LoadEdtFileServiceImpl.addEvent
|
private void addEvent(final List<JRebirthEvent> eventList, final String strLine) {
eventList.add(new JRebirthEventBase(strLine));
}
|
java
|
private void addEvent(final List<JRebirthEvent> eventList, final String strLine) {
eventList.add(new JRebirthEventBase(strLine));
}
|
[
"private",
"void",
"addEvent",
"(",
"final",
"List",
"<",
"JRebirthEvent",
">",
"eventList",
",",
"final",
"String",
"strLine",
")",
"{",
"eventList",
".",
"add",
"(",
"new",
"JRebirthEventBase",
"(",
"strLine",
")",
")",
";",
"}"
] |
Add an event to the event list.
@param eventList the list of events
@param strLine the string to use
|
[
"Add",
"an",
"event",
"to",
"the",
"event",
"list",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/service/impl/LoadEdtFileServiceImpl.java#L108-L110
|
8,389 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/command/multi/AbstractMultiCommand.java
|
AbstractMultiCommand.initSequential
|
private void initSequential(final Boolean sequential) {
// Try to retrieve the Sequential annotation at class level within class hierarchy
final Sequential seq = ClassUtility.getLastClassAnnotation(this.getClass(), Sequential.class);
// First try to get the annotation value (if present
// Secondly by provided runtType argument
// Thirdly (default case) use FALSE value
setSequential(seq == null ? sequential == null ? DEFAULT_SEQUENTIAL_VALUE : sequential : seq.value());
}
|
java
|
private void initSequential(final Boolean sequential) {
// Try to retrieve the Sequential annotation at class level within class hierarchy
final Sequential seq = ClassUtility.getLastClassAnnotation(this.getClass(), Sequential.class);
// First try to get the annotation value (if present
// Secondly by provided runtType argument
// Thirdly (default case) use FALSE value
setSequential(seq == null ? sequential == null ? DEFAULT_SEQUENTIAL_VALUE : sequential : seq.value());
}
|
[
"private",
"void",
"initSequential",
"(",
"final",
"Boolean",
"sequential",
")",
"{",
"// Try to retrieve the Sequential annotation at class level within class hierarchy",
"final",
"Sequential",
"seq",
"=",
"ClassUtility",
".",
"getLastClassAnnotation",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"Sequential",
".",
"class",
")",
";",
"// First try to get the annotation value (if present",
"// Secondly by provided runtType argument",
"// Thirdly (default case) use FALSE value",
"setSequential",
"(",
"seq",
"==",
"null",
"?",
"sequential",
"==",
"null",
"?",
"DEFAULT_SEQUENTIAL_VALUE",
":",
"sequential",
":",
"seq",
".",
"value",
"(",
")",
")",
";",
"}"
] |
Define the sequential value.
It will try to load the annotation value, then the parameter given to constructor. If none of them have been used the default false value will be used.
@param sequential the constructor parameter
|
[
"Define",
"the",
"sequential",
"value",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/command/multi/AbstractMultiCommand.java#L125-L135
|
8,390 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/command/multi/AbstractMultiCommand.java
|
AbstractMultiCommand.getCommandKey
|
protected UniqueKey<? extends Command> getCommandKey(final Class<? extends Command> commandClass, final Object... keyPart) {
return Key.create(commandClass, keyPart);
}
|
java
|
protected UniqueKey<? extends Command> getCommandKey(final Class<? extends Command> commandClass, final Object... keyPart) {
return Key.create(commandClass, keyPart);
}
|
[
"protected",
"UniqueKey",
"<",
"?",
"extends",
"Command",
">",
"getCommandKey",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Command",
">",
"commandClass",
",",
"final",
"Object",
"...",
"keyPart",
")",
"{",
"return",
"Key",
".",
"create",
"(",
"commandClass",
",",
"keyPart",
")",
";",
"}"
] |
Return the command key.
@param commandClass the class of the command to call
@param keyPart the object used as key parts
|
[
"Return",
"the",
"command",
"key",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/command/multi/AbstractMultiCommand.java#L421-L423
|
8,391 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/object/AbstractObjectModel.java
|
AbstractObjectModel.buildObject
|
@SuppressWarnings("unchecked")
protected void buildObject() {
final Class<?> objectType = ClassUtility.findGenericClass(this.getClass(), OBJECT_EXCLUDED_CLASSES);
// If not generic type is defined for Object, object field will remain null
if (objectType != null) {
Object keyPart = null;
boolean found = false;
for (int i = 0; !found && i < getListKeyPart().size(); i++) {
keyPart = getListKeyPart().get(i);
if (objectType.isAssignableFrom(keyPart.getClass())) {
this.object = (O) keyPart;
found = true;
}
}
if (this.object == null) {
// Build the current default object by reflection if it hadn't been provided into the key without any constructor parameters
try {
this.object = (O) ClassUtility.buildGenericType(this.getClass(), OBJECT_EXCLUDED_CLASSES);
} catch (final CoreException ce) {
LOGGER.log(UIMessages.CREATION_FAILURE, ce, this.getClass().getName());
throw new CoreRuntimeException(ce);
}
}
}
}
|
java
|
@SuppressWarnings("unchecked")
protected void buildObject() {
final Class<?> objectType = ClassUtility.findGenericClass(this.getClass(), OBJECT_EXCLUDED_CLASSES);
// If not generic type is defined for Object, object field will remain null
if (objectType != null) {
Object keyPart = null;
boolean found = false;
for (int i = 0; !found && i < getListKeyPart().size(); i++) {
keyPart = getListKeyPart().get(i);
if (objectType.isAssignableFrom(keyPart.getClass())) {
this.object = (O) keyPart;
found = true;
}
}
if (this.object == null) {
// Build the current default object by reflection if it hadn't been provided into the key without any constructor parameters
try {
this.object = (O) ClassUtility.buildGenericType(this.getClass(), OBJECT_EXCLUDED_CLASSES);
} catch (final CoreException ce) {
LOGGER.log(UIMessages.CREATION_FAILURE, ce, this.getClass().getName());
throw new CoreRuntimeException(ce);
}
}
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"buildObject",
"(",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"objectType",
"=",
"ClassUtility",
".",
"findGenericClass",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"OBJECT_EXCLUDED_CLASSES",
")",
";",
"// If not generic type is defined for Object, object field will remain null",
"if",
"(",
"objectType",
"!=",
"null",
")",
"{",
"Object",
"keyPart",
"=",
"null",
";",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"!",
"found",
"&&",
"i",
"<",
"getListKeyPart",
"(",
")",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"keyPart",
"=",
"getListKeyPart",
"(",
")",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"objectType",
".",
"isAssignableFrom",
"(",
"keyPart",
".",
"getClass",
"(",
")",
")",
")",
"{",
"this",
".",
"object",
"=",
"(",
"O",
")",
"keyPart",
";",
"found",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"this",
".",
"object",
"==",
"null",
")",
"{",
"// Build the current default object by reflection if it hadn't been provided into the key without any constructor parameters",
"try",
"{",
"this",
".",
"object",
"=",
"(",
"O",
")",
"ClassUtility",
".",
"buildGenericType",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"OBJECT_EXCLUDED_CLASSES",
")",
";",
"}",
"catch",
"(",
"final",
"CoreException",
"ce",
")",
"{",
"LOGGER",
".",
"log",
"(",
"UIMessages",
".",
"CREATION_FAILURE",
",",
"ce",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"throw",
"new",
"CoreRuntimeException",
"(",
"ce",
")",
";",
"}",
"}",
"}",
"}"
] |
Create the default bindable object.
|
[
"Create",
"the",
"default",
"bindable",
"object",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/object/AbstractObjectModel.java#L72-L101
|
8,392 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java
|
EditorModel.doUnload
|
public void doUnload(final Wave wave) {
this.eventList = new ArrayList<>();
final Collection<BallModel> list = new ArrayList<>(this.ballMap.values());
for (final BallModel ballModel : list) {
unregisterBall(ballModel);
}
}
|
java
|
public void doUnload(final Wave wave) {
this.eventList = new ArrayList<>();
final Collection<BallModel> list = new ArrayList<>(this.ballMap.values());
for (final BallModel ballModel : list) {
unregisterBall(ballModel);
}
}
|
[
"public",
"void",
"doUnload",
"(",
"final",
"Wave",
"wave",
")",
"{",
"this",
".",
"eventList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"Collection",
"<",
"BallModel",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"this",
".",
"ballMap",
".",
"values",
"(",
")",
")",
";",
"for",
"(",
"final",
"BallModel",
"ballModel",
":",
"list",
")",
"{",
"unregisterBall",
"(",
"ballModel",
")",
";",
"}",
"}"
] |
Unload the event list.
@param wave the wave received
|
[
"Unload",
"the",
"event",
"list",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java#L85-L93
|
8,393 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java
|
EditorModel.doPlay
|
public void doPlay(final Wave wave) {
if (!this.playing) {
this.playing = true;
this.timeFrame = 0;
}
if (this.timeFrame < this.eventList.size() - 1) {
showNext(this.eventList.get(this.timeFrame));
} else {
this.playing = false;
}
}
|
java
|
public void doPlay(final Wave wave) {
if (!this.playing) {
this.playing = true;
this.timeFrame = 0;
}
if (this.timeFrame < this.eventList.size() - 1) {
showNext(this.eventList.get(this.timeFrame));
} else {
this.playing = false;
}
}
|
[
"public",
"void",
"doPlay",
"(",
"final",
"Wave",
"wave",
")",
"{",
"if",
"(",
"!",
"this",
".",
"playing",
")",
"{",
"this",
".",
"playing",
"=",
"true",
";",
"this",
".",
"timeFrame",
"=",
"0",
";",
"}",
"if",
"(",
"this",
".",
"timeFrame",
"<",
"this",
".",
"eventList",
".",
"size",
"(",
")",
"-",
"1",
")",
"{",
"showNext",
"(",
"this",
".",
"eventList",
".",
"get",
"(",
"this",
".",
"timeFrame",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"playing",
"=",
"false",
";",
"}",
"}"
] |
Call when event play button is pressed.
@param wave the wave received
|
[
"Call",
"when",
"event",
"play",
"button",
"is",
"pressed",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java#L100-L110
|
8,394 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java
|
EditorModel.doNext
|
public void doNext(final Wave wave) {
if (this.eventList != null && this.timeFrame + 1 < this.eventList.size()) {
showNext(this.eventList.get(this.timeFrame + 1));
}
}
|
java
|
public void doNext(final Wave wave) {
if (this.eventList != null && this.timeFrame + 1 < this.eventList.size()) {
showNext(this.eventList.get(this.timeFrame + 1));
}
}
|
[
"public",
"void",
"doNext",
"(",
"final",
"Wave",
"wave",
")",
"{",
"if",
"(",
"this",
".",
"eventList",
"!=",
"null",
"&&",
"this",
".",
"timeFrame",
"+",
"1",
"<",
"this",
".",
"eventList",
".",
"size",
"(",
")",
")",
"{",
"showNext",
"(",
"this",
".",
"eventList",
".",
"get",
"(",
"this",
".",
"timeFrame",
"+",
"1",
")",
")",
";",
"}",
"}"
] |
Call when event next button is pressed.
@param wave the wave received
|
[
"Call",
"when",
"event",
"next",
"button",
"is",
"pressed",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java#L128-L132
|
8,395 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java
|
EditorModel.showNext
|
private void showNext(final JRebirthEvent event) {
this.timeFrame++;
callCommand(ProcessEventCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
}
|
java
|
private void showNext(final JRebirthEvent event) {
this.timeFrame++;
callCommand(ProcessEventCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
}
|
[
"private",
"void",
"showNext",
"(",
"final",
"JRebirthEvent",
"event",
")",
"{",
"this",
".",
"timeFrame",
"++",
";",
"callCommand",
"(",
"ProcessEventCommand",
".",
"class",
",",
"WBuilder",
".",
"waveData",
"(",
"EditorWaves",
".",
"EVENT",
",",
"event",
")",
")",
";",
"}"
] |
Show next element.
@param event the next event to show
|
[
"Show",
"next",
"element",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java#L139-L142
|
8,396 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java
|
EditorModel.doStop
|
public void doStop(final Wave wave) {
for (int i = this.timeFrame; i >= 0; i--) {
hideCurrent(this.eventList.get(this.timeFrame));
}
}
|
java
|
public void doStop(final Wave wave) {
for (int i = this.timeFrame; i >= 0; i--) {
hideCurrent(this.eventList.get(this.timeFrame));
}
}
|
[
"public",
"void",
"doStop",
"(",
"final",
"Wave",
"wave",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"timeFrame",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"hideCurrent",
"(",
"this",
".",
"eventList",
".",
"get",
"(",
"this",
".",
"timeFrame",
")",
")",
";",
"}",
"}"
] |
Call when event stop button is pressed.
@param wave the wave received
|
[
"Call",
"when",
"event",
"stop",
"button",
"is",
"pressed",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java#L170-L174
|
8,397 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java
|
EditorModel.registerBall
|
public void registerBall(final BallModel ballModel) {
if (!this.ballMap.containsKey(ballModel.getEventModel().target())) {
this.ballMap.put(ballModel.getEventModel().target(), ballModel);
view().getPanel().getChildren().add(ballModel.node());
}
}
|
java
|
public void registerBall(final BallModel ballModel) {
if (!this.ballMap.containsKey(ballModel.getEventModel().target())) {
this.ballMap.put(ballModel.getEventModel().target(), ballModel);
view().getPanel().getChildren().add(ballModel.node());
}
}
|
[
"public",
"void",
"registerBall",
"(",
"final",
"BallModel",
"ballModel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"ballMap",
".",
"containsKey",
"(",
"ballModel",
".",
"getEventModel",
"(",
")",
".",
"target",
"(",
")",
")",
")",
"{",
"this",
".",
"ballMap",
".",
"put",
"(",
"ballModel",
".",
"getEventModel",
"(",
")",
".",
"target",
"(",
")",
",",
"ballModel",
")",
";",
"view",
"(",
")",
".",
"getPanel",
"(",
")",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"ballModel",
".",
"node",
"(",
")",
")",
";",
"}",
"}"
] |
Register a ball model.
@param ballModel the ball model to register
|
[
"Register",
"a",
"ball",
"model",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java#L188-L193
|
8,398 |
JRebirth/JRebirth
|
org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java
|
EditorModel.unregisterBall
|
public void unregisterBall(final BallModel ballModel) {
this.ballMap.remove(ballModel.getEventModel().target());
view().getPanel().getChildren().remove(ballModel.node());
}
|
java
|
public void unregisterBall(final BallModel ballModel) {
this.ballMap.remove(ballModel.getEventModel().target());
view().getPanel().getChildren().remove(ballModel.node());
}
|
[
"public",
"void",
"unregisterBall",
"(",
"final",
"BallModel",
"ballModel",
")",
"{",
"this",
".",
"ballMap",
".",
"remove",
"(",
"ballModel",
".",
"getEventModel",
"(",
")",
".",
"target",
"(",
")",
")",
";",
"view",
"(",
")",
".",
"getPanel",
"(",
")",
".",
"getChildren",
"(",
")",
".",
"remove",
"(",
"ballModel",
".",
"node",
"(",
")",
")",
";",
"}"
] |
Unregister a ball model.
@param ballModel the ball model to unregister
|
[
"Unregister",
"a",
"ball",
"model",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/ui/editor/EditorModel.java#L200-L203
|
8,399 |
JRebirth/JRebirth
|
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirthThread.java
|
JRebirthThread.runIntoJTP
|
public void runIntoJTP(final JRebirthRunnable runnable) {
if (getFacade().executorService().checkAvailability(runnable.priority())) {
getFacade().executorService().execute(runnable);
LOGGER.log(JTP_QUEUED, runnable.toString());
} else {
getFacade().highPriorityExecutorService().execute(runnable);
LOGGER.log(HPTP_QUEUED, runnable.toString());
}
}
|
java
|
public void runIntoJTP(final JRebirthRunnable runnable) {
if (getFacade().executorService().checkAvailability(runnable.priority())) {
getFacade().executorService().execute(runnable);
LOGGER.log(JTP_QUEUED, runnable.toString());
} else {
getFacade().highPriorityExecutorService().execute(runnable);
LOGGER.log(HPTP_QUEUED, runnable.toString());
}
}
|
[
"public",
"void",
"runIntoJTP",
"(",
"final",
"JRebirthRunnable",
"runnable",
")",
"{",
"if",
"(",
"getFacade",
"(",
")",
".",
"executorService",
"(",
")",
".",
"checkAvailability",
"(",
"runnable",
".",
"priority",
"(",
")",
")",
")",
"{",
"getFacade",
"(",
")",
".",
"executorService",
"(",
")",
".",
"execute",
"(",
"runnable",
")",
";",
"LOGGER",
".",
"log",
"(",
"JTP_QUEUED",
",",
"runnable",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"getFacade",
"(",
")",
".",
"highPriorityExecutorService",
"(",
")",
".",
"execute",
"(",
"runnable",
")",
";",
"LOGGER",
".",
"log",
"(",
"HPTP_QUEUED",
",",
"runnable",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
Run into thread pool.
If a slot is available the task will be run immediately.<br />
Otherwise it will run as soon as a slot will be available according to the existing task queue
@param runnable the task to run
|
[
"Run",
"into",
"thread",
"pool",
"."
] |
93f4fc087b83c73db540333b9686e97b4cec694d
|
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirthThread.java#L103-L113
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.