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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
147,100
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlField.java
|
AptControlField.initControlInterface
|
protected AptControlInterface initControlInterface()
{
TypeMirror controlType = _fieldDecl.getType();
if (! (controlType instanceof DeclaredType))
{
_ap.printError( _fieldDecl, "control.field.bad.type" );
return null;
}
//
// The field can either be declared as the bean type or the public interface type.
// If it is the bean type, then we need to reflect to find the public interface
// type it implements.
//
TypeDeclaration typeDecl = ((DeclaredType)controlType).getDeclaration();
InterfaceDeclaration controlIntf = null;
//
// It is possible that the declared type is associated with a to-be-generated
// bean type. In this case, look for the associated control interface on the
// processor input list.
//
if ( typeDecl == null )
{
String className = controlType.toString();
String intfName = className.substring(0, className.length() - 4);
String interfaceHint = getControlInterfaceHint();
controlIntf = (InterfaceDeclaration)_ap.getAnnotationProcessorEnvironment().getTypeDeclaration(intfName);
if (controlIntf == null)
{
// The specified class name may not be fully qualified. In this case, the
// best we can do is look for a best fit match against the input types
for (TypeDeclaration td :_ap.getAnnotationProcessorEnvironment().getSpecifiedTypeDeclarations())
{
// if an interface hint was provided, use it to find the control interface,
// if not provided try to find the control interface by matching simple names.
if (interfaceHint != null) {
if (td instanceof InterfaceDeclaration &&
td.getQualifiedName().equals(interfaceHint))
{
controlIntf = (InterfaceDeclaration)td;
break;
}
}
else {
if (td instanceof InterfaceDeclaration &&
td.getSimpleName().equals(intfName))
{
controlIntf = (InterfaceDeclaration)td;
break;
}
}
}
}
}
else if (typeDecl instanceof ClassDeclaration)
{
Collection<InterfaceType> implIntfs = ((ClassDeclaration)typeDecl).getSuperinterfaces();
for (InterfaceType intfType : implIntfs)
{
InterfaceDeclaration intfDecl = intfType.getDeclaration();
if ( intfDecl == null )
return null;
if (intfDecl.getAnnotation(ControlInterface.class) != null||
intfDecl.getAnnotation(ControlExtension.class) != null)
{
controlIntf = intfDecl;
break;
}
}
}
else if (typeDecl instanceof InterfaceDeclaration)
{
controlIntf = (InterfaceDeclaration)typeDecl;
}
if (controlIntf == null)
{
_ap.printError( _fieldDecl, "control.field.bad.type.2" );
return null;
}
return new AptControlInterface(controlIntf, _ap);
}
|
java
|
protected AptControlInterface initControlInterface()
{
TypeMirror controlType = _fieldDecl.getType();
if (! (controlType instanceof DeclaredType))
{
_ap.printError( _fieldDecl, "control.field.bad.type" );
return null;
}
//
// The field can either be declared as the bean type or the public interface type.
// If it is the bean type, then we need to reflect to find the public interface
// type it implements.
//
TypeDeclaration typeDecl = ((DeclaredType)controlType).getDeclaration();
InterfaceDeclaration controlIntf = null;
//
// It is possible that the declared type is associated with a to-be-generated
// bean type. In this case, look for the associated control interface on the
// processor input list.
//
if ( typeDecl == null )
{
String className = controlType.toString();
String intfName = className.substring(0, className.length() - 4);
String interfaceHint = getControlInterfaceHint();
controlIntf = (InterfaceDeclaration)_ap.getAnnotationProcessorEnvironment().getTypeDeclaration(intfName);
if (controlIntf == null)
{
// The specified class name may not be fully qualified. In this case, the
// best we can do is look for a best fit match against the input types
for (TypeDeclaration td :_ap.getAnnotationProcessorEnvironment().getSpecifiedTypeDeclarations())
{
// if an interface hint was provided, use it to find the control interface,
// if not provided try to find the control interface by matching simple names.
if (interfaceHint != null) {
if (td instanceof InterfaceDeclaration &&
td.getQualifiedName().equals(interfaceHint))
{
controlIntf = (InterfaceDeclaration)td;
break;
}
}
else {
if (td instanceof InterfaceDeclaration &&
td.getSimpleName().equals(intfName))
{
controlIntf = (InterfaceDeclaration)td;
break;
}
}
}
}
}
else if (typeDecl instanceof ClassDeclaration)
{
Collection<InterfaceType> implIntfs = ((ClassDeclaration)typeDecl).getSuperinterfaces();
for (InterfaceType intfType : implIntfs)
{
InterfaceDeclaration intfDecl = intfType.getDeclaration();
if ( intfDecl == null )
return null;
if (intfDecl.getAnnotation(ControlInterface.class) != null||
intfDecl.getAnnotation(ControlExtension.class) != null)
{
controlIntf = intfDecl;
break;
}
}
}
else if (typeDecl instanceof InterfaceDeclaration)
{
controlIntf = (InterfaceDeclaration)typeDecl;
}
if (controlIntf == null)
{
_ap.printError( _fieldDecl, "control.field.bad.type.2" );
return null;
}
return new AptControlInterface(controlIntf, _ap);
}
|
[
"protected",
"AptControlInterface",
"initControlInterface",
"(",
")",
"{",
"TypeMirror",
"controlType",
"=",
"_fieldDecl",
".",
"getType",
"(",
")",
";",
"if",
"(",
"!",
"(",
"controlType",
"instanceof",
"DeclaredType",
")",
")",
"{",
"_ap",
".",
"printError",
"(",
"_fieldDecl",
",",
"\"control.field.bad.type\"",
")",
";",
"return",
"null",
";",
"}",
"//",
"// The field can either be declared as the bean type or the public interface type.",
"// If it is the bean type, then we need to reflect to find the public interface",
"// type it implements.",
"//",
"TypeDeclaration",
"typeDecl",
"=",
"(",
"(",
"DeclaredType",
")",
"controlType",
")",
".",
"getDeclaration",
"(",
")",
";",
"InterfaceDeclaration",
"controlIntf",
"=",
"null",
";",
"//",
"// It is possible that the declared type is associated with a to-be-generated",
"// bean type. In this case, look for the associated control interface on the",
"// processor input list.",
"//",
"if",
"(",
"typeDecl",
"==",
"null",
")",
"{",
"String",
"className",
"=",
"controlType",
".",
"toString",
"(",
")",
";",
"String",
"intfName",
"=",
"className",
".",
"substring",
"(",
"0",
",",
"className",
".",
"length",
"(",
")",
"-",
"4",
")",
";",
"String",
"interfaceHint",
"=",
"getControlInterfaceHint",
"(",
")",
";",
"controlIntf",
"=",
"(",
"InterfaceDeclaration",
")",
"_ap",
".",
"getAnnotationProcessorEnvironment",
"(",
")",
".",
"getTypeDeclaration",
"(",
"intfName",
")",
";",
"if",
"(",
"controlIntf",
"==",
"null",
")",
"{",
"// The specified class name may not be fully qualified. In this case, the",
"// best we can do is look for a best fit match against the input types",
"for",
"(",
"TypeDeclaration",
"td",
":",
"_ap",
".",
"getAnnotationProcessorEnvironment",
"(",
")",
".",
"getSpecifiedTypeDeclarations",
"(",
")",
")",
"{",
"// if an interface hint was provided, use it to find the control interface,",
"// if not provided try to find the control interface by matching simple names.",
"if",
"(",
"interfaceHint",
"!=",
"null",
")",
"{",
"if",
"(",
"td",
"instanceof",
"InterfaceDeclaration",
"&&",
"td",
".",
"getQualifiedName",
"(",
")",
".",
"equals",
"(",
"interfaceHint",
")",
")",
"{",
"controlIntf",
"=",
"(",
"InterfaceDeclaration",
")",
"td",
";",
"break",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"td",
"instanceof",
"InterfaceDeclaration",
"&&",
"td",
".",
"getSimpleName",
"(",
")",
".",
"equals",
"(",
"intfName",
")",
")",
"{",
"controlIntf",
"=",
"(",
"InterfaceDeclaration",
")",
"td",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"typeDecl",
"instanceof",
"ClassDeclaration",
")",
"{",
"Collection",
"<",
"InterfaceType",
">",
"implIntfs",
"=",
"(",
"(",
"ClassDeclaration",
")",
"typeDecl",
")",
".",
"getSuperinterfaces",
"(",
")",
";",
"for",
"(",
"InterfaceType",
"intfType",
":",
"implIntfs",
")",
"{",
"InterfaceDeclaration",
"intfDecl",
"=",
"intfType",
".",
"getDeclaration",
"(",
")",
";",
"if",
"(",
"intfDecl",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"intfDecl",
".",
"getAnnotation",
"(",
"ControlInterface",
".",
"class",
")",
"!=",
"null",
"||",
"intfDecl",
".",
"getAnnotation",
"(",
"ControlExtension",
".",
"class",
")",
"!=",
"null",
")",
"{",
"controlIntf",
"=",
"intfDecl",
";",
"break",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"typeDecl",
"instanceof",
"InterfaceDeclaration",
")",
"{",
"controlIntf",
"=",
"(",
"InterfaceDeclaration",
")",
"typeDecl",
";",
"}",
"if",
"(",
"controlIntf",
"==",
"null",
")",
"{",
"_ap",
".",
"printError",
"(",
"_fieldDecl",
",",
"\"control.field.bad.type.2\"",
")",
";",
"return",
"null",
";",
"}",
"return",
"new",
"AptControlInterface",
"(",
"controlIntf",
",",
"_ap",
")",
";",
"}"
] |
Initializes the ControlInterface associated with this ControlField
|
[
"Initializes",
"the",
"ControlInterface",
"associated",
"with",
"this",
"ControlField"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlField.java#L68-L154
|
147,101
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java
|
TreeHelpers.processTreeRequest
|
public static void processTreeRequest(String treeId, TreeElement treeRoot, HttpServletRequest request, HttpServletResponse response)
{
assert(treeId != null) : "parameter treeId must not be null.";
assert(treeRoot != null) : "parameter treeRoot must not be null.";
assert(request != null) : "paramater request must not be null.";
// check the root node to see if it is a TreeRootElement. if it is, then we
// use it to change the selected node. Otherwise we will do a recursive search
// of the tree to select the node.
String selectNode = request.getParameter(TreeElement.SELECTED_NODE);
if (selectNode != null) {
if (treeRoot instanceof ITreeRootElement) {
ITreeRootElement root = (ITreeRootElement) treeRoot;
root.changeSelected(selectNode, request);
}
else {
setSelected(treeRoot, selectNode, request);
}
}
// handle auto expand.
String expandNode = null;
// our we auto expanding this node?
expandNode = request.getParameter(TreeElement.EXPAND_NODE);
// if we are auto expanding flip the expand of this node if it was expanded
if (expandNode != null) {
TreeElement n = treeRoot.findNode(expandNode);
if (n != null) {
n.onExpand(request, response);
n.setExpanded(!n.isExpanded());
}
}
}
|
java
|
public static void processTreeRequest(String treeId, TreeElement treeRoot, HttpServletRequest request, HttpServletResponse response)
{
assert(treeId != null) : "parameter treeId must not be null.";
assert(treeRoot != null) : "parameter treeRoot must not be null.";
assert(request != null) : "paramater request must not be null.";
// check the root node to see if it is a TreeRootElement. if it is, then we
// use it to change the selected node. Otherwise we will do a recursive search
// of the tree to select the node.
String selectNode = request.getParameter(TreeElement.SELECTED_NODE);
if (selectNode != null) {
if (treeRoot instanceof ITreeRootElement) {
ITreeRootElement root = (ITreeRootElement) treeRoot;
root.changeSelected(selectNode, request);
}
else {
setSelected(treeRoot, selectNode, request);
}
}
// handle auto expand.
String expandNode = null;
// our we auto expanding this node?
expandNode = request.getParameter(TreeElement.EXPAND_NODE);
// if we are auto expanding flip the expand of this node if it was expanded
if (expandNode != null) {
TreeElement n = treeRoot.findNode(expandNode);
if (n != null) {
n.onExpand(request, response);
n.setExpanded(!n.isExpanded());
}
}
}
|
[
"public",
"static",
"void",
"processTreeRequest",
"(",
"String",
"treeId",
",",
"TreeElement",
"treeRoot",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"{",
"assert",
"(",
"treeId",
"!=",
"null",
")",
":",
"\"parameter treeId must not be null.\"",
";",
"assert",
"(",
"treeRoot",
"!=",
"null",
")",
":",
"\"parameter treeRoot must not be null.\"",
";",
"assert",
"(",
"request",
"!=",
"null",
")",
":",
"\"paramater request must not be null.\"",
";",
"// check the root node to see if it is a TreeRootElement. if it is, then we",
"// use it to change the selected node. Otherwise we will do a recursive search",
"// of the tree to select the node.",
"String",
"selectNode",
"=",
"request",
".",
"getParameter",
"(",
"TreeElement",
".",
"SELECTED_NODE",
")",
";",
"if",
"(",
"selectNode",
"!=",
"null",
")",
"{",
"if",
"(",
"treeRoot",
"instanceof",
"ITreeRootElement",
")",
"{",
"ITreeRootElement",
"root",
"=",
"(",
"ITreeRootElement",
")",
"treeRoot",
";",
"root",
".",
"changeSelected",
"(",
"selectNode",
",",
"request",
")",
";",
"}",
"else",
"{",
"setSelected",
"(",
"treeRoot",
",",
"selectNode",
",",
"request",
")",
";",
"}",
"}",
"// handle auto expand.",
"String",
"expandNode",
"=",
"null",
";",
"// our we auto expanding this node?",
"expandNode",
"=",
"request",
".",
"getParameter",
"(",
"TreeElement",
".",
"EXPAND_NODE",
")",
";",
"// if we are auto expanding flip the expand of this node if it was expanded",
"if",
"(",
"expandNode",
"!=",
"null",
")",
"{",
"TreeElement",
"n",
"=",
"treeRoot",
".",
"findNode",
"(",
"expandNode",
")",
";",
"if",
"(",
"n",
"!=",
"null",
")",
"{",
"n",
".",
"onExpand",
"(",
"request",
",",
"response",
")",
";",
"n",
".",
"setExpanded",
"(",
"!",
"n",
".",
"isExpanded",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
If this tree was selected or expanded this will handle that processing.
@param treeId
@param treeRoot
@param request
|
[
"If",
"this",
"tree",
"was",
"selected",
"or",
"expanded",
"this",
"will",
"handle",
"that",
"processing",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java#L41-L75
|
147,102
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java
|
TreeHelpers.setSelected
|
protected static void setSelected(TreeElement node, String selected, ServletRequest request)
{
assert(node != null) : "parameter 'node' must not be null";
assert(selected != null) : "parameter 'selected' must not be null";
assert(request != null) : "parameter 'requested' must not be null";
if (node.getName().equals(selected)) {
node.onSelect(request);
node.setSelected(true);
}
else {
if (node.isSelected()) {
node.onSelect(request);
node.setSelected(false);
}
}
TreeElement children[] = node.getChildren();
assert(children != null);
for (int i = 0; i < children.length; i++) {
setSelected(children[i], selected, request);
}
}
|
java
|
protected static void setSelected(TreeElement node, String selected, ServletRequest request)
{
assert(node != null) : "parameter 'node' must not be null";
assert(selected != null) : "parameter 'selected' must not be null";
assert(request != null) : "parameter 'requested' must not be null";
if (node.getName().equals(selected)) {
node.onSelect(request);
node.setSelected(true);
}
else {
if (node.isSelected()) {
node.onSelect(request);
node.setSelected(false);
}
}
TreeElement children[] = node.getChildren();
assert(children != null);
for (int i = 0; i < children.length; i++) {
setSelected(children[i], selected, request);
}
}
|
[
"protected",
"static",
"void",
"setSelected",
"(",
"TreeElement",
"node",
",",
"String",
"selected",
",",
"ServletRequest",
"request",
")",
"{",
"assert",
"(",
"node",
"!=",
"null",
")",
":",
"\"parameter 'node' must not be null\"",
";",
"assert",
"(",
"selected",
"!=",
"null",
")",
":",
"\"parameter 'selected' must not be null\"",
";",
"assert",
"(",
"request",
"!=",
"null",
")",
":",
"\"parameter 'requested' must not be null\"",
";",
"if",
"(",
"node",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"selected",
")",
")",
"{",
"node",
".",
"onSelect",
"(",
"request",
")",
";",
"node",
".",
"setSelected",
"(",
"true",
")",
";",
"}",
"else",
"{",
"if",
"(",
"node",
".",
"isSelected",
"(",
")",
")",
"{",
"node",
".",
"onSelect",
"(",
"request",
")",
";",
"node",
".",
"setSelected",
"(",
"false",
")",
";",
"}",
"}",
"TreeElement",
"children",
"[",
"]",
"=",
"node",
".",
"getChildren",
"(",
")",
";",
"assert",
"(",
"children",
"!=",
"null",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"setSelected",
"(",
"children",
"[",
"i",
"]",
",",
"selected",
",",
"request",
")",
";",
"}",
"}"
] |
Recursive routine to set the selected node. This will set the selected node
and clear the selection on all other nodes. It will walk the full tree.
@param node
@param selected
|
[
"Recursive",
"routine",
"to",
"set",
"the",
"selected",
"node",
".",
"This",
"will",
"set",
"the",
"selected",
"node",
"and",
"clear",
"the",
"selection",
"on",
"all",
"other",
"nodes",
".",
"It",
"will",
"walk",
"the",
"full",
"tree",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java#L83-L105
|
147,103
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java
|
TreeHelpers.findSelected
|
public static TreeElement findSelected(TreeElement root)
{
assert (root != null) : "parameter 'root' must not be null";
if (root instanceof ITreeRootElement) {
return ((ITreeRootElement) root).getSelectedNode();
}
return recursiveFindSelected(root);
}
|
java
|
public static TreeElement findSelected(TreeElement root)
{
assert (root != null) : "parameter 'root' must not be null";
if (root instanceof ITreeRootElement) {
return ((ITreeRootElement) root).getSelectedNode();
}
return recursiveFindSelected(root);
}
|
[
"public",
"static",
"TreeElement",
"findSelected",
"(",
"TreeElement",
"root",
")",
"{",
"assert",
"(",
"root",
"!=",
"null",
")",
":",
"\"parameter 'root' must not be null\"",
";",
"if",
"(",
"root",
"instanceof",
"ITreeRootElement",
")",
"{",
"return",
"(",
"(",
"ITreeRootElement",
")",
"root",
")",
".",
"getSelectedNode",
"(",
")",
";",
"}",
"return",
"recursiveFindSelected",
"(",
"root",
")",
";",
"}"
] |
This will return the currently selected node from a tree.
<p>Implementation Note: The method that changes the selected node based on the request,
{@link #processTreeRequest(String, TreeElement, HttpServletRequest, HttpServletResponse)},
gets called during the processing of the {@link Tree} tag within a JSP. If the
<code>findSelected</code> method is called from an Action in a Page Flow Controller,
the value of the selected node will have not yet been updated.</p>
@param root the root element of the tree.
@return a TreeElement that is the currently selected node. This may return null.
|
[
"This",
"will",
"return",
"the",
"currently",
"selected",
"node",
"from",
"a",
"tree",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java#L119-L126
|
147,104
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java
|
TreeHelpers.recursiveFindSelected
|
private static TreeElement recursiveFindSelected(TreeElement elem)
{
assert(elem != null);
if (elem.isSelected())
return elem;
TreeElement children[] = elem.getChildren();
assert(children != null);
for (int i = 0; i < children.length; i++) {
TreeElement e = recursiveFindSelected(children[i]);
if (e != null)
return e;
}
return null;
}
|
java
|
private static TreeElement recursiveFindSelected(TreeElement elem)
{
assert(elem != null);
if (elem.isSelected())
return elem;
TreeElement children[] = elem.getChildren();
assert(children != null);
for (int i = 0; i < children.length; i++) {
TreeElement e = recursiveFindSelected(children[i]);
if (e != null)
return e;
}
return null;
}
|
[
"private",
"static",
"TreeElement",
"recursiveFindSelected",
"(",
"TreeElement",
"elem",
")",
"{",
"assert",
"(",
"elem",
"!=",
"null",
")",
";",
"if",
"(",
"elem",
".",
"isSelected",
"(",
")",
")",
"return",
"elem",
";",
"TreeElement",
"children",
"[",
"]",
"=",
"elem",
".",
"getChildren",
"(",
")",
";",
"assert",
"(",
"children",
"!=",
"null",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"TreeElement",
"e",
"=",
"recursiveFindSelected",
"(",
"children",
"[",
"i",
"]",
")",
";",
"if",
"(",
"e",
"!=",
"null",
")",
"return",
"e",
";",
"}",
"return",
"null",
";",
"}"
] |
Recursive method that will find the currently selected element in the tree.
@param elem The current element to search.
@return a TreeElement that is selected.
|
[
"Recursive",
"method",
"that",
"will",
"find",
"the",
"currently",
"selected",
"element",
"in",
"the",
"tree",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java#L133-L148
|
147,105
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/events/EventRef.java
|
EventRef.getEventDescriptor
|
public String getEventDescriptor(Class controlInterface)
{
//
// NOTE: The input controlInterface is currently unused, but included to
// enable downstream optimization of serialization representation. See the
// OPTIMIZE comment below for more details. If implemented, the interface
// is needed to reverse the transformation from a hash back to a method or
// descriptor.
//
if (_descriptor == null)
_descriptor = computeEventDescriptor(_method);
return _descriptor;
}
|
java
|
public String getEventDescriptor(Class controlInterface)
{
//
// NOTE: The input controlInterface is currently unused, but included to
// enable downstream optimization of serialization representation. See the
// OPTIMIZE comment below for more details. If implemented, the interface
// is needed to reverse the transformation from a hash back to a method or
// descriptor.
//
if (_descriptor == null)
_descriptor = computeEventDescriptor(_method);
return _descriptor;
}
|
[
"public",
"String",
"getEventDescriptor",
"(",
"Class",
"controlInterface",
")",
"{",
"//",
"// NOTE: The input controlInterface is currently unused, but included to",
"// enable downstream optimization of serialization representation. See the",
"// OPTIMIZE comment below for more details. If implemented, the interface",
"// is needed to reverse the transformation from a hash back to a method or",
"// descriptor.",
"//",
"if",
"(",
"_descriptor",
"==",
"null",
")",
"_descriptor",
"=",
"computeEventDescriptor",
"(",
"_method",
")",
";",
"return",
"_descriptor",
";",
"}"
] |
Returns the event descriptor string associated with the EventRef.
@param controlInterface the ControlInterface
|
[
"Returns",
"the",
"event",
"descriptor",
"string",
"associated",
"with",
"the",
"EventRef",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/events/EventRef.java#L109-L122
|
147,106
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/events/EventRef.java
|
EventRef.computeEventDescriptor
|
private String computeEventDescriptor(Method method)
{
StringBuilder sb = new StringBuilder();
// Add event class and method name
sb.append(method.getDeclaringClass().getName());
sb.append(".");
sb.append(method.getName());
// Add event arguments
Class [] parms = method.getParameterTypes();
sb.append("(");
for (int i = 0; i < parms.length; i++)
appendTypeDescriptor(sb, parms[i]);
sb.append(")");
// Add event return type
appendTypeDescriptor(sb, method.getReturnType());
return sb.toString();
}
|
java
|
private String computeEventDescriptor(Method method)
{
StringBuilder sb = new StringBuilder();
// Add event class and method name
sb.append(method.getDeclaringClass().getName());
sb.append(".");
sb.append(method.getName());
// Add event arguments
Class [] parms = method.getParameterTypes();
sb.append("(");
for (int i = 0; i < parms.length; i++)
appendTypeDescriptor(sb, parms[i]);
sb.append(")");
// Add event return type
appendTypeDescriptor(sb, method.getReturnType());
return sb.toString();
}
|
[
"private",
"String",
"computeEventDescriptor",
"(",
"Method",
"method",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// Add event class and method name",
"sb",
".",
"append",
"(",
"method",
".",
"getDeclaringClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"\".\"",
")",
";",
"sb",
".",
"append",
"(",
"method",
".",
"getName",
"(",
")",
")",
";",
"// Add event arguments",
"Class",
"[",
"]",
"parms",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"(\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parms",
".",
"length",
";",
"i",
"++",
")",
"appendTypeDescriptor",
"(",
"sb",
",",
"parms",
"[",
"i",
"]",
")",
";",
"sb",
".",
"append",
"(",
"\")\"",
")",
";",
"// Add event return type",
"appendTypeDescriptor",
"(",
"sb",
",",
"method",
".",
"getReturnType",
"(",
")",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Helper method that computes the event descriptor sting for a method
|
[
"Helper",
"method",
"that",
"computes",
"the",
"event",
"descriptor",
"sting",
"for",
"a",
"method"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/events/EventRef.java#L127-L147
|
147,107
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/events/EventRef.java
|
EventRef.appendTypeDescriptor
|
private void appendTypeDescriptor(StringBuilder sb, Class clazz)
{
if (clazz.isPrimitive())
sb.append(_primToType.get(clazz));
else if (clazz.isArray())
sb.append(clazz.getName().replace('.','/'));
else
{
sb.append("L");
sb.append(clazz.getName().replace('.','/'));
sb.append(";");
}
}
|
java
|
private void appendTypeDescriptor(StringBuilder sb, Class clazz)
{
if (clazz.isPrimitive())
sb.append(_primToType.get(clazz));
else if (clazz.isArray())
sb.append(clazz.getName().replace('.','/'));
else
{
sb.append("L");
sb.append(clazz.getName().replace('.','/'));
sb.append(";");
}
}
|
[
"private",
"void",
"appendTypeDescriptor",
"(",
"StringBuilder",
"sb",
",",
"Class",
"clazz",
")",
"{",
"if",
"(",
"clazz",
".",
"isPrimitive",
"(",
")",
")",
"sb",
".",
"append",
"(",
"_primToType",
".",
"get",
"(",
"clazz",
")",
")",
";",
"else",
"if",
"(",
"clazz",
".",
"isArray",
"(",
")",
")",
"sb",
".",
"append",
"(",
"clazz",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
")",
";",
"else",
"{",
"sb",
".",
"append",
"(",
"\"L\"",
")",
";",
"sb",
".",
"append",
"(",
"clazz",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
")",
";",
"sb",
".",
"append",
"(",
"\";\"",
")",
";",
"}",
"}"
] |
Helper method that appends a type descriptor to a StringBuilder. Used
while accumulating an event descriptor string.
|
[
"Helper",
"method",
"that",
"appends",
"a",
"type",
"descriptor",
"to",
"a",
"StringBuilder",
".",
"Used",
"while",
"accumulating",
"an",
"event",
"descriptor",
"string",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/events/EventRef.java#L153-L165
|
147,108
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/events/EventRef.java
|
EventRef.getEventMethod
|
public Method getEventMethod(Class controlInterface)
{
//
// If we already hold a method reference and its loader matches up with the input
// interface, then just return it.
//
if (_method != null &&
_method.getDeclaringClass().getClassLoader().equals(controlInterface.getClassLoader()))
return _method;
//
// Otherwise, obtain the mapping from descriptors to methods, and use it to
// convert back to a method.
//
String eventDescriptor = getEventDescriptor(controlInterface);
HashMap<String,Method> descriptorMap = getDescriptorMap(controlInterface);
if (!descriptorMap.containsKey(eventDescriptor))
{
throw new IllegalArgumentException("Control interface " + controlInterface +
" does not contain an event method that " +
" corresponds to " + eventDescriptor);
}
return descriptorMap.get(eventDescriptor);
}
|
java
|
public Method getEventMethod(Class controlInterface)
{
//
// If we already hold a method reference and its loader matches up with the input
// interface, then just return it.
//
if (_method != null &&
_method.getDeclaringClass().getClassLoader().equals(controlInterface.getClassLoader()))
return _method;
//
// Otherwise, obtain the mapping from descriptors to methods, and use it to
// convert back to a method.
//
String eventDescriptor = getEventDescriptor(controlInterface);
HashMap<String,Method> descriptorMap = getDescriptorMap(controlInterface);
if (!descriptorMap.containsKey(eventDescriptor))
{
throw new IllegalArgumentException("Control interface " + controlInterface +
" does not contain an event method that " +
" corresponds to " + eventDescriptor);
}
return descriptorMap.get(eventDescriptor);
}
|
[
"public",
"Method",
"getEventMethod",
"(",
"Class",
"controlInterface",
")",
"{",
"//",
"// If we already hold a method reference and its loader matches up with the input",
"// interface, then just return it.",
"//",
"if",
"(",
"_method",
"!=",
"null",
"&&",
"_method",
".",
"getDeclaringClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"equals",
"(",
"controlInterface",
".",
"getClassLoader",
"(",
")",
")",
")",
"return",
"_method",
";",
"//",
"// Otherwise, obtain the mapping from descriptors to methods, and use it to",
"// convert back to a method.",
"//",
"String",
"eventDescriptor",
"=",
"getEventDescriptor",
"(",
"controlInterface",
")",
";",
"HashMap",
"<",
"String",
",",
"Method",
">",
"descriptorMap",
"=",
"getDescriptorMap",
"(",
"controlInterface",
")",
";",
"if",
"(",
"!",
"descriptorMap",
".",
"containsKey",
"(",
"eventDescriptor",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Control interface \"",
"+",
"controlInterface",
"+",
"\" does not contain an event method that \"",
"+",
"\" corresponds to \"",
"+",
"eventDescriptor",
")",
";",
"}",
"return",
"descriptorMap",
".",
"get",
"(",
"eventDescriptor",
")",
";",
"}"
] |
Returns the event Method associated with this EventRef.
|
[
"Returns",
"the",
"event",
"Method",
"associated",
"with",
"this",
"EventRef",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/events/EventRef.java#L170-L193
|
147,109
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptTask.java
|
AptTask.scanDir
|
protected void scanDir(File srcDir, File destDir, String[] files, String ext)
{
// If no source path was specified, we effectively created one by adding the generation
// path. Because of this, we need to be sure and add all source dirs to the path too.
if (!_hasSourcepath)
{
Path srcPath = new Path(getProject());
srcPath.setLocation(srcDir);
setSourcepath(srcPath);
}
GlobPatternMapper m = new GlobPatternMapper();
m.setFrom(ext);
m.setTo("*.class");
SourceFileScanner sfs = new SourceFileScanner(this);
if (ext.equals("*.java"))
{
File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
if (newFiles.length > 0)
{
File[] newCompileList = new File[compileList.length + newFiles.length];
System.arraycopy(compileList, 0, newCompileList, 0, compileList.length);
System.arraycopy(newFiles, 0, newCompileList, compileList.length,
newFiles.length);
compileList = newCompileList;
}
}
else
{
String [] newSources = sfs.restrict(files, srcDir, destDir, m);
int extLen = ext.length() - 1; // strip wildcard
if (newSources.length > 0)
{
File[] newCompileList = new File[compileList.length + newSources.length];
System.arraycopy(compileList, 0, newCompileList, 0, compileList.length);
try
{
FileUtils fileUtils = FileUtils.newFileUtils();
for (int j = 0; j < newSources.length; j++)
{
String toName =
newSources[j].substring(0, newSources[j].length() - extLen) +
".java";
File srcFile = new File(srcDir, newSources[j]);
File dstFile = new File(_genDir, toName);
fileUtils.copyFile(srcFile, dstFile, null, true, true);
newCompileList[compileList.length + j] = dstFile;
}
}
catch (IOException ioe)
{
throw new BuildException("Unable to copy " + ext + " file", ioe,
getLocation());
}
compileList = newCompileList;
}
}
}
|
java
|
protected void scanDir(File srcDir, File destDir, String[] files, String ext)
{
// If no source path was specified, we effectively created one by adding the generation
// path. Because of this, we need to be sure and add all source dirs to the path too.
if (!_hasSourcepath)
{
Path srcPath = new Path(getProject());
srcPath.setLocation(srcDir);
setSourcepath(srcPath);
}
GlobPatternMapper m = new GlobPatternMapper();
m.setFrom(ext);
m.setTo("*.class");
SourceFileScanner sfs = new SourceFileScanner(this);
if (ext.equals("*.java"))
{
File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
if (newFiles.length > 0)
{
File[] newCompileList = new File[compileList.length + newFiles.length];
System.arraycopy(compileList, 0, newCompileList, 0, compileList.length);
System.arraycopy(newFiles, 0, newCompileList, compileList.length,
newFiles.length);
compileList = newCompileList;
}
}
else
{
String [] newSources = sfs.restrict(files, srcDir, destDir, m);
int extLen = ext.length() - 1; // strip wildcard
if (newSources.length > 0)
{
File[] newCompileList = new File[compileList.length + newSources.length];
System.arraycopy(compileList, 0, newCompileList, 0, compileList.length);
try
{
FileUtils fileUtils = FileUtils.newFileUtils();
for (int j = 0; j < newSources.length; j++)
{
String toName =
newSources[j].substring(0, newSources[j].length() - extLen) +
".java";
File srcFile = new File(srcDir, newSources[j]);
File dstFile = new File(_genDir, toName);
fileUtils.copyFile(srcFile, dstFile, null, true, true);
newCompileList[compileList.length + j] = dstFile;
}
}
catch (IOException ioe)
{
throw new BuildException("Unable to copy " + ext + " file", ioe,
getLocation());
}
compileList = newCompileList;
}
}
}
|
[
"protected",
"void",
"scanDir",
"(",
"File",
"srcDir",
",",
"File",
"destDir",
",",
"String",
"[",
"]",
"files",
",",
"String",
"ext",
")",
"{",
"// If no source path was specified, we effectively created one by adding the generation",
"// path. Because of this, we need to be sure and add all source dirs to the path too.",
"if",
"(",
"!",
"_hasSourcepath",
")",
"{",
"Path",
"srcPath",
"=",
"new",
"Path",
"(",
"getProject",
"(",
")",
")",
";",
"srcPath",
".",
"setLocation",
"(",
"srcDir",
")",
";",
"setSourcepath",
"(",
"srcPath",
")",
";",
"}",
"GlobPatternMapper",
"m",
"=",
"new",
"GlobPatternMapper",
"(",
")",
";",
"m",
".",
"setFrom",
"(",
"ext",
")",
";",
"m",
".",
"setTo",
"(",
"\"*.class\"",
")",
";",
"SourceFileScanner",
"sfs",
"=",
"new",
"SourceFileScanner",
"(",
"this",
")",
";",
"if",
"(",
"ext",
".",
"equals",
"(",
"\"*.java\"",
")",
")",
"{",
"File",
"[",
"]",
"newFiles",
"=",
"sfs",
".",
"restrictAsFiles",
"(",
"files",
",",
"srcDir",
",",
"destDir",
",",
"m",
")",
";",
"if",
"(",
"newFiles",
".",
"length",
">",
"0",
")",
"{",
"File",
"[",
"]",
"newCompileList",
"=",
"new",
"File",
"[",
"compileList",
".",
"length",
"+",
"newFiles",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"compileList",
",",
"0",
",",
"newCompileList",
",",
"0",
",",
"compileList",
".",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"newFiles",
",",
"0",
",",
"newCompileList",
",",
"compileList",
".",
"length",
",",
"newFiles",
".",
"length",
")",
";",
"compileList",
"=",
"newCompileList",
";",
"}",
"}",
"else",
"{",
"String",
"[",
"]",
"newSources",
"=",
"sfs",
".",
"restrict",
"(",
"files",
",",
"srcDir",
",",
"destDir",
",",
"m",
")",
";",
"int",
"extLen",
"=",
"ext",
".",
"length",
"(",
")",
"-",
"1",
";",
"// strip wildcard",
"if",
"(",
"newSources",
".",
"length",
">",
"0",
")",
"{",
"File",
"[",
"]",
"newCompileList",
"=",
"new",
"File",
"[",
"compileList",
".",
"length",
"+",
"newSources",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"compileList",
",",
"0",
",",
"newCompileList",
",",
"0",
",",
"compileList",
".",
"length",
")",
";",
"try",
"{",
"FileUtils",
"fileUtils",
"=",
"FileUtils",
".",
"newFileUtils",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"newSources",
".",
"length",
";",
"j",
"++",
")",
"{",
"String",
"toName",
"=",
"newSources",
"[",
"j",
"]",
".",
"substring",
"(",
"0",
",",
"newSources",
"[",
"j",
"]",
".",
"length",
"(",
")",
"-",
"extLen",
")",
"+",
"\".java\"",
";",
"File",
"srcFile",
"=",
"new",
"File",
"(",
"srcDir",
",",
"newSources",
"[",
"j",
"]",
")",
";",
"File",
"dstFile",
"=",
"new",
"File",
"(",
"_genDir",
",",
"toName",
")",
";",
"fileUtils",
".",
"copyFile",
"(",
"srcFile",
",",
"dstFile",
",",
"null",
",",
"true",
",",
"true",
")",
";",
"newCompileList",
"[",
"compileList",
".",
"length",
"+",
"j",
"]",
"=",
"dstFile",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Unable to copy \"",
"+",
"ext",
"+",
"\" file\"",
",",
"ioe",
",",
"getLocation",
"(",
")",
")",
";",
"}",
"compileList",
"=",
"newCompileList",
";",
"}",
"}",
"}"
] |
Override the implementation of scanDir, to look for additional files based upon any
specified source extensions
|
[
"Override",
"the",
"implementation",
"of",
"scanDir",
"to",
"look",
"for",
"additional",
"files",
"based",
"upon",
"any",
"specified",
"source",
"extensions"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptTask.java#L116-L174
|
147,110
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
|
ImplicitObjectUtil.loadImplicitObjects
|
public static void loadImplicitObjects(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext,
PageFlowController currentPageFlow) {
// @todo: add an interceptor chain here for putting implicit objects into the request
loadPageFlow(request, currentPageFlow);
// @todo: need to move bundleMap creation to a BundleMapFactory
BundleMap bundleMap = new BundleMap(request, servletContext);
loadBundleMap(request, bundleMap);
}
|
java
|
public static void loadImplicitObjects(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext,
PageFlowController currentPageFlow) {
// @todo: add an interceptor chain here for putting implicit objects into the request
loadPageFlow(request, currentPageFlow);
// @todo: need to move bundleMap creation to a BundleMapFactory
BundleMap bundleMap = new BundleMap(request, servletContext);
loadBundleMap(request, bundleMap);
}
|
[
"public",
"static",
"void",
"loadImplicitObjects",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"ServletContext",
"servletContext",
",",
"PageFlowController",
"currentPageFlow",
")",
"{",
"// @todo: add an interceptor chain here for putting implicit objects into the request",
"loadPageFlow",
"(",
"request",
",",
"currentPageFlow",
")",
";",
"// @todo: need to move bundleMap creation to a BundleMapFactory",
"BundleMap",
"bundleMap",
"=",
"new",
"BundleMap",
"(",
"request",
",",
"servletContext",
")",
";",
"loadBundleMap",
"(",
"request",
",",
"bundleMap",
")",
";",
"}"
] |
Load the NetUI framework's implicit objects into the request.
@param request the request
@param response the response
@param servletContext the servlet context
@param currentPageFlow the current page flow
|
[
"Load",
"the",
"NetUI",
"framework",
"s",
"implicit",
"objects",
"into",
"the",
"request",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L69-L79
|
147,111
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
|
ImplicitObjectUtil.loadPageFlow
|
public static void loadPageFlow(ServletRequest request, PageFlowController pageFlow) {
if(pageFlow != null)
request.setAttribute(PAGE_FLOW_IMPLICIT_OBJECT_KEY, pageFlow);
Map map = InternalUtils.getPageInputMap(request);
request.setAttribute(PAGE_INPUT_IMPLICIT_OBJECT_KEY, map != null ? map : Collections.EMPTY_MAP);
}
|
java
|
public static void loadPageFlow(ServletRequest request, PageFlowController pageFlow) {
if(pageFlow != null)
request.setAttribute(PAGE_FLOW_IMPLICIT_OBJECT_KEY, pageFlow);
Map map = InternalUtils.getPageInputMap(request);
request.setAttribute(PAGE_INPUT_IMPLICIT_OBJECT_KEY, map != null ? map : Collections.EMPTY_MAP);
}
|
[
"public",
"static",
"void",
"loadPageFlow",
"(",
"ServletRequest",
"request",
",",
"PageFlowController",
"pageFlow",
")",
"{",
"if",
"(",
"pageFlow",
"!=",
"null",
")",
"request",
".",
"setAttribute",
"(",
"PAGE_FLOW_IMPLICIT_OBJECT_KEY",
",",
"pageFlow",
")",
";",
"Map",
"map",
"=",
"InternalUtils",
".",
"getPageInputMap",
"(",
"request",
")",
";",
"request",
".",
"setAttribute",
"(",
"PAGE_INPUT_IMPLICIT_OBJECT_KEY",
",",
"map",
"!=",
"null",
"?",
"map",
":",
"Collections",
".",
"EMPTY_MAP",
")",
";",
"}"
] |
Load Page Flow related implicit objects into the request. This method will set the
Page Flow itself and any available page inputs into the request.
@param request the request
@param pageFlow the current page flow
|
[
"Load",
"Page",
"Flow",
"related",
"implicit",
"objects",
"into",
"the",
"request",
".",
"This",
"method",
"will",
"set",
"the",
"Page",
"Flow",
"itself",
"and",
"any",
"available",
"page",
"inputs",
"into",
"the",
"request",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L105-L111
|
147,112
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
|
ImplicitObjectUtil.loadFacesBackingBean
|
public static void loadFacesBackingBean(ServletRequest request, FacesBackingBean facesBackingBean) {
if(facesBackingBean != null)
request.setAttribute(BACKING_IMPLICIT_OBJECT_KEY, facesBackingBean);
}
|
java
|
public static void loadFacesBackingBean(ServletRequest request, FacesBackingBean facesBackingBean) {
if(facesBackingBean != null)
request.setAttribute(BACKING_IMPLICIT_OBJECT_KEY, facesBackingBean);
}
|
[
"public",
"static",
"void",
"loadFacesBackingBean",
"(",
"ServletRequest",
"request",
",",
"FacesBackingBean",
"facesBackingBean",
")",
"{",
"if",
"(",
"facesBackingBean",
"!=",
"null",
")",
"request",
".",
"setAttribute",
"(",
"BACKING_IMPLICIT_OBJECT_KEY",
",",
"facesBackingBean",
")",
";",
"}"
] |
Load the JSF backing bean into the request.
@param request the request
@param facesBackingBean the JSF backing bean
|
[
"Load",
"the",
"JSF",
"backing",
"bean",
"into",
"the",
"request",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L118-L121
|
147,113
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
|
ImplicitObjectUtil.loadSharedFlow
|
public static void loadSharedFlow(ServletRequest request, Map/*<String, SharedFlowController>*/ sharedFlows) {
if(sharedFlows != null)
request.setAttribute(SHARED_FLOW_IMPLICIT_OBJECT_KEY, sharedFlows);
}
|
java
|
public static void loadSharedFlow(ServletRequest request, Map/*<String, SharedFlowController>*/ sharedFlows) {
if(sharedFlows != null)
request.setAttribute(SHARED_FLOW_IMPLICIT_OBJECT_KEY, sharedFlows);
}
|
[
"public",
"static",
"void",
"loadSharedFlow",
"(",
"ServletRequest",
"request",
",",
"Map",
"/*<String, SharedFlowController>*/",
"sharedFlows",
")",
"{",
"if",
"(",
"sharedFlows",
"!=",
"null",
")",
"request",
".",
"setAttribute",
"(",
"SHARED_FLOW_IMPLICIT_OBJECT_KEY",
",",
"sharedFlows",
")",
";",
"}"
] |
Load the shared flow into the request.
@param request the request
@param sharedFlows the current shared flows
|
[
"Load",
"the",
"shared",
"flow",
"into",
"the",
"request",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L136-L139
|
147,114
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
|
ImplicitObjectUtil.loadGlobalApp
|
public static void loadGlobalApp(ServletRequest request, GlobalApp globalApp) {
if(globalApp != null)
request.setAttribute(GLOBAL_APP_IMPLICIT_OBJECT_KEY, globalApp);
}
|
java
|
public static void loadGlobalApp(ServletRequest request, GlobalApp globalApp) {
if(globalApp != null)
request.setAttribute(GLOBAL_APP_IMPLICIT_OBJECT_KEY, globalApp);
}
|
[
"public",
"static",
"void",
"loadGlobalApp",
"(",
"ServletRequest",
"request",
",",
"GlobalApp",
"globalApp",
")",
"{",
"if",
"(",
"globalApp",
"!=",
"null",
")",
"request",
".",
"setAttribute",
"(",
"GLOBAL_APP_IMPLICIT_OBJECT_KEY",
",",
"globalApp",
")",
";",
"}"
] |
Load the global app into the request
@param request the request
@param globalApp the global app
|
[
"Load",
"the",
"global",
"app",
"into",
"the",
"request"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L146-L149
|
147,115
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
|
ImplicitObjectUtil.loadOutputFormBean
|
public static void loadOutputFormBean(ServletRequest request, Object bean) {
if(bean != null)
request.setAttribute(OUTPUT_FORM_BEAN_OBJECT_KEY, bean);
}
|
java
|
public static void loadOutputFormBean(ServletRequest request, Object bean) {
if(bean != null)
request.setAttribute(OUTPUT_FORM_BEAN_OBJECT_KEY, bean);
}
|
[
"public",
"static",
"void",
"loadOutputFormBean",
"(",
"ServletRequest",
"request",
",",
"Object",
"bean",
")",
"{",
"if",
"(",
"bean",
"!=",
"null",
")",
"request",
".",
"setAttribute",
"(",
"OUTPUT_FORM_BEAN_OBJECT_KEY",
",",
"bean",
")",
";",
"}"
] |
Load the output form bean into the request.
@param request the request
@param bean the output form bean
|
[
"Load",
"the",
"output",
"form",
"bean",
"into",
"the",
"request",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L165-L168
|
147,116
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/RowMapper.java
|
RowMapper.isSetterMethod
|
protected boolean isSetterMethod(Method method) {
Matcher matcher = _setterRegex.matcher(method.getName());
if (matcher.matches()) {
if (Modifier.isStatic(method.getModifiers())) return false;
if (!Modifier.isPublic(method.getModifiers())) return false;
if (!Void.TYPE.equals(method.getReturnType())) return false;
// method parameter checks
Class[] params = method.getParameterTypes();
if (params.length != 1) return false;
if (TypeMappingsFactory.TYPE_UNKNOWN == _tmf.getTypeId(params[0])) return false;
return true;
}
return false;
}
|
java
|
protected boolean isSetterMethod(Method method) {
Matcher matcher = _setterRegex.matcher(method.getName());
if (matcher.matches()) {
if (Modifier.isStatic(method.getModifiers())) return false;
if (!Modifier.isPublic(method.getModifiers())) return false;
if (!Void.TYPE.equals(method.getReturnType())) return false;
// method parameter checks
Class[] params = method.getParameterTypes();
if (params.length != 1) return false;
if (TypeMappingsFactory.TYPE_UNKNOWN == _tmf.getTypeId(params[0])) return false;
return true;
}
return false;
}
|
[
"protected",
"boolean",
"isSetterMethod",
"(",
"Method",
"method",
")",
"{",
"Matcher",
"matcher",
"=",
"_setterRegex",
".",
"matcher",
"(",
"method",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"if",
"(",
"Modifier",
".",
"isStatic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"Modifier",
".",
"isPublic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"Void",
".",
"TYPE",
".",
"equals",
"(",
"method",
".",
"getReturnType",
"(",
")",
")",
")",
"return",
"false",
";",
"// method parameter checks",
"Class",
"[",
"]",
"params",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"if",
"(",
"params",
".",
"length",
"!=",
"1",
")",
"return",
"false",
";",
"if",
"(",
"TypeMappingsFactory",
".",
"TYPE_UNKNOWN",
"==",
"_tmf",
".",
"getTypeId",
"(",
"params",
"[",
"0",
"]",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Determine if the given method is a java bean setter method.
@param method Method to check
@return True if the method is a setter method.
|
[
"Determine",
"if",
"the",
"given",
"method",
"is",
"a",
"java",
"bean",
"setter",
"method",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/RowMapper.java#L99-L115
|
147,117
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.lookupMethod
|
public static Method lookupMethod( Class parentClass, String methodName, Class[] signature )
{
try
{
return parentClass.getDeclaredMethod( methodName, signature );
}
catch ( NoSuchMethodException e )
{
Class superClass = parentClass.getSuperclass();
return superClass != null ? lookupMethod( superClass, methodName, signature ) : null;
}
}
|
java
|
public static Method lookupMethod( Class parentClass, String methodName, Class[] signature )
{
try
{
return parentClass.getDeclaredMethod( methodName, signature );
}
catch ( NoSuchMethodException e )
{
Class superClass = parentClass.getSuperclass();
return superClass != null ? lookupMethod( superClass, methodName, signature ) : null;
}
}
|
[
"public",
"static",
"Method",
"lookupMethod",
"(",
"Class",
"parentClass",
",",
"String",
"methodName",
",",
"Class",
"[",
"]",
"signature",
")",
"{",
"try",
"{",
"return",
"parentClass",
".",
"getDeclaredMethod",
"(",
"methodName",
",",
"signature",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"Class",
"superClass",
"=",
"parentClass",
".",
"getSuperclass",
"(",
")",
";",
"return",
"superClass",
"!=",
"null",
"?",
"lookupMethod",
"(",
"superClass",
",",
"methodName",
",",
"signature",
")",
":",
"null",
";",
"}",
"}"
] |
Get a Method in a Class.
@param parentClass the Class in which to find the Method.
@param methodName the name of the Method.
@param signature the argument types for the Method.
@return the Method with the given name and signature, or <code>null</code> if the method does not exist.
|
[
"Get",
"a",
"Method",
"in",
"a",
"Class",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L265-L276
|
147,118
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.lookupField
|
public static Field lookupField( Class parentClass, String fieldName )
{
try {
return parentClass.getDeclaredField( fieldName );
}
catch ( NoSuchFieldException e ) {
Class superClass = parentClass.getSuperclass();
return superClass != null ? lookupField( superClass, fieldName ) : null;
}
}
|
java
|
public static Field lookupField( Class parentClass, String fieldName )
{
try {
return parentClass.getDeclaredField( fieldName );
}
catch ( NoSuchFieldException e ) {
Class superClass = parentClass.getSuperclass();
return superClass != null ? lookupField( superClass, fieldName ) : null;
}
}
|
[
"public",
"static",
"Field",
"lookupField",
"(",
"Class",
"parentClass",
",",
"String",
"fieldName",
")",
"{",
"try",
"{",
"return",
"parentClass",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"Class",
"superClass",
"=",
"parentClass",
".",
"getSuperclass",
"(",
")",
";",
"return",
"superClass",
"!=",
"null",
"?",
"lookupField",
"(",
"superClass",
",",
"fieldName",
")",
":",
"null",
";",
"}",
"}"
] |
Get a Field in a Class.
@param parentClass the Class in which to find the Field.
@param fieldName the name of the Field.
@return the Field with the given name, or <code>null</code> if the field does not exist.
|
[
"Get",
"a",
"Field",
"in",
"a",
"Class",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L285-L294
|
147,119
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.isLongLived
|
public static boolean isLongLived( ModuleConfig moduleConfig )
{
ControllerConfig cc = moduleConfig.getControllerConfig();
if ( cc instanceof PageFlowControllerConfig )
{
return ( ( PageFlowControllerConfig ) cc ).isLongLivedPageFlow();
}
else
{
return false;
}
}
|
java
|
public static boolean isLongLived( ModuleConfig moduleConfig )
{
ControllerConfig cc = moduleConfig.getControllerConfig();
if ( cc instanceof PageFlowControllerConfig )
{
return ( ( PageFlowControllerConfig ) cc ).isLongLivedPageFlow();
}
else
{
return false;
}
}
|
[
"public",
"static",
"boolean",
"isLongLived",
"(",
"ModuleConfig",
"moduleConfig",
")",
"{",
"ControllerConfig",
"cc",
"=",
"moduleConfig",
".",
"getControllerConfig",
"(",
")",
";",
"if",
"(",
"cc",
"instanceof",
"PageFlowControllerConfig",
")",
"{",
"return",
"(",
"(",
"PageFlowControllerConfig",
")",
"cc",
")",
".",
"isLongLivedPageFlow",
"(",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Tell whether the given module is a long-lived page flow.
|
[
"Tell",
"whether",
"the",
"given",
"module",
"is",
"a",
"long",
"-",
"lived",
"page",
"flow",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L314-L326
|
147,120
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.isNestable
|
public static boolean isNestable( ModuleConfig moduleConfig )
{
ControllerConfig cc = moduleConfig.getControllerConfig();
return cc instanceof PageFlowControllerConfig && ( ( PageFlowControllerConfig ) cc ).isNestedPageFlow();
}
|
java
|
public static boolean isNestable( ModuleConfig moduleConfig )
{
ControllerConfig cc = moduleConfig.getControllerConfig();
return cc instanceof PageFlowControllerConfig && ( ( PageFlowControllerConfig ) cc ).isNestedPageFlow();
}
|
[
"public",
"static",
"boolean",
"isNestable",
"(",
"ModuleConfig",
"moduleConfig",
")",
"{",
"ControllerConfig",
"cc",
"=",
"moduleConfig",
".",
"getControllerConfig",
"(",
")",
";",
"return",
"cc",
"instanceof",
"PageFlowControllerConfig",
"&&",
"(",
"(",
"PageFlowControllerConfig",
")",
"cc",
")",
".",
"isNestedPageFlow",
"(",
")",
";",
"}"
] |
Tell whether the given module is a nested page flow.
|
[
"Tell",
"whether",
"the",
"given",
"module",
"is",
"a",
"nested",
"page",
"flow",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L331-L335
|
147,121
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.getModuleConfig
|
public static ModuleConfig getModuleConfig( String modulePath, ServletContext context )
{
return ( ModuleConfig ) context.getAttribute( Globals.MODULE_KEY + modulePath );
}
|
java
|
public static ModuleConfig getModuleConfig( String modulePath, ServletContext context )
{
return ( ModuleConfig ) context.getAttribute( Globals.MODULE_KEY + modulePath );
}
|
[
"public",
"static",
"ModuleConfig",
"getModuleConfig",
"(",
"String",
"modulePath",
",",
"ServletContext",
"context",
")",
"{",
"return",
"(",
"ModuleConfig",
")",
"context",
".",
"getAttribute",
"(",
"Globals",
".",
"MODULE_KEY",
"+",
"modulePath",
")",
";",
"}"
] |
Get the Struts ModuleConfig for the given module path.
|
[
"Get",
"the",
"Struts",
"ModuleConfig",
"for",
"the",
"given",
"module",
"path",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L464-L467
|
147,122
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.ensureModuleConfig
|
public static ModuleConfig ensureModuleConfig( String modulePath, ServletContext context )
{
try
{
ModuleConfig ret = getModuleConfig( modulePath, context );
if ( ret != null )
{
return ret;
}
else
{
ActionServlet as = getActionServlet( context );
if ( as instanceof AutoRegisterActionServlet )
{
return ( ( AutoRegisterActionServlet ) as ).ensureModuleRegistered( modulePath );
}
}
}
catch ( IOException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
catch ( ServletException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
return null;
}
|
java
|
public static ModuleConfig ensureModuleConfig( String modulePath, ServletContext context )
{
try
{
ModuleConfig ret = getModuleConfig( modulePath, context );
if ( ret != null )
{
return ret;
}
else
{
ActionServlet as = getActionServlet( context );
if ( as instanceof AutoRegisterActionServlet )
{
return ( ( AutoRegisterActionServlet ) as ).ensureModuleRegistered( modulePath );
}
}
}
catch ( IOException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
catch ( ServletException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
return null;
}
|
[
"public",
"static",
"ModuleConfig",
"ensureModuleConfig",
"(",
"String",
"modulePath",
",",
"ServletContext",
"context",
")",
"{",
"try",
"{",
"ModuleConfig",
"ret",
"=",
"getModuleConfig",
"(",
"modulePath",
",",
"context",
")",
";",
"if",
"(",
"ret",
"!=",
"null",
")",
"{",
"return",
"ret",
";",
"}",
"else",
"{",
"ActionServlet",
"as",
"=",
"getActionServlet",
"(",
"context",
")",
";",
"if",
"(",
"as",
"instanceof",
"AutoRegisterActionServlet",
")",
"{",
"return",
"(",
"(",
"AutoRegisterActionServlet",
")",
"as",
")",
".",
"ensureModuleRegistered",
"(",
"modulePath",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"_log",
".",
"error",
"(",
"\"Error while registering Struts module \"",
"+",
"modulePath",
",",
"e",
")",
";",
"}",
"catch",
"(",
"ServletException",
"e",
")",
"{",
"_log",
".",
"error",
"(",
"\"Error while registering Struts module \"",
"+",
"modulePath",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get the Struts ModuleConfig for the given module path. If there is none registered,
and if it is possible to register one automatically, do so.
|
[
"Get",
"the",
"Struts",
"ModuleConfig",
"for",
"the",
"given",
"module",
"path",
".",
"If",
"there",
"is",
"none",
"registered",
"and",
"if",
"it",
"is",
"possible",
"to",
"register",
"one",
"automatically",
"do",
"so",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L473-L503
|
147,123
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.initDelegatingConfigs
|
public static void initDelegatingConfigs(ModuleConfig moduleConfig, ServletContext servletContext)
{
ActionConfig[] actionConfigs = moduleConfig.findActionConfigs();
// Initialize action configs.
for (int i = 0; i < actionConfigs.length; i++) {
ActionConfig actionConfig = actionConfigs[i];
if (actionConfig instanceof DelegatingActionMapping) {
((DelegatingActionMapping) actionConfig).init(servletContext);
} else {
// Initialize action-level exception configs.
ExceptionConfig[] exceptionConfigs = actionConfig.findExceptionConfigs();
for (int j = 0; j < exceptionConfigs.length; j++) {
ExceptionConfig exceptionConfig = exceptionConfigs[j];
if (exceptionConfig instanceof DelegatingExceptionConfig) {
((DelegatingExceptionConfig) exceptionConfig).init(servletContext);
}
}
}
}
// Initialize module-level exception configs.
ExceptionConfig[] exceptionConfigs = moduleConfig.findExceptionConfigs();
for (int i = 0; i < exceptionConfigs.length; i++) {
ExceptionConfig exceptionConfig = exceptionConfigs[i];
if (exceptionConfig instanceof DelegatingExceptionConfig) {
((DelegatingExceptionConfig) exceptionConfig).init(servletContext);
}
}
}
|
java
|
public static void initDelegatingConfigs(ModuleConfig moduleConfig, ServletContext servletContext)
{
ActionConfig[] actionConfigs = moduleConfig.findActionConfigs();
// Initialize action configs.
for (int i = 0; i < actionConfigs.length; i++) {
ActionConfig actionConfig = actionConfigs[i];
if (actionConfig instanceof DelegatingActionMapping) {
((DelegatingActionMapping) actionConfig).init(servletContext);
} else {
// Initialize action-level exception configs.
ExceptionConfig[] exceptionConfigs = actionConfig.findExceptionConfigs();
for (int j = 0; j < exceptionConfigs.length; j++) {
ExceptionConfig exceptionConfig = exceptionConfigs[j];
if (exceptionConfig instanceof DelegatingExceptionConfig) {
((DelegatingExceptionConfig) exceptionConfig).init(servletContext);
}
}
}
}
// Initialize module-level exception configs.
ExceptionConfig[] exceptionConfigs = moduleConfig.findExceptionConfigs();
for (int i = 0; i < exceptionConfigs.length; i++) {
ExceptionConfig exceptionConfig = exceptionConfigs[i];
if (exceptionConfig instanceof DelegatingExceptionConfig) {
((DelegatingExceptionConfig) exceptionConfig).init(servletContext);
}
}
}
|
[
"public",
"static",
"void",
"initDelegatingConfigs",
"(",
"ModuleConfig",
"moduleConfig",
",",
"ServletContext",
"servletContext",
")",
"{",
"ActionConfig",
"[",
"]",
"actionConfigs",
"=",
"moduleConfig",
".",
"findActionConfigs",
"(",
")",
";",
"// Initialize action configs.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"actionConfigs",
".",
"length",
";",
"i",
"++",
")",
"{",
"ActionConfig",
"actionConfig",
"=",
"actionConfigs",
"[",
"i",
"]",
";",
"if",
"(",
"actionConfig",
"instanceof",
"DelegatingActionMapping",
")",
"{",
"(",
"(",
"DelegatingActionMapping",
")",
"actionConfig",
")",
".",
"init",
"(",
"servletContext",
")",
";",
"}",
"else",
"{",
"// Initialize action-level exception configs.",
"ExceptionConfig",
"[",
"]",
"exceptionConfigs",
"=",
"actionConfig",
".",
"findExceptionConfigs",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"exceptionConfigs",
".",
"length",
";",
"j",
"++",
")",
"{",
"ExceptionConfig",
"exceptionConfig",
"=",
"exceptionConfigs",
"[",
"j",
"]",
";",
"if",
"(",
"exceptionConfig",
"instanceof",
"DelegatingExceptionConfig",
")",
"{",
"(",
"(",
"DelegatingExceptionConfig",
")",
"exceptionConfig",
")",
".",
"init",
"(",
"servletContext",
")",
";",
"}",
"}",
"}",
"}",
"// Initialize module-level exception configs.",
"ExceptionConfig",
"[",
"]",
"exceptionConfigs",
"=",
"moduleConfig",
".",
"findExceptionConfigs",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"exceptionConfigs",
".",
"length",
";",
"i",
"++",
")",
"{",
"ExceptionConfig",
"exceptionConfig",
"=",
"exceptionConfigs",
"[",
"i",
"]",
";",
"if",
"(",
"exceptionConfig",
"instanceof",
"DelegatingExceptionConfig",
")",
"{",
"(",
"(",
"DelegatingExceptionConfig",
")",
"exceptionConfig",
")",
".",
"init",
"(",
"servletContext",
")",
";",
"}",
"}",
"}"
] |
Initialize delegating action configs and exception configs for a Struts module that should delegate
to one generated from a superclass.
|
[
"Initialize",
"delegating",
"action",
"configs",
"and",
"exception",
"configs",
"for",
"a",
"Struts",
"module",
"that",
"should",
"delegate",
"to",
"one",
"generated",
"from",
"a",
"superclass",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L509-L538
|
147,124
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.getActionServlet
|
public static ActionServlet getActionServlet( ServletContext context )
{
if ( context == null ) return null;
return ( ActionServlet ) context.getAttribute( Globals.ACTION_SERVLET_KEY );
}
|
java
|
public static ActionServlet getActionServlet( ServletContext context )
{
if ( context == null ) return null;
return ( ActionServlet ) context.getAttribute( Globals.ACTION_SERVLET_KEY );
}
|
[
"public",
"static",
"ActionServlet",
"getActionServlet",
"(",
"ServletContext",
"context",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"ActionServlet",
")",
"context",
".",
"getAttribute",
"(",
"Globals",
".",
"ACTION_SERVLET_KEY",
")",
";",
"}"
] |
Get the current ActionServlet.
@param context the current ServletContext
@return the ActionServlet that is stored as an attribute in the ServletContext
|
[
"Get",
"the",
"current",
"ActionServlet",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L546-L550
|
147,125
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.addBindingUpdateError
|
public static void addBindingUpdateError( ServletRequest request, String expression, String message, Throwable cause )
{
Map errors = ( Map ) request.getAttribute( BINDING_UPDATE_ERRORS_ATTR );
if ( errors == null )
{
errors = new LinkedHashMap();
request.setAttribute( BINDING_UPDATE_ERRORS_ATTR, errors );
}
errors.put( expression, new BindingUpdateError( expression, message, cause ) );
}
|
java
|
public static void addBindingUpdateError( ServletRequest request, String expression, String message, Throwable cause )
{
Map errors = ( Map ) request.getAttribute( BINDING_UPDATE_ERRORS_ATTR );
if ( errors == null )
{
errors = new LinkedHashMap();
request.setAttribute( BINDING_UPDATE_ERRORS_ATTR, errors );
}
errors.put( expression, new BindingUpdateError( expression, message, cause ) );
}
|
[
"public",
"static",
"void",
"addBindingUpdateError",
"(",
"ServletRequest",
"request",
",",
"String",
"expression",
",",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"Map",
"errors",
"=",
"(",
"Map",
")",
"request",
".",
"getAttribute",
"(",
"BINDING_UPDATE_ERRORS_ATTR",
")",
";",
"if",
"(",
"errors",
"==",
"null",
")",
"{",
"errors",
"=",
"new",
"LinkedHashMap",
"(",
")",
";",
"request",
".",
"setAttribute",
"(",
"BINDING_UPDATE_ERRORS_ATTR",
",",
"errors",
")",
";",
"}",
"errors",
".",
"put",
"(",
"expression",
",",
"new",
"BindingUpdateError",
"(",
"expression",
",",
"message",
",",
"cause",
")",
")",
";",
"}"
] |
Add a BindingUpdateError to the request.
@param request the current ServletRequest.
@param expression the expression associated with this error.
@param message the error message.
@param cause the Throwable that caused the error.
|
[
"Add",
"a",
"BindingUpdateError",
"to",
"the",
"request",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L560-L571
|
147,126
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.findActionConfig
|
public static ActionConfig findActionConfig( String actionConfigPath, String modulePath, ServletContext context )
{
ModuleConfig moduleConfig = getModuleConfig( modulePath, context );
assert moduleConfig != null;
return moduleConfig.findActionConfig( actionConfigPath );
}
|
java
|
public static ActionConfig findActionConfig( String actionConfigPath, String modulePath, ServletContext context )
{
ModuleConfig moduleConfig = getModuleConfig( modulePath, context );
assert moduleConfig != null;
return moduleConfig.findActionConfig( actionConfigPath );
}
|
[
"public",
"static",
"ActionConfig",
"findActionConfig",
"(",
"String",
"actionConfigPath",
",",
"String",
"modulePath",
",",
"ServletContext",
"context",
")",
"{",
"ModuleConfig",
"moduleConfig",
"=",
"getModuleConfig",
"(",
"modulePath",
",",
"context",
")",
";",
"assert",
"moduleConfig",
"!=",
"null",
";",
"return",
"moduleConfig",
".",
"findActionConfig",
"(",
"actionConfigPath",
")",
";",
"}"
] |
Get the Struts ActionConfig for the given action config path and module path.
|
[
"Get",
"the",
"Struts",
"ActionConfig",
"for",
"the",
"given",
"action",
"config",
"path",
"and",
"module",
"path",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L984-L989
|
147,127
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.getActionMappingPath
|
public static String getActionMappingPath( ServletRequest request )
{
ActionMapping actionMapping = ( ActionMapping ) request.getAttribute( Globals.MAPPING_KEY );
return actionMapping != null ? actionMapping.getPath() : null;
}
|
java
|
public static String getActionMappingPath( ServletRequest request )
{
ActionMapping actionMapping = ( ActionMapping ) request.getAttribute( Globals.MAPPING_KEY );
return actionMapping != null ? actionMapping.getPath() : null;
}
|
[
"public",
"static",
"String",
"getActionMappingPath",
"(",
"ServletRequest",
"request",
")",
"{",
"ActionMapping",
"actionMapping",
"=",
"(",
"ActionMapping",
")",
"request",
".",
"getAttribute",
"(",
"Globals",
".",
"MAPPING_KEY",
")",
";",
"return",
"actionMapping",
"!=",
"null",
"?",
"actionMapping",
".",
"getPath",
"(",
")",
":",
"null",
";",
"}"
] |
Get the Struts ActionMapping path from the ActionMapping that is in the request under the key
Globals.MAPPING_KEY.
@return the path for the ActionMapping, as found with ActionMapping.getPath()
|
[
"Get",
"the",
"Struts",
"ActionMapping",
"path",
"from",
"the",
"ActionMapping",
"that",
"is",
"in",
"the",
"request",
"under",
"the",
"key",
"Globals",
".",
"MAPPING_KEY",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L997-L1001
|
147,128
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.getModulePathFromReqAttr
|
public static String getModulePathFromReqAttr( HttpServletRequest request )
{
//
// If a config was in the request, use its associated prefix; otherwise, fall back to the URI.
//
ModuleConfig config = ( ModuleConfig ) request.getAttribute( Globals.MODULE_KEY );
return config != null ? config.getPrefix() : PageFlowUtils.getModulePath( request );
}
|
java
|
public static String getModulePathFromReqAttr( HttpServletRequest request )
{
//
// If a config was in the request, use its associated prefix; otherwise, fall back to the URI.
//
ModuleConfig config = ( ModuleConfig ) request.getAttribute( Globals.MODULE_KEY );
return config != null ? config.getPrefix() : PageFlowUtils.getModulePath( request );
}
|
[
"public",
"static",
"String",
"getModulePathFromReqAttr",
"(",
"HttpServletRequest",
"request",
")",
"{",
"//",
"// If a config was in the request, use its associated prefix; otherwise, fall back to the URI.",
"//",
"ModuleConfig",
"config",
"=",
"(",
"ModuleConfig",
")",
"request",
".",
"getAttribute",
"(",
"Globals",
".",
"MODULE_KEY",
")",
";",
"return",
"config",
"!=",
"null",
"?",
"config",
".",
"getPrefix",
"(",
")",
":",
"PageFlowUtils",
".",
"getModulePath",
"(",
"request",
")",
";",
"}"
] |
Gets the Struts module path from the input request. If a ModuleConfig
object has been populated into the request it is used to get the module prefix,
otherwise getModulePath is called, which derives the module path from
the request URI.
|
[
"Gets",
"the",
"Struts",
"module",
"path",
"from",
"the",
"input",
"request",
".",
"If",
"a",
"ModuleConfig",
"object",
"has",
"been",
"populated",
"into",
"the",
"request",
"it",
"is",
"used",
"to",
"get",
"the",
"module",
"prefix",
"otherwise",
"getModulePath",
"is",
"called",
"which",
"derives",
"the",
"module",
"path",
"from",
"the",
"request",
"URI",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L1009-L1016
|
147,129
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.selectModule
|
public static ModuleConfig selectModule( String prefix, HttpServletRequest request, ServletContext servletContext )
{
ModuleConfig moduleConfig = getModuleConfig( prefix, servletContext );
if ( moduleConfig == null )
{
request.removeAttribute( Globals.MODULE_KEY );
return null;
}
// If this module came from an abstract page flow controller class, don't select it.
ControllerConfig cc = moduleConfig.getControllerConfig();
if (cc instanceof PageFlowControllerConfig && ((PageFlowControllerConfig) cc).isAbstract()) {
return moduleConfig;
}
// Just return it if it's already registered.
if ( request.getAttribute( Globals.MODULE_KEY ) == moduleConfig ) return moduleConfig;
request.setAttribute( Globals.MODULE_KEY, moduleConfig );
MessageResourcesConfig[] mrConfig = moduleConfig.findMessageResourcesConfigs();
Object formBean = unwrapFormBean( getCurrentActionForm( request ) );
for ( int i = 0; i < mrConfig.length; i++ )
{
String key = mrConfig[i].getKey();
MessageResources resources = ( MessageResources ) servletContext.getAttribute( key + prefix );
if ( resources != null )
{
if ( ! ( resources instanceof ExpressionAwareMessageResources ) )
{
resources = new ExpressionAwareMessageResources( resources, formBean, request, servletContext );
}
request.setAttribute( key, resources );
}
else
{
request.removeAttribute( key );
}
}
return moduleConfig;
}
|
java
|
public static ModuleConfig selectModule( String prefix, HttpServletRequest request, ServletContext servletContext )
{
ModuleConfig moduleConfig = getModuleConfig( prefix, servletContext );
if ( moduleConfig == null )
{
request.removeAttribute( Globals.MODULE_KEY );
return null;
}
// If this module came from an abstract page flow controller class, don't select it.
ControllerConfig cc = moduleConfig.getControllerConfig();
if (cc instanceof PageFlowControllerConfig && ((PageFlowControllerConfig) cc).isAbstract()) {
return moduleConfig;
}
// Just return it if it's already registered.
if ( request.getAttribute( Globals.MODULE_KEY ) == moduleConfig ) return moduleConfig;
request.setAttribute( Globals.MODULE_KEY, moduleConfig );
MessageResourcesConfig[] mrConfig = moduleConfig.findMessageResourcesConfigs();
Object formBean = unwrapFormBean( getCurrentActionForm( request ) );
for ( int i = 0; i < mrConfig.length; i++ )
{
String key = mrConfig[i].getKey();
MessageResources resources = ( MessageResources ) servletContext.getAttribute( key + prefix );
if ( resources != null )
{
if ( ! ( resources instanceof ExpressionAwareMessageResources ) )
{
resources = new ExpressionAwareMessageResources( resources, formBean, request, servletContext );
}
request.setAttribute( key, resources );
}
else
{
request.removeAttribute( key );
}
}
return moduleConfig;
}
|
[
"public",
"static",
"ModuleConfig",
"selectModule",
"(",
"String",
"prefix",
",",
"HttpServletRequest",
"request",
",",
"ServletContext",
"servletContext",
")",
"{",
"ModuleConfig",
"moduleConfig",
"=",
"getModuleConfig",
"(",
"prefix",
",",
"servletContext",
")",
";",
"if",
"(",
"moduleConfig",
"==",
"null",
")",
"{",
"request",
".",
"removeAttribute",
"(",
"Globals",
".",
"MODULE_KEY",
")",
";",
"return",
"null",
";",
"}",
"// If this module came from an abstract page flow controller class, don't select it.",
"ControllerConfig",
"cc",
"=",
"moduleConfig",
".",
"getControllerConfig",
"(",
")",
";",
"if",
"(",
"cc",
"instanceof",
"PageFlowControllerConfig",
"&&",
"(",
"(",
"PageFlowControllerConfig",
")",
"cc",
")",
".",
"isAbstract",
"(",
")",
")",
"{",
"return",
"moduleConfig",
";",
"}",
"// Just return it if it's already registered.",
"if",
"(",
"request",
".",
"getAttribute",
"(",
"Globals",
".",
"MODULE_KEY",
")",
"==",
"moduleConfig",
")",
"return",
"moduleConfig",
";",
"request",
".",
"setAttribute",
"(",
"Globals",
".",
"MODULE_KEY",
",",
"moduleConfig",
")",
";",
"MessageResourcesConfig",
"[",
"]",
"mrConfig",
"=",
"moduleConfig",
".",
"findMessageResourcesConfigs",
"(",
")",
";",
"Object",
"formBean",
"=",
"unwrapFormBean",
"(",
"getCurrentActionForm",
"(",
"request",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mrConfig",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"key",
"=",
"mrConfig",
"[",
"i",
"]",
".",
"getKey",
"(",
")",
";",
"MessageResources",
"resources",
"=",
"(",
"MessageResources",
")",
"servletContext",
".",
"getAttribute",
"(",
"key",
"+",
"prefix",
")",
";",
"if",
"(",
"resources",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"resources",
"instanceof",
"ExpressionAwareMessageResources",
")",
")",
"{",
"resources",
"=",
"new",
"ExpressionAwareMessageResources",
"(",
"resources",
",",
"formBean",
",",
"request",
",",
"servletContext",
")",
";",
"}",
"request",
".",
"setAttribute",
"(",
"key",
",",
"resources",
")",
";",
"}",
"else",
"{",
"request",
".",
"removeAttribute",
"(",
"key",
")",
";",
"}",
"}",
"return",
"moduleConfig",
";",
"}"
] |
Set the given Struts module in the request, and expose its set of MessageResources as request attributes.
@param prefix the prefix of the desired module.
@param request the current HttpServletRequest.
@param servletContext the current ServletContext.
@return the selected ModuleConfig, or <code>null</code> if there is none for the given module prefix.
|
[
"Set",
"the",
"given",
"Struts",
"module",
"in",
"the",
"request",
"and",
"expose",
"its",
"set",
"of",
"MessageResources",
"as",
"request",
"attributes",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L1152-L1196
|
147,130
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
|
InternalUtils.getQualifiedBundleName
|
public static String getQualifiedBundleName( String bundleName, ServletRequest request )
{
if ( bundleName != null )
{
if ( bundleName.indexOf( '/' ) == -1 )
{
ModuleConfig mc = ( ModuleConfig ) request.getAttribute( Globals.MODULE_KEY );
// Note that we don't append the module path for the root module.
if ( mc != null && mc.getPrefix() != null && mc.getPrefix().length() > 1 )
{
bundleName += mc.getPrefix();
}
}
else if ( bundleName.endsWith( "/" ) )
{
// Special handling for bundles referring to the root module -- they should not have
// the module path ("/") at the end.
bundleName = bundleName.substring( 0, bundleName.length() - 1 );
}
}
return bundleName;
}
|
java
|
public static String getQualifiedBundleName( String bundleName, ServletRequest request )
{
if ( bundleName != null )
{
if ( bundleName.indexOf( '/' ) == -1 )
{
ModuleConfig mc = ( ModuleConfig ) request.getAttribute( Globals.MODULE_KEY );
// Note that we don't append the module path for the root module.
if ( mc != null && mc.getPrefix() != null && mc.getPrefix().length() > 1 )
{
bundleName += mc.getPrefix();
}
}
else if ( bundleName.endsWith( "/" ) )
{
// Special handling for bundles referring to the root module -- they should not have
// the module path ("/") at the end.
bundleName = bundleName.substring( 0, bundleName.length() - 1 );
}
}
return bundleName;
}
|
[
"public",
"static",
"String",
"getQualifiedBundleName",
"(",
"String",
"bundleName",
",",
"ServletRequest",
"request",
")",
"{",
"if",
"(",
"bundleName",
"!=",
"null",
")",
"{",
"if",
"(",
"bundleName",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
")",
"{",
"ModuleConfig",
"mc",
"=",
"(",
"ModuleConfig",
")",
"request",
".",
"getAttribute",
"(",
"Globals",
".",
"MODULE_KEY",
")",
";",
"// Note that we don't append the module path for the root module.",
"if",
"(",
"mc",
"!=",
"null",
"&&",
"mc",
".",
"getPrefix",
"(",
")",
"!=",
"null",
"&&",
"mc",
".",
"getPrefix",
"(",
")",
".",
"length",
"(",
")",
">",
"1",
")",
"{",
"bundleName",
"+=",
"mc",
".",
"getPrefix",
"(",
")",
";",
"}",
"}",
"else",
"if",
"(",
"bundleName",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"// Special handling for bundles referring to the root module -- they should not have",
"// the module path (\"/\") at the end.",
"bundleName",
"=",
"bundleName",
".",
"substring",
"(",
"0",
",",
"bundleName",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"return",
"bundleName",
";",
"}"
] |
Qualify the given bundle name with the current module path to return a full bundle name.
@return the qualified Bundle name
|
[
"Qualify",
"the",
"given",
"bundle",
"name",
"with",
"the",
"current",
"module",
"path",
"to",
"return",
"a",
"full",
"bundle",
"name",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L1220-L1243
|
147,131
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptField.java
|
AptField.getType
|
public String getType()
{
if ( _fieldDecl == null || _fieldDecl.getType() == null )
return "";
return _fieldDecl.getType().toString();
}
|
java
|
public String getType()
{
if ( _fieldDecl == null || _fieldDecl.getType() == null )
return "";
return _fieldDecl.getType().toString();
}
|
[
"public",
"String",
"getType",
"(",
")",
"{",
"if",
"(",
"_fieldDecl",
"==",
"null",
"||",
"_fieldDecl",
".",
"getType",
"(",
")",
"==",
"null",
")",
"return",
"\"\"",
";",
"return",
"_fieldDecl",
".",
"getType",
"(",
")",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns the type of the field
|
[
"Returns",
"the",
"type",
"of",
"the",
"field"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptField.java#L55-L61
|
147,132
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptField.java
|
AptField.getClassName
|
public String getClassName()
{
if ( _fieldDecl == null || _fieldDecl.getType() == null )
return "";
//
// This is lazily... but much easier than navigating the APT type system and just
// as effective ;)
String typeName = _fieldDecl.getType().toString();
int formalIndex = typeName.indexOf('<');
if (formalIndex > 0)
return typeName.substring(0, formalIndex);
return typeName;
}
|
java
|
public String getClassName()
{
if ( _fieldDecl == null || _fieldDecl.getType() == null )
return "";
//
// This is lazily... but much easier than navigating the APT type system and just
// as effective ;)
String typeName = _fieldDecl.getType().toString();
int formalIndex = typeName.indexOf('<');
if (formalIndex > 0)
return typeName.substring(0, formalIndex);
return typeName;
}
|
[
"public",
"String",
"getClassName",
"(",
")",
"{",
"if",
"(",
"_fieldDecl",
"==",
"null",
"||",
"_fieldDecl",
".",
"getType",
"(",
")",
"==",
"null",
")",
"return",
"\"\"",
";",
"//",
"// This is lazily... but much easier than navigating the APT type system and just",
"// as effective ;)",
"String",
"typeName",
"=",
"_fieldDecl",
".",
"getType",
"(",
")",
".",
"toString",
"(",
")",
";",
"int",
"formalIndex",
"=",
"typeName",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"formalIndex",
">",
"0",
")",
"return",
"typeName",
".",
"substring",
"(",
"0",
",",
"formalIndex",
")",
";",
"return",
"typeName",
";",
"}"
] |
Returns the class name of the field (does not include any formal type parameters
|
[
"Returns",
"the",
"class",
"name",
"of",
"the",
"field",
"(",
"does",
"not",
"include",
"any",
"formal",
"type",
"parameters"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptField.java#L66-L79
|
147,133
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptField.java
|
AptField.getAccessModifier
|
public String getAccessModifier()
{
if ( _fieldDecl == null )
return "";
Collection<Modifier> modifiers = _fieldDecl.getModifiers();
if (modifiers.contains(Modifier.PRIVATE))
return "private";
if (modifiers.contains(Modifier.PROTECTED))
return "protected";
if (modifiers.contains(Modifier.PUBLIC))
return "public";
return "";
}
|
java
|
public String getAccessModifier()
{
if ( _fieldDecl == null )
return "";
Collection<Modifier> modifiers = _fieldDecl.getModifiers();
if (modifiers.contains(Modifier.PRIVATE))
return "private";
if (modifiers.contains(Modifier.PROTECTED))
return "protected";
if (modifiers.contains(Modifier.PUBLIC))
return "public";
return "";
}
|
[
"public",
"String",
"getAccessModifier",
"(",
")",
"{",
"if",
"(",
"_fieldDecl",
"==",
"null",
")",
"return",
"\"\"",
";",
"Collection",
"<",
"Modifier",
">",
"modifiers",
"=",
"_fieldDecl",
".",
"getModifiers",
"(",
")",
";",
"if",
"(",
"modifiers",
".",
"contains",
"(",
"Modifier",
".",
"PRIVATE",
")",
")",
"return",
"\"private\"",
";",
"if",
"(",
"modifiers",
".",
"contains",
"(",
"Modifier",
".",
"PROTECTED",
")",
")",
"return",
"\"protected\"",
";",
"if",
"(",
"modifiers",
".",
"contains",
"(",
"Modifier",
".",
"PUBLIC",
")",
")",
"return",
"\"public\"",
";",
"return",
"\"\"",
";",
"}"
] |
Returns the access modifier associated with the field
|
[
"Returns",
"the",
"access",
"modifier",
"associated",
"with",
"the",
"field"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptField.java#L84-L98
|
147,134
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/naming/FormDataNameInterceptor.java
|
FormDataNameInterceptor.rewriteName
|
public String rewriteName(String name, Tag currentTag)
throws ExpressionEvaluationException
{
ExpressionEvaluator eval = ExpressionEvaluatorFactory.getInstance();
try {
if (!eval.isExpression(name))
return eval.qualify("actionForm", name);
return name;
}
catch (Exception e) {
if (logger.isErrorEnabled())
logger.error("Could not qualify name \"" + name + "\" into the actionForm binding context.", e);
// return the Struts name. This should cause regular Struts databinding to execute so this property will
// be updated anyway.
return name;
}
}
|
java
|
public String rewriteName(String name, Tag currentTag)
throws ExpressionEvaluationException
{
ExpressionEvaluator eval = ExpressionEvaluatorFactory.getInstance();
try {
if (!eval.isExpression(name))
return eval.qualify("actionForm", name);
return name;
}
catch (Exception e) {
if (logger.isErrorEnabled())
logger.error("Could not qualify name \"" + name + "\" into the actionForm binding context.", e);
// return the Struts name. This should cause regular Struts databinding to execute so this property will
// be updated anyway.
return name;
}
}
|
[
"public",
"String",
"rewriteName",
"(",
"String",
"name",
",",
"Tag",
"currentTag",
")",
"throws",
"ExpressionEvaluationException",
"{",
"ExpressionEvaluator",
"eval",
"=",
"ExpressionEvaluatorFactory",
".",
"getInstance",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"eval",
".",
"isExpression",
"(",
"name",
")",
")",
"return",
"eval",
".",
"qualify",
"(",
"\"actionForm\"",
",",
"name",
")",
";",
"return",
"name",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"logger",
".",
"isErrorEnabled",
"(",
")",
")",
"logger",
".",
"error",
"(",
"\"Could not qualify name \\\"\"",
"+",
"name",
"+",
"\"\\\" into the actionForm binding context.\"",
",",
"e",
")",
";",
"// return the Struts name. This should cause regular Struts databinding to execute so this property will",
"// be updated anyway.",
"return",
"name",
";",
"}",
"}"
] |
Qualify the name of a NetUI JSP tag into the "actionForm" data binding context.
This feature is used to convert non-expression tag names, as those used in Struts,
into actionForm expressions that NetUI consumes.
@param name the name to qualify into the actionForm binding context. If this is "foo", the returned value
is {actionForm.foo}
@return the qualified name or <code>null</code> if an error occurred
|
[
"Qualify",
"the",
"name",
"of",
"a",
"NetUI",
"JSP",
"tag",
"into",
"the",
"actionForm",
"data",
"binding",
"context",
".",
"This",
"feature",
"is",
"used",
"to",
"convert",
"non",
"-",
"expression",
"tag",
"names",
"as",
"those",
"used",
"in",
"Struts",
"into",
"actionForm",
"expressions",
"that",
"NetUI",
"consumes",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/naming/FormDataNameInterceptor.java#L56-L74
|
147,135
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/RibbonColumnRegistry.java
|
RibbonColumnRegistry.getRibbonColumn
|
public static RibbonColumn getRibbonColumn(String key, List<ClientToolInfo> tools, List<Parameter> parameters,
MapWidget mapWidget) {
RibbonColumnCreator ribbonColumnCreator = REGISTRY.get(key);
if (ribbonColumnCreator == null) {
Log.logWarn("Could not find RibbonColumn with ID: " + key);
return null;
} else {
RibbonColumn column = ribbonColumnCreator.create(tools, mapWidget);
if (parameters != null) {
for (Parameter parameter : parameters) {
column.configure(parameter.getName(), parameter.getValue());
}
}
return column;
}
}
|
java
|
public static RibbonColumn getRibbonColumn(String key, List<ClientToolInfo> tools, List<Parameter> parameters,
MapWidget mapWidget) {
RibbonColumnCreator ribbonColumnCreator = REGISTRY.get(key);
if (ribbonColumnCreator == null) {
Log.logWarn("Could not find RibbonColumn with ID: " + key);
return null;
} else {
RibbonColumn column = ribbonColumnCreator.create(tools, mapWidget);
if (parameters != null) {
for (Parameter parameter : parameters) {
column.configure(parameter.getName(), parameter.getValue());
}
}
return column;
}
}
|
[
"public",
"static",
"RibbonColumn",
"getRibbonColumn",
"(",
"String",
"key",
",",
"List",
"<",
"ClientToolInfo",
">",
"tools",
",",
"List",
"<",
"Parameter",
">",
"parameters",
",",
"MapWidget",
"mapWidget",
")",
"{",
"RibbonColumnCreator",
"ribbonColumnCreator",
"=",
"REGISTRY",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"ribbonColumnCreator",
"==",
"null",
")",
"{",
"Log",
".",
"logWarn",
"(",
"\"Could not find RibbonColumn with ID: \"",
"+",
"key",
")",
";",
"return",
"null",
";",
"}",
"else",
"{",
"RibbonColumn",
"column",
"=",
"ribbonColumnCreator",
".",
"create",
"(",
"tools",
",",
"mapWidget",
")",
";",
"if",
"(",
"parameters",
"!=",
"null",
")",
"{",
"for",
"(",
"Parameter",
"parameter",
":",
"parameters",
")",
"{",
"column",
".",
"configure",
"(",
"parameter",
".",
"getName",
"(",
")",
",",
"parameter",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"return",
"column",
";",
"}",
"}"
] |
Get the ribbon column which matches the given key.
@param key
Unique key for the action within this registry.
@param tools
A list of tools to be used in the ribbon column. It is up to the implementation to interpret these
correctly.This is optional, and can be null.
@param parameters
A list of specific configuration parameters to be used in the column. This is optional, and can be
null.
@param mapWidget
The map to which this action is linked.
@return {@link RibbonColumn} or null when key not found.
|
[
"Get",
"the",
"ribbon",
"column",
"which",
"matches",
"the",
"given",
"key",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/RibbonColumnRegistry.java#L153-L168
|
147,136
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LinearRing.java
|
LinearRing.isClosed
|
public boolean isClosed() {
if (isEmpty()) {
return false;
}
if (getNumPoints() == 1) {
return false;
}
Coordinate[] coordinates = getCoordinates();
return coordinates[0].equals(coordinates[coordinates.length - 1]);
}
|
java
|
public boolean isClosed() {
if (isEmpty()) {
return false;
}
if (getNumPoints() == 1) {
return false;
}
Coordinate[] coordinates = getCoordinates();
return coordinates[0].equals(coordinates[coordinates.length - 1]);
}
|
[
"public",
"boolean",
"isClosed",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"getNumPoints",
"(",
")",
"==",
"1",
")",
"{",
"return",
"false",
";",
"}",
"Coordinate",
"[",
"]",
"coordinates",
"=",
"getCoordinates",
"(",
")",
";",
"return",
"coordinates",
"[",
"0",
"]",
".",
"equals",
"(",
"coordinates",
"[",
"coordinates",
".",
"length",
"-",
"1",
"]",
")",
";",
"}"
] |
Checks to see if the last coordinate equals the first. Should always be the case!
|
[
"Checks",
"to",
"see",
"if",
"the",
"last",
"coordinate",
"equals",
"the",
"first",
".",
"Should",
"always",
"be",
"the",
"case!"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LinearRing.java#L57-L66
|
147,137
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LinearRing.java
|
LinearRing.isValid
|
public boolean isValid() {
if (isEmpty()) {
return true;
}
if (!isClosed()) {
return false;
}
Coordinate[] coordinates = getCoordinates();
if (coordinates.length < 4) {
return false;
}
for (int i = 0; i < coordinates.length - 1; i++) {
for (int j = 0; j < coordinates.length - 1; j++) {
if (Mathlib.lineIntersects(coordinates[i], coordinates[i + 1], coordinates[j], coordinates[j + 1])) {
return false;
}
}
}
return true;
}
|
java
|
public boolean isValid() {
if (isEmpty()) {
return true;
}
if (!isClosed()) {
return false;
}
Coordinate[] coordinates = getCoordinates();
if (coordinates.length < 4) {
return false;
}
for (int i = 0; i < coordinates.length - 1; i++) {
for (int j = 0; j < coordinates.length - 1; j++) {
if (Mathlib.lineIntersects(coordinates[i], coordinates[i + 1], coordinates[j], coordinates[j + 1])) {
return false;
}
}
}
return true;
}
|
[
"public",
"boolean",
"isValid",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"isClosed",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Coordinate",
"[",
"]",
"coordinates",
"=",
"getCoordinates",
"(",
")",
";",
"if",
"(",
"coordinates",
".",
"length",
"<",
"4",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"coordinates",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"coordinates",
".",
"length",
"-",
"1",
";",
"j",
"++",
")",
"{",
"if",
"(",
"Mathlib",
".",
"lineIntersects",
"(",
"coordinates",
"[",
"i",
"]",
",",
"coordinates",
"[",
"i",
"+",
"1",
"]",
",",
"coordinates",
"[",
"j",
"]",
",",
"coordinates",
"[",
"j",
"+",
"1",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] |
An empty LinearRing is valid. Furthermore this object must be closed and must not self-intersect.
|
[
"An",
"empty",
"LinearRing",
"is",
"valid",
".",
"Furthermore",
"this",
"object",
"must",
"be",
"closed",
"and",
"must",
"not",
"self",
"-",
"intersect",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LinearRing.java#L71-L93
|
147,138
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/Vector2D.java
|
Vector2D.distance
|
public double distance(Vector2D vector2d) {
double a = vector2d.x - x;
double b = vector2d.y - y;
return Math.sqrt(a * a + b * b);
}
|
java
|
public double distance(Vector2D vector2d) {
double a = vector2d.x - x;
double b = vector2d.y - y;
return Math.sqrt(a * a + b * b);
}
|
[
"public",
"double",
"distance",
"(",
"Vector2D",
"vector2d",
")",
"{",
"double",
"a",
"=",
"vector2d",
".",
"x",
"-",
"x",
";",
"double",
"b",
"=",
"vector2d",
".",
"y",
"-",
"y",
";",
"return",
"Math",
".",
"sqrt",
"(",
"a",
"*",
"a",
"+",
"b",
"*",
"b",
")",
";",
"}"
] |
Calculate the distance between 2 vector by using Pythagoras' formula.
@param vector2d
The other vector.
@returns The distance between these 2 vectors as a Double.
|
[
"Calculate",
"the",
"distance",
"between",
"2",
"vector",
"by",
"using",
"Pythagoras",
"formula",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Vector2D.java#L118-L122
|
147,139
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/util/DistanceFormat.java
|
DistanceFormat.asMapLength
|
public static String asMapLength(MapWidget map, double length) {
double unitLength = map.getUnitLength();
double distance = length * unitLength;
String unit = "m";
if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.METRIC) {
// Right now, the distance is expressed in meter. Switch to km?
if (distance > 10000) {
distance /= METERS_IN_KM;
unit = "km";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.ENGLISH) {
if (distance / METERS_IN_YARD > 10000) {
// More than 10000 yard; switch to mile:
distance = distance / METERS_IN_MILE;
unit = "mi";
} else {
distance /= METERS_IN_YARD; // use yards.
unit = "yd";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.ENGLISH_FOOT) {
if (distance * FEET_IN_METER > FEET_IN_MILE) {
// More than 1 mile (5280 feet); switch to mile:
distance = distance / METERS_IN_MILE;
unit = "mi";
} else {
distance *= FEET_IN_METER; // use feet.
unit = "ft";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.CRS) {
unit = "u";
}
String formatted = NumberFormat.getDecimalFormat().format(distance);
return formatted + unit;
}
|
java
|
public static String asMapLength(MapWidget map, double length) {
double unitLength = map.getUnitLength();
double distance = length * unitLength;
String unit = "m";
if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.METRIC) {
// Right now, the distance is expressed in meter. Switch to km?
if (distance > 10000) {
distance /= METERS_IN_KM;
unit = "km";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.ENGLISH) {
if (distance / METERS_IN_YARD > 10000) {
// More than 10000 yard; switch to mile:
distance = distance / METERS_IN_MILE;
unit = "mi";
} else {
distance /= METERS_IN_YARD; // use yards.
unit = "yd";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.ENGLISH_FOOT) {
if (distance * FEET_IN_METER > FEET_IN_MILE) {
// More than 1 mile (5280 feet); switch to mile:
distance = distance / METERS_IN_MILE;
unit = "mi";
} else {
distance *= FEET_IN_METER; // use feet.
unit = "ft";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.CRS) {
unit = "u";
}
String formatted = NumberFormat.getDecimalFormat().format(distance);
return formatted + unit;
}
|
[
"public",
"static",
"String",
"asMapLength",
"(",
"MapWidget",
"map",
",",
"double",
"length",
")",
"{",
"double",
"unitLength",
"=",
"map",
".",
"getUnitLength",
"(",
")",
";",
"double",
"distance",
"=",
"length",
"*",
"unitLength",
";",
"String",
"unit",
"=",
"\"m\"",
";",
"if",
"(",
"map",
".",
"getMapModel",
"(",
")",
".",
"getMapInfo",
"(",
")",
".",
"getDisplayUnitType",
"(",
")",
"==",
"UnitType",
".",
"METRIC",
")",
"{",
"// Right now, the distance is expressed in meter. Switch to km?",
"if",
"(",
"distance",
">",
"10000",
")",
"{",
"distance",
"/=",
"METERS_IN_KM",
";",
"unit",
"=",
"\"km\"",
";",
"}",
"}",
"else",
"if",
"(",
"map",
".",
"getMapModel",
"(",
")",
".",
"getMapInfo",
"(",
")",
".",
"getDisplayUnitType",
"(",
")",
"==",
"UnitType",
".",
"ENGLISH",
")",
"{",
"if",
"(",
"distance",
"/",
"METERS_IN_YARD",
">",
"10000",
")",
"{",
"// More than 10000 yard; switch to mile:",
"distance",
"=",
"distance",
"/",
"METERS_IN_MILE",
";",
"unit",
"=",
"\"mi\"",
";",
"}",
"else",
"{",
"distance",
"/=",
"METERS_IN_YARD",
";",
"// use yards.",
"unit",
"=",
"\"yd\"",
";",
"}",
"}",
"else",
"if",
"(",
"map",
".",
"getMapModel",
"(",
")",
".",
"getMapInfo",
"(",
")",
".",
"getDisplayUnitType",
"(",
")",
"==",
"UnitType",
".",
"ENGLISH_FOOT",
")",
"{",
"if",
"(",
"distance",
"*",
"FEET_IN_METER",
">",
"FEET_IN_MILE",
")",
"{",
"// More than 1 mile (5280 feet); switch to mile:",
"distance",
"=",
"distance",
"/",
"METERS_IN_MILE",
";",
"unit",
"=",
"\"mi\"",
";",
"}",
"else",
"{",
"distance",
"*=",
"FEET_IN_METER",
";",
"// use feet.",
"unit",
"=",
"\"ft\"",
";",
"}",
"}",
"else",
"if",
"(",
"map",
".",
"getMapModel",
"(",
")",
".",
"getMapInfo",
"(",
")",
".",
"getDisplayUnitType",
"(",
")",
"==",
"UnitType",
".",
"CRS",
")",
"{",
"unit",
"=",
"\"u\"",
";",
"}",
"String",
"formatted",
"=",
"NumberFormat",
".",
"getDecimalFormat",
"(",
")",
".",
"format",
"(",
"distance",
")",
";",
"return",
"formatted",
"+",
"unit",
";",
"}"
] |
Distance formatting method. Requires a length as parameter, expressed in the CRS units of the given map.
@param map
The map for which a distance should be formatted. This map may be configured to use the metric system
or the English system.
@param length
The original length, expressed in the coordinate reference system of the given map.
@return Returns a string that is the formatted distance of the given length. Preference goes to meters or yards
(depending on the configured unit type), but when the number is larger than 10000, it will switch
automatically to kilometer/mile.
|
[
"Distance",
"formatting",
"method",
".",
"Requires",
"a",
"length",
"as",
"parameter",
"expressed",
"in",
"the",
"CRS",
"units",
"of",
"the",
"given",
"map",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/util/DistanceFormat.java#L52-L87
|
147,140
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/util/DistanceFormat.java
|
DistanceFormat.asMapArea
|
public static String asMapArea(MapWidget map, double area) {
double unitLength = map.getUnitLength();
double distance = area * unitLength * unitLength;
String unit = "m";
if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.METRIC) {
// Right now, the distance is expressed in meter. Switch to km?
if (distance > (METERS_IN_KM * METERS_IN_KM)) {
distance /= (METERS_IN_KM * METERS_IN_KM);
unit = "km";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.ENGLISH) {
if (distance > (METERS_IN_MILE * METERS_IN_MILE)) {
// Switch to mile:
distance = distance / (METERS_IN_MILE * METERS_IN_MILE);
unit = "mi";
} else {
distance /= (METERS_IN_YARD * METERS_IN_YARD); // use yards.
unit = "yd";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.CRS) {
unit = "u";
}
String formatted = NumberFormat.getDecimalFormat().format(distance);
return formatted + unit + "²";
}
|
java
|
public static String asMapArea(MapWidget map, double area) {
double unitLength = map.getUnitLength();
double distance = area * unitLength * unitLength;
String unit = "m";
if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.METRIC) {
// Right now, the distance is expressed in meter. Switch to km?
if (distance > (METERS_IN_KM * METERS_IN_KM)) {
distance /= (METERS_IN_KM * METERS_IN_KM);
unit = "km";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.ENGLISH) {
if (distance > (METERS_IN_MILE * METERS_IN_MILE)) {
// Switch to mile:
distance = distance / (METERS_IN_MILE * METERS_IN_MILE);
unit = "mi";
} else {
distance /= (METERS_IN_YARD * METERS_IN_YARD); // use yards.
unit = "yd";
}
} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.CRS) {
unit = "u";
}
String formatted = NumberFormat.getDecimalFormat().format(distance);
return formatted + unit + "²";
}
|
[
"public",
"static",
"String",
"asMapArea",
"(",
"MapWidget",
"map",
",",
"double",
"area",
")",
"{",
"double",
"unitLength",
"=",
"map",
".",
"getUnitLength",
"(",
")",
";",
"double",
"distance",
"=",
"area",
"*",
"unitLength",
"*",
"unitLength",
";",
"String",
"unit",
"=",
"\"m\"",
";",
"if",
"(",
"map",
".",
"getMapModel",
"(",
")",
".",
"getMapInfo",
"(",
")",
".",
"getDisplayUnitType",
"(",
")",
"==",
"UnitType",
".",
"METRIC",
")",
"{",
"// Right now, the distance is expressed in meter. Switch to km?",
"if",
"(",
"distance",
">",
"(",
"METERS_IN_KM",
"*",
"METERS_IN_KM",
")",
")",
"{",
"distance",
"/=",
"(",
"METERS_IN_KM",
"*",
"METERS_IN_KM",
")",
";",
"unit",
"=",
"\"km\"",
";",
"}",
"}",
"else",
"if",
"(",
"map",
".",
"getMapModel",
"(",
")",
".",
"getMapInfo",
"(",
")",
".",
"getDisplayUnitType",
"(",
")",
"==",
"UnitType",
".",
"ENGLISH",
")",
"{",
"if",
"(",
"distance",
">",
"(",
"METERS_IN_MILE",
"*",
"METERS_IN_MILE",
")",
")",
"{",
"// Switch to mile:",
"distance",
"=",
"distance",
"/",
"(",
"METERS_IN_MILE",
"*",
"METERS_IN_MILE",
")",
";",
"unit",
"=",
"\"mi\"",
";",
"}",
"else",
"{",
"distance",
"/=",
"(",
"METERS_IN_YARD",
"*",
"METERS_IN_YARD",
")",
";",
"// use yards.",
"unit",
"=",
"\"yd\"",
";",
"}",
"}",
"else",
"if",
"(",
"map",
".",
"getMapModel",
"(",
")",
".",
"getMapInfo",
"(",
")",
".",
"getDisplayUnitType",
"(",
")",
"==",
"UnitType",
".",
"CRS",
")",
"{",
"unit",
"=",
"\"u\"",
";",
"}",
"String",
"formatted",
"=",
"NumberFormat",
".",
"getDecimalFormat",
"(",
")",
".",
"format",
"(",
"distance",
")",
";",
"return",
"formatted",
"+",
"unit",
"+",
"\"²\"",
";",
"}"
] |
Area formatting method. Requires an area as parameter, expressed in the CRS units of the given map.
@param map
The map for which an area should be formatted. This map may be configured to use the metric system or
the English system.
@param area
The original area, expressed in the coordinate reference system of the given map.
@return Returns a string that is the formatted area of the given area. Preference goes to meters or yards
(depending on the configured unit type), but when the number is larger than meters (or yards), it will
switch automatically to kilometers/miles.
|
[
"Area",
"formatting",
"method",
".",
"Requires",
"an",
"area",
"as",
"parameter",
"expressed",
"in",
"the",
"CRS",
"units",
"of",
"the",
"given",
"map",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/util/DistanceFormat.java#L101-L127
|
147,141
|
geomajas/geomajas-project-client-gwt
|
plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/JsGeometryEditor.java
|
JsGeometryEditor.setMap
|
public void setMap(Map map) {
this.map = (MapImpl) map;
mapWidget = this.map.getMapWidget();
delegate = new GeometryEditorImpl(mapWidget);
editingService = new JsGeometryEditService(delegate.getEditService());
splitService = new JsGeometrySplitService(delegate.getEditService());
mergeService = new JsGeometryMergeService();
renderer = new JsGeometryRenderer(delegate.getRenderer());
styleService = new JsStyleService(delegate.getStyleService());
snapService = new JsSnapService(this);
}
|
java
|
public void setMap(Map map) {
this.map = (MapImpl) map;
mapWidget = this.map.getMapWidget();
delegate = new GeometryEditorImpl(mapWidget);
editingService = new JsGeometryEditService(delegate.getEditService());
splitService = new JsGeometrySplitService(delegate.getEditService());
mergeService = new JsGeometryMergeService();
renderer = new JsGeometryRenderer(delegate.getRenderer());
styleService = new JsStyleService(delegate.getStyleService());
snapService = new JsSnapService(this);
}
|
[
"public",
"void",
"setMap",
"(",
"Map",
"map",
")",
"{",
"this",
".",
"map",
"=",
"(",
"MapImpl",
")",
"map",
";",
"mapWidget",
"=",
"this",
".",
"map",
".",
"getMapWidget",
"(",
")",
";",
"delegate",
"=",
"new",
"GeometryEditorImpl",
"(",
"mapWidget",
")",
";",
"editingService",
"=",
"new",
"JsGeometryEditService",
"(",
"delegate",
".",
"getEditService",
"(",
")",
")",
";",
"splitService",
"=",
"new",
"JsGeometrySplitService",
"(",
"delegate",
".",
"getEditService",
"(",
")",
")",
";",
"mergeService",
"=",
"new",
"JsGeometryMergeService",
"(",
")",
";",
"renderer",
"=",
"new",
"JsGeometryRenderer",
"(",
"delegate",
".",
"getRenderer",
"(",
")",
")",
";",
"styleService",
"=",
"new",
"JsStyleService",
"(",
"delegate",
".",
"getStyleService",
"(",
")",
")",
";",
"snapService",
"=",
"new",
"JsSnapService",
"(",
"this",
")",
";",
"}"
] |
Set the map.
@param map map
|
[
"Set",
"the",
"map",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/JsGeometryEditor.java#L76-L86
|
147,142
|
geomajas/geomajas-project-client-gwt
|
plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/JsGeometryEditor.java
|
JsGeometryEditor.addLayerSnappingRules
|
public void addLayerSnappingRules(String layerId) {
Layer<?> layer = mapWidget.getMapModel().getLayer(layerId);
if (layer != null && layer instanceof VectorLayer) {
VectorLayer vLayer = (VectorLayer) layer;
for (SnappingRuleInfo snappingRuleInfo : vLayer.getLayerInfo().getSnappingRules()) {
SnapRuleUtil.addRule(delegate.getSnappingService(), mapWidget, snappingRuleInfo);
}
}
}
|
java
|
public void addLayerSnappingRules(String layerId) {
Layer<?> layer = mapWidget.getMapModel().getLayer(layerId);
if (layer != null && layer instanceof VectorLayer) {
VectorLayer vLayer = (VectorLayer) layer;
for (SnappingRuleInfo snappingRuleInfo : vLayer.getLayerInfo().getSnappingRules()) {
SnapRuleUtil.addRule(delegate.getSnappingService(), mapWidget, snappingRuleInfo);
}
}
}
|
[
"public",
"void",
"addLayerSnappingRules",
"(",
"String",
"layerId",
")",
"{",
"Layer",
"<",
"?",
">",
"layer",
"=",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getLayer",
"(",
"layerId",
")",
";",
"if",
"(",
"layer",
"!=",
"null",
"&&",
"layer",
"instanceof",
"VectorLayer",
")",
"{",
"VectorLayer",
"vLayer",
"=",
"(",
"VectorLayer",
")",
"layer",
";",
"for",
"(",
"SnappingRuleInfo",
"snappingRuleInfo",
":",
"vLayer",
".",
"getLayerInfo",
"(",
")",
".",
"getSnappingRules",
"(",
")",
")",
"{",
"SnapRuleUtil",
".",
"addRule",
"(",
"delegate",
".",
"getSnappingService",
"(",
")",
",",
"mapWidget",
",",
"snappingRuleInfo",
")",
";",
"}",
"}",
"}"
] |
Add the list of snapping rules as they are configured for a specific layer within the XML configuration.
@param layerId The vector layer to use the configuration from.
|
[
"Add",
"the",
"list",
"of",
"snapping",
"rules",
"as",
"they",
"are",
"configured",
"for",
"a",
"specific",
"layer",
"within",
"the",
"XML",
"configuration",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/JsGeometryEditor.java#L93-L101
|
147,143
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/util/WidgetLayout.java
|
WidgetLayout.keepWindowInScreen
|
public static void keepWindowInScreen(Window window) {
window.setKeepInParentRect(true);
if (null != window.getHeightAsString()) {
int screenHeight = com.google.gwt.user.client.Window.getClientHeight();
int windowHeight = window.getViewportHeight();
window.setMaxHeight(screenHeight - WidgetLayout.windowOffset * 2);
if (windowHeight + window.getAbsoluteTop() > screenHeight) {
int top = screenHeight - windowHeight;
if (top >= 0) {
window.setPageTop(top);
} else {
window.setHeight(screenHeight - WidgetLayout.windowOffset);
window.setPageTop(WidgetLayout.windowOffset);
}
}
}
if (null != window.getWidthAsString()) {
int screenWidth = com.google.gwt.user.client.Window.getClientWidth();
int windowWidth = window.getViewportWidth();
window.setMaxWidth(screenWidth - WidgetLayout.windowOffset * 2);
if (windowWidth + window.getAbsoluteLeft() > screenWidth) {
int left = screenWidth - windowWidth;
if (left >= 0) {
window.setPageLeft(left);
} else {
window.setWidth(screenWidth - WidgetLayout.windowOffset);
window.setPageLeft(WidgetLayout.windowOffset);
}
}
}
}
|
java
|
public static void keepWindowInScreen(Window window) {
window.setKeepInParentRect(true);
if (null != window.getHeightAsString()) {
int screenHeight = com.google.gwt.user.client.Window.getClientHeight();
int windowHeight = window.getViewportHeight();
window.setMaxHeight(screenHeight - WidgetLayout.windowOffset * 2);
if (windowHeight + window.getAbsoluteTop() > screenHeight) {
int top = screenHeight - windowHeight;
if (top >= 0) {
window.setPageTop(top);
} else {
window.setHeight(screenHeight - WidgetLayout.windowOffset);
window.setPageTop(WidgetLayout.windowOffset);
}
}
}
if (null != window.getWidthAsString()) {
int screenWidth = com.google.gwt.user.client.Window.getClientWidth();
int windowWidth = window.getViewportWidth();
window.setMaxWidth(screenWidth - WidgetLayout.windowOffset * 2);
if (windowWidth + window.getAbsoluteLeft() > screenWidth) {
int left = screenWidth - windowWidth;
if (left >= 0) {
window.setPageLeft(left);
} else {
window.setWidth(screenWidth - WidgetLayout.windowOffset);
window.setPageLeft(WidgetLayout.windowOffset);
}
}
}
}
|
[
"public",
"static",
"void",
"keepWindowInScreen",
"(",
"Window",
"window",
")",
"{",
"window",
".",
"setKeepInParentRect",
"(",
"true",
")",
";",
"if",
"(",
"null",
"!=",
"window",
".",
"getHeightAsString",
"(",
")",
")",
"{",
"int",
"screenHeight",
"=",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"Window",
".",
"getClientHeight",
"(",
")",
";",
"int",
"windowHeight",
"=",
"window",
".",
"getViewportHeight",
"(",
")",
";",
"window",
".",
"setMaxHeight",
"(",
"screenHeight",
"-",
"WidgetLayout",
".",
"windowOffset",
"*",
"2",
")",
";",
"if",
"(",
"windowHeight",
"+",
"window",
".",
"getAbsoluteTop",
"(",
")",
">",
"screenHeight",
")",
"{",
"int",
"top",
"=",
"screenHeight",
"-",
"windowHeight",
";",
"if",
"(",
"top",
">=",
"0",
")",
"{",
"window",
".",
"setPageTop",
"(",
"top",
")",
";",
"}",
"else",
"{",
"window",
".",
"setHeight",
"(",
"screenHeight",
"-",
"WidgetLayout",
".",
"windowOffset",
")",
";",
"window",
".",
"setPageTop",
"(",
"WidgetLayout",
".",
"windowOffset",
")",
";",
"}",
"}",
"}",
"if",
"(",
"null",
"!=",
"window",
".",
"getWidthAsString",
"(",
")",
")",
"{",
"int",
"screenWidth",
"=",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"Window",
".",
"getClientWidth",
"(",
")",
";",
"int",
"windowWidth",
"=",
"window",
".",
"getViewportWidth",
"(",
")",
";",
"window",
".",
"setMaxWidth",
"(",
"screenWidth",
"-",
"WidgetLayout",
".",
"windowOffset",
"*",
"2",
")",
";",
"if",
"(",
"windowWidth",
"+",
"window",
".",
"getAbsoluteLeft",
"(",
")",
">",
"screenWidth",
")",
"{",
"int",
"left",
"=",
"screenWidth",
"-",
"windowWidth",
";",
"if",
"(",
"left",
">=",
"0",
")",
"{",
"window",
".",
"setPageLeft",
"(",
"left",
")",
";",
"}",
"else",
"{",
"window",
".",
"setWidth",
"(",
"screenWidth",
"-",
"WidgetLayout",
".",
"windowOffset",
")",
";",
"window",
".",
"setPageLeft",
"(",
"WidgetLayout",
".",
"windowOffset",
")",
";",
"}",
"}",
"}",
"}"
] |
Try to force a window to stay within the screen bounds.
@param window window to affect
|
[
"Try",
"to",
"force",
"a",
"window",
"to",
"stay",
"within",
"the",
"screen",
"bounds",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/util/WidgetLayout.java#L408-L438
|
147,144
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/operation/RemoveRingOperation.java
|
RemoveRingOperation.execute
|
public Geometry execute(Geometry geometry) {
if (geometry instanceof Polygon) {
Polygon polygon = (Polygon) geometry;
// No rings? return null:
if (polygon.getNumInteriorRing() == 0) {
return null;
}
// Correct the index if necessary:
if (ringIndex < 0) {
ringIndex = 0;
} else if (ringIndex >= polygon.getNumInteriorRing()) {
ringIndex = polygon.getNumInteriorRing() - 1;
}
// Create the new array of interior rings:
LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing() - 1];
int count = 0;
for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
if (n != ringIndex) {
interiorRings[count++] = polygon.getInteriorRingN(n);
}
}
return geometry.getGeometryFactory().createPolygon(polygon.getExteriorRing(), interiorRings);
}
return null;
}
|
java
|
public Geometry execute(Geometry geometry) {
if (geometry instanceof Polygon) {
Polygon polygon = (Polygon) geometry;
// No rings? return null:
if (polygon.getNumInteriorRing() == 0) {
return null;
}
// Correct the index if necessary:
if (ringIndex < 0) {
ringIndex = 0;
} else if (ringIndex >= polygon.getNumInteriorRing()) {
ringIndex = polygon.getNumInteriorRing() - 1;
}
// Create the new array of interior rings:
LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing() - 1];
int count = 0;
for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
if (n != ringIndex) {
interiorRings[count++] = polygon.getInteriorRingN(n);
}
}
return geometry.getGeometryFactory().createPolygon(polygon.getExteriorRing(), interiorRings);
}
return null;
}
|
[
"public",
"Geometry",
"execute",
"(",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"geometry",
"instanceof",
"Polygon",
")",
"{",
"Polygon",
"polygon",
"=",
"(",
"Polygon",
")",
"geometry",
";",
"// No rings? return null:",
"if",
"(",
"polygon",
".",
"getNumInteriorRing",
"(",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"// Correct the index if necessary:",
"if",
"(",
"ringIndex",
"<",
"0",
")",
"{",
"ringIndex",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"ringIndex",
">=",
"polygon",
".",
"getNumInteriorRing",
"(",
")",
")",
"{",
"ringIndex",
"=",
"polygon",
".",
"getNumInteriorRing",
"(",
")",
"-",
"1",
";",
"}",
"// Create the new array of interior rings:",
"LinearRing",
"[",
"]",
"interiorRings",
"=",
"new",
"LinearRing",
"[",
"polygon",
".",
"getNumInteriorRing",
"(",
")",
"-",
"1",
"]",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"polygon",
".",
"getNumInteriorRing",
"(",
")",
";",
"n",
"++",
")",
"{",
"if",
"(",
"n",
"!=",
"ringIndex",
")",
"{",
"interiorRings",
"[",
"count",
"++",
"]",
"=",
"polygon",
".",
"getInteriorRingN",
"(",
"n",
")",
";",
"}",
"}",
"return",
"geometry",
".",
"getGeometryFactory",
"(",
")",
".",
"createPolygon",
"(",
"polygon",
".",
"getExteriorRing",
"(",
")",
",",
"interiorRings",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Execute the operation! When the geometry is not a Polygon, null is returned. When the polygon does not have any
interior rings, null is returned.
|
[
"Execute",
"the",
"operation!",
"When",
"the",
"geometry",
"is",
"not",
"a",
"Polygon",
"null",
"is",
"returned",
".",
"When",
"the",
"polygon",
"does",
"not",
"have",
"any",
"interior",
"rings",
"null",
"is",
"returned",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/operation/RemoveRingOperation.java#L50-L77
|
147,145
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/LayerTreeBase.java
|
LayerTreeBase.onFolderClick
|
public void onFolderClick(FolderClickEvent event) {
try {
if (isIconTargetClicked()) {
onIconClick(event.getFolder());
} else {
if (event.getFolder() instanceof LayerTreeTreeNode) {
mapModel.selectLayer(((LayerTreeTreeNode) event.getFolder()).getLayer());
} else {
mapModel.selectLayer(null);
}
}
} catch (Exception e) { // NOSONAR
Log.logError(e.getMessage());
// some other unusable element
}
}
|
java
|
public void onFolderClick(FolderClickEvent event) {
try {
if (isIconTargetClicked()) {
onIconClick(event.getFolder());
} else {
if (event.getFolder() instanceof LayerTreeTreeNode) {
mapModel.selectLayer(((LayerTreeTreeNode) event.getFolder()).getLayer());
} else {
mapModel.selectLayer(null);
}
}
} catch (Exception e) { // NOSONAR
Log.logError(e.getMessage());
// some other unusable element
}
}
|
[
"public",
"void",
"onFolderClick",
"(",
"FolderClickEvent",
"event",
")",
"{",
"try",
"{",
"if",
"(",
"isIconTargetClicked",
"(",
")",
")",
"{",
"onIconClick",
"(",
"event",
".",
"getFolder",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"event",
".",
"getFolder",
"(",
")",
"instanceof",
"LayerTreeTreeNode",
")",
"{",
"mapModel",
".",
"selectLayer",
"(",
"(",
"(",
"LayerTreeTreeNode",
")",
"event",
".",
"getFolder",
"(",
")",
")",
".",
"getLayer",
"(",
")",
")",
";",
"}",
"else",
"{",
"mapModel",
".",
"selectLayer",
"(",
"null",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// NOSONAR",
"Log",
".",
"logError",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"// some other unusable element",
"}",
"}"
] |
When the user clicks on a folder nothing gets selected.
@param event
event
|
[
"When",
"the",
"user",
"clicks",
"on",
"a",
"folder",
"nothing",
"gets",
"selected",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/LayerTreeBase.java#L173-L189
|
147,146
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/LayerTreeBase.java
|
LayerTreeBase.onLeafClick
|
public void onLeafClick(LeafClickEvent event) {
try {
if (isIconTargetClicked()) {
onIconClick(event.getLeaf());
} else {
LayerTreeTreeNode layerTreeNode = (LayerTreeTreeNode) event.getLeaf();
mapModel.selectLayer(layerTreeNode.getLayer());
}
} catch (Exception e) { // NOSONAR
Log.logError(e.getMessage());
// some other unusable element
}
}
|
java
|
public void onLeafClick(LeafClickEvent event) {
try {
if (isIconTargetClicked()) {
onIconClick(event.getLeaf());
} else {
LayerTreeTreeNode layerTreeNode = (LayerTreeTreeNode) event.getLeaf();
mapModel.selectLayer(layerTreeNode.getLayer());
}
} catch (Exception e) { // NOSONAR
Log.logError(e.getMessage());
// some other unusable element
}
}
|
[
"public",
"void",
"onLeafClick",
"(",
"LeafClickEvent",
"event",
")",
"{",
"try",
"{",
"if",
"(",
"isIconTargetClicked",
"(",
")",
")",
"{",
"onIconClick",
"(",
"event",
".",
"getLeaf",
"(",
")",
")",
";",
"}",
"else",
"{",
"LayerTreeTreeNode",
"layerTreeNode",
"=",
"(",
"LayerTreeTreeNode",
")",
"event",
".",
"getLeaf",
"(",
")",
";",
"mapModel",
".",
"selectLayer",
"(",
"layerTreeNode",
".",
"getLayer",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// NOSONAR",
"Log",
".",
"logError",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"// some other unusable element",
"}",
"}"
] |
When the user clicks on a leaf the headertext of the treetable is changed to the selected leaf and the toolbar
buttons are updated to represent the correct state of the buttons.
@param event
event
|
[
"When",
"the",
"user",
"clicks",
"on",
"a",
"leaf",
"the",
"headertext",
"of",
"the",
"treetable",
"is",
"changed",
"to",
"the",
"selected",
"leaf",
"and",
"the",
"toolbar",
"buttons",
"are",
"updated",
"to",
"represent",
"the",
"correct",
"state",
"of",
"the",
"buttons",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/LayerTreeBase.java#L198-L210
|
147,147
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/LayerTreeBase.java
|
LayerTreeBase.isIconTargetClicked
|
private boolean isIconTargetClicked() {
String targetHtml = EventHandler.getNativeMouseTarget().getString();
if (targetHtml.indexOf(ICON_EXTENSION) != -1) {
return true;
}
return false;
}
|
java
|
private boolean isIconTargetClicked() {
String targetHtml = EventHandler.getNativeMouseTarget().getString();
if (targetHtml.indexOf(ICON_EXTENSION) != -1) {
return true;
}
return false;
}
|
[
"private",
"boolean",
"isIconTargetClicked",
"(",
")",
"{",
"String",
"targetHtml",
"=",
"EventHandler",
".",
"getNativeMouseTarget",
"(",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"targetHtml",
".",
"indexOf",
"(",
"ICON_EXTENSION",
")",
"!=",
"-",
"1",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Method that checks if the target html tag of mouse event contains given icon extension.
Should be backwards compatible with smartgwt 3.1 where the source html tag is IMG.
!Will probably not work on touch devices.
@return if treenode icon is clicked.
|
[
"Method",
"that",
"checks",
"if",
"the",
"target",
"html",
"tag",
"of",
"mouse",
"event",
"contains",
"given",
"icon",
"extension",
".",
"Should",
"be",
"backwards",
"compatible",
"with",
"smartgwt",
"3",
".",
"1",
"where",
"the",
"source",
"html",
"tag",
"is",
"IMG",
".",
"!Will",
"probably",
"not",
"work",
"on",
"touch",
"devices",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/LayerTreeBase.java#L244-L252
|
147,148
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/LayerTreeBase.java
|
LayerTreeBase.buildTree
|
protected void buildTree() {
treeGrid.setWidth100();
treeGrid.setHeight100();
treeGrid.setShowHeader(false);
treeGrid.setOverflow(Overflow.AUTO);
tree = new RefreshableTree();
final TreeNode nodeRoot = new TreeNode("ROOT");
tree.setRoot(nodeRoot); // invisible ROOT node (ROOT node is required)
ClientLayerTreeInfo layerTreeInfo = (ClientLayerTreeInfo) mapModel.getMapInfo().getWidgetInfo(
ClientLayerTreeInfo.IDENTIFIER);
tree.setRoot(nodeRoot); // invisible ROOT node (ROOT node is required)
if (layerTreeInfo != null) {
for (ClientAbstractNodeInfo node : layerTreeInfo.getTreeNode().getTreeNodes()) {
processNode(node, nodeRoot, false);
}
}
treeGrid.setData(tree);
treeGrid.addLeafClickHandler(this);
treeGrid.addFolderClickHandler(this);
treeGrid.addFolderClickHandler(new FolderClickHandler() {
@Override
public void onFolderClick(FolderClickEvent folderClickEvent) {
folderClickEvent.getSource();
}
});
treeGrid.addFolderOpenedHandler(new FolderOpenedHandler() {
@Override
public void onFolderOpened(FolderOpenedEvent folderOpenedEvent) {
folderOpenedEvent.getSource();
}
});
tree.openFolder(nodeRoot);
syncNodeState(false);
}
|
java
|
protected void buildTree() {
treeGrid.setWidth100();
treeGrid.setHeight100();
treeGrid.setShowHeader(false);
treeGrid.setOverflow(Overflow.AUTO);
tree = new RefreshableTree();
final TreeNode nodeRoot = new TreeNode("ROOT");
tree.setRoot(nodeRoot); // invisible ROOT node (ROOT node is required)
ClientLayerTreeInfo layerTreeInfo = (ClientLayerTreeInfo) mapModel.getMapInfo().getWidgetInfo(
ClientLayerTreeInfo.IDENTIFIER);
tree.setRoot(nodeRoot); // invisible ROOT node (ROOT node is required)
if (layerTreeInfo != null) {
for (ClientAbstractNodeInfo node : layerTreeInfo.getTreeNode().getTreeNodes()) {
processNode(node, nodeRoot, false);
}
}
treeGrid.setData(tree);
treeGrid.addLeafClickHandler(this);
treeGrid.addFolderClickHandler(this);
treeGrid.addFolderClickHandler(new FolderClickHandler() {
@Override
public void onFolderClick(FolderClickEvent folderClickEvent) {
folderClickEvent.getSource();
}
});
treeGrid.addFolderOpenedHandler(new FolderOpenedHandler() {
@Override
public void onFolderOpened(FolderOpenedEvent folderOpenedEvent) {
folderOpenedEvent.getSource();
}
});
tree.openFolder(nodeRoot);
syncNodeState(false);
}
|
[
"protected",
"void",
"buildTree",
"(",
")",
"{",
"treeGrid",
".",
"setWidth100",
"(",
")",
";",
"treeGrid",
".",
"setHeight100",
"(",
")",
";",
"treeGrid",
".",
"setShowHeader",
"(",
"false",
")",
";",
"treeGrid",
".",
"setOverflow",
"(",
"Overflow",
".",
"AUTO",
")",
";",
"tree",
"=",
"new",
"RefreshableTree",
"(",
")",
";",
"final",
"TreeNode",
"nodeRoot",
"=",
"new",
"TreeNode",
"(",
"\"ROOT\"",
")",
";",
"tree",
".",
"setRoot",
"(",
"nodeRoot",
")",
";",
"// invisible ROOT node (ROOT node is required)",
"ClientLayerTreeInfo",
"layerTreeInfo",
"=",
"(",
"ClientLayerTreeInfo",
")",
"mapModel",
".",
"getMapInfo",
"(",
")",
".",
"getWidgetInfo",
"(",
"ClientLayerTreeInfo",
".",
"IDENTIFIER",
")",
";",
"tree",
".",
"setRoot",
"(",
"nodeRoot",
")",
";",
"// invisible ROOT node (ROOT node is required)",
"if",
"(",
"layerTreeInfo",
"!=",
"null",
")",
"{",
"for",
"(",
"ClientAbstractNodeInfo",
"node",
":",
"layerTreeInfo",
".",
"getTreeNode",
"(",
")",
".",
"getTreeNodes",
"(",
")",
")",
"{",
"processNode",
"(",
"node",
",",
"nodeRoot",
",",
"false",
")",
";",
"}",
"}",
"treeGrid",
".",
"setData",
"(",
"tree",
")",
";",
"treeGrid",
".",
"addLeafClickHandler",
"(",
"this",
")",
";",
"treeGrid",
".",
"addFolderClickHandler",
"(",
"this",
")",
";",
"treeGrid",
".",
"addFolderClickHandler",
"(",
"new",
"FolderClickHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onFolderClick",
"(",
"FolderClickEvent",
"folderClickEvent",
")",
"{",
"folderClickEvent",
".",
"getSource",
"(",
")",
";",
"}",
"}",
")",
";",
"treeGrid",
".",
"addFolderOpenedHandler",
"(",
"new",
"FolderOpenedHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onFolderOpened",
"(",
"FolderOpenedEvent",
"folderOpenedEvent",
")",
"{",
"folderOpenedEvent",
".",
"getSource",
"(",
")",
";",
"}",
"}",
")",
";",
"tree",
".",
"openFolder",
"(",
"nodeRoot",
")",
";",
"syncNodeState",
"(",
"false",
")",
";",
"}"
] |
Builds up the tree showing the layers.
|
[
"Builds",
"up",
"the",
"tree",
"showing",
"the",
"layers",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/LayerTreeBase.java#L270-L309
|
147,149
|
TakahikoKawasaki/nv-cipher
|
src/main/java/com/neovisionaries/security/CodecCipher.java
|
CodecCipher.getAlgorithm
|
public String getAlgorithm()
{
if (cipher == null)
{
return null;
}
String transformation = cipher.getAlgorithm();
if (transformation == null)
{
return null;
}
// Separator position.
int pos = transformation.indexOf('/');
if (pos < 0)
{
return transformation;
}
return transformation.substring(0, pos);
}
|
java
|
public String getAlgorithm()
{
if (cipher == null)
{
return null;
}
String transformation = cipher.getAlgorithm();
if (transformation == null)
{
return null;
}
// Separator position.
int pos = transformation.indexOf('/');
if (pos < 0)
{
return transformation;
}
return transformation.substring(0, pos);
}
|
[
"public",
"String",
"getAlgorithm",
"(",
")",
"{",
"if",
"(",
"cipher",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"transformation",
"=",
"cipher",
".",
"getAlgorithm",
"(",
")",
";",
"if",
"(",
"transformation",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Separator position.\r",
"int",
"pos",
"=",
"transformation",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"return",
"transformation",
";",
"}",
"return",
"transformation",
".",
"substring",
"(",
"0",
",",
"pos",
")",
";",
"}"
] |
Get the cipher algorithm name.
<p>
If the internal cipher is {@code null}, {@code null} is returned.
Otherwise, the algorithm part of the cipher's transformation is
returned.
</p>
@return
The cipher algorithm name.
|
[
"Get",
"the",
"cipher",
"algorithm",
"name",
"."
] |
d01aa4f53611e2724ae03633060f55bacf549175
|
https://github.com/TakahikoKawasaki/nv-cipher/blob/d01aa4f53611e2724ae03633060f55bacf549175/src/main/java/com/neovisionaries/security/CodecCipher.java#L594-L617
|
147,150
|
TakahikoKawasaki/nv-cipher
|
src/main/java/com/neovisionaries/security/CodecCipher.java
|
CodecCipher.setCoder
|
public <TCoder extends BinaryEncoder & BinaryDecoder> CodecCipher setCoder(TCoder coder)
{
this.encoder = coder;
this.decoder = coder;
return this;
}
|
java
|
public <TCoder extends BinaryEncoder & BinaryDecoder> CodecCipher setCoder(TCoder coder)
{
this.encoder = coder;
this.decoder = coder;
return this;
}
|
[
"public",
"<",
"TCoder",
"extends",
"BinaryEncoder",
"&",
"BinaryDecoder",
">",
"CodecCipher",
"setCoder",
"(",
"TCoder",
"coder",
")",
"{",
"this",
".",
"encoder",
"=",
"coder",
";",
"this",
".",
"decoder",
"=",
"coder",
";",
"return",
"this",
";",
"}"
] |
Set a coder.
@param coder
A coder which works as both an encoder and a decoder.
If {@code null} is given, {@link Base64} is used as the
default coder.
@return
{@code this} object.
|
[
"Set",
"a",
"coder",
"."
] |
d01aa4f53611e2724ae03633060f55bacf549175
|
https://github.com/TakahikoKawasaki/nv-cipher/blob/d01aa4f53611e2724ae03633060f55bacf549175/src/main/java/com/neovisionaries/security/CodecCipher.java#L695-L701
|
147,151
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/Wizard.java
|
Wizard.start
|
public void start(DATA wizardData) {
if (!started) {
initHandlers();
}
for (WizardPage<DATA> page : pages) {
page.clear();
page.setWizardData(wizardData);
}
ListIterator<WizardPage<DATA>> iterator = pages.listIterator();
if (iterator.hasNext()) {
setCurrentPage(iterator.next());
}
}
|
java
|
public void start(DATA wizardData) {
if (!started) {
initHandlers();
}
for (WizardPage<DATA> page : pages) {
page.clear();
page.setWizardData(wizardData);
}
ListIterator<WizardPage<DATA>> iterator = pages.listIterator();
if (iterator.hasNext()) {
setCurrentPage(iterator.next());
}
}
|
[
"public",
"void",
"start",
"(",
"DATA",
"wizardData",
")",
"{",
"if",
"(",
"!",
"started",
")",
"{",
"initHandlers",
"(",
")",
";",
"}",
"for",
"(",
"WizardPage",
"<",
"DATA",
">",
"page",
":",
"pages",
")",
"{",
"page",
".",
"clear",
"(",
")",
";",
"page",
".",
"setWizardData",
"(",
"wizardData",
")",
";",
"}",
"ListIterator",
"<",
"WizardPage",
"<",
"DATA",
">",
">",
"iterator",
"=",
"pages",
".",
"listIterator",
"(",
")",
";",
"if",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"setCurrentPage",
"(",
"iterator",
".",
"next",
"(",
")",
")",
";",
"}",
"}"
] |
Starts or restarts this wizard by clearing all pages and presenting the first page to the user. This method
should only be called after all pages have been added. After this method has been called, no more pages can be
added.
@param wizardData initial data
|
[
"Starts",
"or",
"restarts",
"this",
"wizard",
"by",
"clearing",
"all",
"pages",
"and",
"presenting",
"the",
"first",
"page",
"to",
"the",
"user",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"after",
"all",
"pages",
"have",
"been",
"added",
".",
"After",
"this",
"method",
"has",
"been",
"called",
"no",
"more",
"pages",
"can",
"be",
"added",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/Wizard.java#L110-L122
|
147,152
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/Wizard.java
|
Wizard.setCurrentPage
|
protected void setCurrentPage(WizardPage<DATA> newPage) {
currentPage = newPage;
updateState();
wizardView.setCurrentPage(currentPage);
currentPage.show();
}
|
java
|
protected void setCurrentPage(WizardPage<DATA> newPage) {
currentPage = newPage;
updateState();
wizardView.setCurrentPage(currentPage);
currentPage.show();
}
|
[
"protected",
"void",
"setCurrentPage",
"(",
"WizardPage",
"<",
"DATA",
">",
"newPage",
")",
"{",
"currentPage",
"=",
"newPage",
";",
"updateState",
"(",
")",
";",
"wizardView",
".",
"setCurrentPage",
"(",
"currentPage",
")",
";",
"currentPage",
".",
"show",
"(",
")",
";",
"}"
] |
Sets the current page of this wizard. As this method forces the current page, it should only be used after
checking validity of the previous pages.
@param newPage
the page to be set
|
[
"Sets",
"the",
"current",
"page",
"of",
"this",
"wizard",
".",
"As",
"this",
"method",
"forces",
"the",
"current",
"page",
"it",
"should",
"only",
"be",
"used",
"after",
"checking",
"validity",
"of",
"the",
"previous",
"pages",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/Wizard.java#L140-L145
|
147,153
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/Wizard.java
|
Wizard.addPage
|
public void addPage(WizardPage<DATA> page) {
if (!started) {
WizardPage<DATA> lastPage = pages.size() > 0 ? pages.get(pages.size() - 1) : null;
if (lastPage != null) {
lastPage.setNextPage(page);
page.setPreviousPage(lastPage);
}
pages.add(page);
wizardView.addPageToView(page);
}
}
|
java
|
public void addPage(WizardPage<DATA> page) {
if (!started) {
WizardPage<DATA> lastPage = pages.size() > 0 ? pages.get(pages.size() - 1) : null;
if (lastPage != null) {
lastPage.setNextPage(page);
page.setPreviousPage(lastPage);
}
pages.add(page);
wizardView.addPageToView(page);
}
}
|
[
"public",
"void",
"addPage",
"(",
"WizardPage",
"<",
"DATA",
">",
"page",
")",
"{",
"if",
"(",
"!",
"started",
")",
"{",
"WizardPage",
"<",
"DATA",
">",
"lastPage",
"=",
"pages",
".",
"size",
"(",
")",
">",
"0",
"?",
"pages",
".",
"get",
"(",
"pages",
".",
"size",
"(",
")",
"-",
"1",
")",
":",
"null",
";",
"if",
"(",
"lastPage",
"!=",
"null",
")",
"{",
"lastPage",
".",
"setNextPage",
"(",
"page",
")",
";",
"page",
".",
"setPreviousPage",
"(",
"lastPage",
")",
";",
"}",
"pages",
".",
"add",
"(",
"page",
")",
";",
"wizardView",
".",
"addPageToView",
"(",
"page",
")",
";",
"}",
"}"
] |
Adds a page to this wizard. The page order is determined by the order in which pages are added.
@param page
the page to be added
|
[
"Adds",
"a",
"page",
"to",
"this",
"wizard",
".",
"The",
"page",
"order",
"is",
"determined",
"by",
"the",
"order",
"in",
"which",
"pages",
"are",
"added",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/Wizard.java#L153-L163
|
147,154
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/action/menu/UndoOperationAction.java
|
UndoOperationAction.execute
|
public boolean execute(Canvas target, Menu menu, MenuItem item) {
FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
if (featureTransaction != null) {
boolean operationCount = featureTransaction.getOperationQueue().size() > 0;
if (operationCount) {
// The first addCoordinateOp may not be undone!
FeatureOperation firstOperation = featureTransaction.getOperationQueue().get(0);
if (firstOperation instanceof AddCoordinateOp) {
if (featureTransaction.getNewFeatures()[0].getGeometry().getNumPoints() == 1) {
return false;
}
}
return true;
}
}
return false;
}
|
java
|
public boolean execute(Canvas target, Menu menu, MenuItem item) {
FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
if (featureTransaction != null) {
boolean operationCount = featureTransaction.getOperationQueue().size() > 0;
if (operationCount) {
// The first addCoordinateOp may not be undone!
FeatureOperation firstOperation = featureTransaction.getOperationQueue().get(0);
if (firstOperation instanceof AddCoordinateOp) {
if (featureTransaction.getNewFeatures()[0].getGeometry().getNumPoints() == 1) {
return false;
}
}
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"execute",
"(",
"Canvas",
"target",
",",
"Menu",
"menu",
",",
"MenuItem",
"item",
")",
"{",
"FeatureTransaction",
"featureTransaction",
"=",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getFeatureEditor",
"(",
")",
".",
"getFeatureTransaction",
"(",
")",
";",
"if",
"(",
"featureTransaction",
"!=",
"null",
")",
"{",
"boolean",
"operationCount",
"=",
"featureTransaction",
".",
"getOperationQueue",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
";",
"if",
"(",
"operationCount",
")",
"{",
"// The first addCoordinateOp may not be undone!",
"FeatureOperation",
"firstOperation",
"=",
"featureTransaction",
".",
"getOperationQueue",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"firstOperation",
"instanceof",
"AddCoordinateOp",
")",
"{",
"if",
"(",
"featureTransaction",
".",
"getNewFeatures",
"(",
")",
"[",
"0",
"]",
".",
"getGeometry",
"(",
")",
".",
"getNumPoints",
"(",
")",
"==",
"1",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
This function tries to find out whether or not this menu item should be enabled. Only if there are more then 1
operations in the feature transaction operation queue, will this menu item be enabled.
|
[
"This",
"function",
"tries",
"to",
"find",
"out",
"whether",
"or",
"not",
"this",
"menu",
"item",
"should",
"be",
"enabled",
".",
"Only",
"if",
"there",
"are",
"more",
"then",
"1",
"operations",
"in",
"the",
"feature",
"transaction",
"operation",
"queue",
"will",
"this",
"menu",
"item",
"be",
"enabled",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/UndoOperationAction.java#L75-L92
|
147,155
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeyResource.java
|
KeyResource.getKey
|
@GET
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.KEY_READ)
public KeyRepresentation getKey() {
KeyRepresentation keyRepresentation = keyFinder.findKeyWithName(keyName);
if (keyRepresentation == null) {
throw new NotFoundException(String.format(KEY_NOT_FOUND, keyName));
}
return keyRepresentation;
}
|
java
|
@GET
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.KEY_READ)
public KeyRepresentation getKey() {
KeyRepresentation keyRepresentation = keyFinder.findKeyWithName(keyName);
if (keyRepresentation == null) {
throw new NotFoundException(String.format(KEY_NOT_FOUND, keyName));
}
return keyRepresentation;
}
|
[
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"KEY_READ",
")",
"public",
"KeyRepresentation",
"getKey",
"(",
")",
"{",
"KeyRepresentation",
"keyRepresentation",
"=",
"keyFinder",
".",
"findKeyWithName",
"(",
"keyName",
")",
";",
"if",
"(",
"keyRepresentation",
"==",
"null",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"String",
".",
"format",
"(",
"KEY_NOT_FOUND",
",",
"keyName",
")",
")",
";",
"}",
"return",
"keyRepresentation",
";",
"}"
] |
Returns a key with the default translation.
@return translated key
|
[
"Returns",
"a",
"key",
"with",
"the",
"default",
"translation",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeyResource.java#L66-L75
|
147,156
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeyResource.java
|
KeyResource.updateKey
|
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.KEY_WRITE)
public Response updateKey(KeyRepresentation representation) throws URISyntaxException {
WebAssertions.assertNotNull(representation, THE_KEY_SHOULD_NOT_BE_NULL);
WebAssertions.assertNotBlank(representation.getDefaultLocale(), THE_KEY_SHOULD_CONTAINS_A_LOCALE);
Key key = loadKeyIfExistsOrFail();
key.setComment(representation.getComment());
key.setOutdated();
// Updates the default translation
key.addTranslation(representation.getDefaultLocale(),
representation.getTranslation(),
representation.isApprox());
keyRepository.update(key);
return Response.ok(new URI(uriInfo.getRequestUri() + "/" + keyName))
.entity(keyFinder.findKeyWithName(keyName)).build();
}
|
java
|
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.KEY_WRITE)
public Response updateKey(KeyRepresentation representation) throws URISyntaxException {
WebAssertions.assertNotNull(representation, THE_KEY_SHOULD_NOT_BE_NULL);
WebAssertions.assertNotBlank(representation.getDefaultLocale(), THE_KEY_SHOULD_CONTAINS_A_LOCALE);
Key key = loadKeyIfExistsOrFail();
key.setComment(representation.getComment());
key.setOutdated();
// Updates the default translation
key.addTranslation(representation.getDefaultLocale(),
representation.getTranslation(),
representation.isApprox());
keyRepository.update(key);
return Response.ok(new URI(uriInfo.getRequestUri() + "/" + keyName))
.entity(keyFinder.findKeyWithName(keyName)).build();
}
|
[
"@",
"PUT",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"KEY_WRITE",
")",
"public",
"Response",
"updateKey",
"(",
"KeyRepresentation",
"representation",
")",
"throws",
"URISyntaxException",
"{",
"WebAssertions",
".",
"assertNotNull",
"(",
"representation",
",",
"THE_KEY_SHOULD_NOT_BE_NULL",
")",
";",
"WebAssertions",
".",
"assertNotBlank",
"(",
"representation",
".",
"getDefaultLocale",
"(",
")",
",",
"THE_KEY_SHOULD_CONTAINS_A_LOCALE",
")",
";",
"Key",
"key",
"=",
"loadKeyIfExistsOrFail",
"(",
")",
";",
"key",
".",
"setComment",
"(",
"representation",
".",
"getComment",
"(",
")",
")",
";",
"key",
".",
"setOutdated",
"(",
")",
";",
"// Updates the default translation",
"key",
".",
"addTranslation",
"(",
"representation",
".",
"getDefaultLocale",
"(",
")",
",",
"representation",
".",
"getTranslation",
"(",
")",
",",
"representation",
".",
"isApprox",
"(",
")",
")",
";",
"keyRepository",
".",
"update",
"(",
"key",
")",
";",
"return",
"Response",
".",
"ok",
"(",
"new",
"URI",
"(",
"uriInfo",
".",
"getRequestUri",
"(",
")",
"+",
"\"/\"",
"+",
"keyName",
")",
")",
".",
"entity",
"(",
"keyFinder",
".",
"findKeyWithName",
"(",
"keyName",
")",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Updates a key with the translation in the default language.
@param representation key representation
@return key representation
@throws URISyntaxException if the URI is not valid.
|
[
"Updates",
"a",
"key",
"with",
"the",
"translation",
"in",
"the",
"default",
"language",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeyResource.java#L84-L104
|
147,157
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.getGroup
|
public PaintableGroup getGroup(RenderGroup group) {
switch (group) {
case RASTER:
return rasterGroup;
case VECTOR:
return vectorGroup;
case WORLD:
return worldGroup;
case SCREEN:
default:
return screenGroup;
}
}
|
java
|
public PaintableGroup getGroup(RenderGroup group) {
switch (group) {
case RASTER:
return rasterGroup;
case VECTOR:
return vectorGroup;
case WORLD:
return worldGroup;
case SCREEN:
default:
return screenGroup;
}
}
|
[
"public",
"PaintableGroup",
"getGroup",
"(",
"RenderGroup",
"group",
")",
"{",
"switch",
"(",
"group",
")",
"{",
"case",
"RASTER",
":",
"return",
"rasterGroup",
";",
"case",
"VECTOR",
":",
"return",
"vectorGroup",
";",
"case",
"WORLD",
":",
"return",
"worldGroup",
";",
"case",
"SCREEN",
":",
"default",
":",
"return",
"screenGroup",
";",
"}",
"}"
] |
Return the Object that represents one the default RenderGroups in the DOM tree when drawing.
@param group
The general group definition (RenderGroup.SCREEN, RenderGroup.WORLD, ...)
@return paintable group
|
[
"Return",
"the",
"Object",
"that",
"represents",
"one",
"the",
"default",
"RenderGroups",
"in",
"the",
"DOM",
"tree",
"when",
"drawing",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L376-L388
|
147,158
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.renderAll
|
@Api
@Deprecated
public void renderAll(boolean force) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
if (graphics.isReady()) {
render(mapModel, null, RenderStatus.ALL);
}
}
});
}
|
java
|
@Api
@Deprecated
public void renderAll(boolean force) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
if (graphics.isReady()) {
render(mapModel, null, RenderStatus.ALL);
}
}
});
}
|
[
"@",
"Api",
"@",
"Deprecated",
"public",
"void",
"renderAll",
"(",
"boolean",
"force",
")",
"{",
"Scheduler",
".",
"get",
"(",
")",
".",
"scheduleDeferred",
"(",
"new",
"ScheduledCommand",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
")",
"{",
"if",
"(",
"graphics",
".",
"isReady",
"(",
")",
")",
"{",
"render",
"(",
"mapModel",
",",
"null",
",",
"RenderStatus",
".",
"ALL",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] |
Render the map completely.
@param force force rendering now
@since 1.10.0
@deprecated instead of calling this method directly, rendering should be triggered by events.
|
[
"Render",
"the",
"map",
"completely",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L397-L408
|
147,159
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.render
|
@Api
public void render(Paintable paintable, RenderGroup renderGroup, RenderStatus status) {
if (!graphics.isReady() || !mapViewRenderer.isViewPortKnown() || !mapModelRenderer.isReadyToDraw()) {
return;
}
PaintableGroup group = null;
if (renderGroup != null) {
group = getGroup(renderGroup);
}
if (paintable == null) {
paintable = this.mapModel;
}
if (RenderStatus.DELETE.equals(status)) {
List<Painter> painters = painterVisitor.getPaintersForObject(paintable);
if (painters != null) {
for (Painter painter : painters) {
painter.deleteShape(paintable, group, graphics);
}
}
} else {
if (RenderStatus.ALL.equals(status)) {
paintable.accept(painterVisitor, group, mapModel.getMapView().getBounds(), true);
if (paintable == this.mapModel) {
// Paint the world space paintable objects:
for (WorldPaintable worldPaintable : worldPaintables.values()) {
worldPaintable.transform(mapModel.getMapView().getWorldViewTransformer());
worldPaintable.accept(painterVisitor, getGroup(RenderGroup.WORLD), mapModel.getMapView()
.getBounds(), true);
}
}
} else if (RenderStatus.UPDATE.equals(status)) {
if (paintable == this.mapModel) {
// Paint the world space paintable objects:
for (WorldPaintable worldPaintable : worldPaintables.values()) {
worldPaintable.transform(mapModel.getMapView().getWorldViewTransformer());
worldPaintable.accept(painterVisitor, getGroup(RenderGroup.WORLD), mapModel.getMapView()
.getBounds(), false);
}
}
paintable.accept(painterVisitor, group, mapModel.getMapView().getBounds(), false);
}
}
}
|
java
|
@Api
public void render(Paintable paintable, RenderGroup renderGroup, RenderStatus status) {
if (!graphics.isReady() || !mapViewRenderer.isViewPortKnown() || !mapModelRenderer.isReadyToDraw()) {
return;
}
PaintableGroup group = null;
if (renderGroup != null) {
group = getGroup(renderGroup);
}
if (paintable == null) {
paintable = this.mapModel;
}
if (RenderStatus.DELETE.equals(status)) {
List<Painter> painters = painterVisitor.getPaintersForObject(paintable);
if (painters != null) {
for (Painter painter : painters) {
painter.deleteShape(paintable, group, graphics);
}
}
} else {
if (RenderStatus.ALL.equals(status)) {
paintable.accept(painterVisitor, group, mapModel.getMapView().getBounds(), true);
if (paintable == this.mapModel) {
// Paint the world space paintable objects:
for (WorldPaintable worldPaintable : worldPaintables.values()) {
worldPaintable.transform(mapModel.getMapView().getWorldViewTransformer());
worldPaintable.accept(painterVisitor, getGroup(RenderGroup.WORLD), mapModel.getMapView()
.getBounds(), true);
}
}
} else if (RenderStatus.UPDATE.equals(status)) {
if (paintable == this.mapModel) {
// Paint the world space paintable objects:
for (WorldPaintable worldPaintable : worldPaintables.values()) {
worldPaintable.transform(mapModel.getMapView().getWorldViewTransformer());
worldPaintable.accept(painterVisitor, getGroup(RenderGroup.WORLD), mapModel.getMapView()
.getBounds(), false);
}
}
paintable.accept(painterVisitor, group, mapModel.getMapView().getBounds(), false);
}
}
}
|
[
"@",
"Api",
"public",
"void",
"render",
"(",
"Paintable",
"paintable",
",",
"RenderGroup",
"renderGroup",
",",
"RenderStatus",
"status",
")",
"{",
"if",
"(",
"!",
"graphics",
".",
"isReady",
"(",
")",
"||",
"!",
"mapViewRenderer",
".",
"isViewPortKnown",
"(",
")",
"||",
"!",
"mapModelRenderer",
".",
"isReadyToDraw",
"(",
")",
")",
"{",
"return",
";",
"}",
"PaintableGroup",
"group",
"=",
"null",
";",
"if",
"(",
"renderGroup",
"!=",
"null",
")",
"{",
"group",
"=",
"getGroup",
"(",
"renderGroup",
")",
";",
"}",
"if",
"(",
"paintable",
"==",
"null",
")",
"{",
"paintable",
"=",
"this",
".",
"mapModel",
";",
"}",
"if",
"(",
"RenderStatus",
".",
"DELETE",
".",
"equals",
"(",
"status",
")",
")",
"{",
"List",
"<",
"Painter",
">",
"painters",
"=",
"painterVisitor",
".",
"getPaintersForObject",
"(",
"paintable",
")",
";",
"if",
"(",
"painters",
"!=",
"null",
")",
"{",
"for",
"(",
"Painter",
"painter",
":",
"painters",
")",
"{",
"painter",
".",
"deleteShape",
"(",
"paintable",
",",
"group",
",",
"graphics",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"RenderStatus",
".",
"ALL",
".",
"equals",
"(",
"status",
")",
")",
"{",
"paintable",
".",
"accept",
"(",
"painterVisitor",
",",
"group",
",",
"mapModel",
".",
"getMapView",
"(",
")",
".",
"getBounds",
"(",
")",
",",
"true",
")",
";",
"if",
"(",
"paintable",
"==",
"this",
".",
"mapModel",
")",
"{",
"// Paint the world space paintable objects:",
"for",
"(",
"WorldPaintable",
"worldPaintable",
":",
"worldPaintables",
".",
"values",
"(",
")",
")",
"{",
"worldPaintable",
".",
"transform",
"(",
"mapModel",
".",
"getMapView",
"(",
")",
".",
"getWorldViewTransformer",
"(",
")",
")",
";",
"worldPaintable",
".",
"accept",
"(",
"painterVisitor",
",",
"getGroup",
"(",
"RenderGroup",
".",
"WORLD",
")",
",",
"mapModel",
".",
"getMapView",
"(",
")",
".",
"getBounds",
"(",
")",
",",
"true",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"RenderStatus",
".",
"UPDATE",
".",
"equals",
"(",
"status",
")",
")",
"{",
"if",
"(",
"paintable",
"==",
"this",
".",
"mapModel",
")",
"{",
"// Paint the world space paintable objects:",
"for",
"(",
"WorldPaintable",
"worldPaintable",
":",
"worldPaintables",
".",
"values",
"(",
")",
")",
"{",
"worldPaintable",
".",
"transform",
"(",
"mapModel",
".",
"getMapView",
"(",
")",
".",
"getWorldViewTransformer",
"(",
")",
")",
";",
"worldPaintable",
".",
"accept",
"(",
"painterVisitor",
",",
"getGroup",
"(",
"RenderGroup",
".",
"WORLD",
")",
",",
"mapModel",
".",
"getMapView",
"(",
")",
".",
"getBounds",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"paintable",
".",
"accept",
"(",
"painterVisitor",
",",
"group",
",",
"mapModel",
".",
"getMapView",
"(",
")",
".",
"getBounds",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
"}"
] |
The main rendering method. Renders some paintable object in the given group, using the given status.
@param paintable
The actual object to be rendered. Should always contain location and styling information.
@param renderGroup
In what group to render the paintable object?
@param status
how to render
@since 1.6.0
|
[
"The",
"main",
"rendering",
"method",
".",
"Renders",
"some",
"paintable",
"object",
"in",
"the",
"given",
"group",
"using",
"the",
"given",
"status",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L421-L463
|
147,160
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.setDefaultCursorString
|
@Api
public void setDefaultCursorString(String cursor) {
try {
defaultCursor = cursor.toUpperCase();
Cursor.valueOf(cursor.toUpperCase());
} catch (Exception e) { // NOSONAR
// Let us assume the cursor points to an image:
defaultCursor = cursor;
if (!cursor.contains("url")) {
defaultCursor = "url('" + cursor + "'),auto";
}
}
setCursorString(defaultCursor);
}
|
java
|
@Api
public void setDefaultCursorString(String cursor) {
try {
defaultCursor = cursor.toUpperCase();
Cursor.valueOf(cursor.toUpperCase());
} catch (Exception e) { // NOSONAR
// Let us assume the cursor points to an image:
defaultCursor = cursor;
if (!cursor.contains("url")) {
defaultCursor = "url('" + cursor + "'),auto";
}
}
setCursorString(defaultCursor);
}
|
[
"@",
"Api",
"public",
"void",
"setDefaultCursorString",
"(",
"String",
"cursor",
")",
"{",
"try",
"{",
"defaultCursor",
"=",
"cursor",
".",
"toUpperCase",
"(",
")",
";",
"Cursor",
".",
"valueOf",
"(",
"cursor",
".",
"toUpperCase",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// NOSONAR",
"// Let us assume the cursor points to an image:",
"defaultCursor",
"=",
"cursor",
";",
"if",
"(",
"!",
"cursor",
".",
"contains",
"(",
"\"url\"",
")",
")",
"{",
"defaultCursor",
"=",
"\"url('\"",
"+",
"cursor",
"+",
"\"'),auto\"",
";",
"}",
"}",
"setCursorString",
"(",
"defaultCursor",
")",
";",
"}"
] |
Apply a new default cursor on the map. This cursor will be set on deactivation of a controller.
@param cursor The new default cursor to be used when the mouse hovers over the map.
@since 1.12.0
|
[
"Apply",
"a",
"new",
"default",
"cursor",
"on",
"the",
"map",
".",
"This",
"cursor",
"will",
"be",
"set",
"on",
"deactivation",
"of",
"a",
"controller",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L517-L530
|
147,161
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.unregisterMapAddon
|
public void unregisterMapAddon(MapAddon addon) {
if (addon != null && addons.containsKey(addon.getId())) {
addons.remove(addon.getId());
graphics.getVectorContext().deleteGroup(addon);
addon.onRemove();
}
}
|
java
|
public void unregisterMapAddon(MapAddon addon) {
if (addon != null && addons.containsKey(addon.getId())) {
addons.remove(addon.getId());
graphics.getVectorContext().deleteGroup(addon);
addon.onRemove();
}
}
|
[
"public",
"void",
"unregisterMapAddon",
"(",
"MapAddon",
"addon",
")",
"{",
"if",
"(",
"addon",
"!=",
"null",
"&&",
"addons",
".",
"containsKey",
"(",
"addon",
".",
"getId",
"(",
")",
")",
")",
"{",
"addons",
".",
"remove",
"(",
"addon",
".",
"getId",
"(",
")",
")",
";",
"graphics",
".",
"getVectorContext",
"(",
")",
".",
"deleteGroup",
"(",
"addon",
")",
";",
"addon",
".",
"onRemove",
"(",
")",
";",
"}",
"}"
] |
Remove a registered map add-on from the map. Map add-ons are fixed position entities on a map with possibly
additional functionality. Examples are the scale bar, and navigation buttons.
@param addon
The add-on to be removed from the map. If it can't be found, nothing happens.
|
[
"Remove",
"a",
"registered",
"map",
"add",
"-",
"on",
"from",
"the",
"map",
".",
"Map",
"add",
"-",
"ons",
"are",
"fixed",
"position",
"entities",
"on",
"a",
"map",
"with",
"possibly",
"additional",
"functionality",
".",
"Examples",
"are",
"the",
"scale",
"bar",
"and",
"navigation",
"buttons",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L610-L616
|
147,162
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.setZoomOnScrollEnabled
|
public void setZoomOnScrollEnabled(boolean zoomOnScrollEnabled) {
if (mouseWheelRegistration != null) {
mouseWheelRegistration.removeHandler();
mouseWheelRegistration = null;
}
this.zoomOnScrollEnabled = zoomOnScrollEnabled;
if (zoomOnScrollEnabled) {
mouseWheelRegistration = graphics.addMouseWheelHandler(new ZoomOnScrollController());
}
}
|
java
|
public void setZoomOnScrollEnabled(boolean zoomOnScrollEnabled) {
if (mouseWheelRegistration != null) {
mouseWheelRegistration.removeHandler();
mouseWheelRegistration = null;
}
this.zoomOnScrollEnabled = zoomOnScrollEnabled;
if (zoomOnScrollEnabled) {
mouseWheelRegistration = graphics.addMouseWheelHandler(new ZoomOnScrollController());
}
}
|
[
"public",
"void",
"setZoomOnScrollEnabled",
"(",
"boolean",
"zoomOnScrollEnabled",
")",
"{",
"if",
"(",
"mouseWheelRegistration",
"!=",
"null",
")",
"{",
"mouseWheelRegistration",
".",
"removeHandler",
"(",
")",
";",
"mouseWheelRegistration",
"=",
"null",
";",
"}",
"this",
".",
"zoomOnScrollEnabled",
"=",
"zoomOnScrollEnabled",
";",
"if",
"(",
"zoomOnScrollEnabled",
")",
"{",
"mouseWheelRegistration",
"=",
"graphics",
".",
"addMouseWheelHandler",
"(",
"new",
"ZoomOnScrollController",
"(",
")",
")",
";",
"}",
"}"
] |
Determines whether or not the zooming using the mouse wheel should be enabled or not.
@param zoomOnScrollEnabled
True or false. Enable or disable zooming using the mouse wheel.
|
[
"Determines",
"whether",
"or",
"not",
"the",
"zooming",
"using",
"the",
"mouse",
"wheel",
"should",
"be",
"enabled",
"or",
"not",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L701-L710
|
147,163
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.setScalebarEnabled
|
public void setScalebarEnabled(boolean enabled) {
scaleBarEnabled = enabled;
final String scaleBarId = "scalebar";
if (scaleBarEnabled) {
if (!getMapAddons().containsKey(scaleBarId)) {
ScaleBar scalebar = new ScaleBar(scaleBarId, this);
scalebar.setVerticalAlignment(VerticalAlignment.BOTTOM);
scalebar.setHorizontalMargin(2);
scalebar.setVerticalMargin(2);
scalebar.initialize(getMapModel().getMapInfo().getDisplayUnitType(), unitLength, new Coordinate(20,
graphics.getHeight() - 25));
registerMapAddon(scalebar);
}
} else {
unregisterMapAddon(addons.get(scaleBarId));
}
}
|
java
|
public void setScalebarEnabled(boolean enabled) {
scaleBarEnabled = enabled;
final String scaleBarId = "scalebar";
if (scaleBarEnabled) {
if (!getMapAddons().containsKey(scaleBarId)) {
ScaleBar scalebar = new ScaleBar(scaleBarId, this);
scalebar.setVerticalAlignment(VerticalAlignment.BOTTOM);
scalebar.setHorizontalMargin(2);
scalebar.setVerticalMargin(2);
scalebar.initialize(getMapModel().getMapInfo().getDisplayUnitType(), unitLength, new Coordinate(20,
graphics.getHeight() - 25));
registerMapAddon(scalebar);
}
} else {
unregisterMapAddon(addons.get(scaleBarId));
}
}
|
[
"public",
"void",
"setScalebarEnabled",
"(",
"boolean",
"enabled",
")",
"{",
"scaleBarEnabled",
"=",
"enabled",
";",
"final",
"String",
"scaleBarId",
"=",
"\"scalebar\"",
";",
"if",
"(",
"scaleBarEnabled",
")",
"{",
"if",
"(",
"!",
"getMapAddons",
"(",
")",
".",
"containsKey",
"(",
"scaleBarId",
")",
")",
"{",
"ScaleBar",
"scalebar",
"=",
"new",
"ScaleBar",
"(",
"scaleBarId",
",",
"this",
")",
";",
"scalebar",
".",
"setVerticalAlignment",
"(",
"VerticalAlignment",
".",
"BOTTOM",
")",
";",
"scalebar",
".",
"setHorizontalMargin",
"(",
"2",
")",
";",
"scalebar",
".",
"setVerticalMargin",
"(",
"2",
")",
";",
"scalebar",
".",
"initialize",
"(",
"getMapModel",
"(",
")",
".",
"getMapInfo",
"(",
")",
".",
"getDisplayUnitType",
"(",
")",
",",
"unitLength",
",",
"new",
"Coordinate",
"(",
"20",
",",
"graphics",
".",
"getHeight",
"(",
")",
"-",
"25",
")",
")",
";",
"registerMapAddon",
"(",
"scalebar",
")",
";",
"}",
"}",
"else",
"{",
"unregisterMapAddon",
"(",
"addons",
".",
"get",
"(",
"scaleBarId",
")",
")",
";",
"}",
"}"
] |
Enables or disables the scale bar. This setting has immediate effect on the map.
@param enabled
set status
|
[
"Enables",
"or",
"disables",
"the",
"scale",
"bar",
".",
"This",
"setting",
"has",
"immediate",
"effect",
"on",
"the",
"map",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L727-L744
|
147,164
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.setNavigationAddonEnabled
|
public void setNavigationAddonEnabled(boolean enabled) {
navigationAddonEnabled = enabled;
final String panId = "panBTNCollection";
final String zoomId = "zoomAddon";
final String zoomRectId = "zoomRectAddon";
if (enabled) {
if (!getMapAddons().containsKey(panId)) {
PanButtonCollection panButtons = new PanButtonCollection(panId, this);
panButtons.setHorizontalMargin(5);
panButtons.setVerticalMargin(5);
registerMapAddon(panButtons);
}
if (!getMapAddons().containsKey(zoomId)) {
ZoomAddon zoomAddon = new ZoomAddon(zoomId, this);
zoomAddon.setHorizontalMargin(20);
zoomAddon.setVerticalMargin(65);
registerMapAddon(zoomAddon);
}
if (!getMapAddons().containsKey(zoomRectId)) {
ZoomToRectangleAddon zoomToRectangleAddon = new ZoomToRectangleAddon(zoomRectId, this);
zoomToRectangleAddon.setHorizontalMargin(20);
zoomToRectangleAddon.setVerticalMargin(135);
registerMapAddon(zoomToRectangleAddon);
}
} else {
unregisterMapAddon(addons.get(panId));
unregisterMapAddon(addons.get(zoomId));
unregisterMapAddon(addons.get(zoomRectId));
}
}
|
java
|
public void setNavigationAddonEnabled(boolean enabled) {
navigationAddonEnabled = enabled;
final String panId = "panBTNCollection";
final String zoomId = "zoomAddon";
final String zoomRectId = "zoomRectAddon";
if (enabled) {
if (!getMapAddons().containsKey(panId)) {
PanButtonCollection panButtons = new PanButtonCollection(panId, this);
panButtons.setHorizontalMargin(5);
panButtons.setVerticalMargin(5);
registerMapAddon(panButtons);
}
if (!getMapAddons().containsKey(zoomId)) {
ZoomAddon zoomAddon = new ZoomAddon(zoomId, this);
zoomAddon.setHorizontalMargin(20);
zoomAddon.setVerticalMargin(65);
registerMapAddon(zoomAddon);
}
if (!getMapAddons().containsKey(zoomRectId)) {
ZoomToRectangleAddon zoomToRectangleAddon = new ZoomToRectangleAddon(zoomRectId, this);
zoomToRectangleAddon.setHorizontalMargin(20);
zoomToRectangleAddon.setVerticalMargin(135);
registerMapAddon(zoomToRectangleAddon);
}
} else {
unregisterMapAddon(addons.get(panId));
unregisterMapAddon(addons.get(zoomId));
unregisterMapAddon(addons.get(zoomRectId));
}
}
|
[
"public",
"void",
"setNavigationAddonEnabled",
"(",
"boolean",
"enabled",
")",
"{",
"navigationAddonEnabled",
"=",
"enabled",
";",
"final",
"String",
"panId",
"=",
"\"panBTNCollection\"",
";",
"final",
"String",
"zoomId",
"=",
"\"zoomAddon\"",
";",
"final",
"String",
"zoomRectId",
"=",
"\"zoomRectAddon\"",
";",
"if",
"(",
"enabled",
")",
"{",
"if",
"(",
"!",
"getMapAddons",
"(",
")",
".",
"containsKey",
"(",
"panId",
")",
")",
"{",
"PanButtonCollection",
"panButtons",
"=",
"new",
"PanButtonCollection",
"(",
"panId",
",",
"this",
")",
";",
"panButtons",
".",
"setHorizontalMargin",
"(",
"5",
")",
";",
"panButtons",
".",
"setVerticalMargin",
"(",
"5",
")",
";",
"registerMapAddon",
"(",
"panButtons",
")",
";",
"}",
"if",
"(",
"!",
"getMapAddons",
"(",
")",
".",
"containsKey",
"(",
"zoomId",
")",
")",
"{",
"ZoomAddon",
"zoomAddon",
"=",
"new",
"ZoomAddon",
"(",
"zoomId",
",",
"this",
")",
";",
"zoomAddon",
".",
"setHorizontalMargin",
"(",
"20",
")",
";",
"zoomAddon",
".",
"setVerticalMargin",
"(",
"65",
")",
";",
"registerMapAddon",
"(",
"zoomAddon",
")",
";",
"}",
"if",
"(",
"!",
"getMapAddons",
"(",
")",
".",
"containsKey",
"(",
"zoomRectId",
")",
")",
"{",
"ZoomToRectangleAddon",
"zoomToRectangleAddon",
"=",
"new",
"ZoomToRectangleAddon",
"(",
"zoomRectId",
",",
"this",
")",
";",
"zoomToRectangleAddon",
".",
"setHorizontalMargin",
"(",
"20",
")",
";",
"zoomToRectangleAddon",
".",
"setVerticalMargin",
"(",
"135",
")",
";",
"registerMapAddon",
"(",
"zoomToRectangleAddon",
")",
";",
"}",
"}",
"else",
"{",
"unregisterMapAddon",
"(",
"addons",
".",
"get",
"(",
"panId",
")",
")",
";",
"unregisterMapAddon",
"(",
"addons",
".",
"get",
"(",
"zoomId",
")",
")",
";",
"unregisterMapAddon",
"(",
"addons",
".",
"get",
"(",
"zoomRectId",
")",
")",
";",
"}",
"}"
] |
Enables or disables the panning buttons. This setting has immediate effect on the map.
@param enabled
enabled status
|
[
"Enables",
"or",
"disables",
"the",
"panning",
"buttons",
".",
"This",
"setting",
"has",
"immediate",
"effect",
"on",
"the",
"map",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L761-L793
|
147,165
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.setMouseWheelController
|
@Api
public void setMouseWheelController(MouseWheelHandler controller) {
setZoomOnScrollEnabled(false);
mouseWheelRegistration = graphics.addMouseWheelHandler(controller);
}
|
java
|
@Api
public void setMouseWheelController(MouseWheelHandler controller) {
setZoomOnScrollEnabled(false);
mouseWheelRegistration = graphics.addMouseWheelHandler(controller);
}
|
[
"@",
"Api",
"public",
"void",
"setMouseWheelController",
"(",
"MouseWheelHandler",
"controller",
")",
"{",
"setZoomOnScrollEnabled",
"(",
"false",
")",
";",
"mouseWheelRegistration",
"=",
"graphics",
".",
"addMouseWheelHandler",
"(",
"controller",
")",
";",
"}"
] |
Set a new mouse wheel controller on the map. If the zoom on scroll is currently enabled, it will be disabled
first.
@param controller
The new mouse wheel controller to be applied on the map.
@since 1.6.0
|
[
"Set",
"a",
"new",
"mouse",
"wheel",
"controller",
"on",
"the",
"map",
".",
"If",
"the",
"zoom",
"on",
"scroll",
"is",
"currently",
"enabled",
"it",
"will",
"be",
"disabled",
"first",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L860-L864
|
147,166
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.setForceContextMenu
|
private void setForceContextMenu() {
suppressContextMenu(getElement());
addShowContextMenuHandler(new ShowContextMenuHandler() {
@Override
public void onShowContextMenu(ShowContextMenuEvent event) {
getContextMenu().showContextMenu();
}
});
addListener(new Listener() {
@Override
public void onMouseDown(ListenerEvent event) {
if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
fireEvent(new ShowContextMenuEvent(getOrCreateJsObj()));
}
});
}
}
@Override
public void onMouseUp(ListenerEvent event) {
}
@Override
public void onMouseMove(ListenerEvent event) {
}
@Override
public void onMouseOut(ListenerEvent event) {
}
@Override
public void onMouseOver(ListenerEvent event) {
}
@Override
public void onMouseWheel(ListenerEvent event) {
}
});
}
|
java
|
private void setForceContextMenu() {
suppressContextMenu(getElement());
addShowContextMenuHandler(new ShowContextMenuHandler() {
@Override
public void onShowContextMenu(ShowContextMenuEvent event) {
getContextMenu().showContextMenu();
}
});
addListener(new Listener() {
@Override
public void onMouseDown(ListenerEvent event) {
if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
fireEvent(new ShowContextMenuEvent(getOrCreateJsObj()));
}
});
}
}
@Override
public void onMouseUp(ListenerEvent event) {
}
@Override
public void onMouseMove(ListenerEvent event) {
}
@Override
public void onMouseOut(ListenerEvent event) {
}
@Override
public void onMouseOver(ListenerEvent event) {
}
@Override
public void onMouseWheel(ListenerEvent event) {
}
});
}
|
[
"private",
"void",
"setForceContextMenu",
"(",
")",
"{",
"suppressContextMenu",
"(",
"getElement",
"(",
")",
")",
";",
"addShowContextMenuHandler",
"(",
"new",
"ShowContextMenuHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onShowContextMenu",
"(",
"ShowContextMenuEvent",
"event",
")",
"{",
"getContextMenu",
"(",
")",
".",
"showContextMenu",
"(",
")",
";",
"}",
"}",
")",
";",
"addListener",
"(",
"new",
"Listener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onMouseDown",
"(",
"ListenerEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getNativeButton",
"(",
")",
"==",
"NativeEvent",
".",
"BUTTON_RIGHT",
")",
"{",
"Scheduler",
".",
"get",
"(",
")",
".",
"scheduleDeferred",
"(",
"new",
"ScheduledCommand",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"{",
"fireEvent",
"(",
"new",
"ShowContextMenuEvent",
"(",
"getOrCreateJsObj",
"(",
")",
")",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"onMouseUp",
"(",
"ListenerEvent",
"event",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"onMouseMove",
"(",
"ListenerEvent",
"event",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"onMouseOut",
"(",
"ListenerEvent",
"event",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"onMouseOver",
"(",
"ListenerEvent",
"event",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"onMouseWheel",
"(",
"ListenerEvent",
"event",
")",
"{",
"}",
"}",
")",
";",
"}"
] |
IE11 fix to force context !!!
|
[
"IE11",
"fix",
"to",
"force",
"context",
"!!!"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L1165-L1212
|
147,167
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
|
MapWidget.refreshLayer
|
@Api
public void refreshLayer(Layer<?> layer) {
if (layer instanceof VectorLayer) {
VectorLayer vLayer = (VectorLayer) layer;
vLayer.getFeatureStore().clear();
} else if (layer instanceof RasterLayer) {
RasterLayer rLayer = (RasterLayer) layer;
rLayer.getStore().clear();
}
render(layer, null, RenderStatus.ALL);
}
|
java
|
@Api
public void refreshLayer(Layer<?> layer) {
if (layer instanceof VectorLayer) {
VectorLayer vLayer = (VectorLayer) layer;
vLayer.getFeatureStore().clear();
} else if (layer instanceof RasterLayer) {
RasterLayer rLayer = (RasterLayer) layer;
rLayer.getStore().clear();
}
render(layer, null, RenderStatus.ALL);
}
|
[
"@",
"Api",
"public",
"void",
"refreshLayer",
"(",
"Layer",
"<",
"?",
">",
"layer",
")",
"{",
"if",
"(",
"layer",
"instanceof",
"VectorLayer",
")",
"{",
"VectorLayer",
"vLayer",
"=",
"(",
"VectorLayer",
")",
"layer",
";",
"vLayer",
".",
"getFeatureStore",
"(",
")",
".",
"clear",
"(",
")",
";",
"}",
"else",
"if",
"(",
"layer",
"instanceof",
"RasterLayer",
")",
"{",
"RasterLayer",
"rLayer",
"=",
"(",
"RasterLayer",
")",
"layer",
";",
"rLayer",
".",
"getStore",
"(",
")",
".",
"clear",
"(",
")",
";",
"}",
"render",
"(",
"layer",
",",
"null",
",",
"RenderStatus",
".",
"ALL",
")",
";",
"}"
] |
Refresh a layer. This will re-render the layer with freshly fetched data.
@param layer layer
@since 1.11.0
|
[
"Refresh",
"a",
"layer",
".",
"This",
"will",
"re",
"-",
"render",
"the",
"layer",
"with",
"freshly",
"fetched",
"data",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L1487-L1497
|
147,168
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/controller/ZoomSliderController.java
|
ZoomSliderController.validateY
|
private double validateY(double y) {
SliderArea sliderArea = zoomSlider.getSliderArea();
y -= zoomSlider.getVerticalMargin() + sliderArea.getVerticalMargin() + 5;
double startY = 0;
double endY = sliderArea.getHeight() - zoomSlider.getSliderUnit().getBounds().getHeight();
if (y > endY) {
y = endY;
} else if (y < startY) {
y = startY;
}
return y;
}
|
java
|
private double validateY(double y) {
SliderArea sliderArea = zoomSlider.getSliderArea();
y -= zoomSlider.getVerticalMargin() + sliderArea.getVerticalMargin() + 5;
double startY = 0;
double endY = sliderArea.getHeight() - zoomSlider.getSliderUnit().getBounds().getHeight();
if (y > endY) {
y = endY;
} else if (y < startY) {
y = startY;
}
return y;
}
|
[
"private",
"double",
"validateY",
"(",
"double",
"y",
")",
"{",
"SliderArea",
"sliderArea",
"=",
"zoomSlider",
".",
"getSliderArea",
"(",
")",
";",
"y",
"-=",
"zoomSlider",
".",
"getVerticalMargin",
"(",
")",
"+",
"sliderArea",
".",
"getVerticalMargin",
"(",
")",
"+",
"5",
";",
"double",
"startY",
"=",
"0",
";",
"double",
"endY",
"=",
"sliderArea",
".",
"getHeight",
"(",
")",
"-",
"zoomSlider",
".",
"getSliderUnit",
"(",
")",
".",
"getBounds",
"(",
")",
".",
"getHeight",
"(",
")",
";",
"if",
"(",
"y",
">",
"endY",
")",
"{",
"y",
"=",
"endY",
";",
"}",
"else",
"if",
"(",
"y",
"<",
"startY",
")",
"{",
"y",
"=",
"startY",
";",
"}",
"return",
"y",
";",
"}"
] |
Checks if the given y is within the slider area's range.
If not the initial y is corrected to either the top y or bottom y.
@param y initial y
@return validated y
|
[
"Checks",
"if",
"the",
"given",
"y",
"is",
"within",
"the",
"slider",
"area",
"s",
"range",
".",
"If",
"not",
"the",
"initial",
"y",
"is",
"corrected",
"to",
"either",
"the",
"top",
"y",
"or",
"bottom",
"y",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/ZoomSliderController.java#L95-L106
|
147,169
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/factory/FeatureDetailWidgetFactory.java
|
FeatureDetailWidgetFactory.createDefaultFeatureDetailWindow
|
public static Window createDefaultFeatureDetailWindow(Feature feature, Layer<?> layer, boolean editingAllowed) {
if (layer instanceof VectorLayer) {
FeatureAttributeWindow w = new FeatureAttributeWindow(feature, editingAllowed);
customize(w, feature);
return w;
} else {
return new RasterLayerAttributeWindow(feature);
}
}
|
java
|
public static Window createDefaultFeatureDetailWindow(Feature feature, Layer<?> layer, boolean editingAllowed) {
if (layer instanceof VectorLayer) {
FeatureAttributeWindow w = new FeatureAttributeWindow(feature, editingAllowed);
customize(w, feature);
return w;
} else {
return new RasterLayerAttributeWindow(feature);
}
}
|
[
"public",
"static",
"Window",
"createDefaultFeatureDetailWindow",
"(",
"Feature",
"feature",
",",
"Layer",
"<",
"?",
">",
"layer",
",",
"boolean",
"editingAllowed",
")",
"{",
"if",
"(",
"layer",
"instanceof",
"VectorLayer",
")",
"{",
"FeatureAttributeWindow",
"w",
"=",
"new",
"FeatureAttributeWindow",
"(",
"feature",
",",
"editingAllowed",
")",
";",
"customize",
"(",
"w",
",",
"feature",
")",
";",
"return",
"w",
";",
"}",
"else",
"{",
"return",
"new",
"RasterLayerAttributeWindow",
"(",
"feature",
")",
";",
"}",
"}"
] |
Overrule configuration and create Geomajas default FeatureAttributeWindow.
@param feature
@param editingAllowed
@return
|
[
"Overrule",
"configuration",
"and",
"create",
"Geomajas",
"default",
"FeatureAttributeWindow",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/factory/FeatureDetailWidgetFactory.java#L77-L85
|
147,170
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/action/toolbar/ZoomQueue.java
|
ZoomQueue.zoomNext
|
public void zoomNext() {
if (hasNext()) {
MapViewChangedEvent data = next.remove();
previous.addFirst(data);
active = false;
mapView.applyBounds(data.getBounds(), MapView.ZoomOption.LEVEL_CLOSEST);
updateActionsAbility();
}
}
|
java
|
public void zoomNext() {
if (hasNext()) {
MapViewChangedEvent data = next.remove();
previous.addFirst(data);
active = false;
mapView.applyBounds(data.getBounds(), MapView.ZoomOption.LEVEL_CLOSEST);
updateActionsAbility();
}
}
|
[
"public",
"void",
"zoomNext",
"(",
")",
"{",
"if",
"(",
"hasNext",
"(",
")",
")",
"{",
"MapViewChangedEvent",
"data",
"=",
"next",
".",
"remove",
"(",
")",
";",
"previous",
".",
"addFirst",
"(",
"data",
")",
";",
"active",
"=",
"false",
";",
"mapView",
".",
"applyBounds",
"(",
"data",
".",
"getBounds",
"(",
")",
",",
"MapView",
".",
"ZoomOption",
".",
"LEVEL_CLOSEST",
")",
";",
"updateActionsAbility",
"(",
")",
";",
"}",
"}"
] |
Zoom to the next level.
|
[
"Zoom",
"to",
"the",
"next",
"level",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/toolbar/ZoomQueue.java#L101-L109
|
147,171
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/action/toolbar/ZoomQueue.java
|
ZoomQueue.zoomPrevious
|
public void zoomPrevious() {
if (hasPrevious()) {
next.addFirst(previous.remove());
MapViewChangedEvent data = previous.peek();
active = false;
mapView.applyBounds(data.getBounds(), MapView.ZoomOption.LEVEL_CLOSEST);
updateActionsAbility();
}
}
|
java
|
public void zoomPrevious() {
if (hasPrevious()) {
next.addFirst(previous.remove());
MapViewChangedEvent data = previous.peek();
active = false;
mapView.applyBounds(data.getBounds(), MapView.ZoomOption.LEVEL_CLOSEST);
updateActionsAbility();
}
}
|
[
"public",
"void",
"zoomPrevious",
"(",
")",
"{",
"if",
"(",
"hasPrevious",
"(",
")",
")",
"{",
"next",
".",
"addFirst",
"(",
"previous",
".",
"remove",
"(",
")",
")",
";",
"MapViewChangedEvent",
"data",
"=",
"previous",
".",
"peek",
"(",
")",
";",
"active",
"=",
"false",
";",
"mapView",
".",
"applyBounds",
"(",
"data",
".",
"getBounds",
"(",
")",
",",
"MapView",
".",
"ZoomOption",
".",
"LEVEL_CLOSEST",
")",
";",
"updateActionsAbility",
"(",
")",
";",
"}",
"}"
] |
Zoom to the previous level.
|
[
"Zoom",
"to",
"the",
"previous",
"level",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/toolbar/ZoomQueue.java#L114-L122
|
147,172
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeysResource.java
|
KeysResource.getKeys
|
@GET
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.KEY_READ)
public Response getKeys(@QueryParam(PAGE_INDEX) @DefaultValue("0") long pageIndex,
@QueryParam(PAGE_SIZE) @DefaultValue("10") int pageSize,
@QueryParam(IS_MISSING) Boolean isMissing,
@QueryParam(IS_APPROX) Boolean isApprox,
@QueryParam(IS_OUTDATED) Boolean isOutdated,
@QueryParam(SEARCH_NAME) String searchName) {
WebAssertions.assertIf(pageSize > 0, "Page size should be greater than zero.");
KeySearchCriteria keySearchCriteria = new KeySearchCriteria(isMissing, isApprox, isOutdated, searchName);
Page page = new Page(pageIndex, pageSize);
return Response.ok(keyFinder.findKeysWithTheirDefaultTranslation(page, keySearchCriteria)).build();
}
|
java
|
@GET
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.KEY_READ)
public Response getKeys(@QueryParam(PAGE_INDEX) @DefaultValue("0") long pageIndex,
@QueryParam(PAGE_SIZE) @DefaultValue("10") int pageSize,
@QueryParam(IS_MISSING) Boolean isMissing,
@QueryParam(IS_APPROX) Boolean isApprox,
@QueryParam(IS_OUTDATED) Boolean isOutdated,
@QueryParam(SEARCH_NAME) String searchName) {
WebAssertions.assertIf(pageSize > 0, "Page size should be greater than zero.");
KeySearchCriteria keySearchCriteria = new KeySearchCriteria(isMissing, isApprox, isOutdated, searchName);
Page page = new Page(pageIndex, pageSize);
return Response.ok(keyFinder.findKeysWithTheirDefaultTranslation(page, keySearchCriteria)).build();
}
|
[
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"KEY_READ",
")",
"public",
"Response",
"getKeys",
"(",
"@",
"QueryParam",
"(",
"PAGE_INDEX",
")",
"@",
"DefaultValue",
"(",
"\"0\"",
")",
"long",
"pageIndex",
",",
"@",
"QueryParam",
"(",
"PAGE_SIZE",
")",
"@",
"DefaultValue",
"(",
"\"10\"",
")",
"int",
"pageSize",
",",
"@",
"QueryParam",
"(",
"IS_MISSING",
")",
"Boolean",
"isMissing",
",",
"@",
"QueryParam",
"(",
"IS_APPROX",
")",
"Boolean",
"isApprox",
",",
"@",
"QueryParam",
"(",
"IS_OUTDATED",
")",
"Boolean",
"isOutdated",
",",
"@",
"QueryParam",
"(",
"SEARCH_NAME",
")",
"String",
"searchName",
")",
"{",
"WebAssertions",
".",
"assertIf",
"(",
"pageSize",
">",
"0",
",",
"\"Page size should be greater than zero.\"",
")",
";",
"KeySearchCriteria",
"keySearchCriteria",
"=",
"new",
"KeySearchCriteria",
"(",
"isMissing",
",",
"isApprox",
",",
"isOutdated",
",",
"searchName",
")",
";",
"Page",
"page",
"=",
"new",
"Page",
"(",
"pageIndex",
",",
"pageSize",
")",
";",
"return",
"Response",
".",
"ok",
"(",
"keyFinder",
".",
"findKeysWithTheirDefaultTranslation",
"(",
"page",
",",
"keySearchCriteria",
")",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Returns a list of filtered keys without their translations.
@param pageIndex page index
@param pageSize page size
@param isMissing filter on missing default translation
@param isApprox filter on approximate default translation
@param isOutdated filter on outdated key
@param searchName filter on key name
@return 200 - keys without translations
|
[
"Returns",
"a",
"list",
"of",
"filtered",
"keys",
"without",
"their",
"translations",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeysResource.java#L86-L99
|
147,173
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeysResource.java
|
KeysResource.createKey
|
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.KEY_WRITE)
public Response createKey(KeyRepresentation keyRepresentation) throws URISyntaxException {
WebAssertions.assertNotNull(keyRepresentation, THE_KEY_SHOULD_NOT_BE_NULL);
WebAssertions.assertNotBlank(keyRepresentation.getName(), THE_KEY_SHOULD_CONTAINS_A_NAME);
WebAssertions.assertNotBlank(keyRepresentation.getDefaultLocale(), THE_KEY_SHOULD_CONTAINS_A_LOCALE);
assertKeyDoNotAlreadyExists(keyRepresentation);
Key key = factory.createKey(keyRepresentation.getName());
key.setComment(keyRepresentation.getComment());
addDefaultTranslation(keyRepresentation, key);
keyRepository.add(key);
return Response.created(new URI(uriInfo.getRequestUri() + "/" + key.getId()))
.entity(keyFinder.findKeyWithName(key.getId())).build();
}
|
java
|
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.KEY_WRITE)
public Response createKey(KeyRepresentation keyRepresentation) throws URISyntaxException {
WebAssertions.assertNotNull(keyRepresentation, THE_KEY_SHOULD_NOT_BE_NULL);
WebAssertions.assertNotBlank(keyRepresentation.getName(), THE_KEY_SHOULD_CONTAINS_A_NAME);
WebAssertions.assertNotBlank(keyRepresentation.getDefaultLocale(), THE_KEY_SHOULD_CONTAINS_A_LOCALE);
assertKeyDoNotAlreadyExists(keyRepresentation);
Key key = factory.createKey(keyRepresentation.getName());
key.setComment(keyRepresentation.getComment());
addDefaultTranslation(keyRepresentation, key);
keyRepository.add(key);
return Response.created(new URI(uriInfo.getRequestUri() + "/" + key.getId()))
.entity(keyFinder.findKeyWithName(key.getId())).build();
}
|
[
"@",
"POST",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"KEY_WRITE",
")",
"public",
"Response",
"createKey",
"(",
"KeyRepresentation",
"keyRepresentation",
")",
"throws",
"URISyntaxException",
"{",
"WebAssertions",
".",
"assertNotNull",
"(",
"keyRepresentation",
",",
"THE_KEY_SHOULD_NOT_BE_NULL",
")",
";",
"WebAssertions",
".",
"assertNotBlank",
"(",
"keyRepresentation",
".",
"getName",
"(",
")",
",",
"THE_KEY_SHOULD_CONTAINS_A_NAME",
")",
";",
"WebAssertions",
".",
"assertNotBlank",
"(",
"keyRepresentation",
".",
"getDefaultLocale",
"(",
")",
",",
"THE_KEY_SHOULD_CONTAINS_A_LOCALE",
")",
";",
"assertKeyDoNotAlreadyExists",
"(",
"keyRepresentation",
")",
";",
"Key",
"key",
"=",
"factory",
".",
"createKey",
"(",
"keyRepresentation",
".",
"getName",
"(",
")",
")",
";",
"key",
".",
"setComment",
"(",
"keyRepresentation",
".",
"getComment",
"(",
")",
")",
";",
"addDefaultTranslation",
"(",
"keyRepresentation",
",",
"key",
")",
";",
"keyRepository",
".",
"add",
"(",
"key",
")",
";",
"return",
"Response",
".",
"created",
"(",
"new",
"URI",
"(",
"uriInfo",
".",
"getRequestUri",
"(",
")",
"+",
"\"/\"",
"+",
"key",
".",
"getId",
"(",
")",
")",
")",
".",
"entity",
"(",
"keyFinder",
".",
"findKeyWithName",
"(",
"key",
".",
"getId",
"(",
")",
")",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Inserts a key with the translation in the default language.
@param keyRepresentation key representation
@return 201 if the resource is created, 409 if the resource already existed
|
[
"Inserts",
"a",
"key",
"with",
"the",
"translation",
"in",
"the",
"default",
"language",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeysResource.java#L107-L125
|
147,174
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeysResource.java
|
KeysResource.deleteKeys
|
@DELETE
@Produces("text/plain")
@RequiresPermissions(I18nPermissions.KEY_DELETE)
public Response deleteKeys(@QueryParam(IS_MISSING) Boolean isMissing, @QueryParam(IS_APPROX) Boolean isApprox,
@QueryParam(IS_OUTDATED) Boolean isOutdated, @QueryParam(SEARCH_NAME) String searchName) {
KeySearchCriteria keySearchCriteria = new KeySearchCriteria(isMissing, isApprox, isOutdated, searchName);
long numberOfDeletedKeys;
if (shouldDeleteWithoutFilter(keySearchCriteria)) {
numberOfDeletedKeys = keyRepository.size();
keyRepository.clear(); // If no filter are precised use the "deleteAll()" method which is more optimized
} else {
numberOfDeletedKeys = deleteFilteredKeys(keySearchCriteria);
}
return Response.ok(String.format("%d deleted keys", numberOfDeletedKeys)).build();
}
|
java
|
@DELETE
@Produces("text/plain")
@RequiresPermissions(I18nPermissions.KEY_DELETE)
public Response deleteKeys(@QueryParam(IS_MISSING) Boolean isMissing, @QueryParam(IS_APPROX) Boolean isApprox,
@QueryParam(IS_OUTDATED) Boolean isOutdated, @QueryParam(SEARCH_NAME) String searchName) {
KeySearchCriteria keySearchCriteria = new KeySearchCriteria(isMissing, isApprox, isOutdated, searchName);
long numberOfDeletedKeys;
if (shouldDeleteWithoutFilter(keySearchCriteria)) {
numberOfDeletedKeys = keyRepository.size();
keyRepository.clear(); // If no filter are precised use the "deleteAll()" method which is more optimized
} else {
numberOfDeletedKeys = deleteFilteredKeys(keySearchCriteria);
}
return Response.ok(String.format("%d deleted keys", numberOfDeletedKeys)).build();
}
|
[
"@",
"DELETE",
"@",
"Produces",
"(",
"\"text/plain\"",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"KEY_DELETE",
")",
"public",
"Response",
"deleteKeys",
"(",
"@",
"QueryParam",
"(",
"IS_MISSING",
")",
"Boolean",
"isMissing",
",",
"@",
"QueryParam",
"(",
"IS_APPROX",
")",
"Boolean",
"isApprox",
",",
"@",
"QueryParam",
"(",
"IS_OUTDATED",
")",
"Boolean",
"isOutdated",
",",
"@",
"QueryParam",
"(",
"SEARCH_NAME",
")",
"String",
"searchName",
")",
"{",
"KeySearchCriteria",
"keySearchCriteria",
"=",
"new",
"KeySearchCriteria",
"(",
"isMissing",
",",
"isApprox",
",",
"isOutdated",
",",
"searchName",
")",
";",
"long",
"numberOfDeletedKeys",
";",
"if",
"(",
"shouldDeleteWithoutFilter",
"(",
"keySearchCriteria",
")",
")",
"{",
"numberOfDeletedKeys",
"=",
"keyRepository",
".",
"size",
"(",
")",
";",
"keyRepository",
".",
"clear",
"(",
")",
";",
"// If no filter are precised use the \"deleteAll()\" method which is more optimized",
"}",
"else",
"{",
"numberOfDeletedKeys",
"=",
"deleteFilteredKeys",
"(",
"keySearchCriteria",
")",
";",
"}",
"return",
"Response",
".",
"ok",
"(",
"String",
".",
"format",
"(",
"\"%d deleted keys\"",
",",
"numberOfDeletedKeys",
")",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Deletes all the filtered keys.
@param isMissing filter on missing default translation
@param isApprox filter on approximate default translation
@param isOutdated filter on outdated key
@param searchName filter on key name
@return http status code 200 (ok) with the number of deleted keys
|
[
"Deletes",
"all",
"the",
"filtered",
"keys",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/key/KeysResource.java#L147-L162
|
147,175
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/LocaleSelect.java
|
LocaleSelect.onChanged
|
public void onChanged(ChangedEvent event) {
String selectedLocale = (String) event.getValue();
for (Entry<String, String> entry : locales.entrySet()) {
if (entry.getValue().equals(selectedLocale)) {
SC.showPrompt(I18nProvider.getGlobal().localeReload() + ": " + selectedLocale);
Window.Location.assign(buildLocaleUrl(entry.getKey()));
}
}
}
|
java
|
public void onChanged(ChangedEvent event) {
String selectedLocale = (String) event.getValue();
for (Entry<String, String> entry : locales.entrySet()) {
if (entry.getValue().equals(selectedLocale)) {
SC.showPrompt(I18nProvider.getGlobal().localeReload() + ": " + selectedLocale);
Window.Location.assign(buildLocaleUrl(entry.getKey()));
}
}
}
|
[
"public",
"void",
"onChanged",
"(",
"ChangedEvent",
"event",
")",
"{",
"String",
"selectedLocale",
"=",
"(",
"String",
")",
"event",
".",
"getValue",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"locales",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"selectedLocale",
")",
")",
"{",
"SC",
".",
"showPrompt",
"(",
"I18nProvider",
".",
"getGlobal",
"(",
")",
".",
"localeReload",
"(",
")",
"+",
"\": \"",
"+",
"selectedLocale",
")",
";",
"Window",
".",
"Location",
".",
"assign",
"(",
"buildLocaleUrl",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
")",
";",
"}",
"}",
"}"
] |
When a new locale has been selected in the select item, this method will be called. It will automatically reload
the entire page using the newly selected locale.
@param event
The changed event that contains the new value for the locale.
|
[
"When",
"a",
"new",
"locale",
"has",
"been",
"selected",
"in",
"the",
"select",
"item",
"this",
"method",
"will",
"be",
"called",
".",
"It",
"will",
"automatically",
"reload",
"the",
"entire",
"page",
"using",
"the",
"newly",
"selected",
"locale",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/LocaleSelect.java#L90-L98
|
147,176
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/LocaleSelect.java
|
LocaleSelect.buildLocaleUrl
|
private String buildLocaleUrl(String selectedLocale) {
UrlBuilder builder = Window.Location.createUrlBuilder();
builder.removeParameter("locale");
if (!"default".equals(selectedLocale)) {
builder.setParameter("locale", selectedLocale);
}
return builder.buildString();
}
|
java
|
private String buildLocaleUrl(String selectedLocale) {
UrlBuilder builder = Window.Location.createUrlBuilder();
builder.removeParameter("locale");
if (!"default".equals(selectedLocale)) {
builder.setParameter("locale", selectedLocale);
}
return builder.buildString();
}
|
[
"private",
"String",
"buildLocaleUrl",
"(",
"String",
"selectedLocale",
")",
"{",
"UrlBuilder",
"builder",
"=",
"Window",
".",
"Location",
".",
"createUrlBuilder",
"(",
")",
";",
"builder",
".",
"removeParameter",
"(",
"\"locale\"",
")",
";",
"if",
"(",
"!",
"\"default\"",
".",
"equals",
"(",
"selectedLocale",
")",
")",
"{",
"builder",
".",
"setParameter",
"(",
"\"locale\"",
",",
"selectedLocale",
")",
";",
"}",
"return",
"builder",
".",
"buildString",
"(",
")",
";",
"}"
] |
Build the correct URL for the new locale.
|
[
"Build",
"the",
"correct",
"URL",
"for",
"the",
"new",
"locale",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/LocaleSelect.java#L105-L112
|
147,177
|
geomajas/geomajas-project-client-gwt
|
plugin/layer-googlemaps/googlemaps/src/main/java/org/geomajas/layer/google/gwt/client/GoogleAddon.java
|
GoogleAddon.setVisible
|
@Api
public void setVisible(boolean visible) {
this.visible = visible;
if (googleMap != null) {
String mapsId = map.getRasterContext().getId(this);
Element gmap = DOM.getElementById(mapsId);
UIObject.setVisible(gmap, visible);
if (tosGroup != null) {
UIObject.setVisible(tosGroup, visible);
}
if (visible) {
triggerResize(googleMap);
}
}
}
|
java
|
@Api
public void setVisible(boolean visible) {
this.visible = visible;
if (googleMap != null) {
String mapsId = map.getRasterContext().getId(this);
Element gmap = DOM.getElementById(mapsId);
UIObject.setVisible(gmap, visible);
if (tosGroup != null) {
UIObject.setVisible(tosGroup, visible);
}
if (visible) {
triggerResize(googleMap);
}
}
}
|
[
"@",
"Api",
"public",
"void",
"setVisible",
"(",
"boolean",
"visible",
")",
"{",
"this",
".",
"visible",
"=",
"visible",
";",
"if",
"(",
"googleMap",
"!=",
"null",
")",
"{",
"String",
"mapsId",
"=",
"map",
".",
"getRasterContext",
"(",
")",
".",
"getId",
"(",
"this",
")",
";",
"Element",
"gmap",
"=",
"DOM",
".",
"getElementById",
"(",
"mapsId",
")",
";",
"UIObject",
".",
"setVisible",
"(",
"gmap",
",",
"visible",
")",
";",
"if",
"(",
"tosGroup",
"!=",
"null",
")",
"{",
"UIObject",
".",
"setVisible",
"(",
"tosGroup",
",",
"visible",
")",
";",
"}",
"if",
"(",
"visible",
")",
"{",
"triggerResize",
"(",
"googleMap",
")",
";",
"}",
"}",
"}"
] |
Set the visibility of the Google map.
@param visible
@since 1.9.0
|
[
"Set",
"the",
"visibility",
"of",
"the",
"Google",
"map",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/layer-googlemaps/googlemaps/src/main/java/org/geomajas/layer/google/gwt/client/GoogleAddon.java#L249-L263
|
147,178
|
geomajas/geomajas-project-client-gwt
|
plugin/layer-googlemaps/googlemaps/src/main/java/org/geomajas/layer/google/gwt/client/GoogleAddon.java
|
GoogleAddon.setMapType
|
@Api
public void setMapType(MapType type) {
this.type = type;
if (googleMap != null) {
setMapType(googleMap, type.toString());
}
}
|
java
|
@Api
public void setMapType(MapType type) {
this.type = type;
if (googleMap != null) {
setMapType(googleMap, type.toString());
}
}
|
[
"@",
"Api",
"public",
"void",
"setMapType",
"(",
"MapType",
"type",
")",
"{",
"this",
".",
"type",
"=",
"type",
";",
"if",
"(",
"googleMap",
"!=",
"null",
")",
"{",
"setMapType",
"(",
"googleMap",
",",
"type",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
Set the type of the Google map.
@param type the map type
@since 1.9.0
|
[
"Set",
"the",
"type",
"of",
"the",
"Google",
"map",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/layer-googlemaps/googlemaps/src/main/java/org/geomajas/layer/google/gwt/client/GoogleAddon.java#L271-L277
|
147,179
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/controller/AbstractCircleController.java
|
AbstractCircleController.onMouseDown
|
public void onMouseDown(MouseDownEvent event) {
if (event.getNativeButton() != NativeEvent.BUTTON_RIGHT) {
dragging = true;
center = getScreenPosition(event);
LineString radiusLine = mapWidget.getMapModel().getGeometryFactory().createLineString(
new Coordinate[] { center, center });
mapWidget.getVectorContext().drawGroup(mapWidget.getGroup(RenderGroup.SCREEN), circleGroup);
mapWidget.getVectorContext().drawCircle(circleGroup, "outer", center, 1.0f, circleStyle);
mapWidget.getVectorContext().drawCircle(circleGroup, "center", center, 2.0f, circleStyle);
mapWidget.getVectorContext().drawLine(circleGroup, "radius", radiusLine, circleStyle);
}
}
|
java
|
public void onMouseDown(MouseDownEvent event) {
if (event.getNativeButton() != NativeEvent.BUTTON_RIGHT) {
dragging = true;
center = getScreenPosition(event);
LineString radiusLine = mapWidget.getMapModel().getGeometryFactory().createLineString(
new Coordinate[] { center, center });
mapWidget.getVectorContext().drawGroup(mapWidget.getGroup(RenderGroup.SCREEN), circleGroup);
mapWidget.getVectorContext().drawCircle(circleGroup, "outer", center, 1.0f, circleStyle);
mapWidget.getVectorContext().drawCircle(circleGroup, "center", center, 2.0f, circleStyle);
mapWidget.getVectorContext().drawLine(circleGroup, "radius", radiusLine, circleStyle);
}
}
|
[
"public",
"void",
"onMouseDown",
"(",
"MouseDownEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getNativeButton",
"(",
")",
"!=",
"NativeEvent",
".",
"BUTTON_RIGHT",
")",
"{",
"dragging",
"=",
"true",
";",
"center",
"=",
"getScreenPosition",
"(",
"event",
")",
";",
"LineString",
"radiusLine",
"=",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getGeometryFactory",
"(",
")",
".",
"createLineString",
"(",
"new",
"Coordinate",
"[",
"]",
"{",
"center",
",",
"center",
"}",
")",
";",
"mapWidget",
".",
"getVectorContext",
"(",
")",
".",
"drawGroup",
"(",
"mapWidget",
".",
"getGroup",
"(",
"RenderGroup",
".",
"SCREEN",
")",
",",
"circleGroup",
")",
";",
"mapWidget",
".",
"getVectorContext",
"(",
")",
".",
"drawCircle",
"(",
"circleGroup",
",",
"\"outer\"",
",",
"center",
",",
"1.0f",
",",
"circleStyle",
")",
";",
"mapWidget",
".",
"getVectorContext",
"(",
")",
".",
"drawCircle",
"(",
"circleGroup",
",",
"\"center\"",
",",
"center",
",",
"2.0f",
",",
"circleStyle",
")",
";",
"mapWidget",
".",
"getVectorContext",
"(",
")",
".",
"drawLine",
"(",
"circleGroup",
",",
"\"radius\"",
",",
"radiusLine",
",",
"circleStyle",
")",
";",
"}",
"}"
] |
Register center point for the circle, and start dragging and rendering.
@param event
event
|
[
"Register",
"center",
"point",
"for",
"the",
"circle",
"and",
"start",
"dragging",
"and",
"rendering",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/AbstractCircleController.java#L73-L85
|
147,180
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/controller/AbstractCircleController.java
|
AbstractCircleController.getWorldCenter
|
protected Coordinate getWorldCenter() {
if (center != null) {
return mapWidget.getMapModel().getMapView().getWorldViewTransformer().viewToWorld(center);
}
return null;
}
|
java
|
protected Coordinate getWorldCenter() {
if (center != null) {
return mapWidget.getMapModel().getMapView().getWorldViewTransformer().viewToWorld(center);
}
return null;
}
|
[
"protected",
"Coordinate",
"getWorldCenter",
"(",
")",
"{",
"if",
"(",
"center",
"!=",
"null",
")",
"{",
"return",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getMapView",
"(",
")",
".",
"getWorldViewTransformer",
"(",
")",
".",
"viewToWorld",
"(",
"center",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Return the center position of the circle in world coordinates.
|
[
"Return",
"the",
"center",
"position",
"of",
"the",
"circle",
"in",
"world",
"coordinates",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/AbstractCircleController.java#L134-L139
|
147,181
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/controller/AbstractCircleController.java
|
AbstractCircleController.getWorldRadius
|
protected double getWorldRadius() {
if (center != null) {
Coordinate screenEndPoint = new Coordinate(center.getX() + radius, center.getY());
Coordinate worldEndPoint = mapWidget.getMapModel().getMapView().getWorldViewTransformer().viewToWorld(
screenEndPoint);
double deltaX = worldEndPoint.getX() - getWorldCenter().getX();
double deltaY = worldEndPoint.getY() - getWorldCenter().getY();
return (float) Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
}
return 0;
}
|
java
|
protected double getWorldRadius() {
if (center != null) {
Coordinate screenEndPoint = new Coordinate(center.getX() + radius, center.getY());
Coordinate worldEndPoint = mapWidget.getMapModel().getMapView().getWorldViewTransformer().viewToWorld(
screenEndPoint);
double deltaX = worldEndPoint.getX() - getWorldCenter().getX();
double deltaY = worldEndPoint.getY() - getWorldCenter().getY();
return (float) Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
}
return 0;
}
|
[
"protected",
"double",
"getWorldRadius",
"(",
")",
"{",
"if",
"(",
"center",
"!=",
"null",
")",
"{",
"Coordinate",
"screenEndPoint",
"=",
"new",
"Coordinate",
"(",
"center",
".",
"getX",
"(",
")",
"+",
"radius",
",",
"center",
".",
"getY",
"(",
")",
")",
";",
"Coordinate",
"worldEndPoint",
"=",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getMapView",
"(",
")",
".",
"getWorldViewTransformer",
"(",
")",
".",
"viewToWorld",
"(",
"screenEndPoint",
")",
";",
"double",
"deltaX",
"=",
"worldEndPoint",
".",
"getX",
"(",
")",
"-",
"getWorldCenter",
"(",
")",
".",
"getX",
"(",
")",
";",
"double",
"deltaY",
"=",
"worldEndPoint",
".",
"getY",
"(",
")",
"-",
"getWorldCenter",
"(",
")",
".",
"getY",
"(",
")",
";",
"return",
"(",
"float",
")",
"Math",
".",
"sqrt",
"(",
"(",
"deltaX",
"*",
"deltaX",
")",
"+",
"(",
"deltaY",
"*",
"deltaY",
")",
")",
";",
"}",
"return",
"0",
";",
"}"
] |
Return the circle's radius in world length units.
|
[
"Return",
"the",
"circle",
"s",
"radius",
"in",
"world",
"length",
"units",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/AbstractCircleController.java#L142-L152
|
147,182
|
geomajas/geomajas-project-client-gwt
|
plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryEditService.java
|
JsGeometryEditService.move
|
public void move(GeometryIndex[] indices, JsArray<JsArrayObject> coordinates) {
List<List<Coordinate>> coords = new ArrayList<List<Coordinate>>(coordinates.length());
for (int i = 0; i < coordinates.length(); i++) {
JsArrayObject jsObj = coordinates.get(i);
coords.add(Arrays.asList(ExporterUtil.toArrObject(jsObj, new Coordinate[jsObj.length()])));
}
try {
delegate.move(Arrays.asList(indices), coords);
} catch (GeometryOperationFailedException e) {
throw new RuntimeException(e.getMessage());
}
}
|
java
|
public void move(GeometryIndex[] indices, JsArray<JsArrayObject> coordinates) {
List<List<Coordinate>> coords = new ArrayList<List<Coordinate>>(coordinates.length());
for (int i = 0; i < coordinates.length(); i++) {
JsArrayObject jsObj = coordinates.get(i);
coords.add(Arrays.asList(ExporterUtil.toArrObject(jsObj, new Coordinate[jsObj.length()])));
}
try {
delegate.move(Arrays.asList(indices), coords);
} catch (GeometryOperationFailedException e) {
throw new RuntimeException(e.getMessage());
}
}
|
[
"public",
"void",
"move",
"(",
"GeometryIndex",
"[",
"]",
"indices",
",",
"JsArray",
"<",
"JsArrayObject",
">",
"coordinates",
")",
"{",
"List",
"<",
"List",
"<",
"Coordinate",
">>",
"coords",
"=",
"new",
"ArrayList",
"<",
"List",
"<",
"Coordinate",
">",
">",
"(",
"coordinates",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"coordinates",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"JsArrayObject",
"jsObj",
"=",
"coordinates",
".",
"get",
"(",
"i",
")",
";",
"coords",
".",
"add",
"(",
"Arrays",
".",
"asList",
"(",
"ExporterUtil",
".",
"toArrObject",
"(",
"jsObj",
",",
"new",
"Coordinate",
"[",
"jsObj",
".",
"length",
"(",
")",
"]",
")",
")",
")",
";",
"}",
"try",
"{",
"delegate",
".",
"move",
"(",
"Arrays",
".",
"asList",
"(",
"indices",
")",
",",
"coords",
")",
";",
"}",
"catch",
"(",
"GeometryOperationFailedException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Move a set of indices to new locations. These indices can point to vertices, edges or sub-geometries. For each
index, a list of new coordinates is provided.
@param indices
The list of indices to move.
@param coordinates
The coordinates to move the indices to. Must be a nested array of coordinates. In other words, for
each index an array of coordinates must be supplied.
@throws GeometryOperationFailedException
In case one of the indices could not be found. No changes will have been performed.
|
[
"Move",
"a",
"set",
"of",
"indices",
"to",
"new",
"locations",
".",
"These",
"indices",
"can",
"point",
"to",
"vertices",
"edges",
"or",
"sub",
"-",
"geometries",
".",
"For",
"each",
"index",
"a",
"list",
"of",
"new",
"coordinates",
"is",
"provided",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryEditService.java#L441-L452
|
147,183
|
geomajas/geomajas-project-client-gwt
|
plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryEditService.java
|
JsGeometryEditService.remove
|
public void remove(GeometryIndex[] indices) {
try {
delegate.remove(Arrays.asList(indices));
} catch (GeometryOperationFailedException e) {
throw new RuntimeException(e.getMessage());
}
}
|
java
|
public void remove(GeometryIndex[] indices) {
try {
delegate.remove(Arrays.asList(indices));
} catch (GeometryOperationFailedException e) {
throw new RuntimeException(e.getMessage());
}
}
|
[
"public",
"void",
"remove",
"(",
"GeometryIndex",
"[",
"]",
"indices",
")",
"{",
"try",
"{",
"delegate",
".",
"remove",
"(",
"Arrays",
".",
"asList",
"(",
"indices",
")",
")",
";",
"}",
"catch",
"(",
"GeometryOperationFailedException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Delete vertices, edges or sub-geometries at the given indices.
@param indices
The list of indices that point to the vertices/edges/sub-geometries that should be deleted.
@throws GeometryOperationFailedException
In case one of the indices could not be found. No changes will have been performed.
|
[
"Delete",
"vertices",
"edges",
"or",
"sub",
"-",
"geometries",
"at",
"the",
"given",
"indices",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryEditService.java#L487-L493
|
147,184
|
wnameless/rubycollect4j
|
src/main/java/net/sf/rubycollect4j/RubyKernel.java
|
RubyKernel.p
|
@SafeVarargs
public static <T> RubyArray<T> p(T first, T... others) {
RubyArray<T> ra = new RubyArray<>();
out.print("[");
ra.add(p(first, false));
Arrays.asList(others).forEach(item -> {
out.print(", ");
ra.add(p(item, false));
});
out.print("]");
out.println();
return ra;
}
|
java
|
@SafeVarargs
public static <T> RubyArray<T> p(T first, T... others) {
RubyArray<T> ra = new RubyArray<>();
out.print("[");
ra.add(p(first, false));
Arrays.asList(others).forEach(item -> {
out.print(", ");
ra.add(p(item, false));
});
out.print("]");
out.println();
return ra;
}
|
[
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"RubyArray",
"<",
"T",
">",
"p",
"(",
"T",
"first",
",",
"T",
"...",
"others",
")",
"{",
"RubyArray",
"<",
"T",
">",
"ra",
"=",
"new",
"RubyArray",
"<>",
"(",
")",
";",
"out",
".",
"print",
"(",
"\"[\"",
")",
";",
"ra",
".",
"add",
"(",
"p",
"(",
"first",
",",
"false",
")",
")",
";",
"Arrays",
".",
"asList",
"(",
"others",
")",
".",
"forEach",
"(",
"item",
"->",
"{",
"out",
".",
"print",
"(",
"\", \"",
")",
";",
"ra",
".",
"add",
"(",
"p",
"(",
"item",
",",
"false",
")",
")",
";",
"}",
")",
";",
"out",
".",
"print",
"(",
"\"]\"",
")",
";",
"out",
".",
"println",
"(",
")",
";",
"return",
"ra",
";",
"}"
] |
Prints a human-readable representation of given Objects.
@param first
first Object
@param others
other Object
@return a {@link RubyArray} of given Objects
|
[
"Prints",
"a",
"human",
"-",
"readable",
"representation",
"of",
"given",
"Objects",
"."
] |
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
|
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyKernel.java#L68-L80
|
147,185
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LineString.java
|
LineString.getCoordinateN
|
public Coordinate getCoordinateN(int n) {
if (isEmpty()) {
return null;
}
if (n >= 0 && n < coordinates.length) {
return coordinates[n];
}
return null;
}
|
java
|
public Coordinate getCoordinateN(int n) {
if (isEmpty()) {
return null;
}
if (n >= 0 && n < coordinates.length) {
return coordinates[n];
}
return null;
}
|
[
"public",
"Coordinate",
"getCoordinateN",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"n",
">=",
"0",
"&&",
"n",
"<",
"coordinates",
".",
"length",
")",
"{",
"return",
"coordinates",
"[",
"n",
"]",
";",
"}",
"return",
"null",
";",
"}"
] |
Return a coordinate, or null.
@param n
Index in the geometry. This can be an integer value or an array of values.
@return A coordinate or null.
|
[
"Return",
"a",
"coordinate",
"or",
"null",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LineString.java#L54-L62
|
147,186
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LineString.java
|
LineString.getLength
|
public double getLength() {
double len = 0;
if (!isEmpty()) {
for (int i = 0; i < coordinates.length - 1; i++) {
double deltaX = coordinates[i + 1].getX() - coordinates[i].getX();
double deltaY = coordinates[i + 1].getY() - coordinates[i].getY();
len += Math.sqrt(deltaX * deltaX + deltaY * deltaY);
}
}
return len;
}
|
java
|
public double getLength() {
double len = 0;
if (!isEmpty()) {
for (int i = 0; i < coordinates.length - 1; i++) {
double deltaX = coordinates[i + 1].getX() - coordinates[i].getX();
double deltaY = coordinates[i + 1].getY() - coordinates[i].getY();
len += Math.sqrt(deltaX * deltaX + deltaY * deltaY);
}
}
return len;
}
|
[
"public",
"double",
"getLength",
"(",
")",
"{",
"double",
"len",
"=",
"0",
";",
"if",
"(",
"!",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"coordinates",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"double",
"deltaX",
"=",
"coordinates",
"[",
"i",
"+",
"1",
"]",
".",
"getX",
"(",
")",
"-",
"coordinates",
"[",
"i",
"]",
".",
"getX",
"(",
")",
";",
"double",
"deltaY",
"=",
"coordinates",
"[",
"i",
"+",
"1",
"]",
".",
"getY",
"(",
")",
"-",
"coordinates",
"[",
"i",
"]",
".",
"getY",
"(",
")",
";",
"len",
"+=",
"Math",
".",
"sqrt",
"(",
"deltaX",
"*",
"deltaX",
"+",
"deltaY",
"*",
"deltaY",
")",
";",
"}",
"}",
"return",
"len",
";",
"}"
] |
Return the length of the LineString.
|
[
"Return",
"the",
"length",
"of",
"the",
"LineString",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LineString.java#L151-L161
|
147,187
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LineString.java
|
LineString.getDistance
|
public double getDistance(Coordinate coordinate) {
double minDistance = Double.MAX_VALUE;
if (!isEmpty()) {
for (int i = 0; i < this.coordinates.length - 1; i++) {
double dist = Mathlib.distance(this.coordinates[i], this.coordinates[i + 1], coordinate);
if (dist < minDistance) {
minDistance = dist;
}
}
}
return minDistance;
}
|
java
|
public double getDistance(Coordinate coordinate) {
double minDistance = Double.MAX_VALUE;
if (!isEmpty()) {
for (int i = 0; i < this.coordinates.length - 1; i++) {
double dist = Mathlib.distance(this.coordinates[i], this.coordinates[i + 1], coordinate);
if (dist < minDistance) {
minDistance = dist;
}
}
}
return minDistance;
}
|
[
"public",
"double",
"getDistance",
"(",
"Coordinate",
"coordinate",
")",
"{",
"double",
"minDistance",
"=",
"Double",
".",
"MAX_VALUE",
";",
"if",
"(",
"!",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"coordinates",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"double",
"dist",
"=",
"Mathlib",
".",
"distance",
"(",
"this",
".",
"coordinates",
"[",
"i",
"]",
",",
"this",
".",
"coordinates",
"[",
"i",
"+",
"1",
"]",
",",
"coordinate",
")",
";",
"if",
"(",
"dist",
"<",
"minDistance",
")",
"{",
"minDistance",
"=",
"dist",
";",
"}",
"}",
"}",
"return",
"minDistance",
";",
"}"
] |
Return the minimal distance between this coordinate and any line segment of the geometry.
@return Return the minimal distance
|
[
"Return",
"the",
"minimal",
"distance",
"between",
"this",
"coordinate",
"and",
"any",
"line",
"segment",
"of",
"the",
"geometry",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LineString.java#L192-L204
|
147,188
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/feature/TransactionGeomIndex.java
|
TransactionGeomIndex.getLineString
|
public LineString getLineString(Geometry geometry) {
if (geometry instanceof MultiLineString) {
if (geometryIndex >= 0 && geometryIndex < geometry.getNumGeometries()) {
return getLinearRing(geometry.getGeometryN(geometryIndex));
}
} else if (geometry instanceof LineString) {
return (LineString) geometry;
}
return getLinearRing(geometry);
}
|
java
|
public LineString getLineString(Geometry geometry) {
if (geometry instanceof MultiLineString) {
if (geometryIndex >= 0 && geometryIndex < geometry.getNumGeometries()) {
return getLinearRing(geometry.getGeometryN(geometryIndex));
}
} else if (geometry instanceof LineString) {
return (LineString) geometry;
}
return getLinearRing(geometry);
}
|
[
"public",
"LineString",
"getLineString",
"(",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"geometry",
"instanceof",
"MultiLineString",
")",
"{",
"if",
"(",
"geometryIndex",
">=",
"0",
"&&",
"geometryIndex",
"<",
"geometry",
".",
"getNumGeometries",
"(",
")",
")",
"{",
"return",
"getLinearRing",
"(",
"geometry",
".",
"getGeometryN",
"(",
"geometryIndex",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"LineString",
")",
"{",
"return",
"(",
"LineString",
")",
"geometry",
";",
"}",
"return",
"getLinearRing",
"(",
"geometry",
")",
";",
"}"
] |
Returns a LineString or LinearRing that is described by this index.
@param geometry
The original geometry.
@return A LineString or LinearRing.
|
[
"Returns",
"a",
"LineString",
"or",
"LinearRing",
"that",
"is",
"described",
"by",
"this",
"index",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/TransactionGeomIndex.java#L94-L103
|
147,189
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/feature/TransactionGeomIndex.java
|
TransactionGeomIndex.isNeighbor
|
public boolean isNeighbor(String identifier, Geometry geometry) {
LineString lineString = getLineString(geometry);
if (lineString != null) {
int index = TransactionGeomIndexUtil.getIndex(identifier).getCoordinateIndex();
if (index >= 0 && coordinateIndex >= 0) {
if (coordinateIndex == 0) {
if (index == 1) {
return true;
}
if (lineString.isClosed() && index == lineString.getNumPoints() - 2) {
return true;
}
} else if (coordinateIndex == lineString.getNumPoints() - 2) {
if (index == coordinateIndex - 1) {
return true;
} else if (lineString.isClosed() && index == 0) {
return true;
}
} else {
if (index == coordinateIndex - 1 || index == coordinateIndex + 1) {
return true;
}
}
} else {
SC.warn("TransactionGeomIndex.isNeighbor: Implement me");
}
}
return false;
}
|
java
|
public boolean isNeighbor(String identifier, Geometry geometry) {
LineString lineString = getLineString(geometry);
if (lineString != null) {
int index = TransactionGeomIndexUtil.getIndex(identifier).getCoordinateIndex();
if (index >= 0 && coordinateIndex >= 0) {
if (coordinateIndex == 0) {
if (index == 1) {
return true;
}
if (lineString.isClosed() && index == lineString.getNumPoints() - 2) {
return true;
}
} else if (coordinateIndex == lineString.getNumPoints() - 2) {
if (index == coordinateIndex - 1) {
return true;
} else if (lineString.isClosed() && index == 0) {
return true;
}
} else {
if (index == coordinateIndex - 1 || index == coordinateIndex + 1) {
return true;
}
}
} else {
SC.warn("TransactionGeomIndex.isNeighbor: Implement me");
}
}
return false;
}
|
[
"public",
"boolean",
"isNeighbor",
"(",
"String",
"identifier",
",",
"Geometry",
"geometry",
")",
"{",
"LineString",
"lineString",
"=",
"getLineString",
"(",
"geometry",
")",
";",
"if",
"(",
"lineString",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"TransactionGeomIndexUtil",
".",
"getIndex",
"(",
"identifier",
")",
".",
"getCoordinateIndex",
"(",
")",
";",
"if",
"(",
"index",
">=",
"0",
"&&",
"coordinateIndex",
">=",
"0",
")",
"{",
"if",
"(",
"coordinateIndex",
"==",
"0",
")",
"{",
"if",
"(",
"index",
"==",
"1",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"lineString",
".",
"isClosed",
"(",
")",
"&&",
"index",
"==",
"lineString",
".",
"getNumPoints",
"(",
")",
"-",
"2",
")",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"coordinateIndex",
"==",
"lineString",
".",
"getNumPoints",
"(",
")",
"-",
"2",
")",
"{",
"if",
"(",
"index",
"==",
"coordinateIndex",
"-",
"1",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"lineString",
".",
"isClosed",
"(",
")",
"&&",
"index",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"index",
"==",
"coordinateIndex",
"-",
"1",
"||",
"index",
"==",
"coordinateIndex",
"+",
"1",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"else",
"{",
"SC",
".",
"warn",
"(",
"\"TransactionGeomIndex.isNeighbor: Implement me\"",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Return true or false indicating of the given identifier for an edge or vertex is a neighbor for this index.
@param identifier
The given identifier to establish this status for. Must be a coordinate identifier.(TODO support edges
as well)
@param geometry
A geometry that fits this index.
@return Returns true or false.
|
[
"Return",
"true",
"or",
"false",
"indicating",
"of",
"the",
"given",
"identifier",
"for",
"an",
"edge",
"or",
"vertex",
"is",
"a",
"neighbor",
"for",
"this",
"index",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/TransactionGeomIndex.java#L176-L204
|
147,190
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/gfx/painter/MapModelPainter.java
|
MapModelPainter.paint
|
public void paint(Paintable paintable, Object group, MapContext context) {
// Group for objects in raster space
context.getRasterContext().drawGroup(null, mapWidget.getGroup(RenderGroup.RASTER),
mapWidget.getMapModel().getMapView()
.getPanToViewTranslation());
// Group for objects in vector space
context.getVectorContext().drawGroup(null, mapWidget.getGroup(RenderGroup.VECTOR),
mapWidget.getMapModel().getMapView().getPanToViewTranslation());
// Group for objects in world space
context.getVectorContext().drawGroup(null, mapWidget.getGroup(RenderGroup.WORLD),
mapWidget.getMapModel().getMapView().getPanToViewTranslation());
// Group for objects in screen space
context.getVectorContext().drawGroup(null, mapWidget.getGroup(RenderGroup.SCREEN));
}
|
java
|
public void paint(Paintable paintable, Object group, MapContext context) {
// Group for objects in raster space
context.getRasterContext().drawGroup(null, mapWidget.getGroup(RenderGroup.RASTER),
mapWidget.getMapModel().getMapView()
.getPanToViewTranslation());
// Group for objects in vector space
context.getVectorContext().drawGroup(null, mapWidget.getGroup(RenderGroup.VECTOR),
mapWidget.getMapModel().getMapView().getPanToViewTranslation());
// Group for objects in world space
context.getVectorContext().drawGroup(null, mapWidget.getGroup(RenderGroup.WORLD),
mapWidget.getMapModel().getMapView().getPanToViewTranslation());
// Group for objects in screen space
context.getVectorContext().drawGroup(null, mapWidget.getGroup(RenderGroup.SCREEN));
}
|
[
"public",
"void",
"paint",
"(",
"Paintable",
"paintable",
",",
"Object",
"group",
",",
"MapContext",
"context",
")",
"{",
"// Group for objects in raster space",
"context",
".",
"getRasterContext",
"(",
")",
".",
"drawGroup",
"(",
"null",
",",
"mapWidget",
".",
"getGroup",
"(",
"RenderGroup",
".",
"RASTER",
")",
",",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getMapView",
"(",
")",
".",
"getPanToViewTranslation",
"(",
")",
")",
";",
"// Group for objects in vector space",
"context",
".",
"getVectorContext",
"(",
")",
".",
"drawGroup",
"(",
"null",
",",
"mapWidget",
".",
"getGroup",
"(",
"RenderGroup",
".",
"VECTOR",
")",
",",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getMapView",
"(",
")",
".",
"getPanToViewTranslation",
"(",
")",
")",
";",
"// Group for objects in world space",
"context",
".",
"getVectorContext",
"(",
")",
".",
"drawGroup",
"(",
"null",
",",
"mapWidget",
".",
"getGroup",
"(",
"RenderGroup",
".",
"WORLD",
")",
",",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getMapView",
"(",
")",
".",
"getPanToViewTranslation",
"(",
")",
")",
";",
"// Group for objects in screen space",
"context",
".",
"getVectorContext",
"(",
")",
".",
"drawGroup",
"(",
"null",
",",
"mapWidget",
".",
"getGroup",
"(",
"RenderGroup",
".",
"SCREEN",
")",
")",
";",
"}"
] |
The actual painting function. Draws the basic groups.
@param paintable
A {@link org.geomajas.gwt.client.map.MapModel} object.
@param group
The group where the object resides in (optional).
@param context
A MapContext object, responsible for actual drawing.
|
[
"The",
"actual",
"painting",
"function",
".",
"Draws",
"the",
"basic",
"groups",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/painter/MapModelPainter.java#L53-L70
|
147,191
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/controller/AbstractRectangleController.java
|
AbstractRectangleController.onDown
|
@Override
public void onDown(HumanInputEvent<?> event) {
if (dragging && leftWidget) {
// mouse was moved outside of widget
doSelect(event);
} else if (!isRightMouseButton(event)) {
// no point trying to select when there is no active layer
dragging = true;
leftWidget = false;
timestamp = new Date().getTime();
begin = getLocation(event, RenderSpace.SCREEN);
bounds = new Bbox(begin.getX(), begin.getY(), 0.0, 0.0);
shift = event.isShiftKeyDown();
rectangle = new Rectangle("selectionRectangle");
rectangle.setStyle(rectangleStyle);
rectangle.setBounds(bounds);
mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.UPDATE);
}
}
|
java
|
@Override
public void onDown(HumanInputEvent<?> event) {
if (dragging && leftWidget) {
// mouse was moved outside of widget
doSelect(event);
} else if (!isRightMouseButton(event)) {
// no point trying to select when there is no active layer
dragging = true;
leftWidget = false;
timestamp = new Date().getTime();
begin = getLocation(event, RenderSpace.SCREEN);
bounds = new Bbox(begin.getX(), begin.getY(), 0.0, 0.0);
shift = event.isShiftKeyDown();
rectangle = new Rectangle("selectionRectangle");
rectangle.setStyle(rectangleStyle);
rectangle.setBounds(bounds);
mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.UPDATE);
}
}
|
[
"@",
"Override",
"public",
"void",
"onDown",
"(",
"HumanInputEvent",
"<",
"?",
">",
"event",
")",
"{",
"if",
"(",
"dragging",
"&&",
"leftWidget",
")",
"{",
"// mouse was moved outside of widget",
"doSelect",
"(",
"event",
")",
";",
"}",
"else",
"if",
"(",
"!",
"isRightMouseButton",
"(",
"event",
")",
")",
"{",
"// no point trying to select when there is no active layer",
"dragging",
"=",
"true",
";",
"leftWidget",
"=",
"false",
";",
"timestamp",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"begin",
"=",
"getLocation",
"(",
"event",
",",
"RenderSpace",
".",
"SCREEN",
")",
";",
"bounds",
"=",
"new",
"Bbox",
"(",
"begin",
".",
"getX",
"(",
")",
",",
"begin",
".",
"getY",
"(",
")",
",",
"0.0",
",",
"0.0",
")",
";",
"shift",
"=",
"event",
".",
"isShiftKeyDown",
"(",
")",
";",
"rectangle",
"=",
"new",
"Rectangle",
"(",
"\"selectionRectangle\"",
")",
";",
"rectangle",
".",
"setStyle",
"(",
"rectangleStyle",
")",
";",
"rectangle",
".",
"setBounds",
"(",
"bounds",
")",
";",
"mapWidget",
".",
"render",
"(",
"rectangle",
",",
"RenderGroup",
".",
"SCREEN",
",",
"RenderStatus",
".",
"UPDATE",
")",
";",
"}",
"}"
] |
Start dragging, register base for selection rectangle.
@param event
event
|
[
"Start",
"dragging",
"register",
"base",
"for",
"selection",
"rectangle",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/AbstractRectangleController.java#L73-L92
|
147,192
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/attribute/FormItemList.java
|
FormItemList.indexOf
|
public int indexOf(String name) {
int i = 0;
for (FormItem formItem : this) {
if (name.equals(formItem.getName())) {
return i;
}
i++;
}
return -1;
}
|
java
|
public int indexOf(String name) {
int i = 0;
for (FormItem formItem : this) {
if (name.equals(formItem.getName())) {
return i;
}
i++;
}
return -1;
}
|
[
"public",
"int",
"indexOf",
"(",
"String",
"name",
")",
"{",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"FormItem",
"formItem",
":",
"this",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"formItem",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"i",
";",
"}",
"i",
"++",
";",
"}",
"return",
"-",
"1",
";",
"}"
] |
Get the index of the field with given name.
@param name field name
@return index
|
[
"Get",
"the",
"index",
"of",
"the",
"field",
"with",
"given",
"name",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/FormItemList.java#L41-L50
|
147,193
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/attribute/FormItemList.java
|
FormItemList.insertBefore
|
public void insertBefore(String name, FormItem... newItem) {
int index = indexOf(name);
if (index >= 0) {
addAll(index, Arrays.asList(newItem));
}
}
|
java
|
public void insertBefore(String name, FormItem... newItem) {
int index = indexOf(name);
if (index >= 0) {
addAll(index, Arrays.asList(newItem));
}
}
|
[
"public",
"void",
"insertBefore",
"(",
"String",
"name",
",",
"FormItem",
"...",
"newItem",
")",
"{",
"int",
"index",
"=",
"indexOf",
"(",
"name",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"addAll",
"(",
"index",
",",
"Arrays",
".",
"asList",
"(",
"newItem",
")",
")",
";",
"}",
"}"
] |
Insert a form item before the item with the specified name.
@param name name of the item before which to insert
@param newItem the item to insert
|
[
"Insert",
"a",
"form",
"item",
"before",
"the",
"item",
"with",
"the",
"specified",
"name",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/FormItemList.java#L58-L63
|
147,194
|
geomajas/geomajas-project-client-gwt
|
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java
|
GeomajasServiceImpl.addDispatchStartedHandler
|
@Export
public JsHandlerRegistration addDispatchStartedHandler(final DispatchStartedHandler handler) {
HandlerRegistration registration = GwtCommandDispatcher.getInstance().addDispatchStartedHandler(
new org.geomajas.gwt.client.command.event.DispatchStartedHandler() {
public void onDispatchStarted(DispatchStartedEvent event) {
handler.onDispatchStarted(new org.geomajas.plugin.jsapi.client.event.DispatchStartedEvent());
}
});
return new JsHandlerRegistration(new HandlerRegistration[] { registration });
}
|
java
|
@Export
public JsHandlerRegistration addDispatchStartedHandler(final DispatchStartedHandler handler) {
HandlerRegistration registration = GwtCommandDispatcher.getInstance().addDispatchStartedHandler(
new org.geomajas.gwt.client.command.event.DispatchStartedHandler() {
public void onDispatchStarted(DispatchStartedEvent event) {
handler.onDispatchStarted(new org.geomajas.plugin.jsapi.client.event.DispatchStartedEvent());
}
});
return new JsHandlerRegistration(new HandlerRegistration[] { registration });
}
|
[
"@",
"Export",
"public",
"JsHandlerRegistration",
"addDispatchStartedHandler",
"(",
"final",
"DispatchStartedHandler",
"handler",
")",
"{",
"HandlerRegistration",
"registration",
"=",
"GwtCommandDispatcher",
".",
"getInstance",
"(",
")",
".",
"addDispatchStartedHandler",
"(",
"new",
"org",
".",
"geomajas",
".",
"gwt",
".",
"client",
".",
"command",
".",
"event",
".",
"DispatchStartedHandler",
"(",
")",
"{",
"public",
"void",
"onDispatchStarted",
"(",
"DispatchStartedEvent",
"event",
")",
"{",
"handler",
".",
"onDispatchStarted",
"(",
"new",
"org",
".",
"geomajas",
".",
"plugin",
".",
"jsapi",
".",
"client",
".",
"event",
".",
"DispatchStartedEvent",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"new",
"JsHandlerRegistration",
"(",
"new",
"HandlerRegistration",
"[",
"]",
"{",
"registration",
"}",
")",
";",
"}"
] |
Add a handler that is called whenever the client starts communicating with the back-end.
@param handler
The actual handler (closure).
@return The registration for the handler. Using this object the handler can be removed again.
|
[
"Add",
"a",
"handler",
"that",
"is",
"called",
"whenever",
"the",
"client",
"starts",
"communicating",
"with",
"the",
"back",
"-",
"end",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java#L160-L170
|
147,195
|
geomajas/geomajas-project-client-gwt
|
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java
|
GeomajasServiceImpl.addDispatchStoppedHandler
|
@Export
public JsHandlerRegistration addDispatchStoppedHandler(final DispatchStoppedHandler handler) {
HandlerRegistration registration = GwtCommandDispatcher.getInstance().addDispatchStoppedHandler(
new org.geomajas.gwt.client.command.event.DispatchStoppedHandler() {
public void onDispatchStopped(DispatchStoppedEvent event) {
handler.onDispatchStopped(new org.geomajas.plugin.jsapi.client.event.DispatchStoppedEvent());
}
});
return new JsHandlerRegistration(new HandlerRegistration[] { registration });
}
|
java
|
@Export
public JsHandlerRegistration addDispatchStoppedHandler(final DispatchStoppedHandler handler) {
HandlerRegistration registration = GwtCommandDispatcher.getInstance().addDispatchStoppedHandler(
new org.geomajas.gwt.client.command.event.DispatchStoppedHandler() {
public void onDispatchStopped(DispatchStoppedEvent event) {
handler.onDispatchStopped(new org.geomajas.plugin.jsapi.client.event.DispatchStoppedEvent());
}
});
return new JsHandlerRegistration(new HandlerRegistration[] { registration });
}
|
[
"@",
"Export",
"public",
"JsHandlerRegistration",
"addDispatchStoppedHandler",
"(",
"final",
"DispatchStoppedHandler",
"handler",
")",
"{",
"HandlerRegistration",
"registration",
"=",
"GwtCommandDispatcher",
".",
"getInstance",
"(",
")",
".",
"addDispatchStoppedHandler",
"(",
"new",
"org",
".",
"geomajas",
".",
"gwt",
".",
"client",
".",
"command",
".",
"event",
".",
"DispatchStoppedHandler",
"(",
")",
"{",
"public",
"void",
"onDispatchStopped",
"(",
"DispatchStoppedEvent",
"event",
")",
"{",
"handler",
".",
"onDispatchStopped",
"(",
"new",
"org",
".",
"geomajas",
".",
"plugin",
".",
"jsapi",
".",
"client",
".",
"event",
".",
"DispatchStoppedEvent",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"new",
"JsHandlerRegistration",
"(",
"new",
"HandlerRegistration",
"[",
"]",
"{",
"registration",
"}",
")",
";",
"}"
] |
Add a handler that is called whenever the client stops communicating with the back-end.
@param handler
The actual handler (closure).
@return The registration for the handler. Using this object the handler can be removed again.
|
[
"Add",
"a",
"handler",
"that",
"is",
"called",
"whenever",
"the",
"client",
"stops",
"communicating",
"with",
"the",
"back",
"-",
"end",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java#L179-L189
|
147,196
|
geomajas/geomajas-project-client-gwt
|
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java
|
GeomajasServiceImpl.createMapController
|
@Export
public MapController createMapController(Map map, String id) {
MapWidget mapWidget = ((MapImpl) map).getMapWidget();
if ("PanMode".equalsIgnoreCase(id)) {
return createMapController(map, new PanController(mapWidget), id);
} else if (ToolId.TOOL_MEASURE_DISTANCE_MODE.equalsIgnoreCase(id)) {
return createMapController(map, new MeasureDistanceController(mapWidget), id);
} else if (ToolId.TOOL_FEATURE_INFO.equalsIgnoreCase(id)) {
return createMapController(map, new FeatureInfoController(mapWidget, 3), id);
} else if (ToolId.TOOL_SELECTION_MODE.equalsIgnoreCase(id)) {
return createMapController(map, new SelectionController(mapWidget, 500, 0.5f, false, 3), id);
} else if ("SingleSelectionMode".equalsIgnoreCase(id)) {
return createMapController(map, new SingleSelectionController(mapWidget, false, 3), id);
} else if (ToolId.TOOL_EDIT.equalsIgnoreCase(id)) {
return createMapController(map, new ParentEditController(mapWidget), id);
}
return null;
}
|
java
|
@Export
public MapController createMapController(Map map, String id) {
MapWidget mapWidget = ((MapImpl) map).getMapWidget();
if ("PanMode".equalsIgnoreCase(id)) {
return createMapController(map, new PanController(mapWidget), id);
} else if (ToolId.TOOL_MEASURE_DISTANCE_MODE.equalsIgnoreCase(id)) {
return createMapController(map, new MeasureDistanceController(mapWidget), id);
} else if (ToolId.TOOL_FEATURE_INFO.equalsIgnoreCase(id)) {
return createMapController(map, new FeatureInfoController(mapWidget, 3), id);
} else if (ToolId.TOOL_SELECTION_MODE.equalsIgnoreCase(id)) {
return createMapController(map, new SelectionController(mapWidget, 500, 0.5f, false, 3), id);
} else if ("SingleSelectionMode".equalsIgnoreCase(id)) {
return createMapController(map, new SingleSelectionController(mapWidget, false, 3), id);
} else if (ToolId.TOOL_EDIT.equalsIgnoreCase(id)) {
return createMapController(map, new ParentEditController(mapWidget), id);
}
return null;
}
|
[
"@",
"Export",
"public",
"MapController",
"createMapController",
"(",
"Map",
"map",
",",
"String",
"id",
")",
"{",
"MapWidget",
"mapWidget",
"=",
"(",
"(",
"MapImpl",
")",
"map",
")",
".",
"getMapWidget",
"(",
")",
";",
"if",
"(",
"\"PanMode\"",
".",
"equalsIgnoreCase",
"(",
"id",
")",
")",
"{",
"return",
"createMapController",
"(",
"map",
",",
"new",
"PanController",
"(",
"mapWidget",
")",
",",
"id",
")",
";",
"}",
"else",
"if",
"(",
"ToolId",
".",
"TOOL_MEASURE_DISTANCE_MODE",
".",
"equalsIgnoreCase",
"(",
"id",
")",
")",
"{",
"return",
"createMapController",
"(",
"map",
",",
"new",
"MeasureDistanceController",
"(",
"mapWidget",
")",
",",
"id",
")",
";",
"}",
"else",
"if",
"(",
"ToolId",
".",
"TOOL_FEATURE_INFO",
".",
"equalsIgnoreCase",
"(",
"id",
")",
")",
"{",
"return",
"createMapController",
"(",
"map",
",",
"new",
"FeatureInfoController",
"(",
"mapWidget",
",",
"3",
")",
",",
"id",
")",
";",
"}",
"else",
"if",
"(",
"ToolId",
".",
"TOOL_SELECTION_MODE",
".",
"equalsIgnoreCase",
"(",
"id",
")",
")",
"{",
"return",
"createMapController",
"(",
"map",
",",
"new",
"SelectionController",
"(",
"mapWidget",
",",
"500",
",",
"0.5f",
",",
"false",
",",
"3",
")",
",",
"id",
")",
";",
"}",
"else",
"if",
"(",
"\"SingleSelectionMode\"",
".",
"equalsIgnoreCase",
"(",
"id",
")",
")",
"{",
"return",
"createMapController",
"(",
"map",
",",
"new",
"SingleSelectionController",
"(",
"mapWidget",
",",
"false",
",",
"3",
")",
",",
"id",
")",
";",
"}",
"else",
"if",
"(",
"ToolId",
".",
"TOOL_EDIT",
".",
"equalsIgnoreCase",
"(",
"id",
")",
")",
"{",
"return",
"createMapController",
"(",
"map",
",",
"new",
"ParentEditController",
"(",
"mapWidget",
")",
",",
"id",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Create a known controller for the map. Different implementations may 'know' different controllers, so it's best
to check with the implementing class.
@param map
The onto which the controller should be applied.
@param id
The unique ID for the map controller (implementation specific).
@return The map controller, or null if it could not be found.
|
[
"Create",
"a",
"known",
"controller",
"for",
"the",
"map",
".",
"Different",
"implementations",
"may",
"know",
"different",
"controllers",
"so",
"it",
"s",
"best",
"to",
"check",
"with",
"the",
"implementing",
"class",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java#L201-L218
|
147,197
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java
|
LineSegment.getLength
|
public double getLength() {
double deltaX = this.c2.getX() - this.c1.getX();
double deltaY = this.c2.getY() - this.c1.getY();
return Math.sqrt(deltaX * deltaX + deltaY * deltaY);
}
|
java
|
public double getLength() {
double deltaX = this.c2.getX() - this.c1.getX();
double deltaY = this.c2.getY() - this.c1.getY();
return Math.sqrt(deltaX * deltaX + deltaY * deltaY);
}
|
[
"public",
"double",
"getLength",
"(",
")",
"{",
"double",
"deltaX",
"=",
"this",
".",
"c2",
".",
"getX",
"(",
")",
"-",
"this",
".",
"c1",
".",
"getX",
"(",
")",
";",
"double",
"deltaY",
"=",
"this",
".",
"c2",
".",
"getY",
"(",
")",
"-",
"this",
".",
"c1",
".",
"getY",
"(",
")",
";",
"return",
"Math",
".",
"sqrt",
"(",
"deltaX",
"*",
"deltaX",
"+",
"deltaY",
"*",
"deltaY",
")",
";",
"}"
] |
Return the length of the linesegment.
|
[
"Return",
"the",
"length",
"of",
"the",
"linesegment",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java#L55-L59
|
147,198
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java
|
LineSegment.getMiddlePoint
|
public Coordinate getMiddlePoint() {
double x = this.x1() + 0.5 * (this.x2() - this.x1());
double y = this.y1() + 0.5 * (this.y2() - this.y1());
return new Coordinate(x, y);
}
|
java
|
public Coordinate getMiddlePoint() {
double x = this.x1() + 0.5 * (this.x2() - this.x1());
double y = this.y1() + 0.5 * (this.y2() - this.y1());
return new Coordinate(x, y);
}
|
[
"public",
"Coordinate",
"getMiddlePoint",
"(",
")",
"{",
"double",
"x",
"=",
"this",
".",
"x1",
"(",
")",
"+",
"0.5",
"*",
"(",
"this",
".",
"x2",
"(",
")",
"-",
"this",
".",
"x1",
"(",
")",
")",
";",
"double",
"y",
"=",
"this",
".",
"y1",
"(",
")",
"+",
"0.5",
"*",
"(",
"this",
".",
"y2",
"(",
")",
"-",
"this",
".",
"y1",
"(",
")",
")",
";",
"return",
"new",
"Coordinate",
"(",
"x",
",",
"y",
")",
";",
"}"
] |
Return the middle point of this linesegment.
|
[
"Return",
"the",
"middle",
"point",
"of",
"this",
"linesegment",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java#L64-L68
|
147,199
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java
|
LineSegment.distance
|
public double distance(Coordinate c) {
Coordinate nearest = this.nearest(c);
LineSegment ls = new LineSegment(c, nearest);
return ls.getLength();
}
|
java
|
public double distance(Coordinate c) {
Coordinate nearest = this.nearest(c);
LineSegment ls = new LineSegment(c, nearest);
return ls.getLength();
}
|
[
"public",
"double",
"distance",
"(",
"Coordinate",
"c",
")",
"{",
"Coordinate",
"nearest",
"=",
"this",
".",
"nearest",
"(",
"c",
")",
";",
"LineSegment",
"ls",
"=",
"new",
"LineSegment",
"(",
"c",
",",
"nearest",
")",
";",
"return",
"ls",
".",
"getLength",
"(",
")",
";",
"}"
] |
Return the distance from a point to this linesegment. If the point is not perpendicular to the linesegment, the
closest endpoint will be returned.
@param c
The {@link Coordinate} to check distance from.
|
[
"Return",
"the",
"distance",
"from",
"a",
"point",
"to",
"this",
"linesegment",
".",
"If",
"the",
"point",
"is",
"not",
"perpendicular",
"to",
"the",
"linesegment",
"the",
"closest",
"endpoint",
"will",
"be",
"returned",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java#L77-L81
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.