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,400
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/ScaleBar.java
ScaleBar.initialize
public void initialize(UnitType unitType, double unitLength, Coordinate position) { if (null == unitType) { throw new IllegalArgumentException("please provide a unitType"); } this.unitType = unitType; this.unitLength = unitLength; backGround = new Rectangle((null == getId() ? "" : getId() + "-bg")); backGround.setBounds(new Bbox(0, 0, 5, MARKER_HEIGHT + 2 * VERTICAL_PADDING)); backGround.setStyle(STYLE_BACKGROUND); leftMarker = new Rectangle((null == getId() ? "" : getId() + "-lm")); leftMarker.setStyle(STYLE_MARKER); leftMarker.setBounds(new Bbox(0, 0, 1, MARKER_HEIGHT)); rightMarker = new Rectangle((null == getId() ? "" : getId() + "-rm")); rightMarker.setStyle(STYLE_MARKER); rightMarker.setBounds(new Bbox(0, 0, 1, MARKER_HEIGHT)); bottomLine = new Rectangle((null == getId() ? "" : getId() + "-bm")); bottomLine.setStyle(STYLE_MARKER); bottomLine.setBounds(new Bbox(0, 0, 0, 1)); distance = new Text((null == getId() ? "" : getId() + "-text")); distance.setStyle(STYLE_FONT); dummy = new Rectangle(getId() + "-dummy"); dummy.setStyle(new ShapeStyle("#FFFFFF", 0, "#FFFFFF", 0, 0)); dummy.setBounds(new Bbox(0, 0, 1, 1)); }
java
public void initialize(UnitType unitType, double unitLength, Coordinate position) { if (null == unitType) { throw new IllegalArgumentException("please provide a unitType"); } this.unitType = unitType; this.unitLength = unitLength; backGround = new Rectangle((null == getId() ? "" : getId() + "-bg")); backGround.setBounds(new Bbox(0, 0, 5, MARKER_HEIGHT + 2 * VERTICAL_PADDING)); backGround.setStyle(STYLE_BACKGROUND); leftMarker = new Rectangle((null == getId() ? "" : getId() + "-lm")); leftMarker.setStyle(STYLE_MARKER); leftMarker.setBounds(new Bbox(0, 0, 1, MARKER_HEIGHT)); rightMarker = new Rectangle((null == getId() ? "" : getId() + "-rm")); rightMarker.setStyle(STYLE_MARKER); rightMarker.setBounds(new Bbox(0, 0, 1, MARKER_HEIGHT)); bottomLine = new Rectangle((null == getId() ? "" : getId() + "-bm")); bottomLine.setStyle(STYLE_MARKER); bottomLine.setBounds(new Bbox(0, 0, 0, 1)); distance = new Text((null == getId() ? "" : getId() + "-text")); distance.setStyle(STYLE_FONT); dummy = new Rectangle(getId() + "-dummy"); dummy.setStyle(new ShapeStyle("#FFFFFF", 0, "#FFFFFF", 0, 0)); dummy.setBounds(new Bbox(0, 0, 1, 1)); }
[ "public", "void", "initialize", "(", "UnitType", "unitType", ",", "double", "unitLength", ",", "Coordinate", "position", ")", "{", "if", "(", "null", "==", "unitType", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"please provide a unitType\"", ")", ";", "}", "this", ".", "unitType", "=", "unitType", ";", "this", ".", "unitLength", "=", "unitLength", ";", "backGround", "=", "new", "Rectangle", "(", "(", "null", "==", "getId", "(", ")", "?", "\"\"", ":", "getId", "(", ")", "+", "\"-bg\"", ")", ")", ";", "backGround", ".", "setBounds", "(", "new", "Bbox", "(", "0", ",", "0", ",", "5", ",", "MARKER_HEIGHT", "+", "2", "*", "VERTICAL_PADDING", ")", ")", ";", "backGround", ".", "setStyle", "(", "STYLE_BACKGROUND", ")", ";", "leftMarker", "=", "new", "Rectangle", "(", "(", "null", "==", "getId", "(", ")", "?", "\"\"", ":", "getId", "(", ")", "+", "\"-lm\"", ")", ")", ";", "leftMarker", ".", "setStyle", "(", "STYLE_MARKER", ")", ";", "leftMarker", ".", "setBounds", "(", "new", "Bbox", "(", "0", ",", "0", ",", "1", ",", "MARKER_HEIGHT", ")", ")", ";", "rightMarker", "=", "new", "Rectangle", "(", "(", "null", "==", "getId", "(", ")", "?", "\"\"", ":", "getId", "(", ")", "+", "\"-rm\"", ")", ")", ";", "rightMarker", ".", "setStyle", "(", "STYLE_MARKER", ")", ";", "rightMarker", ".", "setBounds", "(", "new", "Bbox", "(", "0", ",", "0", ",", "1", ",", "MARKER_HEIGHT", ")", ")", ";", "bottomLine", "=", "new", "Rectangle", "(", "(", "null", "==", "getId", "(", ")", "?", "\"\"", ":", "getId", "(", ")", "+", "\"-bm\"", ")", ")", ";", "bottomLine", ".", "setStyle", "(", "STYLE_MARKER", ")", ";", "bottomLine", ".", "setBounds", "(", "new", "Bbox", "(", "0", ",", "0", ",", "0", ",", "1", ")", ")", ";", "distance", "=", "new", "Text", "(", "(", "null", "==", "getId", "(", ")", "?", "\"\"", ":", "getId", "(", ")", "+", "\"-text\"", ")", ")", ";", "distance", ".", "setStyle", "(", "STYLE_FONT", ")", ";", "dummy", "=", "new", "Rectangle", "(", "getId", "(", ")", "+", "\"-dummy\"", ")", ";", "dummy", ".", "setStyle", "(", "new", "ShapeStyle", "(", "\"#FFFFFF\"", ",", "0", ",", "\"#FFFFFF\"", ",", "0", ",", "0", ")", ")", ";", "dummy", ".", "setBounds", "(", "new", "Bbox", "(", "0", ",", "0", ",", "1", ",", "1", ")", ")", ";", "}" ]
Initialize scale bar. @param unitType how are units shown (english/metric/crs) @param unitLength length of a unit in meter @param position coordinate where scalebar should be drawn on the graphics context
[ "Initialize", "scale", "bar", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/ScaleBar.java#L143-L170
147,401
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/ScaleBar.java
ScaleBar.setMapSize
public void setMapSize(int mapWidth, int mapHeight) { super.setMapSize(mapWidth, mapHeight); if (null == unitType) { throw new IllegalStateException("Please initialize scale bar before using"); } backGround.getBounds().setX(getUpperLeftCorner().getX()); backGround.getBounds().setY(getUpperLeftCorner().getY()); bottomLine.getBounds().setX(getUpperLeftCorner().getX() + HORIZONTAL_PADDING); bottomLine.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING + MARKER_HEIGHT); leftMarker.getBounds().setX(getUpperLeftCorner().getX() + HORIZONTAL_PADDING); leftMarker.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING); rightMarker.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING); distance.setPosition(new Coordinate(getUpperLeftCorner().getX() + HORIZONTAL_PADDING + 6, getUpperLeftCorner().getY() + VERTICAL_PADDING)); }
java
public void setMapSize(int mapWidth, int mapHeight) { super.setMapSize(mapWidth, mapHeight); if (null == unitType) { throw new IllegalStateException("Please initialize scale bar before using"); } backGround.getBounds().setX(getUpperLeftCorner().getX()); backGround.getBounds().setY(getUpperLeftCorner().getY()); bottomLine.getBounds().setX(getUpperLeftCorner().getX() + HORIZONTAL_PADDING); bottomLine.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING + MARKER_HEIGHT); leftMarker.getBounds().setX(getUpperLeftCorner().getX() + HORIZONTAL_PADDING); leftMarker.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING); rightMarker.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING); distance.setPosition(new Coordinate(getUpperLeftCorner().getX() + HORIZONTAL_PADDING + 6, getUpperLeftCorner().getY() + VERTICAL_PADDING)); }
[ "public", "void", "setMapSize", "(", "int", "mapWidth", ",", "int", "mapHeight", ")", "{", "super", ".", "setMapSize", "(", "mapWidth", ",", "mapHeight", ")", ";", "if", "(", "null", "==", "unitType", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Please initialize scale bar before using\"", ")", ";", "}", "backGround", ".", "getBounds", "(", ")", ".", "setX", "(", "getUpperLeftCorner", "(", ")", ".", "getX", "(", ")", ")", ";", "backGround", ".", "getBounds", "(", ")", ".", "setY", "(", "getUpperLeftCorner", "(", ")", ".", "getY", "(", ")", ")", ";", "bottomLine", ".", "getBounds", "(", ")", ".", "setX", "(", "getUpperLeftCorner", "(", ")", ".", "getX", "(", ")", "+", "HORIZONTAL_PADDING", ")", ";", "bottomLine", ".", "getBounds", "(", ")", ".", "setY", "(", "getUpperLeftCorner", "(", ")", ".", "getY", "(", ")", "+", "VERTICAL_PADDING", "+", "MARKER_HEIGHT", ")", ";", "leftMarker", ".", "getBounds", "(", ")", ".", "setX", "(", "getUpperLeftCorner", "(", ")", ".", "getX", "(", ")", "+", "HORIZONTAL_PADDING", ")", ";", "leftMarker", ".", "getBounds", "(", ")", ".", "setY", "(", "getUpperLeftCorner", "(", ")", ".", "getY", "(", ")", "+", "VERTICAL_PADDING", ")", ";", "rightMarker", ".", "getBounds", "(", ")", ".", "setY", "(", "getUpperLeftCorner", "(", ")", ".", "getY", "(", ")", "+", "VERTICAL_PADDING", ")", ";", "distance", ".", "setPosition", "(", "new", "Coordinate", "(", "getUpperLeftCorner", "(", ")", ".", "getX", "(", ")", "+", "HORIZONTAL_PADDING", "+", "6", ",", "getUpperLeftCorner", "(", ")", ".", "getY", "(", ")", "+", "VERTICAL_PADDING", ")", ")", ";", "}" ]
Set map size. @param mapWidth map width @param mapHeight map height
[ "Set", "map", "size", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/ScaleBar.java#L212-L226
147,402
geomajas/geomajas-project-client-gwt
plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/util/LayerIconUtil.java
LayerIconUtil.getSmallLayerIcon
public static Img getSmallLayerIcon(Layer<?> layer) { String url = getSmallLayerIconUrl(layer); if (url != null) { return new Img(url); } else { return null; } }
java
public static Img getSmallLayerIcon(Layer<?> layer) { String url = getSmallLayerIconUrl(layer); if (url != null) { return new Img(url); } else { return null; } }
[ "public", "static", "Img", "getSmallLayerIcon", "(", "Layer", "<", "?", ">", "layer", ")", "{", "String", "url", "=", "getSmallLayerIconUrl", "(", "layer", ")", ";", "if", "(", "url", "!=", "null", ")", "{", "return", "new", "Img", "(", "url", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Get small layer icon as image. @param layer layer @return image
[ "Get", "small", "layer", "icon", "as", "image", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/util/LayerIconUtil.java#L39-L46
147,403
geomajas/geomajas-project-client-gwt
plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/util/LayerIconUtil.java
LayerIconUtil.getSmallLayerIconUrl
public static String getSmallLayerIconUrl(Layer<?> layer) { ClientExtraLayerInfo eli = (ClientExtraLayerInfo) layer.getLayerInfo().getWidgetInfo( ClientExtraLayerInfo.IDENTIFIER); if (eli != null && eli.getSmallLayerIconUrl() != null && !"".equals(eli.getSmallLayerIconUrl())) { return eli.getSmallLayerIconUrl(); } else { return null; } }
java
public static String getSmallLayerIconUrl(Layer<?> layer) { ClientExtraLayerInfo eli = (ClientExtraLayerInfo) layer.getLayerInfo().getWidgetInfo( ClientExtraLayerInfo.IDENTIFIER); if (eli != null && eli.getSmallLayerIconUrl() != null && !"".equals(eli.getSmallLayerIconUrl())) { return eli.getSmallLayerIconUrl(); } else { return null; } }
[ "public", "static", "String", "getSmallLayerIconUrl", "(", "Layer", "<", "?", ">", "layer", ")", "{", "ClientExtraLayerInfo", "eli", "=", "(", "ClientExtraLayerInfo", ")", "layer", ".", "getLayerInfo", "(", ")", ".", "getWidgetInfo", "(", "ClientExtraLayerInfo", ".", "IDENTIFIER", ")", ";", "if", "(", "eli", "!=", "null", "&&", "eli", ".", "getSmallLayerIconUrl", "(", ")", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "eli", ".", "getSmallLayerIconUrl", "(", ")", ")", ")", "{", "return", "eli", ".", "getSmallLayerIconUrl", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Get small layer image URL. @param layer layer @return image URL
[ "Get", "small", "layer", "image", "URL", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/util/LayerIconUtil.java#L55-L63
147,404
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/toolbar/PanToSelectionAction.java
PanToSelectionAction.onClick
public void onClick(ClickEvent clickEvent) { List<Feature> features = new ArrayList<Feature>(); for (VectorLayer layer : mapWidget.getMapModel().getVectorLayers()) { features.addAll(layer.getSelectedFeatureValues()); } // only zoom when there where really some items selected if (features.size() > 0) { mapWidget.getMapModel().panToFeatures(features); } }
java
public void onClick(ClickEvent clickEvent) { List<Feature> features = new ArrayList<Feature>(); for (VectorLayer layer : mapWidget.getMapModel().getVectorLayers()) { features.addAll(layer.getSelectedFeatureValues()); } // only zoom when there where really some items selected if (features.size() > 0) { mapWidget.getMapModel().panToFeatures(features); } }
[ "public", "void", "onClick", "(", "ClickEvent", "clickEvent", ")", "{", "List", "<", "Feature", ">", "features", "=", "new", "ArrayList", "<", "Feature", ">", "(", ")", ";", "for", "(", "VectorLayer", "layer", ":", "mapWidget", ".", "getMapModel", "(", ")", ".", "getVectorLayers", "(", ")", ")", "{", "features", ".", "addAll", "(", "layer", ".", "getSelectedFeatureValues", "(", ")", ")", ";", "}", "// only zoom when there where really some items selected", "if", "(", "features", ".", "size", "(", ")", ">", "0", ")", "{", "mapWidget", ".", "getMapModel", "(", ")", ".", "panToFeatures", "(", "features", ")", ";", "}", "}" ]
Pan to the selected features.
[ "Pan", "to", "the", "selected", "features", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/toolbar/PanToSelectionAction.java#L44-L53
147,405
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/Legend.java
Legend.render
public void render() { removeMembers(getMembers()); // Then go over all layers, to draw styles: for (Layer<?> layer : mapModel.getLayers()) { if (staticLegend || layer.isShowing()) { // Go over every truly visible layer: if (layer instanceof VectorLayer) { ClientVectorLayerInfo layerInfo = ((VectorLayer) layer).getLayerInfo(); // For vector layer; loop over the style definitions: UserStyleInfo userStyle = layerInfo.getNamedStyleInfo().getUserStyle(); FeatureTypeStyleInfo info = userStyle.getFeatureTypeStyleList().get(0); for (int i = 0; i < info.getRuleList().size(); i++) { RuleInfo rule = info.getRuleList().get(i); // use title if present, name if not String title = (rule.getTitle() != null ? rule.getTitle() : rule.getName()); // fall back to style name if (title == null) { title = layerInfo.getNamedStyleInfo().getName(); } addVector((VectorLayer) layer, i, title); } } else if (layer instanceof RasterLayer) { addRaster((RasterLayer) layer); } } } }
java
public void render() { removeMembers(getMembers()); // Then go over all layers, to draw styles: for (Layer<?> layer : mapModel.getLayers()) { if (staticLegend || layer.isShowing()) { // Go over every truly visible layer: if (layer instanceof VectorLayer) { ClientVectorLayerInfo layerInfo = ((VectorLayer) layer).getLayerInfo(); // For vector layer; loop over the style definitions: UserStyleInfo userStyle = layerInfo.getNamedStyleInfo().getUserStyle(); FeatureTypeStyleInfo info = userStyle.getFeatureTypeStyleList().get(0); for (int i = 0; i < info.getRuleList().size(); i++) { RuleInfo rule = info.getRuleList().get(i); // use title if present, name if not String title = (rule.getTitle() != null ? rule.getTitle() : rule.getName()); // fall back to style name if (title == null) { title = layerInfo.getNamedStyleInfo().getName(); } addVector((VectorLayer) layer, i, title); } } else if (layer instanceof RasterLayer) { addRaster((RasterLayer) layer); } } } }
[ "public", "void", "render", "(", ")", "{", "removeMembers", "(", "getMembers", "(", ")", ")", ";", "// Then go over all layers, to draw styles:", "for", "(", "Layer", "<", "?", ">", "layer", ":", "mapModel", ".", "getLayers", "(", ")", ")", "{", "if", "(", "staticLegend", "||", "layer", ".", "isShowing", "(", ")", ")", "{", "// Go over every truly visible layer:", "if", "(", "layer", "instanceof", "VectorLayer", ")", "{", "ClientVectorLayerInfo", "layerInfo", "=", "(", "(", "VectorLayer", ")", "layer", ")", ".", "getLayerInfo", "(", ")", ";", "// For vector layer; loop over the style definitions:", "UserStyleInfo", "userStyle", "=", "layerInfo", ".", "getNamedStyleInfo", "(", ")", ".", "getUserStyle", "(", ")", ";", "FeatureTypeStyleInfo", "info", "=", "userStyle", ".", "getFeatureTypeStyleList", "(", ")", ".", "get", "(", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "info", ".", "getRuleList", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "RuleInfo", "rule", "=", "info", ".", "getRuleList", "(", ")", ".", "get", "(", "i", ")", ";", "// use title if present, name if not", "String", "title", "=", "(", "rule", ".", "getTitle", "(", ")", "!=", "null", "?", "rule", ".", "getTitle", "(", ")", ":", "rule", ".", "getName", "(", ")", ")", ";", "// fall back to style name", "if", "(", "title", "==", "null", ")", "{", "title", "=", "layerInfo", ".", "getNamedStyleInfo", "(", ")", ".", "getName", "(", ")", ";", "}", "addVector", "(", "(", "VectorLayer", ")", "layer", ",", "i", ",", "title", ")", ";", "}", "}", "else", "if", "(", "layer", "instanceof", "RasterLayer", ")", "{", "addRaster", "(", "(", "RasterLayer", ")", "layer", ")", ";", "}", "}", "}", "}" ]
Render the legend. This triggers a complete redraw.
[ "Render", "the", "legend", ".", "This", "triggers", "a", "complete", "redraw", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/Legend.java#L111-L138
147,406
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/Legend.java
Legend.initialize
private void initialize() { registrations.clear(); for (Layer<?> layer : mapModel.getLayers()) { registrations.add(layer.addLayerChangedHandler(new LayerChangedHandler() { public void onLabelChange(LayerLabeledEvent event) { } public void onVisibleChange(LayerShownEvent event) { render(); } })); registrations.add(layer.addLayerStyleChangedHandler(new LayerStyleChangedHandler() { public void onLayerStyleChange(LayerStyleChangeEvent event) { render(); } })); } for (final VectorLayer layer : mapModel.getVectorLayers()) { layer.addLayerFilteredHandler(new LayerFilteredHandler() { public void onFilterChange(LayerFilteredEvent event) { render(); } }); } render(); }
java
private void initialize() { registrations.clear(); for (Layer<?> layer : mapModel.getLayers()) { registrations.add(layer.addLayerChangedHandler(new LayerChangedHandler() { public void onLabelChange(LayerLabeledEvent event) { } public void onVisibleChange(LayerShownEvent event) { render(); } })); registrations.add(layer.addLayerStyleChangedHandler(new LayerStyleChangedHandler() { public void onLayerStyleChange(LayerStyleChangeEvent event) { render(); } })); } for (final VectorLayer layer : mapModel.getVectorLayers()) { layer.addLayerFilteredHandler(new LayerFilteredHandler() { public void onFilterChange(LayerFilteredEvent event) { render(); } }); } render(); }
[ "private", "void", "initialize", "(", ")", "{", "registrations", ".", "clear", "(", ")", ";", "for", "(", "Layer", "<", "?", ">", "layer", ":", "mapModel", ".", "getLayers", "(", ")", ")", "{", "registrations", ".", "add", "(", "layer", ".", "addLayerChangedHandler", "(", "new", "LayerChangedHandler", "(", ")", "{", "public", "void", "onLabelChange", "(", "LayerLabeledEvent", "event", ")", "{", "}", "public", "void", "onVisibleChange", "(", "LayerShownEvent", "event", ")", "{", "render", "(", ")", ";", "}", "}", ")", ")", ";", "registrations", ".", "add", "(", "layer", ".", "addLayerStyleChangedHandler", "(", "new", "LayerStyleChangedHandler", "(", ")", "{", "public", "void", "onLayerStyleChange", "(", "LayerStyleChangeEvent", "event", ")", "{", "render", "(", ")", ";", "}", "}", ")", ")", ";", "}", "for", "(", "final", "VectorLayer", "layer", ":", "mapModel", ".", "getVectorLayers", "(", ")", ")", "{", "layer", ".", "addLayerFilteredHandler", "(", "new", "LayerFilteredHandler", "(", ")", "{", "public", "void", "onFilterChange", "(", "LayerFilteredEvent", "event", ")", "{", "render", "(", ")", ";", "}", "}", ")", ";", "}", "render", "(", ")", ";", "}" ]
Called when the MapModel configuration has been loaded.
[ "Called", "when", "the", "MapModel", "configuration", "has", "been", "loaded", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/Legend.java#L210-L239
147,407
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/Legend.java
Legend.onUnload
protected void onUnload() { if (registrations != null) { for (HandlerRegistration registration : registrations) { registration.removeHandler(); } } loadedRegistration.removeHandler(); super.onUnload(); }
java
protected void onUnload() { if (registrations != null) { for (HandlerRegistration registration : registrations) { registration.removeHandler(); } } loadedRegistration.removeHandler(); super.onUnload(); }
[ "protected", "void", "onUnload", "(", ")", "{", "if", "(", "registrations", "!=", "null", ")", "{", "for", "(", "HandlerRegistration", "registration", ":", "registrations", ")", "{", "registration", ".", "removeHandler", "(", ")", ";", "}", "}", "loadedRegistration", ".", "removeHandler", "(", ")", ";", "super", ".", "onUnload", "(", ")", ";", "}" ]
Remove all handlers on unload.
[ "Remove", "all", "handlers", "on", "unload", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/Legend.java#L242-L250
147,408
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java
MeasureDistanceController.onActivate
public void onActivate() { menu = new Menu(); menu.addItem(new CancelMeasuringAction(this)); Layer selectedLayer = mapWidget.getMapModel().getSelectedLayer(); if (selectedLayer instanceof VectorLayer) { menu.addItem(new ToggleSnappingAction((VectorLayer) selectedLayer, this)); } mapWidget.setContextMenu(menu); }
java
public void onActivate() { menu = new Menu(); menu.addItem(new CancelMeasuringAction(this)); Layer selectedLayer = mapWidget.getMapModel().getSelectedLayer(); if (selectedLayer instanceof VectorLayer) { menu.addItem(new ToggleSnappingAction((VectorLayer) selectedLayer, this)); } mapWidget.setContextMenu(menu); }
[ "public", "void", "onActivate", "(", ")", "{", "menu", "=", "new", "Menu", "(", ")", ";", "menu", ".", "addItem", "(", "new", "CancelMeasuringAction", "(", "this", ")", ")", ";", "Layer", "selectedLayer", "=", "mapWidget", ".", "getMapModel", "(", ")", ".", "getSelectedLayer", "(", ")", ";", "if", "(", "selectedLayer", "instanceof", "VectorLayer", ")", "{", "menu", ".", "addItem", "(", "new", "ToggleSnappingAction", "(", "(", "VectorLayer", ")", "selectedLayer", ",", "this", ")", ")", ";", "}", "mapWidget", ".", "setContextMenu", "(", "menu", ")", ";", "}" ]
Create the context menu for this controller.
[ "Create", "the", "context", "menu", "for", "this", "controller", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java#L130-L138
147,409
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java
MeasureDistanceController.onDeactivate
public void onDeactivate() { onDoubleClick(null); menu.destroy(); menu = null; mapWidget.setContextMenu(null); mapWidget.unregisterWorldPaintable(distanceLine); mapWidget.unregisterWorldPaintable(lineSegment); }
java
public void onDeactivate() { onDoubleClick(null); menu.destroy(); menu = null; mapWidget.setContextMenu(null); mapWidget.unregisterWorldPaintable(distanceLine); mapWidget.unregisterWorldPaintable(lineSegment); }
[ "public", "void", "onDeactivate", "(", ")", "{", "onDoubleClick", "(", "null", ")", ";", "menu", ".", "destroy", "(", ")", ";", "menu", "=", "null", ";", "mapWidget", ".", "setContextMenu", "(", "null", ")", ";", "mapWidget", ".", "unregisterWorldPaintable", "(", "distanceLine", ")", ";", "mapWidget", ".", "unregisterWorldPaintable", "(", "lineSegment", ")", ";", "}" ]
Clean everything up.
[ "Clean", "everything", "up", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java#L141-L148
147,410
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java
MeasureDistanceController.onMouseUp
public void onMouseUp(MouseUpEvent event) { if (event.getNativeButton() != NativeEvent.BUTTON_RIGHT) { Coordinate coordinate = getWorldPosition(event); if (distanceLine.getOriginalLocation() == null) { distanceLine.setGeometry(getFactory().createLineString(new Coordinate[] { coordinate })); mapWidget.registerWorldPaintable(distanceLine); mapWidget.registerWorldPaintable(lineSegment); dispatchState(State.START); } else { Geometry geometry = (Geometry) distanceLine.getOriginalLocation(); InsertCoordinateOperation op = new InsertCoordinateOperation(geometry.getNumPoints(), coordinate); geometry = op.execute(geometry); distanceLine.setGeometry(geometry); tempLength = (float) geometry.getLength(); updateMeasure(event, true); dispatchState(State.CLICK); } mapWidget.render(mapWidget.getMapModel(), RenderGroup.VECTOR, RenderStatus.UPDATE); } }
java
public void onMouseUp(MouseUpEvent event) { if (event.getNativeButton() != NativeEvent.BUTTON_RIGHT) { Coordinate coordinate = getWorldPosition(event); if (distanceLine.getOriginalLocation() == null) { distanceLine.setGeometry(getFactory().createLineString(new Coordinate[] { coordinate })); mapWidget.registerWorldPaintable(distanceLine); mapWidget.registerWorldPaintable(lineSegment); dispatchState(State.START); } else { Geometry geometry = (Geometry) distanceLine.getOriginalLocation(); InsertCoordinateOperation op = new InsertCoordinateOperation(geometry.getNumPoints(), coordinate); geometry = op.execute(geometry); distanceLine.setGeometry(geometry); tempLength = (float) geometry.getLength(); updateMeasure(event, true); dispatchState(State.CLICK); } mapWidget.render(mapWidget.getMapModel(), RenderGroup.VECTOR, RenderStatus.UPDATE); } }
[ "public", "void", "onMouseUp", "(", "MouseUpEvent", "event", ")", "{", "if", "(", "event", ".", "getNativeButton", "(", ")", "!=", "NativeEvent", ".", "BUTTON_RIGHT", ")", "{", "Coordinate", "coordinate", "=", "getWorldPosition", "(", "event", ")", ";", "if", "(", "distanceLine", ".", "getOriginalLocation", "(", ")", "==", "null", ")", "{", "distanceLine", ".", "setGeometry", "(", "getFactory", "(", ")", ".", "createLineString", "(", "new", "Coordinate", "[", "]", "{", "coordinate", "}", ")", ")", ";", "mapWidget", ".", "registerWorldPaintable", "(", "distanceLine", ")", ";", "mapWidget", ".", "registerWorldPaintable", "(", "lineSegment", ")", ";", "dispatchState", "(", "State", ".", "START", ")", ";", "}", "else", "{", "Geometry", "geometry", "=", "(", "Geometry", ")", "distanceLine", ".", "getOriginalLocation", "(", ")", ";", "InsertCoordinateOperation", "op", "=", "new", "InsertCoordinateOperation", "(", "geometry", ".", "getNumPoints", "(", ")", ",", "coordinate", ")", ";", "geometry", "=", "op", ".", "execute", "(", "geometry", ")", ";", "distanceLine", ".", "setGeometry", "(", "geometry", ")", ";", "tempLength", "=", "(", "float", ")", "geometry", ".", "getLength", "(", ")", ";", "updateMeasure", "(", "event", ",", "true", ")", ";", "dispatchState", "(", "State", ".", "CLICK", ")", ";", "}", "mapWidget", ".", "render", "(", "mapWidget", ".", "getMapModel", "(", ")", ",", "RenderGroup", ".", "VECTOR", ",", "RenderStatus", ".", "UPDATE", ")", ";", "}", "}" ]
Set a new point on the distance-line.
[ "Set", "a", "new", "point", "on", "the", "distance", "-", "line", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java#L151-L170
147,411
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java
MeasureDistanceController.onMouseMove
public void onMouseMove(MouseMoveEvent event) { if (isMeasuring() && distanceLine.getOriginalLocation() != null) { updateMeasure(event, false); dispatchState(State.MOVE); } }
java
public void onMouseMove(MouseMoveEvent event) { if (isMeasuring() && distanceLine.getOriginalLocation() != null) { updateMeasure(event, false); dispatchState(State.MOVE); } }
[ "public", "void", "onMouseMove", "(", "MouseMoveEvent", "event", ")", "{", "if", "(", "isMeasuring", "(", ")", "&&", "distanceLine", ".", "getOriginalLocation", "(", ")", "!=", "null", ")", "{", "updateMeasure", "(", "event", ",", "false", ")", ";", "dispatchState", "(", "State", ".", "MOVE", ")", ";", "}", "}" ]
Update the drawing while moving the mouse.
[ "Update", "the", "drawing", "while", "moving", "the", "mouse", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java#L173-L178
147,412
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java
MeasureDistanceController.onDoubleClick
public void onDoubleClick(DoubleClickEvent event) { tempLength = 0; mapWidget.unregisterWorldPaintable(distanceLine); mapWidget.unregisterWorldPaintable(lineSegment); distanceLine.setGeometry(null); lineSegment.setGeometry(null); if (panel != null) { panel.destroy(); } dispatchState(State.STOP); }
java
public void onDoubleClick(DoubleClickEvent event) { tempLength = 0; mapWidget.unregisterWorldPaintable(distanceLine); mapWidget.unregisterWorldPaintable(lineSegment); distanceLine.setGeometry(null); lineSegment.setGeometry(null); if (panel != null) { panel.destroy(); } dispatchState(State.STOP); }
[ "public", "void", "onDoubleClick", "(", "DoubleClickEvent", "event", ")", "{", "tempLength", "=", "0", ";", "mapWidget", ".", "unregisterWorldPaintable", "(", "distanceLine", ")", ";", "mapWidget", ".", "unregisterWorldPaintable", "(", "lineSegment", ")", ";", "distanceLine", ".", "setGeometry", "(", "null", ")", ";", "lineSegment", ".", "setGeometry", "(", "null", ")", ";", "if", "(", "panel", "!=", "null", ")", "{", "panel", ".", "destroy", "(", ")", ";", "}", "dispatchState", "(", "State", ".", "STOP", ")", ";", "}" ]
Stop the measuring, and remove all graphics from the map.
[ "Stop", "the", "measuring", "and", "remove", "all", "graphics", "from", "the", "map", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/MeasureDistanceController.java#L181-L191
147,413
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/feature/FeatureSearchServiceImpl.java
FeatureSearchServiceImpl.searchById
public void searchById(final FeaturesSupported layer, final String[] ids, final FeatureArrayCallback callback) { Layer<?> gwtLayer = map.getMapWidget().getMapModel().getLayer(layer.getId()); if (gwtLayer != null && gwtLayer instanceof VectorLayer) { VectorLayer vLayer = (VectorLayer) gwtLayer; SearchCriterion[] criteria = new SearchCriterion[ids.length]; for (int i = 0; i < ids.length; i++) { criteria[i] = new SearchCriterion(SearchFeatureRequest.ID_ATTRIBUTE, "=", ids[i]); } SearchFeatureRequest request = new SearchFeatureRequest(); request.setBooleanOperator("OR"); request.setCrs(map.getMapWidget().getMapModel().getCrs()); request.setLayerId(vLayer.getServerLayerId()); request.setMax(ids.length); request.setFilter(layer.getFilter()); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL); request.setCriteria(criteria); GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { if (response.getFeatures() != null && response.getFeatures().length > 0) { Feature[] features = new Feature[response.getFeatures().length]; for (int i = 0; i < response.getFeatures().length; i++) { features[i] = new FeatureImpl(response.getFeatures()[i], layer); } callback.execute(new FeatureArrayHolder(features)); } } }); } }
java
public void searchById(final FeaturesSupported layer, final String[] ids, final FeatureArrayCallback callback) { Layer<?> gwtLayer = map.getMapWidget().getMapModel().getLayer(layer.getId()); if (gwtLayer != null && gwtLayer instanceof VectorLayer) { VectorLayer vLayer = (VectorLayer) gwtLayer; SearchCriterion[] criteria = new SearchCriterion[ids.length]; for (int i = 0; i < ids.length; i++) { criteria[i] = new SearchCriterion(SearchFeatureRequest.ID_ATTRIBUTE, "=", ids[i]); } SearchFeatureRequest request = new SearchFeatureRequest(); request.setBooleanOperator("OR"); request.setCrs(map.getMapWidget().getMapModel().getCrs()); request.setLayerId(vLayer.getServerLayerId()); request.setMax(ids.length); request.setFilter(layer.getFilter()); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL); request.setCriteria(criteria); GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { if (response.getFeatures() != null && response.getFeatures().length > 0) { Feature[] features = new Feature[response.getFeatures().length]; for (int i = 0; i < response.getFeatures().length; i++) { features[i] = new FeatureImpl(response.getFeatures()[i], layer); } callback.execute(new FeatureArrayHolder(features)); } } }); } }
[ "public", "void", "searchById", "(", "final", "FeaturesSupported", "layer", ",", "final", "String", "[", "]", "ids", ",", "final", "FeatureArrayCallback", "callback", ")", "{", "Layer", "<", "?", ">", "gwtLayer", "=", "map", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(", ")", ".", "getLayer", "(", "layer", ".", "getId", "(", ")", ")", ";", "if", "(", "gwtLayer", "!=", "null", "&&", "gwtLayer", "instanceof", "VectorLayer", ")", "{", "VectorLayer", "vLayer", "=", "(", "VectorLayer", ")", "gwtLayer", ";", "SearchCriterion", "[", "]", "criteria", "=", "new", "SearchCriterion", "[", "ids", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ids", ".", "length", ";", "i", "++", ")", "{", "criteria", "[", "i", "]", "=", "new", "SearchCriterion", "(", "SearchFeatureRequest", ".", "ID_ATTRIBUTE", ",", "\"=\"", ",", "ids", "[", "i", "]", ")", ";", "}", "SearchFeatureRequest", "request", "=", "new", "SearchFeatureRequest", "(", ")", ";", "request", ".", "setBooleanOperator", "(", "\"OR\"", ")", ";", "request", ".", "setCrs", "(", "map", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(", ")", ".", "getCrs", "(", ")", ")", ";", "request", ".", "setLayerId", "(", "vLayer", ".", "getServerLayerId", "(", ")", ")", ";", "request", ".", "setMax", "(", "ids", ".", "length", ")", ";", "request", ".", "setFilter", "(", "layer", ".", "getFilter", "(", ")", ")", ";", "request", ".", "setFeatureIncludes", "(", "GeomajasConstant", ".", "FEATURE_INCLUDE_ALL", ")", ";", "request", ".", "setCriteria", "(", "criteria", ")", ";", "GwtCommand", "command", "=", "new", "GwtCommand", "(", "SearchFeatureRequest", ".", "COMMAND", ")", ";", "command", ".", "setCommandRequest", "(", "request", ")", ";", "GwtCommandDispatcher", ".", "getInstance", "(", ")", ".", "execute", "(", "command", ",", "new", "AbstractCommandCallback", "<", "SearchFeatureResponse", ">", "(", ")", "{", "public", "void", "execute", "(", "SearchFeatureResponse", "response", ")", "{", "if", "(", "response", ".", "getFeatures", "(", ")", "!=", "null", "&&", "response", ".", "getFeatures", "(", ")", ".", "length", ">", "0", ")", "{", "Feature", "[", "]", "features", "=", "new", "Feature", "[", "response", ".", "getFeatures", "(", ")", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "response", ".", "getFeatures", "(", ")", ".", "length", ";", "i", "++", ")", "{", "features", "[", "i", "]", "=", "new", "FeatureImpl", "(", "response", ".", "getFeatures", "(", ")", "[", "i", "]", ",", "layer", ")", ";", "}", "callback", ".", "execute", "(", "new", "FeatureArrayHolder", "(", "features", ")", ")", ";", "}", "}", "}", ")", ";", "}", "}" ]
Search features within a certain layer, using the feature IDs. @param layer The features supported layer wherein to search. @param ids The unique IDs of the feature within the layer. @param callback Call-back method executed on return (when the feature has been found).
[ "Search", "features", "within", "a", "certain", "layer", "using", "the", "feature", "IDs", "." ]
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/map/feature/FeatureSearchServiceImpl.java#L71-L104
147,414
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/feature/FeatureSearchServiceImpl.java
FeatureSearchServiceImpl.searchInBounds
public void searchInBounds(final FeaturesSupported layer, Bbox bbox, final FeatureArrayCallback callback) { MapModel mapModel = map.getMapWidget().getMapModel(); Layer<?> gwtLayer = mapModel.getLayer(layer.getId()); if (gwtLayer != null && gwtLayer instanceof VectorLayer) { final VectorLayer vLayer = (VectorLayer) gwtLayer; SearchByLocationRequest request = new SearchByLocationRequest(); request.addLayerWithFilter(vLayer.getId(), vLayer.getServerLayerId(), layer.getFilter()); GeometryFactory factory = new GeometryFactory(mapModel.getSrid(), GeometryFactory.PARAM_DEFAULT_PRECISION); org.geomajas.gwt.client.spatial.Bbox box = new org.geomajas.gwt.client.spatial.Bbox(bbox.getX(), bbox.getY(), bbox.getWidth(), bbox.getHeight()); request.setLocation(GeometryConverter.toDto(factory.createPolygon(box))); request.setCrs(mapModel.getCrs()); request.setSearchType(SearchByLocationRequest.QUERY_INTERSECTS); request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL); GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap(); List<org.geomajas.layer.feature.Feature> dtos = featureMap.get(vLayer.getId()); Feature[] features = new Feature[dtos.size()]; for (int i = 0; i < dtos.size(); i++) { features[i] = new FeatureImpl(dtos.get(i), layer); } callback.execute(new FeatureArrayHolder(features)); } }); } }
java
public void searchInBounds(final FeaturesSupported layer, Bbox bbox, final FeatureArrayCallback callback) { MapModel mapModel = map.getMapWidget().getMapModel(); Layer<?> gwtLayer = mapModel.getLayer(layer.getId()); if (gwtLayer != null && gwtLayer instanceof VectorLayer) { final VectorLayer vLayer = (VectorLayer) gwtLayer; SearchByLocationRequest request = new SearchByLocationRequest(); request.addLayerWithFilter(vLayer.getId(), vLayer.getServerLayerId(), layer.getFilter()); GeometryFactory factory = new GeometryFactory(mapModel.getSrid(), GeometryFactory.PARAM_DEFAULT_PRECISION); org.geomajas.gwt.client.spatial.Bbox box = new org.geomajas.gwt.client.spatial.Bbox(bbox.getX(), bbox.getY(), bbox.getWidth(), bbox.getHeight()); request.setLocation(GeometryConverter.toDto(factory.createPolygon(box))); request.setCrs(mapModel.getCrs()); request.setSearchType(SearchByLocationRequest.QUERY_INTERSECTS); request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL); GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap(); List<org.geomajas.layer.feature.Feature> dtos = featureMap.get(vLayer.getId()); Feature[] features = new Feature[dtos.size()]; for (int i = 0; i < dtos.size(); i++) { features[i] = new FeatureImpl(dtos.get(i), layer); } callback.execute(new FeatureArrayHolder(features)); } }); } }
[ "public", "void", "searchInBounds", "(", "final", "FeaturesSupported", "layer", ",", "Bbox", "bbox", ",", "final", "FeatureArrayCallback", "callback", ")", "{", "MapModel", "mapModel", "=", "map", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(", ")", ";", "Layer", "<", "?", ">", "gwtLayer", "=", "mapModel", ".", "getLayer", "(", "layer", ".", "getId", "(", ")", ")", ";", "if", "(", "gwtLayer", "!=", "null", "&&", "gwtLayer", "instanceof", "VectorLayer", ")", "{", "final", "VectorLayer", "vLayer", "=", "(", "VectorLayer", ")", "gwtLayer", ";", "SearchByLocationRequest", "request", "=", "new", "SearchByLocationRequest", "(", ")", ";", "request", ".", "addLayerWithFilter", "(", "vLayer", ".", "getId", "(", ")", ",", "vLayer", ".", "getServerLayerId", "(", ")", ",", "layer", ".", "getFilter", "(", ")", ")", ";", "GeometryFactory", "factory", "=", "new", "GeometryFactory", "(", "mapModel", ".", "getSrid", "(", ")", ",", "GeometryFactory", ".", "PARAM_DEFAULT_PRECISION", ")", ";", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "spatial", ".", "Bbox", "box", "=", "new", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "spatial", ".", "Bbox", "(", "bbox", ".", "getX", "(", ")", ",", "bbox", ".", "getY", "(", ")", ",", "bbox", ".", "getWidth", "(", ")", ",", "bbox", ".", "getHeight", "(", ")", ")", ";", "request", ".", "setLocation", "(", "GeometryConverter", ".", "toDto", "(", "factory", ".", "createPolygon", "(", "box", ")", ")", ")", ";", "request", ".", "setCrs", "(", "mapModel", ".", "getCrs", "(", ")", ")", ";", "request", ".", "setSearchType", "(", "SearchByLocationRequest", ".", "QUERY_INTERSECTS", ")", ";", "request", ".", "setSearchType", "(", "SearchByLocationRequest", ".", "SEARCH_ALL_LAYERS", ")", ";", "request", ".", "setFeatureIncludes", "(", "GeomajasConstant", ".", "FEATURE_INCLUDE_ALL", ")", ";", "GwtCommand", "commandRequest", "=", "new", "GwtCommand", "(", "SearchByLocationRequest", ".", "COMMAND", ")", ";", "commandRequest", ".", "setCommandRequest", "(", "request", ")", ";", "GwtCommandDispatcher", ".", "getInstance", "(", ")", ".", "execute", "(", "commandRequest", ",", "new", "AbstractCommandCallback", "<", "SearchByLocationResponse", ">", "(", ")", "{", "public", "void", "execute", "(", "SearchByLocationResponse", "response", ")", "{", "Map", "<", "String", ",", "List", "<", "org", ".", "geomajas", ".", "layer", ".", "feature", ".", "Feature", ">", ">", "featureMap", "=", "response", ".", "getFeatureMap", "(", ")", ";", "List", "<", "org", ".", "geomajas", ".", "layer", ".", "feature", ".", "Feature", ">", "dtos", "=", "featureMap", ".", "get", "(", "vLayer", ".", "getId", "(", ")", ")", ";", "Feature", "[", "]", "features", "=", "new", "Feature", "[", "dtos", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dtos", ".", "size", "(", ")", ";", "i", "++", ")", "{", "features", "[", "i", "]", "=", "new", "FeatureImpl", "(", "dtos", ".", "get", "(", "i", ")", ",", "layer", ")", ";", "}", "callback", ".", "execute", "(", "new", "FeatureArrayHolder", "(", "features", ")", ")", ";", "}", "}", ")", ";", "}", "}" ]
Search all features within a certain layer that intersect a certain bounding box. @param layer The features supported layer wherein to search. @param bbox The bounding box wherein to search. @param callback Call-back method executed on return (when features have been found).
[ "Search", "all", "features", "within", "a", "certain", "layer", "that", "intersect", "a", "certain", "bounding", "box", "." ]
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/map/feature/FeatureSearchServiceImpl.java#L116-L151
147,415
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/layer/VectorLayer.java
VectorLayer.getSelectedFeatures
public Feature[] getSelectedFeatures() { Collection<org.geomajas.gwt.client.map.feature.Feature> selection = getLayer().getSelectedFeatureValues(); Feature[] features = new Feature[selection.size()]; int count = 0; for (org.geomajas.gwt.client.map.feature.Feature feature : selection) { features[count] = new FeatureImpl(feature.toDto(), this); count++; } return features; }
java
public Feature[] getSelectedFeatures() { Collection<org.geomajas.gwt.client.map.feature.Feature> selection = getLayer().getSelectedFeatureValues(); Feature[] features = new Feature[selection.size()]; int count = 0; for (org.geomajas.gwt.client.map.feature.Feature feature : selection) { features[count] = new FeatureImpl(feature.toDto(), this); count++; } return features; }
[ "public", "Feature", "[", "]", "getSelectedFeatures", "(", ")", "{", "Collection", "<", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "map", ".", "feature", ".", "Feature", ">", "selection", "=", "getLayer", "(", ")", ".", "getSelectedFeatureValues", "(", ")", ";", "Feature", "[", "]", "features", "=", "new", "Feature", "[", "selection", ".", "size", "(", ")", "]", ";", "int", "count", "=", "0", ";", "for", "(", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "map", ".", "feature", ".", "Feature", "feature", ":", "selection", ")", "{", "features", "[", "count", "]", "=", "new", "FeatureImpl", "(", "feature", ".", "toDto", "(", ")", ",", "this", ")", ";", "count", "++", ";", "}", "return", "features", ";", "}" ]
Get the full list of currently selected features within this layer. @return The list of selected features as an array.
[ "Get", "the", "full", "list", "of", "currently", "selected", "features", "within", "this", "layer", "." ]
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/map/layer/VectorLayer.java#L130-L139
147,416
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/OverviewMapController.java
OverviewMapController.onMouseMove
@Override public void onMouseMove(MouseMoveEvent event) { if (dragging) { Coordinate current = getScreenPosition(event); getOverviewMap().movePov(current.getX() - previous.getX(), current.getY() - previous.getY()); previous = current; } }
java
@Override public void onMouseMove(MouseMoveEvent event) { if (dragging) { Coordinate current = getScreenPosition(event); getOverviewMap().movePov(current.getX() - previous.getX(), current.getY() - previous.getY()); previous = current; } }
[ "@", "Override", "public", "void", "onMouseMove", "(", "MouseMoveEvent", "event", ")", "{", "if", "(", "dragging", ")", "{", "Coordinate", "current", "=", "getScreenPosition", "(", "event", ")", ";", "getOverviewMap", "(", ")", ".", "movePov", "(", "current", ".", "getX", "(", ")", "-", "previous", ".", "getX", "(", ")", ",", "current", ".", "getY", "(", ")", "-", "previous", ".", "getY", "(", ")", ")", ";", "previous", "=", "current", ";", "}", "}" ]
Only moving rectangle or reticle during drag.
[ "Only", "moving", "rectangle", "or", "reticle", "during", "drag", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/OverviewMapController.java#L52-L59
147,417
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlStyleUtil.java
VmlStyleUtil.applyStyle
public static void applyStyle(Element element, Style style) { if (style != null && element != null) { if (style instanceof ShapeStyle) { applyShapeStyle(element, (ShapeStyle) style); } else if (style instanceof FontStyle) { FontStyle fontStyle = (FontStyle) style; element.getStyle().setProperty("fontSize", "" + fontStyle.getFontSize()); element.getStyle().setProperty("color", fontStyle.getFillColor()); element.getStyle().setProperty("fontFamily", fontStyle.getFontFamily()); element.getStyle().setProperty("fontWeight", fontStyle.getFontWeight()); element.getStyle().setProperty("fontStyle", fontStyle.getFontStyle()); } else if (style instanceof PictureStyle) { PictureStyle picturStyle = (PictureStyle) style; if (SC.isIE()) { //TODO: it's a VML decoder, why make this check? element.getStyle().setProperty("filter", "alpha(opacity=" + 100 * picturStyle.getOpacity() + ")"); } else { element.setAttribute("style", "opacity:" + picturStyle.getOpacity() + ";"); } } } }
java
public static void applyStyle(Element element, Style style) { if (style != null && element != null) { if (style instanceof ShapeStyle) { applyShapeStyle(element, (ShapeStyle) style); } else if (style instanceof FontStyle) { FontStyle fontStyle = (FontStyle) style; element.getStyle().setProperty("fontSize", "" + fontStyle.getFontSize()); element.getStyle().setProperty("color", fontStyle.getFillColor()); element.getStyle().setProperty("fontFamily", fontStyle.getFontFamily()); element.getStyle().setProperty("fontWeight", fontStyle.getFontWeight()); element.getStyle().setProperty("fontStyle", fontStyle.getFontStyle()); } else if (style instanceof PictureStyle) { PictureStyle picturStyle = (PictureStyle) style; if (SC.isIE()) { //TODO: it's a VML decoder, why make this check? element.getStyle().setProperty("filter", "alpha(opacity=" + 100 * picturStyle.getOpacity() + ")"); } else { element.setAttribute("style", "opacity:" + picturStyle.getOpacity() + ";"); } } } }
[ "public", "static", "void", "applyStyle", "(", "Element", "element", ",", "Style", "style", ")", "{", "if", "(", "style", "!=", "null", "&&", "element", "!=", "null", ")", "{", "if", "(", "style", "instanceof", "ShapeStyle", ")", "{", "applyShapeStyle", "(", "element", ",", "(", "ShapeStyle", ")", "style", ")", ";", "}", "else", "if", "(", "style", "instanceof", "FontStyle", ")", "{", "FontStyle", "fontStyle", "=", "(", "FontStyle", ")", "style", ";", "element", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"fontSize\"", ",", "\"\"", "+", "fontStyle", ".", "getFontSize", "(", ")", ")", ";", "element", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"color\"", ",", "fontStyle", ".", "getFillColor", "(", ")", ")", ";", "element", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"fontFamily\"", ",", "fontStyle", ".", "getFontFamily", "(", ")", ")", ";", "element", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"fontWeight\"", ",", "fontStyle", ".", "getFontWeight", "(", ")", ")", ";", "element", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"fontStyle\"", ",", "fontStyle", ".", "getFontStyle", "(", ")", ")", ";", "}", "else", "if", "(", "style", "instanceof", "PictureStyle", ")", "{", "PictureStyle", "picturStyle", "=", "(", "PictureStyle", ")", "style", ";", "if", "(", "SC", ".", "isIE", "(", ")", ")", "{", "//TODO: it's a VML decoder, why make this check?", "element", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"filter\"", ",", "\"alpha(opacity=\"", "+", "100", "*", "picturStyle", ".", "getOpacity", "(", ")", "+", "\")\"", ")", ";", "}", "else", "{", "element", ".", "setAttribute", "(", "\"style\"", ",", "\"opacity:\"", "+", "picturStyle", ".", "getOpacity", "(", ")", "+", "\";\"", ")", ";", "}", "}", "}", "}" ]
Apply the given style onto a DOM element. This decoder will decide how to handle all the details. @param element The target element onto whom we apply a style object. @param style The style object to be applied.
[ "Apply", "the", "given", "style", "onto", "a", "DOM", "element", ".", "This", "decoder", "will", "decide", "how", "to", "handle", "all", "the", "details", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlStyleUtil.java#L46-L66
147,418
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlStyleUtil.java
VmlStyleUtil.retrieveShapeStyle
public static ShapeStyle retrieveShapeStyle(Element element) { ShapeStyle style = new ShapeStyle(); // Check the "fill" child-element: String filled = element.getAttribute("filled"); if ("true".equals(filled)) { Element fill = element.getElementsByTagName("fill").getItem(0); style.setFillColor(fill.getAttribute("color")); style.setFillOpacity(Float.parseFloat(fill.getAttribute("opacity"))); } // Check the "stroke" child-element: String stroked = element.getAttribute("stroked"); if ("true".equals(stroked)) { Element stroke = element.getElementsByTagName("stroke").getItem(0); style.setFillColor(stroke.getAttribute("color")); style.setFillOpacity(Float.parseFloat(stroke.getAttribute("opacity"))); style.setStrokeWidth(Integer.parseInt(stroke.getAttribute("strokeweight"))); } return style; }
java
public static ShapeStyle retrieveShapeStyle(Element element) { ShapeStyle style = new ShapeStyle(); // Check the "fill" child-element: String filled = element.getAttribute("filled"); if ("true".equals(filled)) { Element fill = element.getElementsByTagName("fill").getItem(0); style.setFillColor(fill.getAttribute("color")); style.setFillOpacity(Float.parseFloat(fill.getAttribute("opacity"))); } // Check the "stroke" child-element: String stroked = element.getAttribute("stroked"); if ("true".equals(stroked)) { Element stroke = element.getElementsByTagName("stroke").getItem(0); style.setFillColor(stroke.getAttribute("color")); style.setFillOpacity(Float.parseFloat(stroke.getAttribute("opacity"))); style.setStrokeWidth(Integer.parseInt(stroke.getAttribute("strokeweight"))); } return style; }
[ "public", "static", "ShapeStyle", "retrieveShapeStyle", "(", "Element", "element", ")", "{", "ShapeStyle", "style", "=", "new", "ShapeStyle", "(", ")", ";", "// Check the \"fill\" child-element:", "String", "filled", "=", "element", ".", "getAttribute", "(", "\"filled\"", ")", ";", "if", "(", "\"true\"", ".", "equals", "(", "filled", ")", ")", "{", "Element", "fill", "=", "element", ".", "getElementsByTagName", "(", "\"fill\"", ")", ".", "getItem", "(", "0", ")", ";", "style", ".", "setFillColor", "(", "fill", ".", "getAttribute", "(", "\"color\"", ")", ")", ";", "style", ".", "setFillOpacity", "(", "Float", ".", "parseFloat", "(", "fill", ".", "getAttribute", "(", "\"opacity\"", ")", ")", ")", ";", "}", "// Check the \"stroke\" child-element:", "String", "stroked", "=", "element", ".", "getAttribute", "(", "\"stroked\"", ")", ";", "if", "(", "\"true\"", ".", "equals", "(", "stroked", ")", ")", "{", "Element", "stroke", "=", "element", ".", "getElementsByTagName", "(", "\"stroke\"", ")", ".", "getItem", "(", "0", ")", ";", "style", ".", "setFillColor", "(", "stroke", ".", "getAttribute", "(", "\"color\"", ")", ")", ";", "style", ".", "setFillOpacity", "(", "Float", ".", "parseFloat", "(", "stroke", ".", "getAttribute", "(", "\"opacity\"", ")", ")", ")", ";", "style", ".", "setStrokeWidth", "(", "Integer", ".", "parseInt", "(", "stroke", ".", "getAttribute", "(", "\"strokeweight\"", ")", ")", ")", ";", "}", "return", "style", ";", "}" ]
Retrieve a ShapeStyle object from a DOM element. Note that this function will always return a shapestyle object, even if nothing is in it. @param element The element to retrieve the style from. @return The ShapeStyle object retrieved from the element.
[ "Retrieve", "a", "ShapeStyle", "object", "from", "a", "DOM", "element", ".", "Note", "that", "this", "function", "will", "always", "return", "a", "shapestyle", "object", "even", "if", "nothing", "is", "in", "it", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlStyleUtil.java#L76-L96
147,419
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlStyleUtil.java
VmlStyleUtil.applyShapeStyle
private static void applyShapeStyle(Element element, ShapeStyle style) { // First check the presence of the fill and stroke elements: NodeList<Element> fills = element.getElementsByTagName("fill"); if (fills.getLength() == 0) { Element stroke = Dom.createElementNS(Dom.NS_VML, "stroke"); element.appendChild(stroke); Element fill = Dom.createElementNS(Dom.NS_VML, "fill"); element.appendChild(fill); fills = element.getElementsByTagName("fill"); } // Then if fill-color then filled=true: if (style.getFillColor() != null) { element.setAttribute("filled", "true"); fills.getItem(0).setAttribute("color", style.getFillColor()); fills.getItem(0).setAttribute("opacity", Float.toString(style.getFillOpacity())); } else { element.setAttribute("filled", "false"); } // Then if stroke-color then stroke=true: if (style.getStrokeColor() != null) { element.setAttribute("stroked", "true"); NodeList<Element> strokes = element.getElementsByTagName("stroke"); strokes.getItem(0).setAttribute("color", style.getStrokeColor()); strokes.getItem(0).setAttribute("opacity", Float.toString(style.getStrokeOpacity())); element.setAttribute("strokeweight", Float.toString(style.getStrokeWidth())); } else { element.setAttribute("stroked", "false"); } }
java
private static void applyShapeStyle(Element element, ShapeStyle style) { // First check the presence of the fill and stroke elements: NodeList<Element> fills = element.getElementsByTagName("fill"); if (fills.getLength() == 0) { Element stroke = Dom.createElementNS(Dom.NS_VML, "stroke"); element.appendChild(stroke); Element fill = Dom.createElementNS(Dom.NS_VML, "fill"); element.appendChild(fill); fills = element.getElementsByTagName("fill"); } // Then if fill-color then filled=true: if (style.getFillColor() != null) { element.setAttribute("filled", "true"); fills.getItem(0).setAttribute("color", style.getFillColor()); fills.getItem(0).setAttribute("opacity", Float.toString(style.getFillOpacity())); } else { element.setAttribute("filled", "false"); } // Then if stroke-color then stroke=true: if (style.getStrokeColor() != null) { element.setAttribute("stroked", "true"); NodeList<Element> strokes = element.getElementsByTagName("stroke"); strokes.getItem(0).setAttribute("color", style.getStrokeColor()); strokes.getItem(0).setAttribute("opacity", Float.toString(style.getStrokeOpacity())); element.setAttribute("strokeweight", Float.toString(style.getStrokeWidth())); } else { element.setAttribute("stroked", "false"); } }
[ "private", "static", "void", "applyShapeStyle", "(", "Element", "element", ",", "ShapeStyle", "style", ")", "{", "// First check the presence of the fill and stroke elements:", "NodeList", "<", "Element", ">", "fills", "=", "element", ".", "getElementsByTagName", "(", "\"fill\"", ")", ";", "if", "(", "fills", ".", "getLength", "(", ")", "==", "0", ")", "{", "Element", "stroke", "=", "Dom", ".", "createElementNS", "(", "Dom", ".", "NS_VML", ",", "\"stroke\"", ")", ";", "element", ".", "appendChild", "(", "stroke", ")", ";", "Element", "fill", "=", "Dom", ".", "createElementNS", "(", "Dom", ".", "NS_VML", ",", "\"fill\"", ")", ";", "element", ".", "appendChild", "(", "fill", ")", ";", "fills", "=", "element", ".", "getElementsByTagName", "(", "\"fill\"", ")", ";", "}", "// Then if fill-color then filled=true:", "if", "(", "style", ".", "getFillColor", "(", ")", "!=", "null", ")", "{", "element", ".", "setAttribute", "(", "\"filled\"", ",", "\"true\"", ")", ";", "fills", ".", "getItem", "(", "0", ")", ".", "setAttribute", "(", "\"color\"", ",", "style", ".", "getFillColor", "(", ")", ")", ";", "fills", ".", "getItem", "(", "0", ")", ".", "setAttribute", "(", "\"opacity\"", ",", "Float", ".", "toString", "(", "style", ".", "getFillOpacity", "(", ")", ")", ")", ";", "}", "else", "{", "element", ".", "setAttribute", "(", "\"filled\"", ",", "\"false\"", ")", ";", "}", "// Then if stroke-color then stroke=true:", "if", "(", "style", ".", "getStrokeColor", "(", ")", "!=", "null", ")", "{", "element", ".", "setAttribute", "(", "\"stroked\"", ",", "\"true\"", ")", ";", "NodeList", "<", "Element", ">", "strokes", "=", "element", ".", "getElementsByTagName", "(", "\"stroke\"", ")", ";", "strokes", ".", "getItem", "(", "0", ")", ".", "setAttribute", "(", "\"color\"", ",", "style", ".", "getStrokeColor", "(", ")", ")", ";", "strokes", ".", "getItem", "(", "0", ")", ".", "setAttribute", "(", "\"opacity\"", ",", "Float", ".", "toString", "(", "style", ".", "getStrokeOpacity", "(", ")", ")", ")", ";", "element", ".", "setAttribute", "(", "\"strokeweight\"", ",", "Float", ".", "toString", "(", "style", ".", "getStrokeWidth", "(", ")", ")", ")", ";", "}", "else", "{", "element", ".", "setAttribute", "(", "\"stroked\"", ",", "\"false\"", ")", ";", "}", "}" ]
When applying ShapeStyles, we create child elements for fill and stroke. According to Microsoft, this is the proper way to go.
[ "When", "applying", "ShapeStyles", "we", "create", "child", "elements", "for", "fill", "and", "stroke", ".", "According", "to", "Microsoft", "this", "is", "the", "proper", "way", "to", "go", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlStyleUtil.java#L106-L136
147,420
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/AttributeCriterionUtil.java
AttributeCriterionUtil.getSearchCriterion
public static AttributeCriterion getSearchCriterion(String serverLayerId, AbstractReadOnlyAttributeInfo selectedAttribute, FormItem valueFormItem, String operationCode) { Object value = valueFormItem.getValue(); if (selectedAttribute != null && operationCode != null) { String valueString = ""; String nameString = selectedAttribute.getName(); String displayText = nameString + " " + operationCode + " " + valueFormItem.getDisplayValue(); if (value != null) { valueString = value.toString(); } // CQL does not recognize "contains", so change to "like": if ("contains".equals(operationCode)) { operationCode = "like"; valueString = CQL_WILDCARD + valueString + CQL_WILDCARD; } else if ("like".equals(operationCode) && valueString.isEmpty()) { valueString = CQL_WILDCARD + valueString + CQL_WILDCARD; } // If value was null, and no "contains" operator, return null: if (valueString == null || valueString.length() == 0) { return null; } if (selectedAttribute instanceof PrimitiveAttributeInfo) { PrimitiveAttributeInfo attr = (PrimitiveAttributeInfo) selectedAttribute; if (attr.getType().equals(PrimitiveType.DATE)) { if (value instanceof Date) { // In case of a date, parse correctly for CQL: 2006-11-30T01:30:00Z DateTimeFormat format = DateTimeFormat.getFormat(CQL_TIME_FORMAT); valueString = format.format((Date) value); if ("=".equals(operationCode)) { // Date equals not supported by CQL, so we use the DURING operator instead and // create a day period for this day (browser time zone !) operationCode = "DURING"; String startOfDay = valueString.replaceAll("\\d\\d:\\d\\d:\\d\\d", "00:00:00"); // 1 day period, starting at 0h00 valueString = startOfDay + "/P1D"; } else if ("AFTER".equals(operationCode)) { // we can't discriminate between date and timestamp values yet, use end of day for now valueString = valueString.replaceAll("\\d\\d:\\d\\d:\\d\\d", "23:59:59"); } else if ("BEFORE".equals(operationCode)) { // we can't discriminate between date and timestamp values yet, use start of day for now valueString = valueString.replaceAll("\\d\\d:\\d\\d:\\d\\d", "00:00:00"); } } } } else if (selectedAttribute instanceof AssociationAttributeInfo) { AssociationAttributeInfo assInfo = (AssociationAttributeInfo) selectedAttribute; if (AssociationType.MANY_TO_ONE == assInfo.getType()) { nameString = nameString + ID_SUFFIX; } } // Now create the criterion: AttributeCriterion criterion = new AttributeCriterion(); criterion.setServerLayerId(serverLayerId); criterion.setAttributeName(nameString); criterion.setOperator(operationCode); criterion.setValue(valueString); criterion.setDisplayText(displayText); return criterion; } return null; }
java
public static AttributeCriterion getSearchCriterion(String serverLayerId, AbstractReadOnlyAttributeInfo selectedAttribute, FormItem valueFormItem, String operationCode) { Object value = valueFormItem.getValue(); if (selectedAttribute != null && operationCode != null) { String valueString = ""; String nameString = selectedAttribute.getName(); String displayText = nameString + " " + operationCode + " " + valueFormItem.getDisplayValue(); if (value != null) { valueString = value.toString(); } // CQL does not recognize "contains", so change to "like": if ("contains".equals(operationCode)) { operationCode = "like"; valueString = CQL_WILDCARD + valueString + CQL_WILDCARD; } else if ("like".equals(operationCode) && valueString.isEmpty()) { valueString = CQL_WILDCARD + valueString + CQL_WILDCARD; } // If value was null, and no "contains" operator, return null: if (valueString == null || valueString.length() == 0) { return null; } if (selectedAttribute instanceof PrimitiveAttributeInfo) { PrimitiveAttributeInfo attr = (PrimitiveAttributeInfo) selectedAttribute; if (attr.getType().equals(PrimitiveType.DATE)) { if (value instanceof Date) { // In case of a date, parse correctly for CQL: 2006-11-30T01:30:00Z DateTimeFormat format = DateTimeFormat.getFormat(CQL_TIME_FORMAT); valueString = format.format((Date) value); if ("=".equals(operationCode)) { // Date equals not supported by CQL, so we use the DURING operator instead and // create a day period for this day (browser time zone !) operationCode = "DURING"; String startOfDay = valueString.replaceAll("\\d\\d:\\d\\d:\\d\\d", "00:00:00"); // 1 day period, starting at 0h00 valueString = startOfDay + "/P1D"; } else if ("AFTER".equals(operationCode)) { // we can't discriminate between date and timestamp values yet, use end of day for now valueString = valueString.replaceAll("\\d\\d:\\d\\d:\\d\\d", "23:59:59"); } else if ("BEFORE".equals(operationCode)) { // we can't discriminate between date and timestamp values yet, use start of day for now valueString = valueString.replaceAll("\\d\\d:\\d\\d:\\d\\d", "00:00:00"); } } } } else if (selectedAttribute instanceof AssociationAttributeInfo) { AssociationAttributeInfo assInfo = (AssociationAttributeInfo) selectedAttribute; if (AssociationType.MANY_TO_ONE == assInfo.getType()) { nameString = nameString + ID_SUFFIX; } } // Now create the criterion: AttributeCriterion criterion = new AttributeCriterion(); criterion.setServerLayerId(serverLayerId); criterion.setAttributeName(nameString); criterion.setOperator(operationCode); criterion.setValue(valueString); criterion.setDisplayText(displayText); return criterion; } return null; }
[ "public", "static", "AttributeCriterion", "getSearchCriterion", "(", "String", "serverLayerId", ",", "AbstractReadOnlyAttributeInfo", "selectedAttribute", ",", "FormItem", "valueFormItem", ",", "String", "operationCode", ")", "{", "Object", "value", "=", "valueFormItem", ".", "getValue", "(", ")", ";", "if", "(", "selectedAttribute", "!=", "null", "&&", "operationCode", "!=", "null", ")", "{", "String", "valueString", "=", "\"\"", ";", "String", "nameString", "=", "selectedAttribute", ".", "getName", "(", ")", ";", "String", "displayText", "=", "nameString", "+", "\" \"", "+", "operationCode", "+", "\" \"", "+", "valueFormItem", ".", "getDisplayValue", "(", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "valueString", "=", "value", ".", "toString", "(", ")", ";", "}", "// CQL does not recognize \"contains\", so change to \"like\":", "if", "(", "\"contains\"", ".", "equals", "(", "operationCode", ")", ")", "{", "operationCode", "=", "\"like\"", ";", "valueString", "=", "CQL_WILDCARD", "+", "valueString", "+", "CQL_WILDCARD", ";", "}", "else", "if", "(", "\"like\"", ".", "equals", "(", "operationCode", ")", "&&", "valueString", ".", "isEmpty", "(", ")", ")", "{", "valueString", "=", "CQL_WILDCARD", "+", "valueString", "+", "CQL_WILDCARD", ";", "}", "// If value was null, and no \"contains\" operator, return null:", "if", "(", "valueString", "==", "null", "||", "valueString", ".", "length", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "if", "(", "selectedAttribute", "instanceof", "PrimitiveAttributeInfo", ")", "{", "PrimitiveAttributeInfo", "attr", "=", "(", "PrimitiveAttributeInfo", ")", "selectedAttribute", ";", "if", "(", "attr", ".", "getType", "(", ")", ".", "equals", "(", "PrimitiveType", ".", "DATE", ")", ")", "{", "if", "(", "value", "instanceof", "Date", ")", "{", "// In case of a date, parse correctly for CQL: 2006-11-30T01:30:00Z", "DateTimeFormat", "format", "=", "DateTimeFormat", ".", "getFormat", "(", "CQL_TIME_FORMAT", ")", ";", "valueString", "=", "format", ".", "format", "(", "(", "Date", ")", "value", ")", ";", "if", "(", "\"=\"", ".", "equals", "(", "operationCode", ")", ")", "{", "// Date equals not supported by CQL, so we use the DURING operator instead and", "// create a day period for this day (browser time zone !)", "operationCode", "=", "\"DURING\"", ";", "String", "startOfDay", "=", "valueString", ".", "replaceAll", "(", "\"\\\\d\\\\d:\\\\d\\\\d:\\\\d\\\\d\"", ",", "\"00:00:00\"", ")", ";", "// 1 day period, starting at 0h00", "valueString", "=", "startOfDay", "+", "\"/P1D\"", ";", "}", "else", "if", "(", "\"AFTER\"", ".", "equals", "(", "operationCode", ")", ")", "{", "// we can't discriminate between date and timestamp values yet, use end of day for now", "valueString", "=", "valueString", ".", "replaceAll", "(", "\"\\\\d\\\\d:\\\\d\\\\d:\\\\d\\\\d\"", ",", "\"23:59:59\"", ")", ";", "}", "else", "if", "(", "\"BEFORE\"", ".", "equals", "(", "operationCode", ")", ")", "{", "// we can't discriminate between date and timestamp values yet, use start of day for now", "valueString", "=", "valueString", ".", "replaceAll", "(", "\"\\\\d\\\\d:\\\\d\\\\d:\\\\d\\\\d\"", ",", "\"00:00:00\"", ")", ";", "}", "}", "}", "}", "else", "if", "(", "selectedAttribute", "instanceof", "AssociationAttributeInfo", ")", "{", "AssociationAttributeInfo", "assInfo", "=", "(", "AssociationAttributeInfo", ")", "selectedAttribute", ";", "if", "(", "AssociationType", ".", "MANY_TO_ONE", "==", "assInfo", ".", "getType", "(", ")", ")", "{", "nameString", "=", "nameString", "+", "ID_SUFFIX", ";", "}", "}", "// Now create the criterion:", "AttributeCriterion", "criterion", "=", "new", "AttributeCriterion", "(", ")", ";", "criterion", ".", "setServerLayerId", "(", "serverLayerId", ")", ";", "criterion", ".", "setAttributeName", "(", "nameString", ")", ";", "criterion", ".", "setOperator", "(", "operationCode", ")", ";", "criterion", ".", "setValue", "(", "valueString", ")", ";", "criterion", ".", "setDisplayText", "(", "displayText", ")", ";", "return", "criterion", ";", "}", "return", "null", ";", "}" ]
Return a search criterion object, or null if not all fields have been properly filled. @param serverLayerId server id of the vector layer that will be searched in @param selectedAttribute the attributeInfo of the attribute that is subject of the criterion @param valueFormItem the form element that contains the value of the attribute @param operationCode string code representation of operator, as provided by {@link org.geomajas.gwt.client.widget.attribute .AttributeCriterionPane#getOperatorCodeFromLabel(String)} @return a fully configured attribute criterion that can be used for the search
[ "Return", "a", "search", "criterion", "object", "or", "null", "if", "not", "all", "fields", "have", "been", "properly", "filled", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/AttributeCriterionUtil.java#L140-L207
147,421
geomajas/geomajas-project-client-gwt
plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryIndexService.java
JsGeometryIndexService.create
@ExportInstanceMethod public static GeometryIndex create(GeometryIndexService instance, String type, int[] values) { if ("geometry".equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_GEOMETRY, values); } else if ("vertex".equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_VERTEX, values); } else if ("edge".equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_EDGE, values); } return null; }
java
@ExportInstanceMethod public static GeometryIndex create(GeometryIndexService instance, String type, int[] values) { if ("geometry".equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_GEOMETRY, values); } else if ("vertex".equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_VERTEX, values); } else if ("edge".equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_EDGE, values); } return null; }
[ "@", "ExportInstanceMethod", "public", "static", "GeometryIndex", "create", "(", "GeometryIndexService", "instance", ",", "String", "type", ",", "int", "[", "]", "values", ")", "{", "if", "(", "\"geometry\"", ".", "equalsIgnoreCase", "(", "type", ")", ")", "{", "return", "instance", ".", "create", "(", "GeometryIndexType", ".", "TYPE_GEOMETRY", ",", "values", ")", ";", "}", "else", "if", "(", "\"vertex\"", ".", "equalsIgnoreCase", "(", "type", ")", ")", "{", "return", "instance", ".", "create", "(", "GeometryIndexType", ".", "TYPE_VERTEX", ",", "values", ")", ";", "}", "else", "if", "(", "\"edge\"", ".", "equalsIgnoreCase", "(", "type", ")", ")", "{", "return", "instance", ".", "create", "(", "GeometryIndexType", ".", "TYPE_EDGE", ",", "values", ")", ";", "}", "return", "null", ";", "}" ]
Create a new geometry index instance. @param instance The index service instance to help you create the index. @param type The type for the deepest index value. @param values A list of values for the children to create. @return The new index.
[ "Create", "a", "new", "geometry", "index", "instance", "." ]
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/JsGeometryIndexService.java#L51-L61
147,422
geomajas/geomajas-project-client-gwt
plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryIndexService.java
JsGeometryIndexService.addChildren
@ExportInstanceMethod public static GeometryIndex addChildren(GeometryIndexService instance, GeometryIndex index, String type, int[] values) { if ("geometry".equalsIgnoreCase(type)) { return instance.addChildren(index, GeometryIndexType.TYPE_GEOMETRY, values); } else if ("vertex".equalsIgnoreCase(type)) { return instance.addChildren(index, GeometryIndexType.TYPE_VERTEX, values); } else if ("edge".equalsIgnoreCase(type)) { return instance.addChildren(index, GeometryIndexType.TYPE_EDGE, values); } return null; }
java
@ExportInstanceMethod public static GeometryIndex addChildren(GeometryIndexService instance, GeometryIndex index, String type, int[] values) { if ("geometry".equalsIgnoreCase(type)) { return instance.addChildren(index, GeometryIndexType.TYPE_GEOMETRY, values); } else if ("vertex".equalsIgnoreCase(type)) { return instance.addChildren(index, GeometryIndexType.TYPE_VERTEX, values); } else if ("edge".equalsIgnoreCase(type)) { return instance.addChildren(index, GeometryIndexType.TYPE_EDGE, values); } return null; }
[ "@", "ExportInstanceMethod", "public", "static", "GeometryIndex", "addChildren", "(", "GeometryIndexService", "instance", ",", "GeometryIndex", "index", ",", "String", "type", ",", "int", "[", "]", "values", ")", "{", "if", "(", "\"geometry\"", ".", "equalsIgnoreCase", "(", "type", ")", ")", "{", "return", "instance", ".", "addChildren", "(", "index", ",", "GeometryIndexType", ".", "TYPE_GEOMETRY", ",", "values", ")", ";", "}", "else", "if", "(", "\"vertex\"", ".", "equalsIgnoreCase", "(", "type", ")", ")", "{", "return", "instance", ".", "addChildren", "(", "index", ",", "GeometryIndexType", ".", "TYPE_VERTEX", ",", "values", ")", ";", "}", "else", "if", "(", "\"edge\"", ".", "equalsIgnoreCase", "(", "type", ")", ")", "{", "return", "instance", ".", "addChildren", "(", "index", ",", "GeometryIndexType", ".", "TYPE_EDGE", ",", "values", ")", ";", "}", "return", "null", ";", "}" ]
Create a new geometry index instance, by adding more depth to a given parent index. @param instance The index service instance to help you create the index. @param index The parent index to start from. @param type The type for the deepest index value. @param values A list of values for the children to attach to the parent index. @return The next index.
[ "Create", "a", "new", "geometry", "index", "instance", "by", "adding", "more", "depth", "to", "a", "given", "parent", "index", "." ]
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/JsGeometryIndexService.java#L76-L87
147,423
geomajas/geomajas-project-client-gwt
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/factory/WidgetFactory.java
WidgetFactory.put
public static void put(String key, WidgetBuilder builder) { if (null != key && null != builder) { WIDGETBUILDERS.put(key, builder); } }
java
public static void put(String key, WidgetBuilder builder) { if (null != key && null != builder) { WIDGETBUILDERS.put(key, builder); } }
[ "public", "static", "void", "put", "(", "String", "key", ",", "WidgetBuilder", "builder", ")", "{", "if", "(", "null", "!=", "key", "&&", "null", "!=", "builder", ")", "{", "WIDGETBUILDERS", ".", "put", "(", "key", ",", "builder", ")", ";", "}", "}" ]
Add a builder to the factory. @param key @param builder
[ "Add", "a", "builder", "to", "the", "factory", "." ]
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/WidgetFactory.java#L46-L50
147,424
geomajas/geomajas-project-client-gwt
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/factory/WidgetFactory.java
WidgetFactory.createWidget
public static Canvas createWidget(String key) { WidgetBuilder builder = WIDGETBUILDERS.get(key); if (null == builder) { return null; } return builder.createWidget(); }
java
public static Canvas createWidget(String key) { WidgetBuilder builder = WIDGETBUILDERS.get(key); if (null == builder) { return null; } return builder.createWidget(); }
[ "public", "static", "Canvas", "createWidget", "(", "String", "key", ")", "{", "WidgetBuilder", "builder", "=", "WIDGETBUILDERS", ".", "get", "(", "key", ")", ";", "if", "(", "null", "==", "builder", ")", "{", "return", "null", ";", "}", "return", "builder", ".", "createWidget", "(", ")", ";", "}" ]
Create a widget of given type. @param key key of widgettype @return widget (canvas) or null when key not found
[ "Create", "a", "widget", "of", "given", "type", "." ]
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/WidgetFactory.java#L69-L75
147,425
geomajas/geomajas-project-client-gwt
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/action/toolbar/MultiLayerFeatureInfoModalAction.java
MultiLayerFeatureInfoModalAction.setFeaturesListLabels
public void setFeaturesListLabels(Map<String, String> featuresListLabels) { this.featuresListLabels = featuresListLabels; controller.setFeaturesListLabels(featuresListLabels); }
java
public void setFeaturesListLabels(Map<String, String> featuresListLabels) { this.featuresListLabels = featuresListLabels; controller.setFeaturesListLabels(featuresListLabels); }
[ "public", "void", "setFeaturesListLabels", "(", "Map", "<", "String", ",", "String", ">", "featuresListLabels", ")", "{", "this", ".", "featuresListLabels", "=", "featuresListLabels", ";", "controller", ".", "setFeaturesListLabels", "(", "featuresListLabels", ")", ";", "}" ]
Set labels for feature lists. @param featuresListLabels the featuresListLabels to set
[ "Set", "labels", "for", "feature", "lists", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/action/toolbar/MultiLayerFeatureInfoModalAction.java#L131-L134
147,426
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/ToolbarBaseAction.java
ToolbarBaseAction.setDisabled
public void setDisabled(boolean disabled) { this.disabled = disabled; if (disabled) { handlerManager.fireEvent(new ToolbarActionDisabledEvent()); } else { handlerManager.fireEvent(new ToolbarActionEnabledEvent()); } }
java
public void setDisabled(boolean disabled) { this.disabled = disabled; if (disabled) { handlerManager.fireEvent(new ToolbarActionDisabledEvent()); } else { handlerManager.fireEvent(new ToolbarActionEnabledEvent()); } }
[ "public", "void", "setDisabled", "(", "boolean", "disabled", ")", "{", "this", ".", "disabled", "=", "disabled", ";", "if", "(", "disabled", ")", "{", "handlerManager", ".", "fireEvent", "(", "new", "ToolbarActionDisabledEvent", "(", ")", ")", ";", "}", "else", "{", "handlerManager", ".", "fireEvent", "(", "new", "ToolbarActionEnabledEvent", "(", ")", ")", ";", "}", "}" ]
Is the button for this action disabled or not? @param disabled The new value
[ "Is", "the", "button", "for", "this", "action", "disabled", "or", "not?" ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/ToolbarBaseAction.java#L136-L143
147,427
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiLineString.java
MultiLineString.getCoordinates
public Coordinate[] getCoordinates() { if (isEmpty()) { return null; } Coordinate[] coordinates = new Coordinate[getNumPoints()]; int count = 0; for (LineString lineString : lineStrings) { for (int j = 0; j < lineString.getNumPoints(); j++) { coordinates[count++] = lineString.getCoordinateN(j); } } return coordinates; }
java
public Coordinate[] getCoordinates() { if (isEmpty()) { return null; } Coordinate[] coordinates = new Coordinate[getNumPoints()]; int count = 0; for (LineString lineString : lineStrings) { for (int j = 0; j < lineString.getNumPoints(); j++) { coordinates[count++] = lineString.getCoordinateN(j); } } return coordinates; }
[ "public", "Coordinate", "[", "]", "getCoordinates", "(", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "Coordinate", "[", "]", "coordinates", "=", "new", "Coordinate", "[", "getNumPoints", "(", ")", "]", ";", "int", "count", "=", "0", ";", "for", "(", "LineString", "lineString", ":", "lineStrings", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "lineString", ".", "getNumPoints", "(", ")", ";", "j", "++", ")", "{", "coordinates", "[", "count", "++", "]", "=", "lineString", ".", "getCoordinateN", "(", "j", ")", ";", "}", "}", "return", "coordinates", ";", "}" ]
Get the full concatenated list of coordinates of all the LineStrings in this MultiLineString geometry.
[ "Get", "the", "full", "concatenated", "list", "of", "coordinates", "of", "all", "the", "LineStrings", "in", "this", "MultiLineString", "geometry", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiLineString.java#L214-L226
147,428
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiLineString.java
MultiLineString.intersects
public boolean intersects(Geometry geometry) { if (isEmpty()) { return false; } for (LineString lineString : lineStrings) { if (lineString.intersects(geometry)) { return true; } } return false; }
java
public boolean intersects(Geometry geometry) { if (isEmpty()) { return false; } for (LineString lineString : lineStrings) { if (lineString.intersects(geometry)) { return true; } } return false; }
[ "public", "boolean", "intersects", "(", "Geometry", "geometry", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "LineString", "lineString", ":", "lineStrings", ")", "{", "if", "(", "lineString", ".", "intersects", "(", "geometry", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check the LineStrings one by one for intersections with the given geometry.
[ "Check", "the", "LineStrings", "one", "by", "one", "for", "intersections", "with", "the", "given", "geometry", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiLineString.java#L236-L247
147,429
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/spatial/GeometryServiceImpl.java
GeometryServiceImpl.getBounds
public Bbox getBounds(Geometry geometry) { org.geomajas.gwt.client.spatial.geometry.Geometry geom = GeometryConverter.toGwt(geometry); return GeometryConverter.toDto(geom.getBounds()); }
java
public Bbox getBounds(Geometry geometry) { org.geomajas.gwt.client.spatial.geometry.Geometry geom = GeometryConverter.toGwt(geometry); return GeometryConverter.toDto(geom.getBounds()); }
[ "public", "Bbox", "getBounds", "(", "Geometry", "geometry", ")", "{", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "spatial", ".", "geometry", ".", "Geometry", "geom", "=", "GeometryConverter", ".", "toGwt", "(", "geometry", ")", ";", "return", "GeometryConverter", ".", "toDto", "(", "geom", ".", "getBounds", "(", ")", ")", ";", "}" ]
Return the bounding box that defines the outer most border of a geometry. @param geometry The geometry for which to calculate the bounding box. @return The outer bounds for the given geometry.
[ "Return", "the", "bounding", "box", "that", "defines", "the", "outer", "most", "border", "of", "a", "geometry", "." ]
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/spatial/GeometryServiceImpl.java#L43-L46
147,430
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/spatial/GeometryServiceImpl.java
GeometryServiceImpl.toWkt
public String toWkt(Geometry geometry) { try { return WktService.toWkt(geometry); } catch (WktException e) { return null; } }
java
public String toWkt(Geometry geometry) { try { return WktService.toWkt(geometry); } catch (WktException e) { return null; } }
[ "public", "String", "toWkt", "(", "Geometry", "geometry", ")", "{", "try", "{", "return", "WktService", ".", "toWkt", "(", "geometry", ")", ";", "}", "catch", "(", "WktException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Format the given geometry object to Well Known Text representation. @param geometry The geometry to format. @return Get WKT representation of the given geometry, or null in case something went wrong.
[ "Format", "the", "given", "geometry", "object", "to", "Well", "Known", "Text", "representation", "." ]
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/spatial/GeometryServiceImpl.java#L55-L61
147,431
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/spatial/GeometryServiceImpl.java
GeometryServiceImpl.toGeometry
public Geometry toGeometry(String wkt) { try { return WktService.toGeometry(wkt); } catch (WktException e) { return null; } }
java
public Geometry toGeometry(String wkt) { try { return WktService.toGeometry(wkt); } catch (WktException e) { return null; } }
[ "public", "Geometry", "toGeometry", "(", "String", "wkt", ")", "{", "try", "{", "return", "WktService", ".", "toGeometry", "(", "wkt", ")", ";", "}", "catch", "(", "WktException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Parse the given Well Known Text string into a geometry. @param wkt The WKT text. @return The resulting geometry, or null in case something went wrong.
[ "Parse", "the", "given", "Well", "Known", "Text", "string", "into", "a", "geometry", "." ]
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/spatial/GeometryServiceImpl.java#L70-L76
147,432
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/AttributeListGrid.java
AttributeListGrid.saveOrUpdateValue
public boolean saveOrUpdateValue(AssociationValue associationValue) { if (idByValue.containsKey(associationValue)) { updateValue(associationValue); setData(getRecords()); return true; } else { // Calculate id Object idObject = associationValue.getId().getValue(); String id; if (idObject != null) { id = idObject.toString(); } else { // fake id id = NEW_PREFIX + "." + (newRows++); } // Feature checks out, add it to the grid: ListGridRecord record = new ListGridRecord(); record.setAttribute(ID_NAME, id); updateAttributes(associationValue, record); idByValue.put(associationValue, id); addData(record); return false; } }
java
public boolean saveOrUpdateValue(AssociationValue associationValue) { if (idByValue.containsKey(associationValue)) { updateValue(associationValue); setData(getRecords()); return true; } else { // Calculate id Object idObject = associationValue.getId().getValue(); String id; if (idObject != null) { id = idObject.toString(); } else { // fake id id = NEW_PREFIX + "." + (newRows++); } // Feature checks out, add it to the grid: ListGridRecord record = new ListGridRecord(); record.setAttribute(ID_NAME, id); updateAttributes(associationValue, record); idByValue.put(associationValue, id); addData(record); return false; } }
[ "public", "boolean", "saveOrUpdateValue", "(", "AssociationValue", "associationValue", ")", "{", "if", "(", "idByValue", ".", "containsKey", "(", "associationValue", ")", ")", "{", "updateValue", "(", "associationValue", ")", ";", "setData", "(", "getRecords", "(", ")", ")", ";", "return", "true", ";", "}", "else", "{", "// Calculate id", "Object", "idObject", "=", "associationValue", ".", "getId", "(", ")", ".", "getValue", "(", ")", ";", "String", "id", ";", "if", "(", "idObject", "!=", "null", ")", "{", "id", "=", "idObject", ".", "toString", "(", ")", ";", "}", "else", "{", "// fake id", "id", "=", "NEW_PREFIX", "+", "\".\"", "+", "(", "newRows", "++", ")", ";", "}", "// Feature checks out, add it to the grid:", "ListGridRecord", "record", "=", "new", "ListGridRecord", "(", ")", ";", "record", ".", "setAttribute", "(", "ID_NAME", ",", "id", ")", ";", "updateAttributes", "(", "associationValue", ",", "record", ")", ";", "idByValue", ".", "put", "(", "associationValue", ",", "id", ")", ";", "addData", "(", "record", ")", ";", "return", "false", ";", "}", "}" ]
Adds a new value to the list. @param associationValue The value to be added to the list. @return Returns true in case of update, and false if the value is already in the list or the value is null
[ "Adds", "a", "new", "value", "to", "the", "list", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/AttributeListGrid.java#L113-L136
147,433
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/AttributeListGrid.java
AttributeListGrid.deleteValue
public boolean deleteValue(AssociationValue associationValue) { if (idByValue.containsKey(associationValue)) { for (ListGridRecord record : getRecords()) { if (record.getAttributeAsObject(VALUE_HOLDER_RECORD_ATTRIBUTE) == associationValue) { removeData(record); idByValue.remove(associationValue); return true; } } } return false; }
java
public boolean deleteValue(AssociationValue associationValue) { if (idByValue.containsKey(associationValue)) { for (ListGridRecord record : getRecords()) { if (record.getAttributeAsObject(VALUE_HOLDER_RECORD_ATTRIBUTE) == associationValue) { removeData(record); idByValue.remove(associationValue); return true; } } } return false; }
[ "public", "boolean", "deleteValue", "(", "AssociationValue", "associationValue", ")", "{", "if", "(", "idByValue", ".", "containsKey", "(", "associationValue", ")", ")", "{", "for", "(", "ListGridRecord", "record", ":", "getRecords", "(", ")", ")", "{", "if", "(", "record", ".", "getAttributeAsObject", "(", "VALUE_HOLDER_RECORD_ATTRIBUTE", ")", "==", "associationValue", ")", "{", "removeData", "(", "record", ")", ";", "idByValue", ".", "remove", "(", "associationValue", ")", ";", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Removes a value to the list. @param associationValue The value to be removed from the list. @return Returns true in case of successful removal.
[ "Removes", "a", "value", "to", "the", "list", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/AttributeListGrid.java#L144-L155
147,434
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/AttributeListGrid.java
AttributeListGrid.updateFields
private void updateFields() { if (featureInfo != null) { // Create a header field for each attribute definition: List<ListGridField> fields = new ArrayList<ListGridField>(); if (idInTable) { ListGridField gridField = new ListGridField(ID_NAME, "ID"); gridField.setAlign(Alignment.LEFT); gridField.setCanEdit(false); fields.add(gridField); } for (AttributeInfo attributeInfo : featureInfo.getAttributes()) { if (!attributeInfo.isHidden() && (attributeInfo.isIdentifying() || allAttributesDisplayed)) { fields.add(createAttributeGridField(attributeInfo)); } } setFields(fields.toArray(new ListGridField[fields.size()])); setCanResizeFields(true); } }
java
private void updateFields() { if (featureInfo != null) { // Create a header field for each attribute definition: List<ListGridField> fields = new ArrayList<ListGridField>(); if (idInTable) { ListGridField gridField = new ListGridField(ID_NAME, "ID"); gridField.setAlign(Alignment.LEFT); gridField.setCanEdit(false); fields.add(gridField); } for (AttributeInfo attributeInfo : featureInfo.getAttributes()) { if (!attributeInfo.isHidden() && (attributeInfo.isIdentifying() || allAttributesDisplayed)) { fields.add(createAttributeGridField(attributeInfo)); } } setFields(fields.toArray(new ListGridField[fields.size()])); setCanResizeFields(true); } }
[ "private", "void", "updateFields", "(", ")", "{", "if", "(", "featureInfo", "!=", "null", ")", "{", "// Create a header field for each attribute definition:", "List", "<", "ListGridField", ">", "fields", "=", "new", "ArrayList", "<", "ListGridField", ">", "(", ")", ";", "if", "(", "idInTable", ")", "{", "ListGridField", "gridField", "=", "new", "ListGridField", "(", "ID_NAME", ",", "\"ID\"", ")", ";", "gridField", ".", "setAlign", "(", "Alignment", ".", "LEFT", ")", ";", "gridField", ".", "setCanEdit", "(", "false", ")", ";", "fields", ".", "add", "(", "gridField", ")", ";", "}", "for", "(", "AttributeInfo", "attributeInfo", ":", "featureInfo", ".", "getAttributes", "(", ")", ")", "{", "if", "(", "!", "attributeInfo", ".", "isHidden", "(", ")", "&&", "(", "attributeInfo", ".", "isIdentifying", "(", ")", "||", "allAttributesDisplayed", ")", ")", "{", "fields", ".", "add", "(", "createAttributeGridField", "(", "attributeInfo", ")", ")", ";", "}", "}", "setFields", "(", "fields", ".", "toArray", "(", "new", "ListGridField", "[", "fields", ".", "size", "(", ")", "]", ")", ")", ";", "setCanResizeFields", "(", "true", ")", ";", "}", "}" ]
Actually create or update the fields.
[ "Actually", "create", "or", "update", "the", "fields", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/AttributeListGrid.java#L308-L327
147,435
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/workflow/activity/ValidationActivity.java
ValidationActivity.execute
public WorkflowContext execute(WorkflowContext context) throws WorkflowException { if (context instanceof MapModelWorkflowContext) { MapModelWorkflowContext mmContext = (MapModelWorkflowContext) context; FeatureTransaction ft = mmContext.getFeatureTransaction(); if (ft.getNewFeatures() != null) { for (Feature feature : ft.getNewFeatures()) { if (!feature.getGeometry().isValid()) { throw new WorkflowException(I18nProvider.getGlobal().validationActivityError()); } } } } return context; }
java
public WorkflowContext execute(WorkflowContext context) throws WorkflowException { if (context instanceof MapModelWorkflowContext) { MapModelWorkflowContext mmContext = (MapModelWorkflowContext) context; FeatureTransaction ft = mmContext.getFeatureTransaction(); if (ft.getNewFeatures() != null) { for (Feature feature : ft.getNewFeatures()) { if (!feature.getGeometry().isValid()) { throw new WorkflowException(I18nProvider.getGlobal().validationActivityError()); } } } } return context; }
[ "public", "WorkflowContext", "execute", "(", "WorkflowContext", "context", ")", "throws", "WorkflowException", "{", "if", "(", "context", "instanceof", "MapModelWorkflowContext", ")", "{", "MapModelWorkflowContext", "mmContext", "=", "(", "MapModelWorkflowContext", ")", "context", ";", "FeatureTransaction", "ft", "=", "mmContext", ".", "getFeatureTransaction", "(", ")", ";", "if", "(", "ft", ".", "getNewFeatures", "(", ")", "!=", "null", ")", "{", "for", "(", "Feature", "feature", ":", "ft", ".", "getNewFeatures", "(", ")", ")", "{", "if", "(", "!", "feature", ".", "getGeometry", "(", ")", ".", "isValid", "(", ")", ")", "{", "throw", "new", "WorkflowException", "(", "I18nProvider", ".", "getGlobal", "(", ")", ".", "validationActivityError", "(", ")", ")", ";", "}", "}", "}", "}", "return", "context", ";", "}" ]
Check for geometry validity. @param context Expects a {@link MapModelWorkflowContext}.
[ "Check", "for", "geometry", "validity", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/workflow/activity/ValidationActivity.java#L39-L52
147,436
seedstack/i18n-addon
rest/src/main/java/org/seedstack/i18n/rest/internal/translation/TranslationsResource.java
TranslationsResource.getTranslations
@GET @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.TRANSLATION_READ) public Response getTranslations(@QueryParam(PAGE_INDEX) Long pageIndex, @QueryParam(PAGE_SIZE) Integer pageSize, @QueryParam(IS_MISSING) Boolean isMissing, @QueryParam(IS_APPROX) Boolean isApprox, @QueryParam(IS_OUTDATED) Boolean isOutdated, @QueryParam(SEARCH_NAME) String searchName) { Response response = Response.noContent().build(); if (pageIndex != null && pageSize != null) { KeySearchCriteria criteria = new KeySearchCriteria(isMissing, isApprox, isOutdated, searchName, locale); response = Response.ok(translationFinder.findAllTranslations(new Page(pageIndex, pageSize), criteria)) .build(); } else { List<TranslationRepresentation> translations = translationFinder.findTranslations(locale); if (!translations.isEmpty()) { response = Response.ok(translations).build(); } } return response; }
java
@GET @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.TRANSLATION_READ) public Response getTranslations(@QueryParam(PAGE_INDEX) Long pageIndex, @QueryParam(PAGE_SIZE) Integer pageSize, @QueryParam(IS_MISSING) Boolean isMissing, @QueryParam(IS_APPROX) Boolean isApprox, @QueryParam(IS_OUTDATED) Boolean isOutdated, @QueryParam(SEARCH_NAME) String searchName) { Response response = Response.noContent().build(); if (pageIndex != null && pageSize != null) { KeySearchCriteria criteria = new KeySearchCriteria(isMissing, isApprox, isOutdated, searchName, locale); response = Response.ok(translationFinder.findAllTranslations(new Page(pageIndex, pageSize), criteria)) .build(); } else { List<TranslationRepresentation> translations = translationFinder.findTranslations(locale); if (!translations.isEmpty()) { response = Response.ok(translations).build(); } } return response; }
[ "@", "GET", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "RequiresPermissions", "(", "I18nPermissions", ".", "TRANSLATION_READ", ")", "public", "Response", "getTranslations", "(", "@", "QueryParam", "(", "PAGE_INDEX", ")", "Long", "pageIndex", ",", "@", "QueryParam", "(", "PAGE_SIZE", ")", "Integer", "pageSize", ",", "@", "QueryParam", "(", "IS_MISSING", ")", "Boolean", "isMissing", ",", "@", "QueryParam", "(", "IS_APPROX", ")", "Boolean", "isApprox", ",", "@", "QueryParam", "(", "IS_OUTDATED", ")", "Boolean", "isOutdated", ",", "@", "QueryParam", "(", "SEARCH_NAME", ")", "String", "searchName", ")", "{", "Response", "response", "=", "Response", ".", "noContent", "(", ")", ".", "build", "(", ")", ";", "if", "(", "pageIndex", "!=", "null", "&&", "pageSize", "!=", "null", ")", "{", "KeySearchCriteria", "criteria", "=", "new", "KeySearchCriteria", "(", "isMissing", ",", "isApprox", ",", "isOutdated", ",", "searchName", ",", "locale", ")", ";", "response", "=", "Response", ".", "ok", "(", "translationFinder", ".", "findAllTranslations", "(", "new", "Page", "(", "pageIndex", ",", "pageSize", ")", ",", "criteria", ")", ")", ".", "build", "(", ")", ";", "}", "else", "{", "List", "<", "TranslationRepresentation", ">", "translations", "=", "translationFinder", ".", "findTranslations", "(", "locale", ")", ";", "if", "(", "!", "translations", ".", "isEmpty", "(", ")", ")", "{", "response", "=", "Response", ".", "ok", "(", "translations", ")", ".", "build", "(", ")", ";", "}", "}", "return", "response", ";", "}" ]
Returns filtered translation with pagination. @param pageIndex page index @param pageSize page size @param isMissing filter indicator on missing translation @param isApprox filter indicator on approximate translation @param isOutdated filter indicator on outdated translation @param searchName filter on key name @return status code 200 with filtered translations or 204 if no translation
[ "Returns", "filtered", "translation", "with", "pagination", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/translation/TranslationsResource.java#L72-L92
147,437
seedstack/i18n-addon
rest/src/main/java/org/seedstack/i18n/rest/internal/translation/TranslationsResource.java
TranslationsResource.getTranslation
@GET @Path("/{key}") @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.TRANSLATION_READ) public TranslationRepresentation getTranslation(@PathParam("key") String key) { TranslationRepresentation translation = translationFinder.findTranslation(locale, key); if (translation == null) { throw new NotFoundException("No translation for key: " + key + " and locale: " + locale); } return translation; }
java
@GET @Path("/{key}") @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.TRANSLATION_READ) public TranslationRepresentation getTranslation(@PathParam("key") String key) { TranslationRepresentation translation = translationFinder.findTranslation(locale, key); if (translation == null) { throw new NotFoundException("No translation for key: " + key + " and locale: " + locale); } return translation; }
[ "@", "GET", "@", "Path", "(", "\"/{key}\"", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "RequiresPermissions", "(", "I18nPermissions", ".", "TRANSLATION_READ", ")", "public", "TranslationRepresentation", "getTranslation", "(", "@", "PathParam", "(", "\"key\"", ")", "String", "key", ")", "{", "TranslationRepresentation", "translation", "=", "translationFinder", ".", "findTranslation", "(", "locale", ",", "key", ")", ";", "if", "(", "translation", "==", "null", ")", "{", "throw", "new", "NotFoundException", "(", "\"No translation for key: \"", "+", "key", "+", "\" and locale: \"", "+", "locale", ")", ";", "}", "return", "translation", ";", "}" ]
Returns a translation for specified key and locale. @param key key name @return status code 200 with a translation or 404 if not found
[ "Returns", "a", "translation", "for", "specified", "key", "and", "locale", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/translation/TranslationsResource.java#L100-L110
147,438
seedstack/i18n-addon
rest/src/main/java/org/seedstack/i18n/rest/internal/translation/TranslationsResource.java
TranslationsResource.updateTranslation
@PUT @Path("/{key}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.TRANSLATION_WRITE) public Response updateTranslation(@PathParam("key") String keyName, TranslationRepresentation representation) { WebAssertions.assertNotNull(representation, "The translation should not be null"); TranslationValueRepresentation translationToUpdate = representation.getTarget(); WebAssertions.assertNotNull(translationToUpdate, "The translation target should not be null"); Key key = keyRepository.get(keyName).orElseThrow(() -> new NotFoundException("The key is not found")); key.addTranslation(locale, translationToUpdate.getTranslation(), translationToUpdate.isApprox()); keyRepository.update(key); return Response.noContent().build(); }
java
@PUT @Path("/{key}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.TRANSLATION_WRITE) public Response updateTranslation(@PathParam("key") String keyName, TranslationRepresentation representation) { WebAssertions.assertNotNull(representation, "The translation should not be null"); TranslationValueRepresentation translationToUpdate = representation.getTarget(); WebAssertions.assertNotNull(translationToUpdate, "The translation target should not be null"); Key key = keyRepository.get(keyName).orElseThrow(() -> new NotFoundException("The key is not found")); key.addTranslation(locale, translationToUpdate.getTranslation(), translationToUpdate.isApprox()); keyRepository.update(key); return Response.noContent().build(); }
[ "@", "PUT", "@", "Path", "(", "\"/{key}\"", ")", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "RequiresPermissions", "(", "I18nPermissions", ".", "TRANSLATION_WRITE", ")", "public", "Response", "updateTranslation", "(", "@", "PathParam", "(", "\"key\"", ")", "String", "keyName", ",", "TranslationRepresentation", "representation", ")", "{", "WebAssertions", ".", "assertNotNull", "(", "representation", ",", "\"The translation should not be null\"", ")", ";", "TranslationValueRepresentation", "translationToUpdate", "=", "representation", ".", "getTarget", "(", ")", ";", "WebAssertions", ".", "assertNotNull", "(", "translationToUpdate", ",", "\"The translation target should not be null\"", ")", ";", "Key", "key", "=", "keyRepository", ".", "get", "(", "keyName", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "NotFoundException", "(", "\"The key is not found\"", ")", ")", ";", "key", ".", "addTranslation", "(", "locale", ",", "translationToUpdate", ".", "getTranslation", "(", ")", ",", "translationToUpdate", ".", "isApprox", "(", ")", ")", ";", "keyRepository", ".", "update", "(", "key", ")", ";", "return", "Response", ".", "noContent", "(", ")", ".", "build", "(", ")", ";", "}" ]
Update translation for the given locale. @param keyName key name @param representation translation representation @return status code 204 (no content) or 404 (not found) if key or target translation is null.
[ "Update", "translation", "for", "the", "given", "locale", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/translation/TranslationsResource.java#L119-L134
147,439
geomajas/geomajas-project-client-gwt
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/MultiLayerFeaturesList.java
MultiLayerFeaturesList.setFeatures
public void setFeatures(Map<String, List<org.geomajas.layer.feature.Feature>> featureMap) { MapModel mapModel = mapWidget.getMapModel(); for (Entry<String, List<org.geomajas.layer.feature.Feature>> clientLayerId : featureMap.entrySet()) { Layer<?> layer = mapModel.getLayer(clientLayerId.getKey()); if (null != layer) { List<org.geomajas.layer.feature.Feature> orgFeatures = clientLayerId.getValue(); if (!orgFeatures.isEmpty()) { addFeatures(layer, orgFeatures); } } } }
java
public void setFeatures(Map<String, List<org.geomajas.layer.feature.Feature>> featureMap) { MapModel mapModel = mapWidget.getMapModel(); for (Entry<String, List<org.geomajas.layer.feature.Feature>> clientLayerId : featureMap.entrySet()) { Layer<?> layer = mapModel.getLayer(clientLayerId.getKey()); if (null != layer) { List<org.geomajas.layer.feature.Feature> orgFeatures = clientLayerId.getValue(); if (!orgFeatures.isEmpty()) { addFeatures(layer, orgFeatures); } } } }
[ "public", "void", "setFeatures", "(", "Map", "<", "String", ",", "List", "<", "org", ".", "geomajas", ".", "layer", ".", "feature", ".", "Feature", ">", ">", "featureMap", ")", "{", "MapModel", "mapModel", "=", "mapWidget", ".", "getMapModel", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "List", "<", "org", ".", "geomajas", ".", "layer", ".", "feature", ".", "Feature", ">", ">", "clientLayerId", ":", "featureMap", ".", "entrySet", "(", ")", ")", "{", "Layer", "<", "?", ">", "layer", "=", "mapModel", ".", "getLayer", "(", "clientLayerId", ".", "getKey", "(", ")", ")", ";", "if", "(", "null", "!=", "layer", ")", "{", "List", "<", "org", ".", "geomajas", ".", "layer", ".", "feature", ".", "Feature", ">", "orgFeatures", "=", "clientLayerId", ".", "getValue", "(", ")", ";", "if", "(", "!", "orgFeatures", ".", "isEmpty", "(", ")", ")", "{", "addFeatures", "(", "layer", ",", "orgFeatures", ")", ";", "}", "}", "}", "}" ]
Feed a map of features to the widget, so it can be built. @param featureMap feature map
[ "Feed", "a", "map", "of", "features", "to", "the", "widget", "so", "it", "can", "be", "built", "." ]
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/MultiLayerFeaturesList.java#L100-L112
147,440
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api/src/main/java/org/geomajas/plugin/jsapi/client/spatial/Geometry.java
Geometry.constructor
@ExportConstructor public static org.geomajas.geometry.Geometry constructor(String geometryType, int srid, int precision) { return new org.geomajas.geometry.Geometry(geometryType, srid, precision); }
java
@ExportConstructor public static org.geomajas.geometry.Geometry constructor(String geometryType, int srid, int precision) { return new org.geomajas.geometry.Geometry(geometryType, srid, precision); }
[ "@", "ExportConstructor", "public", "static", "org", ".", "geomajas", ".", "geometry", ".", "Geometry", "constructor", "(", "String", "geometryType", ",", "int", "srid", ",", "int", "precision", ")", "{", "return", "new", "org", ".", "geomajas", ".", "geometry", ".", "Geometry", "(", "geometryType", ",", "srid", ",", "precision", ")", ";", "}" ]
Create geometry. @param geometryType geometry type @param srid srid @param precision precision
[ "Create", "geometry", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api/src/main/java/org/geomajas/plugin/jsapi/client/spatial/Geometry.java#L42-L45
147,441
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java
AbstractI18nRestIT.httpGet
protected Response httpGet(String path, int statusCode) { return httpRequest(statusCode, null).get(baseURL + PATH_PREFIX + path); }
java
protected Response httpGet(String path, int statusCode) { return httpRequest(statusCode, null).get(baseURL + PATH_PREFIX + path); }
[ "protected", "Response", "httpGet", "(", "String", "path", ",", "int", "statusCode", ")", "{", "return", "httpRequest", "(", "statusCode", ",", "null", ")", ".", "get", "(", "baseURL", "+", "PATH_PREFIX", "+", "path", ")", ";", "}" ]
Gets the resource at the path and expect the given status code. @param path the resource URI @return the http response
[ "Gets", "the", "resource", "at", "the", "path", "and", "expect", "the", "given", "status", "code", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java#L59-L61
147,442
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java
AbstractI18nRestIT.httpPost
protected Response httpPost(String path, String body, int status) { return httpRequest(status, null).body(body).post(baseURL + PATH_PREFIX + path); }
java
protected Response httpPost(String path, String body, int status) { return httpRequest(status, null).body(body).post(baseURL + PATH_PREFIX + path); }
[ "protected", "Response", "httpPost", "(", "String", "path", ",", "String", "body", ",", "int", "status", ")", "{", "return", "httpRequest", "(", "status", ",", "null", ")", ".", "body", "(", "body", ")", ".", "post", "(", "baseURL", "+", "PATH_PREFIX", "+", "path", ")", ";", "}" ]
Posts the body to the given path and expect a 200 status code. @param path the resource URI @param body the resource representation @return the http response
[ "Posts", "the", "body", "to", "the", "given", "path", "and", "expect", "a", "200", "status", "code", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java#L70-L72
147,443
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java
AbstractI18nRestIT.httpPostCSV
protected Response httpPostCSV(String path, String csvBody, int status) { MultiPartSpecBuilder multipart = new MultiPartSpecBuilder(csvBody.getBytes()); multipart.mimeType("multipart/form-data"); multipart.fileName("file.csv"); return httpRequest(status, "multipart/form-data") .multiPart(multipart.build()) .header("Authorization", "Basic YWRtaW46cGFzc3dvcmQ=") .post(baseURL + PATH_PREFIX + path); }
java
protected Response httpPostCSV(String path, String csvBody, int status) { MultiPartSpecBuilder multipart = new MultiPartSpecBuilder(csvBody.getBytes()); multipart.mimeType("multipart/form-data"); multipart.fileName("file.csv"); return httpRequest(status, "multipart/form-data") .multiPart(multipart.build()) .header("Authorization", "Basic YWRtaW46cGFzc3dvcmQ=") .post(baseURL + PATH_PREFIX + path); }
[ "protected", "Response", "httpPostCSV", "(", "String", "path", ",", "String", "csvBody", ",", "int", "status", ")", "{", "MultiPartSpecBuilder", "multipart", "=", "new", "MultiPartSpecBuilder", "(", "csvBody", ".", "getBytes", "(", ")", ")", ";", "multipart", ".", "mimeType", "(", "\"multipart/form-data\"", ")", ";", "multipart", ".", "fileName", "(", "\"file.csv\"", ")", ";", "return", "httpRequest", "(", "status", ",", "\"multipart/form-data\"", ")", ".", "multiPart", "(", "multipart", ".", "build", "(", ")", ")", ".", "header", "(", "\"Authorization\"", ",", "\"Basic YWRtaW46cGFzc3dvcmQ=\"", ")", ".", "post", "(", "baseURL", "+", "PATH_PREFIX", "+", "path", ")", ";", "}" ]
Posts the given CSV as multipart form data to the given path and expect a 200 status code. @param path the resource URI @param csvBody the resource representation @return the http response
[ "Posts", "the", "given", "CSV", "as", "multipart", "form", "data", "to", "the", "given", "path", "and", "expect", "a", "200", "status", "code", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java#L81-L89
147,444
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java
AbstractI18nRestIT.httpDelete
protected Response httpDelete(String path, int status) { return httpRequest(status, null).delete(baseURL + PATH_PREFIX + path); }
java
protected Response httpDelete(String path, int status) { return httpRequest(status, null).delete(baseURL + PATH_PREFIX + path); }
[ "protected", "Response", "httpDelete", "(", "String", "path", ",", "int", "status", ")", "{", "return", "httpRequest", "(", "status", ",", "null", ")", ".", "delete", "(", "baseURL", "+", "PATH_PREFIX", "+", "path", ")", ";", "}" ]
Deletes the resource at the given path. @param path the resource URI @return the http response
[ "Deletes", "the", "resource", "at", "the", "given", "path", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java#L119-L121
147,445
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/ViewPortImpl.java
ViewPortImpl.getMaximumBounds
public Bbox getMaximumBounds() { org.geomajas.gwt.client.spatial.Bbox box = mapView.getMaxBounds(); return new Bbox(box.getX(), box.getY(), box.getWidth(), box.getHeight()); }
java
public Bbox getMaximumBounds() { org.geomajas.gwt.client.spatial.Bbox box = mapView.getMaxBounds(); return new Bbox(box.getX(), box.getY(), box.getWidth(), box.getHeight()); }
[ "public", "Bbox", "getMaximumBounds", "(", ")", "{", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "spatial", ".", "Bbox", "box", "=", "mapView", ".", "getMaxBounds", "(", ")", ";", "return", "new", "Bbox", "(", "box", ".", "getX", "(", ")", ",", "box", ".", "getY", "(", ")", ",", "box", ".", "getWidth", "(", ")", ",", "box", ".", "getHeight", "(", ")", ")", ";", "}" ]
Get the maximum zooming extent that is allowed on this view port. These bounds are determined by the map configuration. @return The maximum zooming extent that is allowed on this view port.
[ "Get", "the", "maximum", "zooming", "extent", "that", "is", "allowed", "on", "this", "view", "port", ".", "These", "bounds", "are", "determined", "by", "the", "map", "configuration", "." ]
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/map/ViewPortImpl.java#L128-L131
147,446
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/ViewPortImpl.java
ViewPortImpl.transform
public Coordinate transform(Coordinate coordinate, String from, String to) { if (from.equalsIgnoreCase(to)) { return coordinate; } org.geomajas.geometry.Coordinate transformed; if (SCREEN.equalsIgnoreCase(from) && WORLD.equalsIgnoreCase(to)) { transformed = mapView.getWorldViewTransformer().viewToWorld(coordinate); return new Coordinate(transformed.getX(), transformed.getY()); } else if (WORLD.equalsIgnoreCase(from) && SCREEN.equalsIgnoreCase(to)) { transformed = mapView.getWorldViewTransformer().worldToView(coordinate); return new Coordinate(transformed.getX(), transformed.getY()); } return coordinate; }
java
public Coordinate transform(Coordinate coordinate, String from, String to) { if (from.equalsIgnoreCase(to)) { return coordinate; } org.geomajas.geometry.Coordinate transformed; if (SCREEN.equalsIgnoreCase(from) && WORLD.equalsIgnoreCase(to)) { transformed = mapView.getWorldViewTransformer().viewToWorld(coordinate); return new Coordinate(transformed.getX(), transformed.getY()); } else if (WORLD.equalsIgnoreCase(from) && SCREEN.equalsIgnoreCase(to)) { transformed = mapView.getWorldViewTransformer().worldToView(coordinate); return new Coordinate(transformed.getX(), transformed.getY()); } return coordinate; }
[ "public", "Coordinate", "transform", "(", "Coordinate", "coordinate", ",", "String", "from", ",", "String", "to", ")", "{", "if", "(", "from", ".", "equalsIgnoreCase", "(", "to", ")", ")", "{", "return", "coordinate", ";", "}", "org", ".", "geomajas", ".", "geometry", ".", "Coordinate", "transformed", ";", "if", "(", "SCREEN", ".", "equalsIgnoreCase", "(", "from", ")", "&&", "WORLD", ".", "equalsIgnoreCase", "(", "to", ")", ")", "{", "transformed", "=", "mapView", ".", "getWorldViewTransformer", "(", ")", ".", "viewToWorld", "(", "coordinate", ")", ";", "return", "new", "Coordinate", "(", "transformed", ".", "getX", "(", ")", ",", "transformed", ".", "getY", "(", ")", ")", ";", "}", "else", "if", "(", "WORLD", ".", "equalsIgnoreCase", "(", "from", ")", "&&", "SCREEN", ".", "equalsIgnoreCase", "(", "to", ")", ")", "{", "transformed", "=", "mapView", ".", "getWorldViewTransformer", "(", ")", ".", "worldToView", "(", "coordinate", ")", ";", "return", "new", "Coordinate", "(", "transformed", ".", "getX", "(", ")", ",", "transformed", ".", "getY", "(", ")", ")", ";", "}", "return", "coordinate", ";", "}" ]
Transform the given coordinate from a certain rendering space to another. @param coordinate The coordinate to transform. The X and Y ordinates are expected to be expressed in the 'from' rendering space. @param from The rendering space that expresses the X and Y ordinates of the given coordinate. Options are: <ul> <li>screen</li> <li>world</li> </ul> @param to The rendering space where to the coordinate should be transformed. Options are: <ul> <li>screen</li> <li>world</li> </ul> @return The transformed coordinate.
[ "Transform", "the", "given", "coordinate", "from", "a", "certain", "rendering", "space", "to", "another", "." ]
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/map/ViewPortImpl.java#L168-L182
147,447
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/painter/ImagePainter.java
ImagePainter.paint
public void paint(Paintable paintable, Object group, MapContext context) { Image image = (Image) paintable; context.getVectorContext().drawImage(group, image.getId(), image.getHref(), image.getBounds(), image.getStyle()); }
java
public void paint(Paintable paintable, Object group, MapContext context) { Image image = (Image) paintable; context.getVectorContext().drawImage(group, image.getId(), image.getHref(), image.getBounds(), image.getStyle()); }
[ "public", "void", "paint", "(", "Paintable", "paintable", ",", "Object", "group", ",", "MapContext", "context", ")", "{", "Image", "image", "=", "(", "Image", ")", "paintable", ";", "context", ".", "getVectorContext", "(", ")", ".", "drawImage", "(", "group", ",", "image", ".", "getId", "(", ")", ",", "image", ".", "getHref", "(", ")", ",", "image", ".", "getBounds", "(", ")", ",", "image", ".", "getStyle", "(", ")", ")", ";", "}" ]
The actual painting function. Draws the images with the object's id. @param paintable A {@link org.geomajas.gwt.client.gfx.paintable.Image} 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", "images", "with", "the", "object", "s", "id", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/painter/ImagePainter.java#L48-L52
147,448
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/snapping/ClosestPointAlgorithm.java
ClosestPointAlgorithm.getCoordinates
private List<Coordinate> getCoordinates(List<Geometry> geometries) { List<Coordinate> coordinates = new ArrayList<Coordinate>(); for (Geometry geometry : geometries) { Coordinate[] geometryCoordinates = geometry.getCoordinates(); for (int i = 0; i < geometryCoordinates.length; i++) { coordinates.add(geometryCoordinates[i]); } } return coordinates; }
java
private List<Coordinate> getCoordinates(List<Geometry> geometries) { List<Coordinate> coordinates = new ArrayList<Coordinate>(); for (Geometry geometry : geometries) { Coordinate[] geometryCoordinates = geometry.getCoordinates(); for (int i = 0; i < geometryCoordinates.length; i++) { coordinates.add(geometryCoordinates[i]); } } return coordinates; }
[ "private", "List", "<", "Coordinate", ">", "getCoordinates", "(", "List", "<", "Geometry", ">", "geometries", ")", "{", "List", "<", "Coordinate", ">", "coordinates", "=", "new", "ArrayList", "<", "Coordinate", ">", "(", ")", ";", "for", "(", "Geometry", "geometry", ":", "geometries", ")", "{", "Coordinate", "[", "]", "geometryCoordinates", "=", "geometry", ".", "getCoordinates", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "geometryCoordinates", ".", "length", ";", "i", "++", ")", "{", "coordinates", ".", "add", "(", "geometryCoordinates", "[", "i", "]", ")", ";", "}", "}", "return", "coordinates", ";", "}" ]
Get a single list of coordinates from a list of geometries.
[ "Get", "a", "single", "list", "of", "coordinates", "from", "a", "list", "of", "geometries", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/snapping/ClosestPointAlgorithm.java#L106-L115
147,449
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/snapping/ClosestPointAlgorithm.java
ClosestPointAlgorithm.getPossibleCoordinates
private List<Coordinate> getPossibleCoordinates(Coordinate coordinate) { int xMin = Collections.binarySearch(sortedX, new Coordinate(coordinate.getX() - ruleDistance, 0), new XComparator()); int xMax = Collections.binarySearch(sortedX, new Coordinate(coordinate.getX() + ruleDistance, 0), new XComparator()); int yMin = Collections.binarySearch(sortedY, new Coordinate(0, coordinate.getY() - ruleDistance), new YComparator()); int yMax = Collections.binarySearch(sortedY, new Coordinate(0, coordinate.getY() + ruleDistance), new YComparator()); if (xMin < 0) { xMin = Math.abs(xMin) - 1; } if (xMax < 0) { xMax = Math.abs(xMax) - 1; } if (yMin < 0) { yMin = Math.abs(yMin) - 1; } if (yMax < 0) { yMax = Math.abs(yMax) - 1; } List<Coordinate> coordinates = new ArrayList<Coordinate>(); for (int i = xMin; i < xMax; i++) { coordinates.add(sortedX.get(i)); } for (int i = yMin; i < yMax; i++) { coordinates.add(sortedY.get(i)); } return coordinates; }
java
private List<Coordinate> getPossibleCoordinates(Coordinate coordinate) { int xMin = Collections.binarySearch(sortedX, new Coordinate(coordinate.getX() - ruleDistance, 0), new XComparator()); int xMax = Collections.binarySearch(sortedX, new Coordinate(coordinate.getX() + ruleDistance, 0), new XComparator()); int yMin = Collections.binarySearch(sortedY, new Coordinate(0, coordinate.getY() - ruleDistance), new YComparator()); int yMax = Collections.binarySearch(sortedY, new Coordinate(0, coordinate.getY() + ruleDistance), new YComparator()); if (xMin < 0) { xMin = Math.abs(xMin) - 1; } if (xMax < 0) { xMax = Math.abs(xMax) - 1; } if (yMin < 0) { yMin = Math.abs(yMin) - 1; } if (yMax < 0) { yMax = Math.abs(yMax) - 1; } List<Coordinate> coordinates = new ArrayList<Coordinate>(); for (int i = xMin; i < xMax; i++) { coordinates.add(sortedX.get(i)); } for (int i = yMin; i < yMax; i++) { coordinates.add(sortedY.get(i)); } return coordinates; }
[ "private", "List", "<", "Coordinate", ">", "getPossibleCoordinates", "(", "Coordinate", "coordinate", ")", "{", "int", "xMin", "=", "Collections", ".", "binarySearch", "(", "sortedX", ",", "new", "Coordinate", "(", "coordinate", ".", "getX", "(", ")", "-", "ruleDistance", ",", "0", ")", ",", "new", "XComparator", "(", ")", ")", ";", "int", "xMax", "=", "Collections", ".", "binarySearch", "(", "sortedX", ",", "new", "Coordinate", "(", "coordinate", ".", "getX", "(", ")", "+", "ruleDistance", ",", "0", ")", ",", "new", "XComparator", "(", ")", ")", ";", "int", "yMin", "=", "Collections", ".", "binarySearch", "(", "sortedY", ",", "new", "Coordinate", "(", "0", ",", "coordinate", ".", "getY", "(", ")", "-", "ruleDistance", ")", ",", "new", "YComparator", "(", ")", ")", ";", "int", "yMax", "=", "Collections", ".", "binarySearch", "(", "sortedY", ",", "new", "Coordinate", "(", "0", ",", "coordinate", ".", "getY", "(", ")", "+", "ruleDistance", ")", ",", "new", "YComparator", "(", ")", ")", ";", "if", "(", "xMin", "<", "0", ")", "{", "xMin", "=", "Math", ".", "abs", "(", "xMin", ")", "-", "1", ";", "}", "if", "(", "xMax", "<", "0", ")", "{", "xMax", "=", "Math", ".", "abs", "(", "xMax", ")", "-", "1", ";", "}", "if", "(", "yMin", "<", "0", ")", "{", "yMin", "=", "Math", ".", "abs", "(", "yMin", ")", "-", "1", ";", "}", "if", "(", "yMax", "<", "0", ")", "{", "yMax", "=", "Math", ".", "abs", "(", "yMax", ")", "-", "1", ";", "}", "List", "<", "Coordinate", ">", "coordinates", "=", "new", "ArrayList", "<", "Coordinate", ">", "(", ")", ";", "for", "(", "int", "i", "=", "xMin", ";", "i", "<", "xMax", ";", "i", "++", ")", "{", "coordinates", ".", "add", "(", "sortedX", ".", "get", "(", "i", ")", ")", ";", "}", "for", "(", "int", "i", "=", "yMin", ";", "i", "<", "yMax", ";", "i", "++", ")", "{", "coordinates", ".", "add", "(", "sortedY", ".", "get", "(", "i", ")", ")", ";", "}", "return", "coordinates", ";", "}" ]
Return a possible list of coordinates that are within range of the given coordinate. This function is very fast as it uses binary search, and it returns a small subset of coordinates. The perfect set to start calculating from.
[ "Return", "a", "possible", "list", "of", "coordinates", "that", "are", "within", "range", "of", "the", "given", "coordinate", ".", "This", "function", "is", "very", "fast", "as", "it", "uses", "binary", "search", "and", "it", "returns", "a", "small", "subset", "of", "coordinates", ".", "The", "perfect", "set", "to", "start", "calculating", "from", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/snapping/ClosestPointAlgorithm.java#L140-L171
147,450
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/snapping/NearestAlgorithm.java
NearestAlgorithm.getCoordinateArrays
private List<Coordinate[]> getCoordinateArrays(List<Geometry> geometries) { List<Coordinate[]> res = new ArrayList<Coordinate[]>(); for (Geometry geometry : geometries) { res.add(geometry.getCoordinates()); } return res; }
java
private List<Coordinate[]> getCoordinateArrays(List<Geometry> geometries) { List<Coordinate[]> res = new ArrayList<Coordinate[]>(); for (Geometry geometry : geometries) { res.add(geometry.getCoordinates()); } return res; }
[ "private", "List", "<", "Coordinate", "[", "]", ">", "getCoordinateArrays", "(", "List", "<", "Geometry", ">", "geometries", ")", "{", "List", "<", "Coordinate", "[", "]", ">", "res", "=", "new", "ArrayList", "<", "Coordinate", "[", "]", ">", "(", ")", ";", "for", "(", "Geometry", "geometry", ":", "geometries", ")", "{", "res", ".", "add", "(", "geometry", ".", "getCoordinates", "(", ")", ")", ";", "}", "return", "res", ";", "}" ]
Transform the list of geometries into a list of coordinate arrays.
[ "Transform", "the", "list", "of", "geometries", "into", "a", "list", "of", "coordinate", "arrays", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/snapping/NearestAlgorithm.java#L95-L101
147,451
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/SingleSelectionController.java
SingleSelectionController.onUp
public void onUp(HumanInputEvent<?> event) { if (!isRightMouseButton(event)) { ToggleSelectionAction action = new ToggleSelectionAction(mapWidget, pixelTolerance); action.setPriorityToSelectedLayer(priorityToSelectedLayer); action.toggleSingle(getLocation(event, RenderSpace.SCREEN)); } }
java
public void onUp(HumanInputEvent<?> event) { if (!isRightMouseButton(event)) { ToggleSelectionAction action = new ToggleSelectionAction(mapWidget, pixelTolerance); action.setPriorityToSelectedLayer(priorityToSelectedLayer); action.toggleSingle(getLocation(event, RenderSpace.SCREEN)); } }
[ "public", "void", "onUp", "(", "HumanInputEvent", "<", "?", ">", "event", ")", "{", "if", "(", "!", "isRightMouseButton", "(", "event", ")", ")", "{", "ToggleSelectionAction", "action", "=", "new", "ToggleSelectionAction", "(", "mapWidget", ",", "pixelTolerance", ")", ";", "action", ".", "setPriorityToSelectedLayer", "(", "priorityToSelectedLayer", ")", ";", "action", ".", "toggleSingle", "(", "getLocation", "(", "event", ",", "RenderSpace", ".", "SCREEN", ")", ")", ";", "}", "}" ]
Toggle selection at the event location. @param event event
[ "Toggle", "selection", "at", "the", "event", "location", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/SingleSelectionController.java#L66-L72
147,452
seedstack/i18n-addon
rest/src/main/java/org/seedstack/i18n/rest/internal/messages/MessageResource.java
MessageResource.getTranslations
@GET @Path("/{locale}") @Produces(MediaType.APPLICATION_JSON) public Response getTranslations(@PathParam("locale") String locale) { Map<String, String> messages = getMessages(locale); if (!messages.isEmpty()) { return Response.ok(messages).build(); } return Response.ok("{}").build(); }
java
@GET @Path("/{locale}") @Produces(MediaType.APPLICATION_JSON) public Response getTranslations(@PathParam("locale") String locale) { Map<String, String> messages = getMessages(locale); if (!messages.isEmpty()) { return Response.ok(messages).build(); } return Response.ok("{}").build(); }
[ "@", "GET", "@", "Path", "(", "\"/{locale}\"", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "public", "Response", "getTranslations", "(", "@", "PathParam", "(", "\"locale\"", ")", "String", "locale", ")", "{", "Map", "<", "String", ",", "String", ">", "messages", "=", "getMessages", "(", "locale", ")", ";", "if", "(", "!", "messages", ".", "isEmpty", "(", ")", ")", "{", "return", "Response", ".", "ok", "(", "messages", ")", ".", "build", "(", ")", ";", "}", "return", "Response", ".", "ok", "(", "\"{}\"", ")", ".", "build", "(", ")", ";", "}" ]
Returns a map of key, translation for the given locale. @param locale locale identifier @return status code 200 with all application messages or "{}" if no message
[ "Returns", "a", "map", "of", "key", "translation", "for", "the", "given", "locale", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/messages/MessageResource.java#L44-L53
147,453
seedstack/i18n-addon
core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java
Key.getTranslation
public Translation getTranslation(String locale) { LocaleCodeSpecification.assertCode(locale); return this.getTranslations().get(locale); }
java
public Translation getTranslation(String locale) { LocaleCodeSpecification.assertCode(locale); return this.getTranslations().get(locale); }
[ "public", "Translation", "getTranslation", "(", "String", "locale", ")", "{", "LocaleCodeSpecification", ".", "assertCode", "(", "locale", ")", ";", "return", "this", ".", "getTranslations", "(", ")", ".", "get", "(", "locale", ")", ";", "}" ]
Returns the translation corresponding to the given locale code. @param locale locale code @return the translation @throws java.lang.IllegalArgumentException if the locale is null or empty or contains other characters than letters and "-".
[ "Returns", "the", "translation", "corresponding", "to", "the", "given", "locale", "code", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java#L116-L120
147,454
seedstack/i18n-addon
core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java
Key.removeTranslation
public void removeTranslation(String locale) { LocaleCodeSpecification.assertCode(locale); Translation translation = getTranslation(locale); if (translation != null) { this.translations.remove(translation.getId()); } }
java
public void removeTranslation(String locale) { LocaleCodeSpecification.assertCode(locale); Translation translation = getTranslation(locale); if (translation != null) { this.translations.remove(translation.getId()); } }
[ "public", "void", "removeTranslation", "(", "String", "locale", ")", "{", "LocaleCodeSpecification", ".", "assertCode", "(", "locale", ")", ";", "Translation", "translation", "=", "getTranslation", "(", "locale", ")", ";", "if", "(", "translation", "!=", "null", ")", "{", "this", ".", "translations", ".", "remove", "(", "translation", ".", "getId", "(", ")", ")", ";", "}", "}" ]
Removes the translation corresponding to the given locale code. @param locale locale code @throws java.lang.IllegalArgumentException if the locale is null or empty or contains other characters than letters and "-".
[ "Removes", "the", "translation", "corresponding", "to", "the", "given", "locale", "code", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java#L129-L136
147,455
seedstack/i18n-addon
core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java
Key.checkOutdatedStatus
public void checkOutdatedStatus() { boolean newStatus = false; for (Translation translation : translations.values()) { if (translation.isOutdated()) { newStatus = true; break; } } outdated = newStatus; }
java
public void checkOutdatedStatus() { boolean newStatus = false; for (Translation translation : translations.values()) { if (translation.isOutdated()) { newStatus = true; break; } } outdated = newStatus; }
[ "public", "void", "checkOutdatedStatus", "(", ")", "{", "boolean", "newStatus", "=", "false", ";", "for", "(", "Translation", "translation", ":", "translations", ".", "values", "(", ")", ")", "{", "if", "(", "translation", ".", "isOutdated", "(", ")", ")", "{", "newStatus", "=", "true", ";", "break", ";", "}", "}", "outdated", "=", "newStatus", ";", "}" ]
Checks if the key has outdated translations and then update the outdated status of the key.
[ "Checks", "if", "the", "key", "has", "outdated", "translations", "and", "then", "update", "the", "outdated", "status", "of", "the", "key", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java#L141-L150
147,456
seedstack/i18n-addon
core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java
Key.getTranslations
public Map<String, Translation> getTranslations() { Map<String, Translation> map = new HashMap<>(); for (Map.Entry<TranslationId, Translation> translationEntry : translations.entrySet()) { map.put(translationEntry.getKey().getLocale(), translationEntry.getValue()); } return map; }
java
public Map<String, Translation> getTranslations() { Map<String, Translation> map = new HashMap<>(); for (Map.Entry<TranslationId, Translation> translationEntry : translations.entrySet()) { map.put(translationEntry.getKey().getLocale(), translationEntry.getValue()); } return map; }
[ "public", "Map", "<", "String", ",", "Translation", ">", "getTranslations", "(", ")", "{", "Map", "<", "String", ",", "Translation", ">", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "TranslationId", ",", "Translation", ">", "translationEntry", ":", "translations", ".", "entrySet", "(", ")", ")", "{", "map", ".", "put", "(", "translationEntry", ".", "getKey", "(", ")", ".", "getLocale", "(", ")", ",", "translationEntry", ".", "getValue", "(", ")", ")", ";", "}", "return", "map", ";", "}" ]
Returns the translation set. @return the translations
[ "Returns", "the", "translation", "set", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java#L195-L201
147,457
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.toDtoBbox
public org.geomajas.geometry.Bbox toDtoBbox() { return new org.geomajas.geometry.Bbox(getX(), getY(), getWidth(), getHeight()); }
java
public org.geomajas.geometry.Bbox toDtoBbox() { return new org.geomajas.geometry.Bbox(getX(), getY(), getWidth(), getHeight()); }
[ "public", "org", ".", "geomajas", ".", "geometry", ".", "Bbox", "toDtoBbox", "(", ")", "{", "return", "new", "org", ".", "geomajas", ".", "geometry", ".", "Bbox", "(", "getX", "(", ")", ",", "getY", "(", ")", ",", "getWidth", "(", ")", ",", "getHeight", "(", ")", ")", ";", "}" ]
Convert the GWT bounding box to a DTO bounding box. @return the bbox
[ "Convert", "the", "GWT", "bounding", "box", "to", "a", "DTO", "bounding", "box", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L109-L111
147,458
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.getCoordinates
public Coordinate[] getCoordinates() { Coordinate[] result = new Coordinate[5]; result[0] = new Coordinate(x, y); result[1] = new Coordinate(x + width, y); result[2] = new Coordinate(x + width, y + height); result[3] = new Coordinate(x, y + height); result[4] = new Coordinate(x, y); return result; }
java
public Coordinate[] getCoordinates() { Coordinate[] result = new Coordinate[5]; result[0] = new Coordinate(x, y); result[1] = new Coordinate(x + width, y); result[2] = new Coordinate(x + width, y + height); result[3] = new Coordinate(x, y + height); result[4] = new Coordinate(x, y); return result; }
[ "public", "Coordinate", "[", "]", "getCoordinates", "(", ")", "{", "Coordinate", "[", "]", "result", "=", "new", "Coordinate", "[", "5", "]", ";", "result", "[", "0", "]", "=", "new", "Coordinate", "(", "x", ",", "y", ")", ";", "result", "[", "1", "]", "=", "new", "Coordinate", "(", "x", "+", "width", ",", "y", ")", ";", "result", "[", "2", "]", "=", "new", "Coordinate", "(", "x", "+", "width", ",", "y", "+", "height", ")", ";", "result", "[", "3", "]", "=", "new", "Coordinate", "(", "x", ",", "y", "+", "height", ")", ";", "result", "[", "4", "]", "=", "new", "Coordinate", "(", "x", ",", "y", ")", ";", "return", "result", ";", "}" ]
Get the coordinates of the bounding box as an array. @return Returns 5 coordinates so that the array is closed. This can be useful when using this array to creating a <code>LinearRing</code>.
[ "Get", "the", "coordinates", "of", "the", "bounding", "box", "as", "an", "array", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L162-L171
147,459
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.contains
public boolean contains(Bbox other) { if (other.getX() < this.getX()) { return false; } if (other.getY() < this.getY()) { return false; } if (other.getEndPoint().getX() > this.getEndPoint().getX()) { return false; } if (other.getEndPoint().getY() > this.getEndPoint().getY()) { return false; } return true; }
java
public boolean contains(Bbox other) { if (other.getX() < this.getX()) { return false; } if (other.getY() < this.getY()) { return false; } if (other.getEndPoint().getX() > this.getEndPoint().getX()) { return false; } if (other.getEndPoint().getY() > this.getEndPoint().getY()) { return false; } return true; }
[ "public", "boolean", "contains", "(", "Bbox", "other", ")", "{", "if", "(", "other", ".", "getX", "(", ")", "<", "this", ".", "getX", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "other", ".", "getY", "(", ")", "<", "this", ".", "getY", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "other", ".", "getEndPoint", "(", ")", ".", "getX", "(", ")", ">", "this", ".", "getEndPoint", "(", ")", ".", "getX", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "other", ".", "getEndPoint", "(", ")", ".", "getY", "(", ")", ">", "this", ".", "getEndPoint", "(", ")", ".", "getY", "(", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Does this bounding box contain the given bounding box? @param other Another Bbox. @return true if the other is completely surrounded by this one, false otherwise.
[ "Does", "this", "bounding", "box", "contain", "the", "given", "bounding", "box?" ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L180-L194
147,460
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.intersects
public boolean intersects(Bbox other) { if (other.getX() > this.getEndPoint().getX()) { return false; } if (other.getY() > this.getEndPoint().getY()) { return false; } if (other.getEndPoint().getX() < this.getX()) { return false; } if (other.getEndPoint().getY() < this.getY()) { return false; } return true; }
java
public boolean intersects(Bbox other) { if (other.getX() > this.getEndPoint().getX()) { return false; } if (other.getY() > this.getEndPoint().getY()) { return false; } if (other.getEndPoint().getX() < this.getX()) { return false; } if (other.getEndPoint().getY() < this.getY()) { return false; } return true; }
[ "public", "boolean", "intersects", "(", "Bbox", "other", ")", "{", "if", "(", "other", ".", "getX", "(", ")", ">", "this", ".", "getEndPoint", "(", ")", ".", "getX", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "other", ".", "getY", "(", ")", ">", "this", ".", "getEndPoint", "(", ")", ".", "getY", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "other", ".", "getEndPoint", "(", ")", ".", "getX", "(", ")", "<", "this", ".", "getX", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "other", ".", "getEndPoint", "(", ")", ".", "getY", "(", ")", "<", "this", ".", "getY", "(", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Does this bounding box intersect the given bounding box? @param other Another Bbox. @return true if the other intersects this one, false otherwise.
[ "Does", "this", "bounding", "box", "intersect", "the", "given", "bounding", "box?" ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L226-L240
147,461
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.intersection
public Bbox intersection(Bbox other) { if (!this.intersects(other)) { return null; } else { double minx = other.getX() > this.getX() ? other.getX() : this.getX(); double maxx = other.getEndPoint().getX() < this.getEndPoint().getX() ? other.getEndPoint().getX() : this .getEndPoint().getX(); double miny = other.getY() > this.getY() ? other.getY() : this.getY(); double maxy = other.getEndPoint().getY() < this.getEndPoint().getY() ? other.getEndPoint().getY() : this .getEndPoint().getY(); return new Bbox(minx, miny, (maxx - minx), (maxy - miny)); } }
java
public Bbox intersection(Bbox other) { if (!this.intersects(other)) { return null; } else { double minx = other.getX() > this.getX() ? other.getX() : this.getX(); double maxx = other.getEndPoint().getX() < this.getEndPoint().getX() ? other.getEndPoint().getX() : this .getEndPoint().getX(); double miny = other.getY() > this.getY() ? other.getY() : this.getY(); double maxy = other.getEndPoint().getY() < this.getEndPoint().getY() ? other.getEndPoint().getY() : this .getEndPoint().getY(); return new Bbox(minx, miny, (maxx - minx), (maxy - miny)); } }
[ "public", "Bbox", "intersection", "(", "Bbox", "other", ")", "{", "if", "(", "!", "this", ".", "intersects", "(", "other", ")", ")", "{", "return", "null", ";", "}", "else", "{", "double", "minx", "=", "other", ".", "getX", "(", ")", ">", "this", ".", "getX", "(", ")", "?", "other", ".", "getX", "(", ")", ":", "this", ".", "getX", "(", ")", ";", "double", "maxx", "=", "other", ".", "getEndPoint", "(", ")", ".", "getX", "(", ")", "<", "this", ".", "getEndPoint", "(", ")", ".", "getX", "(", ")", "?", "other", ".", "getEndPoint", "(", ")", ".", "getX", "(", ")", ":", "this", ".", "getEndPoint", "(", ")", ".", "getX", "(", ")", ";", "double", "miny", "=", "other", ".", "getY", "(", ")", ">", "this", ".", "getY", "(", ")", "?", "other", ".", "getY", "(", ")", ":", "this", ".", "getY", "(", ")", ";", "double", "maxy", "=", "other", ".", "getEndPoint", "(", ")", ".", "getY", "(", ")", "<", "this", ".", "getEndPoint", "(", ")", ".", "getY", "(", ")", "?", "other", ".", "getEndPoint", "(", ")", ".", "getY", "(", ")", ":", "this", ".", "getEndPoint", "(", ")", ".", "getY", "(", ")", ";", "return", "new", "Bbox", "(", "minx", ",", "miny", ",", "(", "maxx", "-", "minx", ")", ",", "(", "maxy", "-", "miny", ")", ")", ";", "}", "}" ]
Computes the intersection of this bounding box with the specified bounding box. @param other Another Bbox. @return bounding box of intersection or null if they do not intersect.
[ "Computes", "the", "intersection", "of", "this", "bounding", "box", "with", "the", "specified", "bounding", "box", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L249-L261
147,462
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.buffer
public Bbox buffer(double range) { if (range > 0) { double r2 = range * 2; return new Bbox(x - range, y - range, width + r2, height + r2); } return null; }
java
public Bbox buffer(double range) { if (range > 0) { double r2 = range * 2; return new Bbox(x - range, y - range, width + r2, height + r2); } return null; }
[ "public", "Bbox", "buffer", "(", "double", "range", ")", "{", "if", "(", "range", ">", "0", ")", "{", "double", "r2", "=", "range", "*", "2", ";", "return", "new", "Bbox", "(", "x", "-", "range", ",", "y", "-", "range", ",", "width", "+", "r2", ",", "height", "+", "r2", ")", ";", "}", "return", "null", ";", "}" ]
Return a new bounding box that has increased in size by adding a range to this bounding box. @param range Must be a positive number, otherwise null will be returned. @return new buffered bounding box
[ "Return", "a", "new", "bounding", "box", "that", "has", "increased", "in", "size", "by", "adding", "a", "range", "to", "this", "bounding", "box", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L292-L298
147,463
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.transform
public Bbox transform(Matrix t) { Coordinate c1 = transform(t, new Coordinate(x, y)); Coordinate c2 = transform(t, new Coordinate(x + width, y + height)); Coordinate origin = new Coordinate(Math.min(c1.getX(), c2.getX()), Math.min(c1.getY(), c2.getY())); Coordinate endPoint = new Coordinate(Math.max(c1.getX(), c2.getX()), Math.max(c1.getY(), c2.getY())); return new Bbox(origin.getX(), origin.getY(), endPoint.getX() - origin.getX(), endPoint.getY() - origin.getY()); }
java
public Bbox transform(Matrix t) { Coordinate c1 = transform(t, new Coordinate(x, y)); Coordinate c2 = transform(t, new Coordinate(x + width, y + height)); Coordinate origin = new Coordinate(Math.min(c1.getX(), c2.getX()), Math.min(c1.getY(), c2.getY())); Coordinate endPoint = new Coordinate(Math.max(c1.getX(), c2.getX()), Math.max(c1.getY(), c2.getY())); return new Bbox(origin.getX(), origin.getY(), endPoint.getX() - origin.getX(), endPoint.getY() - origin.getY()); }
[ "public", "Bbox", "transform", "(", "Matrix", "t", ")", "{", "Coordinate", "c1", "=", "transform", "(", "t", ",", "new", "Coordinate", "(", "x", ",", "y", ")", ")", ";", "Coordinate", "c2", "=", "transform", "(", "t", ",", "new", "Coordinate", "(", "x", "+", "width", ",", "y", "+", "height", ")", ")", ";", "Coordinate", "origin", "=", "new", "Coordinate", "(", "Math", ".", "min", "(", "c1", ".", "getX", "(", ")", ",", "c2", ".", "getX", "(", ")", ")", ",", "Math", ".", "min", "(", "c1", ".", "getY", "(", ")", ",", "c2", ".", "getY", "(", ")", ")", ")", ";", "Coordinate", "endPoint", "=", "new", "Coordinate", "(", "Math", ".", "max", "(", "c1", ".", "getX", "(", ")", ",", "c2", ".", "getX", "(", ")", ")", ",", "Math", ".", "max", "(", "c1", ".", "getY", "(", ")", ",", "c2", ".", "getY", "(", ")", ")", ")", ";", "return", "new", "Bbox", "(", "origin", ".", "getX", "(", ")", ",", "origin", ".", "getY", "(", ")", ",", "endPoint", ".", "getX", "(", ")", "-", "origin", ".", "getX", "(", ")", ",", "endPoint", ".", "getY", "(", ")", "-", "origin", ".", "getY", "(", ")", ")", ";", "}" ]
Create a new bounds by transforming this bounds with the specified tranformation matrix. @param t the transformation matrix @return the transformed bounds
[ "Create", "a", "new", "bounds", "by", "transforming", "this", "bounds", "with", "the", "specified", "tranformation", "matrix", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L365-L371
147,464
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.setCenterPoint
public void setCenterPoint(Coordinate coordinate) { this.x = coordinate.getX() - 0.5 * this.width; this.y = coordinate.getY() - 0.5 * this.height; }
java
public void setCenterPoint(Coordinate coordinate) { this.x = coordinate.getX() - 0.5 * this.width; this.y = coordinate.getY() - 0.5 * this.height; }
[ "public", "void", "setCenterPoint", "(", "Coordinate", "coordinate", ")", "{", "this", ".", "x", "=", "coordinate", ".", "getX", "(", ")", "-", "0.5", "*", "this", ".", "width", ";", "this", ".", "y", "=", "coordinate", ".", "getY", "(", ")", "-", "0.5", "*", "this", ".", "height", ";", "}" ]
Moves center to the specified coordinate. @param coordinate new center point
[ "Moves", "center", "to", "the", "specified", "coordinate", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L379-L382
147,465
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/MapImpl.java
MapImpl.getMapController
public MapController getMapController() { final GraphicsController controller = mapWidget.getController(); MapController mapController = new MapController(this, controller); mapController.setActivationHandler(new ExportableFunction() { public void execute() { controller.onActivate(); } }); mapController.setDeactivationHandler(new ExportableFunction() { public void execute() { controller.onDeactivate(); } }); return mapController; }
java
public MapController getMapController() { final GraphicsController controller = mapWidget.getController(); MapController mapController = new MapController(this, controller); mapController.setActivationHandler(new ExportableFunction() { public void execute() { controller.onActivate(); } }); mapController.setDeactivationHandler(new ExportableFunction() { public void execute() { controller.onDeactivate(); } }); return mapController; }
[ "public", "MapController", "getMapController", "(", ")", "{", "final", "GraphicsController", "controller", "=", "mapWidget", ".", "getController", "(", ")", ";", "MapController", "mapController", "=", "new", "MapController", "(", "this", ",", "controller", ")", ";", "mapController", ".", "setActivationHandler", "(", "new", "ExportableFunction", "(", ")", "{", "public", "void", "execute", "(", ")", "{", "controller", ".", "onActivate", "(", ")", ";", "}", "}", ")", ";", "mapController", ".", "setDeactivationHandler", "(", "new", "ExportableFunction", "(", ")", "{", "public", "void", "execute", "(", ")", "{", "controller", ".", "onDeactivate", "(", ")", ";", "}", "}", ")", ";", "return", "mapController", ";", "}" ]
Return the currently active controller on the map. @return The currently active controller.
[ "Return", "the", "currently", "active", "controller", "on", "the", "map", "." ]
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/map/MapImpl.java#L147-L163
147,466
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java
PainterVisitor.registerPainter
public void registerPainter(Painter painter) { if (painters.containsKey(painter.getPaintableClassName())) { List<Painter> list = painters.remove(painter.getPaintableClassName()); list.add(painter); this.painters.put(painter.getPaintableClassName(), list); } else { List<Painter> list = new ArrayList<Painter>(); list.add(painter); this.painters.put(painter.getPaintableClassName(), list); } }
java
public void registerPainter(Painter painter) { if (painters.containsKey(painter.getPaintableClassName())) { List<Painter> list = painters.remove(painter.getPaintableClassName()); list.add(painter); this.painters.put(painter.getPaintableClassName(), list); } else { List<Painter> list = new ArrayList<Painter>(); list.add(painter); this.painters.put(painter.getPaintableClassName(), list); } }
[ "public", "void", "registerPainter", "(", "Painter", "painter", ")", "{", "if", "(", "painters", ".", "containsKey", "(", "painter", ".", "getPaintableClassName", "(", ")", ")", ")", "{", "List", "<", "Painter", ">", "list", "=", "painters", ".", "remove", "(", "painter", ".", "getPaintableClassName", "(", ")", ")", ";", "list", ".", "add", "(", "painter", ")", ";", "this", ".", "painters", ".", "put", "(", "painter", ".", "getPaintableClassName", "(", ")", ",", "list", ")", ";", "}", "else", "{", "List", "<", "Painter", ">", "list", "=", "new", "ArrayList", "<", "Painter", ">", "(", ")", ";", "list", ".", "add", "(", "painter", ")", ";", "this", ".", "painters", ".", "put", "(", "painter", ".", "getPaintableClassName", "(", ")", ",", "list", ")", ";", "}", "}" ]
Register a new painter to this visitor. @param painter The painter itself.
[ "Register", "a", "new", "painter", "to", "this", "visitor", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java#L57-L67
147,467
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java
PainterVisitor.unregisterPainter
public void unregisterPainter(Painter painter) { String className = painter.getPaintableClassName(); if (painters.containsKey(className)) { List<Painter> list = painters.remove(className); if (list.size() > 1) { list.remove(painter); painters.put(className, list); } } }
java
public void unregisterPainter(Painter painter) { String className = painter.getPaintableClassName(); if (painters.containsKey(className)) { List<Painter> list = painters.remove(className); if (list.size() > 1) { list.remove(painter); painters.put(className, list); } } }
[ "public", "void", "unregisterPainter", "(", "Painter", "painter", ")", "{", "String", "className", "=", "painter", ".", "getPaintableClassName", "(", ")", ";", "if", "(", "painters", ".", "containsKey", "(", "className", ")", ")", "{", "List", "<", "Painter", ">", "list", "=", "painters", ".", "remove", "(", "className", ")", ";", "if", "(", "list", ".", "size", "(", ")", ">", "1", ")", "{", "list", ".", "remove", "(", "painter", ")", ";", "painters", ".", "put", "(", "className", ",", "list", ")", ";", "}", "}", "}" ]
Unregister an existing painter from this visitor. @param painter The painter itself.
[ "Unregister", "an", "existing", "painter", "from", "this", "visitor", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java#L75-L84
147,468
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java
PainterVisitor.visit
public void visit(Paintable paintable, Object group) { if (context.isReady()) { String className = paintable.getClass().getName(); if (painters.containsKey(className)) { List<Painter> list = painters.get(className); for (Painter painter : list) { painter.paint(paintable, group, context); } } } }
java
public void visit(Paintable paintable, Object group) { if (context.isReady()) { String className = paintable.getClass().getName(); if (painters.containsKey(className)) { List<Painter> list = painters.get(className); for (Painter painter : list) { painter.paint(paintable, group, context); } } } }
[ "public", "void", "visit", "(", "Paintable", "paintable", ",", "Object", "group", ")", "{", "if", "(", "context", ".", "isReady", "(", ")", ")", "{", "String", "className", "=", "paintable", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "painters", ".", "containsKey", "(", "className", ")", ")", "{", "List", "<", "Painter", ">", "list", "=", "painters", ".", "get", "(", "className", ")", ";", "for", "(", "Painter", "painter", ":", "list", ")", "{", "painter", ".", "paint", "(", "paintable", ",", "group", ",", "context", ")", ";", "}", "}", "}", "}" ]
The visitors visit function. @param paintable object to draw @param group group to draw
[ "The", "visitors", "visit", "function", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java#L92-L102
147,469
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java
PainterVisitor.remove
public void remove(Paintable paintable, Object group) { String className = paintable.getClass().getName(); if (painters.containsKey(className)) { List<Painter> list = painters.get(className); for (Painter painter : list) { painter.deleteShape(paintable, group, context); } } }
java
public void remove(Paintable paintable, Object group) { String className = paintable.getClass().getName(); if (painters.containsKey(className)) { List<Painter> list = painters.get(className); for (Painter painter : list) { painter.deleteShape(paintable, group, context); } } }
[ "public", "void", "remove", "(", "Paintable", "paintable", ",", "Object", "group", ")", "{", "String", "className", "=", "paintable", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "painters", ".", "containsKey", "(", "className", ")", ")", "{", "List", "<", "Painter", ">", "list", "=", "painters", ".", "get", "(", "className", ")", ";", "for", "(", "Painter", "painter", ":", "list", ")", "{", "painter", ".", "deleteShape", "(", "paintable", ",", "group", ",", "context", ")", ";", "}", "}", "}" ]
Remove a paintable object from the graphics. @param paintable paintable object @param group group to draw
[ "Remove", "a", "paintable", "object", "from", "the", "graphics", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java#L110-L118
147,470
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java
PainterVisitor.getPaintersForObject
public List<Painter> getPaintersForObject(Paintable paintable) { String className = paintable.getClass().getName(); if (painters.containsKey(className)) { return painters.get(className); } return null; }
java
public List<Painter> getPaintersForObject(Paintable paintable) { String className = paintable.getClass().getName(); if (painters.containsKey(className)) { return painters.get(className); } return null; }
[ "public", "List", "<", "Painter", ">", "getPaintersForObject", "(", "Paintable", "paintable", ")", "{", "String", "className", "=", "paintable", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "painters", ".", "containsKey", "(", "className", ")", ")", "{", "return", "painters", ".", "get", "(", "className", ")", ";", "}", "return", "null", ";", "}" ]
Retrieve the full list of painter for a specific type of paintable object. @param paintable The type of object to retrieve painter for. @return Return a list of painter, or null.
[ "Retrieve", "the", "full", "list", "of", "painter", "for", "a", "specific", "type", "of", "paintable", "object", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/PainterVisitor.java#L127-L133
147,471
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/AttributeUtil.java
AttributeUtil.createEmptyAssociationValue
public static AssociationValue createEmptyAssociationValue(AssociationAttributeInfo attributeInfo) { AssociationValue value = new AssociationValue(); Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>(); for (AbstractAttributeInfo attrInfo : attributeInfo.getFeature().getAttributes()) { attributes.put(attrInfo.getName(), createEmptyAttribute(attrInfo)); } value.setAllAttributes(attributes); value.setId(createEmptyPrimitiveAttribute(attributeInfo.getFeature().getIdentifier())); return value; }
java
public static AssociationValue createEmptyAssociationValue(AssociationAttributeInfo attributeInfo) { AssociationValue value = new AssociationValue(); Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>(); for (AbstractAttributeInfo attrInfo : attributeInfo.getFeature().getAttributes()) { attributes.put(attrInfo.getName(), createEmptyAttribute(attrInfo)); } value.setAllAttributes(attributes); value.setId(createEmptyPrimitiveAttribute(attributeInfo.getFeature().getIdentifier())); return value; }
[ "public", "static", "AssociationValue", "createEmptyAssociationValue", "(", "AssociationAttributeInfo", "attributeInfo", ")", "{", "AssociationValue", "value", "=", "new", "AssociationValue", "(", ")", ";", "Map", "<", "String", ",", "Attribute", "<", "?", ">", ">", "attributes", "=", "new", "HashMap", "<", "String", ",", "Attribute", "<", "?", ">", ">", "(", ")", ";", "for", "(", "AbstractAttributeInfo", "attrInfo", ":", "attributeInfo", ".", "getFeature", "(", ")", ".", "getAttributes", "(", ")", ")", "{", "attributes", ".", "put", "(", "attrInfo", ".", "getName", "(", ")", ",", "createEmptyAttribute", "(", "attrInfo", ")", ")", ";", "}", "value", ".", "setAllAttributes", "(", "attributes", ")", ";", "value", ".", "setId", "(", "createEmptyPrimitiveAttribute", "(", "attributeInfo", ".", "getFeature", "(", ")", ".", "getIdentifier", "(", ")", ")", ")", ";", "return", "value", ";", "}" ]
Creates an empty association value. An empty association value is a value for which the attributes and identifier are empty. @param attributeInfo attribute info @return an empty value
[ "Creates", "an", "empty", "association", "value", ".", "An", "empty", "association", "value", "is", "a", "value", "for", "which", "the", "attributes", "and", "identifier", "are", "empty", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/AttributeUtil.java#L55-L64
147,472
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/AttributeUtil.java
AttributeUtil.createEmptyAttribute
public static Attribute<?> createEmptyAttribute(AbstractAttributeInfo attrInfo) { if (attrInfo instanceof PrimitiveAttributeInfo) { return createEmptyPrimitiveAttribute((PrimitiveAttributeInfo) attrInfo); } else if (attrInfo instanceof AssociationAttributeInfo) { return createEmptyAssociationAttribute((AssociationAttributeInfo) attrInfo); } return null; }
java
public static Attribute<?> createEmptyAttribute(AbstractAttributeInfo attrInfo) { if (attrInfo instanceof PrimitiveAttributeInfo) { return createEmptyPrimitiveAttribute((PrimitiveAttributeInfo) attrInfo); } else if (attrInfo instanceof AssociationAttributeInfo) { return createEmptyAssociationAttribute((AssociationAttributeInfo) attrInfo); } return null; }
[ "public", "static", "Attribute", "<", "?", ">", "createEmptyAttribute", "(", "AbstractAttributeInfo", "attrInfo", ")", "{", "if", "(", "attrInfo", "instanceof", "PrimitiveAttributeInfo", ")", "{", "return", "createEmptyPrimitiveAttribute", "(", "(", "PrimitiveAttributeInfo", ")", "attrInfo", ")", ";", "}", "else", "if", "(", "attrInfo", "instanceof", "AssociationAttributeInfo", ")", "{", "return", "createEmptyAssociationAttribute", "(", "(", "AssociationAttributeInfo", ")", "attrInfo", ")", ";", "}", "return", "null", ";", "}" ]
Creates an empty attribute. An empty attribute is an attribute which has null as its value. @param attrInfo attribute info @return an empty attribute.
[ "Creates", "an", "empty", "attribute", ".", "An", "empty", "attribute", "is", "an", "attribute", "which", "has", "null", "as", "its", "value", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/AttributeUtil.java#L72-L79
147,473
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/AttributeUtil.java
AttributeUtil.createEmptyPrimitiveAttribute
public static PrimitiveAttribute<?> createEmptyPrimitiveAttribute(PrimitiveAttributeInfo info) { PrimitiveAttribute<?> attribute; switch (info.getType()) { case BOOLEAN: attribute = new BooleanAttribute(); break; case SHORT: attribute = new ShortAttribute(); break; case INTEGER: attribute = new IntegerAttribute(); break; case LONG: attribute = new LongAttribute(); break; case FLOAT: attribute = new FloatAttribute(); break; case DOUBLE: attribute = new DoubleAttribute(); break; case CURRENCY: attribute = new CurrencyAttribute(); break; case STRING: attribute = new StringAttribute(); break; case DATE: attribute = new DateAttribute(); break; case URL: attribute = new UrlAttribute(); break; case IMGURL: attribute = new ImageUrlAttribute(); break; default: String msg = "Trying to build an unknown primitive attribute type " + info.getType(); Log.logError(msg); throw new IllegalStateException(msg); } attribute.setEditable(info.isEditable()); return attribute; }
java
public static PrimitiveAttribute<?> createEmptyPrimitiveAttribute(PrimitiveAttributeInfo info) { PrimitiveAttribute<?> attribute; switch (info.getType()) { case BOOLEAN: attribute = new BooleanAttribute(); break; case SHORT: attribute = new ShortAttribute(); break; case INTEGER: attribute = new IntegerAttribute(); break; case LONG: attribute = new LongAttribute(); break; case FLOAT: attribute = new FloatAttribute(); break; case DOUBLE: attribute = new DoubleAttribute(); break; case CURRENCY: attribute = new CurrencyAttribute(); break; case STRING: attribute = new StringAttribute(); break; case DATE: attribute = new DateAttribute(); break; case URL: attribute = new UrlAttribute(); break; case IMGURL: attribute = new ImageUrlAttribute(); break; default: String msg = "Trying to build an unknown primitive attribute type " + info.getType(); Log.logError(msg); throw new IllegalStateException(msg); } attribute.setEditable(info.isEditable()); return attribute; }
[ "public", "static", "PrimitiveAttribute", "<", "?", ">", "createEmptyPrimitiveAttribute", "(", "PrimitiveAttributeInfo", "info", ")", "{", "PrimitiveAttribute", "<", "?", ">", "attribute", ";", "switch", "(", "info", ".", "getType", "(", ")", ")", "{", "case", "BOOLEAN", ":", "attribute", "=", "new", "BooleanAttribute", "(", ")", ";", "break", ";", "case", "SHORT", ":", "attribute", "=", "new", "ShortAttribute", "(", ")", ";", "break", ";", "case", "INTEGER", ":", "attribute", "=", "new", "IntegerAttribute", "(", ")", ";", "break", ";", "case", "LONG", ":", "attribute", "=", "new", "LongAttribute", "(", ")", ";", "break", ";", "case", "FLOAT", ":", "attribute", "=", "new", "FloatAttribute", "(", ")", ";", "break", ";", "case", "DOUBLE", ":", "attribute", "=", "new", "DoubleAttribute", "(", ")", ";", "break", ";", "case", "CURRENCY", ":", "attribute", "=", "new", "CurrencyAttribute", "(", ")", ";", "break", ";", "case", "STRING", ":", "attribute", "=", "new", "StringAttribute", "(", ")", ";", "break", ";", "case", "DATE", ":", "attribute", "=", "new", "DateAttribute", "(", ")", ";", "break", ";", "case", "URL", ":", "attribute", "=", "new", "UrlAttribute", "(", ")", ";", "break", ";", "case", "IMGURL", ":", "attribute", "=", "new", "ImageUrlAttribute", "(", ")", ";", "break", ";", "default", ":", "String", "msg", "=", "\"Trying to build an unknown primitive attribute type \"", "+", "info", ".", "getType", "(", ")", ";", "Log", ".", "logError", "(", "msg", ")", ";", "throw", "new", "IllegalStateException", "(", "msg", ")", ";", "}", "attribute", ".", "setEditable", "(", "info", ".", "isEditable", "(", ")", ")", ";", "return", "attribute", ";", "}" ]
Creates an empty primitive attribute. An empty attribute is an attribute which has null as its value. @param info attribute info @return an empty primitive attribute of the right type.
[ "Creates", "an", "empty", "primitive", "attribute", ".", "An", "empty", "attribute", "is", "an", "attribute", "which", "has", "null", "as", "its", "value", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/AttributeUtil.java#L87-L130
147,474
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/AttributeUtil.java
AttributeUtil.createEmptyAssociationAttribute
public static AssociationAttribute<?> createEmptyAssociationAttribute(AssociationAttributeInfo info) { AssociationAttribute<?> association; switch (info.getType()) { case MANY_TO_ONE: association = new ManyToOneAttribute(); break; case ONE_TO_MANY: association = new OneToManyAttribute(); break; default: String msg = "Trying to build an unknown association attribute type " + info.getType(); Log.logError(msg); throw new IllegalStateException(msg); } association.setEditable(info.isEditable()); return association; }
java
public static AssociationAttribute<?> createEmptyAssociationAttribute(AssociationAttributeInfo info) { AssociationAttribute<?> association; switch (info.getType()) { case MANY_TO_ONE: association = new ManyToOneAttribute(); break; case ONE_TO_MANY: association = new OneToManyAttribute(); break; default: String msg = "Trying to build an unknown association attribute type " + info.getType(); Log.logError(msg); throw new IllegalStateException(msg); } association.setEditable(info.isEditable()); return association; }
[ "public", "static", "AssociationAttribute", "<", "?", ">", "createEmptyAssociationAttribute", "(", "AssociationAttributeInfo", "info", ")", "{", "AssociationAttribute", "<", "?", ">", "association", ";", "switch", "(", "info", ".", "getType", "(", ")", ")", "{", "case", "MANY_TO_ONE", ":", "association", "=", "new", "ManyToOneAttribute", "(", ")", ";", "break", ";", "case", "ONE_TO_MANY", ":", "association", "=", "new", "OneToManyAttribute", "(", ")", ";", "break", ";", "default", ":", "String", "msg", "=", "\"Trying to build an unknown association attribute type \"", "+", "info", ".", "getType", "(", ")", ";", "Log", ".", "logError", "(", "msg", ")", ";", "throw", "new", "IllegalStateException", "(", "msg", ")", ";", "}", "association", ".", "setEditable", "(", "info", ".", "isEditable", "(", ")", ")", ";", "return", "association", ";", "}" ]
Creates an empty association attribute. An empty attribute is an attribute which has null as its value. @param info attribute info @return an empty association attribute of the right type.
[ "Creates", "an", "empty", "association", "attribute", ".", "An", "empty", "attribute", "is", "an", "attribute", "which", "has", "null", "as", "its", "value", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/AttributeUtil.java#L138-L154
147,475
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/event/JsEventBusImpl.java
JsEventBusImpl.addLayersModelChangedHandler
public JsHandlerRegistration addLayersModelChangedHandler(final LayersModelChangedHandler handler) { HandlerRegistration registration = ((MapImpl) map).getMapWidget().getMapModel() .addMapModelChangedHandler(new MapModelChangedHandler() { public void onMapModelChanged(MapModelChangedEvent event) { handler.onLayersModelChanged(new LayersModelChangedEvent(map.getLayersModel())); } }); return new JsHandlerRegistration(new HandlerRegistration[] { registration }); }
java
public JsHandlerRegistration addLayersModelChangedHandler(final LayersModelChangedHandler handler) { HandlerRegistration registration = ((MapImpl) map).getMapWidget().getMapModel() .addMapModelChangedHandler(new MapModelChangedHandler() { public void onMapModelChanged(MapModelChangedEvent event) { handler.onLayersModelChanged(new LayersModelChangedEvent(map.getLayersModel())); } }); return new JsHandlerRegistration(new HandlerRegistration[] { registration }); }
[ "public", "JsHandlerRegistration", "addLayersModelChangedHandler", "(", "final", "LayersModelChangedHandler", "handler", ")", "{", "HandlerRegistration", "registration", "=", "(", "(", "MapImpl", ")", "map", ")", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(", ")", ".", "addMapModelChangedHandler", "(", "new", "MapModelChangedHandler", "(", ")", "{", "public", "void", "onMapModelChanged", "(", "MapModelChangedEvent", "event", ")", "{", "handler", ".", "onLayersModelChanged", "(", "new", "LayersModelChangedEvent", "(", "map", ".", "getLayersModel", "(", ")", ")", ")", ";", "}", "}", ")", ";", "return", "new", "JsHandlerRegistration", "(", "new", "HandlerRegistration", "[", "]", "{", "registration", "}", ")", ";", "}" ]
Add a handler to change events in the layer configuration from the map. This event is fired for example when the map gets it's configuration from the server. Only then can it know what layers it has available.
[ "Add", "a", "handler", "to", "change", "events", "in", "the", "layer", "configuration", "from", "the", "map", ".", "This", "event", "is", "fired", "for", "example", "when", "the", "map", "gets", "it", "s", "configuration", "from", "the", "server", ".", "Only", "then", "can", "it", "know", "what", "layers", "it", "has", "available", "." ]
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/event/JsEventBusImpl.java#L66-L75
147,476
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/event/JsEventBusImpl.java
JsEventBusImpl.addFeatureSelectionHandler
public JsHandlerRegistration addFeatureSelectionHandler(final FeatureSelectedHandler selectedHandler, final FeatureDeselectedHandler deselectedHandler) { if (((MapImpl) map).getMapWidget().getMapModel().isInitialized()) { return addFeatureSelectionHandler2(selectedHandler, deselectedHandler); } final CallbackHandlerRegistration callbackRegistration = new CallbackHandlerRegistration(); ((MapImpl) map).getMapWidget().getMapModel().addMapModelChangedHandler(new MapModelChangedHandler() { public void onMapModelChanged(MapModelChangedEvent event) { JsHandlerRegistration temp = addFeatureSelectionHandler2(selectedHandler, deselectedHandler); callbackRegistration.setRegistration(temp); } }); return callbackRegistration; }
java
public JsHandlerRegistration addFeatureSelectionHandler(final FeatureSelectedHandler selectedHandler, final FeatureDeselectedHandler deselectedHandler) { if (((MapImpl) map).getMapWidget().getMapModel().isInitialized()) { return addFeatureSelectionHandler2(selectedHandler, deselectedHandler); } final CallbackHandlerRegistration callbackRegistration = new CallbackHandlerRegistration(); ((MapImpl) map).getMapWidget().getMapModel().addMapModelChangedHandler(new MapModelChangedHandler() { public void onMapModelChanged(MapModelChangedEvent event) { JsHandlerRegistration temp = addFeatureSelectionHandler2(selectedHandler, deselectedHandler); callbackRegistration.setRegistration(temp); } }); return callbackRegistration; }
[ "public", "JsHandlerRegistration", "addFeatureSelectionHandler", "(", "final", "FeatureSelectedHandler", "selectedHandler", ",", "final", "FeatureDeselectedHandler", "deselectedHandler", ")", "{", "if", "(", "(", "(", "MapImpl", ")", "map", ")", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(", ")", ".", "isInitialized", "(", ")", ")", "{", "return", "addFeatureSelectionHandler2", "(", "selectedHandler", ",", "deselectedHandler", ")", ";", "}", "final", "CallbackHandlerRegistration", "callbackRegistration", "=", "new", "CallbackHandlerRegistration", "(", ")", ";", "(", "(", "MapImpl", ")", "map", ")", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(", ")", ".", "addMapModelChangedHandler", "(", "new", "MapModelChangedHandler", "(", ")", "{", "public", "void", "onMapModelChanged", "(", "MapModelChangedEvent", "event", ")", "{", "JsHandlerRegistration", "temp", "=", "addFeatureSelectionHandler2", "(", "selectedHandler", ",", "deselectedHandler", ")", ";", "callbackRegistration", ".", "setRegistration", "(", "temp", ")", ";", "}", "}", ")", ";", "return", "callbackRegistration", ";", "}" ]
Add a handler for feature selection.
[ "Add", "a", "handler", "for", "feature", "selection", "." ]
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/event/JsEventBusImpl.java#L80-L94
147,477
daisy/jhyphen
src/main/java/ch/sbs/jhyphen/Hyphenator.java
Hyphenator.hyphenate
public String hyphenate(String text, Character shy, Character zwsp) throws StandardHyphenationException { if (shy == null && zwsp == null) return text; byte[] hyphens = hyphenate(text); StringBuffer hyphenatedText = new StringBuffer(); int i; for (i = 0; i < hyphens.length; i++) { hyphenatedText.append(text.charAt(i)); if (shy != null && hyphens[i] == SHY) hyphenatedText.append(shy); else if (zwsp != null && hyphens[i] == ZWSP) hyphenatedText.append(zwsp); } hyphenatedText.append(text.charAt(i)); return hyphenatedText.toString(); }
java
public String hyphenate(String text, Character shy, Character zwsp) throws StandardHyphenationException { if (shy == null && zwsp == null) return text; byte[] hyphens = hyphenate(text); StringBuffer hyphenatedText = new StringBuffer(); int i; for (i = 0; i < hyphens.length; i++) { hyphenatedText.append(text.charAt(i)); if (shy != null && hyphens[i] == SHY) hyphenatedText.append(shy); else if (zwsp != null && hyphens[i] == ZWSP) hyphenatedText.append(zwsp); } hyphenatedText.append(text.charAt(i)); return hyphenatedText.toString(); }
[ "public", "String", "hyphenate", "(", "String", "text", ",", "Character", "shy", ",", "Character", "zwsp", ")", "throws", "StandardHyphenationException", "{", "if", "(", "shy", "==", "null", "&&", "zwsp", "==", "null", ")", "return", "text", ";", "byte", "[", "]", "hyphens", "=", "hyphenate", "(", "text", ")", ";", "StringBuffer", "hyphenatedText", "=", "new", "StringBuffer", "(", ")", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "hyphens", ".", "length", ";", "i", "++", ")", "{", "hyphenatedText", ".", "append", "(", "text", ".", "charAt", "(", "i", ")", ")", ";", "if", "(", "shy", "!=", "null", "&&", "hyphens", "[", "i", "]", "==", "SHY", ")", "hyphenatedText", ".", "append", "(", "shy", ")", ";", "else", "if", "(", "zwsp", "!=", "null", "&&", "hyphens", "[", "i", "]", "==", "ZWSP", ")", "hyphenatedText", ".", "append", "(", "zwsp", ")", ";", "}", "hyphenatedText", ".", "append", "(", "text", ".", "charAt", "(", "i", ")", ")", ";", "return", "hyphenatedText", ".", "toString", "(", ")", ";", "}" ]
Returns the fully hyphenated string. The given hyphen characters are inserted at all possible hyphenation points. @param text The string to be hyphenated @param shy The character to be used as soft hyphen. @param zwsp The character to be used as zero-width space. @return The hyphenated string @throws StandardHyphenationException if the word contains non-standard hyphenation points, in which case the method {@link #hyphenate(String, int, Character, Character)} should be used instead.
[ "Returns", "the", "fully", "hyphenated", "string", ".", "The", "given", "hyphen", "characters", "are", "inserted", "at", "all", "possible", "hyphenation", "points", "." ]
a66a6ca29bf47aba9a07562c5dc90c3192bec0fc
https://github.com/daisy/jhyphen/blob/a66a6ca29bf47aba9a07562c5dc90c3192bec0fc/src/main/java/ch/sbs/jhyphen/Hyphenator.java#L80-L95
147,478
daisy/jhyphen
src/main/java/ch/sbs/jhyphen/Hyphenator.java
Hyphenator.hyphenate
public byte[] hyphenate(String text) throws StandardHyphenationException { // TODO: what if word already contains soft hyphens? Matcher matcher = Pattern.compile("['\\p{L}]+").matcher(text); StringBuffer hyphenBuffer = new StringBuffer(); int pos = 0; // iterate words while (matcher.find()) { int start = matcher.start(); int end = matcher.end(); while (pos++ < start) hyphenBuffer.append('0'); String word = text.substring(start, end); // libhyphen requires that word is lowercase word = word.toLowerCase(); byte[] wordBytes = encode(word); int wordSize = wordBytes.length; if (wordSize > wordHyphens.capacity()) wordHyphens = ByteBuffer.allocate(wordSize * 2); PointerByReference repPointer = new PointerByReference(Pointer.NULL); PointerByReference posPointer = new PointerByReference(Pointer.NULL); PointerByReference cutPointer = new PointerByReference(Pointer.NULL); Hyphen.getLibrary().hnj_hyphen_hyphenate2(dictionary, wordBytes, wordSize, wordHyphens, null, repPointer, posPointer, cutPointer); if (repPointer.getValue() != Pointer.NULL) throw new StandardHyphenationException("Text contains non-standard hyphenation points."); // TODO: assert that last element of wordHyphens is not a hyphen hyphenBuffer.append(new String(wordHyphens.array(), 0, word.length())); pos = end; } while (pos < text.length()) { hyphenBuffer.append('0'); pos++; } hyphenBuffer.deleteCharAt(pos-1); byte[] hyphens = new byte[hyphenBuffer.length()]; CharacterIterator iter = new StringCharacterIterator(hyphenBuffer.toString()); int i = 0; for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) hyphens[i++] = (c & 1) > 0 ? SHY : 0; // add a zero-width space after hard hyphens ("-" followed and preceded by a letter or number) matcher = Pattern.compile("[\\p{L}\\p{N}]-(?=[\\p{L}\\p{N}])").matcher(text); while (matcher.find()) hyphens[matcher.start()+1] = ZWSP; return hyphens; } /* For testing */ protected String hyphenate(String text, int lineLength, Character hyphen, Character noHyphen) { Break b = hyphenate(text, lineLength); String hyphenatedText = ""; hyphenatedText += b.getText().substring(0, b.getBreakPosition()); if (b.hasHyphen()) { if (hyphen != null) hyphenatedText += hyphen; } else if (noHyphen != null) hyphenatedText += noHyphen; hyphenatedText += b.getText().substring(b.getBreakPosition()); return hyphenatedText; }
java
public byte[] hyphenate(String text) throws StandardHyphenationException { // TODO: what if word already contains soft hyphens? Matcher matcher = Pattern.compile("['\\p{L}]+").matcher(text); StringBuffer hyphenBuffer = new StringBuffer(); int pos = 0; // iterate words while (matcher.find()) { int start = matcher.start(); int end = matcher.end(); while (pos++ < start) hyphenBuffer.append('0'); String word = text.substring(start, end); // libhyphen requires that word is lowercase word = word.toLowerCase(); byte[] wordBytes = encode(word); int wordSize = wordBytes.length; if (wordSize > wordHyphens.capacity()) wordHyphens = ByteBuffer.allocate(wordSize * 2); PointerByReference repPointer = new PointerByReference(Pointer.NULL); PointerByReference posPointer = new PointerByReference(Pointer.NULL); PointerByReference cutPointer = new PointerByReference(Pointer.NULL); Hyphen.getLibrary().hnj_hyphen_hyphenate2(dictionary, wordBytes, wordSize, wordHyphens, null, repPointer, posPointer, cutPointer); if (repPointer.getValue() != Pointer.NULL) throw new StandardHyphenationException("Text contains non-standard hyphenation points."); // TODO: assert that last element of wordHyphens is not a hyphen hyphenBuffer.append(new String(wordHyphens.array(), 0, word.length())); pos = end; } while (pos < text.length()) { hyphenBuffer.append('0'); pos++; } hyphenBuffer.deleteCharAt(pos-1); byte[] hyphens = new byte[hyphenBuffer.length()]; CharacterIterator iter = new StringCharacterIterator(hyphenBuffer.toString()); int i = 0; for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) hyphens[i++] = (c & 1) > 0 ? SHY : 0; // add a zero-width space after hard hyphens ("-" followed and preceded by a letter or number) matcher = Pattern.compile("[\\p{L}\\p{N}]-(?=[\\p{L}\\p{N}])").matcher(text); while (matcher.find()) hyphens[matcher.start()+1] = ZWSP; return hyphens; } /* For testing */ protected String hyphenate(String text, int lineLength, Character hyphen, Character noHyphen) { Break b = hyphenate(text, lineLength); String hyphenatedText = ""; hyphenatedText += b.getText().substring(0, b.getBreakPosition()); if (b.hasHyphen()) { if (hyphen != null) hyphenatedText += hyphen; } else if (noHyphen != null) hyphenatedText += noHyphen; hyphenatedText += b.getText().substring(b.getBreakPosition()); return hyphenatedText; }
[ "public", "byte", "[", "]", "hyphenate", "(", "String", "text", ")", "throws", "StandardHyphenationException", "{", "// TODO: what if word already contains soft hyphens?", "Matcher", "matcher", "=", "Pattern", ".", "compile", "(", "\"['\\\\p{L}]+\"", ")", ".", "matcher", "(", "text", ")", ";", "StringBuffer", "hyphenBuffer", "=", "new", "StringBuffer", "(", ")", ";", "int", "pos", "=", "0", ";", "// iterate words", "while", "(", "matcher", ".", "find", "(", ")", ")", "{", "int", "start", "=", "matcher", ".", "start", "(", ")", ";", "int", "end", "=", "matcher", ".", "end", "(", ")", ";", "while", "(", "pos", "++", "<", "start", ")", "hyphenBuffer", ".", "append", "(", "'", "'", ")", ";", "String", "word", "=", "text", ".", "substring", "(", "start", ",", "end", ")", ";", "// libhyphen requires that word is lowercase", "word", "=", "word", ".", "toLowerCase", "(", ")", ";", "byte", "[", "]", "wordBytes", "=", "encode", "(", "word", ")", ";", "int", "wordSize", "=", "wordBytes", ".", "length", ";", "if", "(", "wordSize", ">", "wordHyphens", ".", "capacity", "(", ")", ")", "wordHyphens", "=", "ByteBuffer", ".", "allocate", "(", "wordSize", "*", "2", ")", ";", "PointerByReference", "repPointer", "=", "new", "PointerByReference", "(", "Pointer", ".", "NULL", ")", ";", "PointerByReference", "posPointer", "=", "new", "PointerByReference", "(", "Pointer", ".", "NULL", ")", ";", "PointerByReference", "cutPointer", "=", "new", "PointerByReference", "(", "Pointer", ".", "NULL", ")", ";", "Hyphen", ".", "getLibrary", "(", ")", ".", "hnj_hyphen_hyphenate2", "(", "dictionary", ",", "wordBytes", ",", "wordSize", ",", "wordHyphens", ",", "null", ",", "repPointer", ",", "posPointer", ",", "cutPointer", ")", ";", "if", "(", "repPointer", ".", "getValue", "(", ")", "!=", "Pointer", ".", "NULL", ")", "throw", "new", "StandardHyphenationException", "(", "\"Text contains non-standard hyphenation points.\"", ")", ";", "// TODO: assert that last element of wordHyphens is not a hyphen", "hyphenBuffer", ".", "append", "(", "new", "String", "(", "wordHyphens", ".", "array", "(", ")", ",", "0", ",", "word", ".", "length", "(", ")", ")", ")", ";", "pos", "=", "end", ";", "}", "while", "(", "pos", "<", "text", ".", "length", "(", ")", ")", "{", "hyphenBuffer", ".", "append", "(", "'", "'", ")", ";", "pos", "++", ";", "}", "hyphenBuffer", ".", "deleteCharAt", "(", "pos", "-", "1", ")", ";", "byte", "[", "]", "hyphens", "=", "new", "byte", "[", "hyphenBuffer", ".", "length", "(", ")", "]", ";", "CharacterIterator", "iter", "=", "new", "StringCharacterIterator", "(", "hyphenBuffer", ".", "toString", "(", ")", ")", ";", "int", "i", "=", "0", ";", "for", "(", "char", "c", "=", "iter", ".", "first", "(", ")", ";", "c", "!=", "CharacterIterator", ".", "DONE", ";", "c", "=", "iter", ".", "next", "(", ")", ")", "hyphens", "[", "i", "++", "]", "=", "(", "c", "&", "1", ")", ">", "0", "?", "SHY", ":", "0", ";", "// add a zero-width space after hard hyphens (\"-\" followed and preceded by a letter or number)", "matcher", "=", "Pattern", ".", "compile", "(", "\"[\\\\p{L}\\\\p{N}]-(?=[\\\\p{L}\\\\p{N}])\"", ")", ".", "matcher", "(", "text", ")", ";", "while", "(", "matcher", ".", "find", "(", ")", ")", "hyphens", "[", "matcher", ".", "start", "(", ")", "+", "1", "]", "=", "ZWSP", ";", "return", "hyphens", ";", "}", "/* For testing */", "protected", "String", "hyphenate", "(", "String", "text", ",", "int", "lineLength", ",", "Character", "hyphen", ",", "Character", "noHyphen", ")", "{", "Break", "=", "hyphenate", "(", "text", ",", "lineLength", ")", ";", "String", "hyphenatedText", "=", "\"\"", ";", "hyphenatedText", "+=", "b", ".", "getText", "(", ")", ".", "substring", "(", "0", ",", "b", ".", "getBreakPosition", "(", ")", ")", ";", "if", "(", "b", ".", "hasHyphen", "(", ")", ")", "{", "if", "(", "hyphen", "!=", "null", ")", "hyphenatedText", "+=", "hyphen", ";", "}", "else", "if", "", "(", "noHyphen", "!=", "null", ")", "", "hyphenatedText", "+=", "noHyphen", ";", "hyphenatedText", "+=", "b", ".", "getText", "(", ")", ".", "substring", "(", "b", ".", "getBreakPosition", "(", ")", ")", ";", "return", "hyphenatedText", ";", "}" ]
Returns all possible hyphenation opportunities within a string @param text The string to be hyphenated @return A byte array which represents the break opportunities. The length of the hyphen array is the length of the input string minus 1. A hyphen at index i corresponds to characters i and i+1 of the string. Possible values are `0` for no hyphenation point, `1` for a hyphenation point (soft hyphen), or `2` for a zero-width space (which are inserted after hard hyphens). @throws StandardHyphenationException if the text contains non-standard hyphenation points, in which case the method {@link #hyphenate(String, int, Character, Character)} should be used instead.
[ "Returns", "all", "possible", "hyphenation", "opportunities", "within", "a", "string" ]
a66a6ca29bf47aba9a07562c5dc90c3192bec0fc
https://github.com/daisy/jhyphen/blob/a66a6ca29bf47aba9a07562c5dc90c3192bec0fc/src/main/java/ch/sbs/jhyphen/Hyphenator.java#L109-L173
147,479
daisy/jhyphen
src/main/java/ch/sbs/jhyphen/Hyphenator.java
Hyphenator.getCharset
private static Charset getCharset(File dictionaryFile) throws UnsupportedCharsetException, FileNotFoundException { Charset cs = charsets.get(dictionaryFile); if (cs == null) { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(dictionaryFile)); String charsetName = reader.readLine(); charsetName = charsetName.replaceAll("\\s+", ""); cs = Charset.forName(charsetName); charsets.put(dictionaryFile, cs); } catch (IOException e) { throw new RuntimeException("Could not read first line of file"); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } } return cs; }
java
private static Charset getCharset(File dictionaryFile) throws UnsupportedCharsetException, FileNotFoundException { Charset cs = charsets.get(dictionaryFile); if (cs == null) { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(dictionaryFile)); String charsetName = reader.readLine(); charsetName = charsetName.replaceAll("\\s+", ""); cs = Charset.forName(charsetName); charsets.put(dictionaryFile, cs); } catch (IOException e) { throw new RuntimeException("Could not read first line of file"); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } } return cs; }
[ "private", "static", "Charset", "getCharset", "(", "File", "dictionaryFile", ")", "throws", "UnsupportedCharsetException", ",", "FileNotFoundException", "{", "Charset", "cs", "=", "charsets", ".", "get", "(", "dictionaryFile", ")", ";", "if", "(", "cs", "==", "null", ")", "{", "BufferedReader", "reader", "=", "null", ";", "try", "{", "reader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "dictionaryFile", ")", ")", ";", "String", "charsetName", "=", "reader", ".", "readLine", "(", ")", ";", "charsetName", "=", "charsetName", ".", "replaceAll", "(", "\"\\\\s+\"", ",", "\"\"", ")", ";", "cs", "=", "Charset", ".", "forName", "(", "charsetName", ")", ";", "charsets", ".", "put", "(", "dictionaryFile", ",", "cs", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Could not read first line of file\"", ")", ";", "}", "finally", "{", "if", "(", "reader", "!=", "null", ")", "{", "try", "{", "reader", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}", "return", "cs", ";", "}" ]
Reads the first line of the dictionary file which is the encoding @param dictionaryFile The dictionary file @return The encoding @throws FileNotFoundException if the dictionary file cannot be found. @throws UnsupportedCharsetException if the encoding of the file is not supported.
[ "Reads", "the", "first", "line", "of", "the", "dictionary", "file", "which", "is", "the", "encoding" ]
a66a6ca29bf47aba9a07562c5dc90c3192bec0fc
https://github.com/daisy/jhyphen/blob/a66a6ca29bf47aba9a07562c5dc90c3192bec0fc/src/main/java/ch/sbs/jhyphen/Hyphenator.java#L382-L407
147,480
geomajas/geomajas-project-client-gwt
plugin/widget-advancedviews/advancedviews-gwt/src/main/java/org/geomajas/widget/advancedviews/client/widget/ExpandingThemeWidget.java
ExpandingThemeWidget.resetIcons
protected void resetIcons() { for (ViewConfigItem item : viewConfigItems) { RangeConfig config = getRangeConfigForCurrentScale(item.getViewConfig(), mapWidget.getMapModel() .getMapView().getCurrentScale()); if (null != config && null != config.getIcon()) { ((MenuItem) item.getButton()).setIcon(Geomajas.getDispatcherUrl() + config.getIcon()); } } if (activeViewConfig != null) { setMasterItem((MenuItem) activeViewConfig.getButton()); } }
java
protected void resetIcons() { for (ViewConfigItem item : viewConfigItems) { RangeConfig config = getRangeConfigForCurrentScale(item.getViewConfig(), mapWidget.getMapModel() .getMapView().getCurrentScale()); if (null != config && null != config.getIcon()) { ((MenuItem) item.getButton()).setIcon(Geomajas.getDispatcherUrl() + config.getIcon()); } } if (activeViewConfig != null) { setMasterItem((MenuItem) activeViewConfig.getButton()); } }
[ "protected", "void", "resetIcons", "(", ")", "{", "for", "(", "ViewConfigItem", "item", ":", "viewConfigItems", ")", "{", "RangeConfig", "config", "=", "getRangeConfigForCurrentScale", "(", "item", ".", "getViewConfig", "(", ")", ",", "mapWidget", ".", "getMapModel", "(", ")", ".", "getMapView", "(", ")", ".", "getCurrentScale", "(", ")", ")", ";", "if", "(", "null", "!=", "config", "&&", "null", "!=", "config", ".", "getIcon", "(", ")", ")", "{", "(", "(", "MenuItem", ")", "item", ".", "getButton", "(", ")", ")", ".", "setIcon", "(", "Geomajas", ".", "getDispatcherUrl", "(", ")", "+", "config", ".", "getIcon", "(", ")", ")", ";", "}", "}", "if", "(", "activeViewConfig", "!=", "null", ")", "{", "setMasterItem", "(", "(", "MenuItem", ")", "activeViewConfig", ".", "getButton", "(", ")", ")", ";", "}", "}" ]
Reset all icons.
[ "Reset", "all", "icons", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-advancedviews/advancedviews-gwt/src/main/java/org/geomajas/widget/advancedviews/client/widget/ExpandingThemeWidget.java#L217-L229
147,481
geomajas/geomajas-project-client-gwt
plugin/staticsecurity/staticsecurity-gwt/src/main/java/org/geomajas/plugin/staticsecurity/client/Authentication.java
Authentication.loginUser
private void loginUser(final String userId, final String password, final BooleanCallback callback) { LoginRequest request = new LoginRequest(); request.setLogin(userId); request.setPassword(password); GwtCommand command = new GwtCommand(loginCommandName); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<LoginResponse>() { public void execute(LoginResponse loginResponse) { if (loginResponse.getToken() == null) { if (callback != null) { callback.execute(false); } manager.fireEvent(new LoginFailureEvent(loginResponse.getErrorMessages())); } else { userToken = loginResponse.getToken(); Authentication.this.userId = userId; UserDetail userDetail = GwtCommandDispatcher.getInstance().getUserDetail(); userDetail.setUserId(loginResponse.getUserId()); userDetail.setUserName(loginResponse.getUserName()); userDetail.setUserOrganization(loginResponse.getUserOrganization()); userDetail.setUserDivision(loginResponse.getUserDivision()); userDetail.setUserLocale(loginResponse.getUserLocale()); if (callback != null) { callback.execute(true); } manager.fireEvent(new LoginSuccessEvent(userToken)); } } }); }
java
private void loginUser(final String userId, final String password, final BooleanCallback callback) { LoginRequest request = new LoginRequest(); request.setLogin(userId); request.setPassword(password); GwtCommand command = new GwtCommand(loginCommandName); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<LoginResponse>() { public void execute(LoginResponse loginResponse) { if (loginResponse.getToken() == null) { if (callback != null) { callback.execute(false); } manager.fireEvent(new LoginFailureEvent(loginResponse.getErrorMessages())); } else { userToken = loginResponse.getToken(); Authentication.this.userId = userId; UserDetail userDetail = GwtCommandDispatcher.getInstance().getUserDetail(); userDetail.setUserId(loginResponse.getUserId()); userDetail.setUserName(loginResponse.getUserName()); userDetail.setUserOrganization(loginResponse.getUserOrganization()); userDetail.setUserDivision(loginResponse.getUserDivision()); userDetail.setUserLocale(loginResponse.getUserLocale()); if (callback != null) { callback.execute(true); } manager.fireEvent(new LoginSuccessEvent(userToken)); } } }); }
[ "private", "void", "loginUser", "(", "final", "String", "userId", ",", "final", "String", "password", ",", "final", "BooleanCallback", "callback", ")", "{", "LoginRequest", "request", "=", "new", "LoginRequest", "(", ")", ";", "request", ".", "setLogin", "(", "userId", ")", ";", "request", ".", "setPassword", "(", "password", ")", ";", "GwtCommand", "command", "=", "new", "GwtCommand", "(", "loginCommandName", ")", ";", "command", ".", "setCommandRequest", "(", "request", ")", ";", "GwtCommandDispatcher", ".", "getInstance", "(", ")", ".", "execute", "(", "command", ",", "new", "AbstractCommandCallback", "<", "LoginResponse", ">", "(", ")", "{", "public", "void", "execute", "(", "LoginResponse", "loginResponse", ")", "{", "if", "(", "loginResponse", ".", "getToken", "(", ")", "==", "null", ")", "{", "if", "(", "callback", "!=", "null", ")", "{", "callback", ".", "execute", "(", "false", ")", ";", "}", "manager", ".", "fireEvent", "(", "new", "LoginFailureEvent", "(", "loginResponse", ".", "getErrorMessages", "(", ")", ")", ")", ";", "}", "else", "{", "userToken", "=", "loginResponse", ".", "getToken", "(", ")", ";", "Authentication", ".", "this", ".", "userId", "=", "userId", ";", "UserDetail", "userDetail", "=", "GwtCommandDispatcher", ".", "getInstance", "(", ")", ".", "getUserDetail", "(", ")", ";", "userDetail", ".", "setUserId", "(", "loginResponse", ".", "getUserId", "(", ")", ")", ";", "userDetail", ".", "setUserName", "(", "loginResponse", ".", "getUserName", "(", ")", ")", ";", "userDetail", ".", "setUserOrganization", "(", "loginResponse", ".", "getUserOrganization", "(", ")", ")", ";", "userDetail", ".", "setUserDivision", "(", "loginResponse", ".", "getUserDivision", "(", ")", ")", ";", "userDetail", ".", "setUserLocale", "(", "loginResponse", ".", "getUserLocale", "(", ")", ")", ";", "if", "(", "callback", "!=", "null", ")", "{", "callback", ".", "execute", "(", "true", ")", ";", "}", "manager", ".", "fireEvent", "(", "new", "LoginSuccessEvent", "(", "userToken", ")", ")", ";", "}", "}", "}", ")", ";", "}" ]
Effectively log in a certain user.
[ "Effectively", "log", "in", "a", "certain", "user", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/staticsecurity/staticsecurity-gwt/src/main/java/org/geomajas/plugin/staticsecurity/client/Authentication.java#L207-L237
147,482
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/PanButtonCollection.java
PanButtonCollection.accept
public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) { // Apply position on all pan buttons: applyPosition(); // Then render them: map.getVectorContext().drawGroup(group, this); map.getVectorContext().drawImage(this, background.getId(), background.getHref(), background.getBounds(), (PictureStyle) background.getStyle()); north.accept(visitor, group, bounds, recursive); east.accept(visitor, group, bounds, recursive); south.accept(visitor, group, bounds, recursive); west.accept(visitor, group, bounds, recursive); }
java
public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) { // Apply position on all pan buttons: applyPosition(); // Then render them: map.getVectorContext().drawGroup(group, this); map.getVectorContext().drawImage(this, background.getId(), background.getHref(), background.getBounds(), (PictureStyle) background.getStyle()); north.accept(visitor, group, bounds, recursive); east.accept(visitor, group, bounds, recursive); south.accept(visitor, group, bounds, recursive); west.accept(visitor, group, bounds, recursive); }
[ "public", "void", "accept", "(", "PainterVisitor", "visitor", ",", "Object", "group", ",", "Bbox", "bounds", ",", "boolean", "recursive", ")", "{", "// Apply position on all pan buttons:", "applyPosition", "(", ")", ";", "// Then render them:", "map", ".", "getVectorContext", "(", ")", ".", "drawGroup", "(", "group", ",", "this", ")", ";", "map", ".", "getVectorContext", "(", ")", ".", "drawImage", "(", "this", ",", "background", ".", "getId", "(", ")", ",", "background", ".", "getHref", "(", ")", ",", "background", ".", "getBounds", "(", ")", ",", "(", "PictureStyle", ")", "background", ".", "getStyle", "(", ")", ")", ";", "north", ".", "accept", "(", "visitor", ",", "group", ",", "bounds", ",", "recursive", ")", ";", "east", ".", "accept", "(", "visitor", ",", "group", ",", "bounds", ",", "recursive", ")", ";", "south", ".", "accept", "(", "visitor", ",", "group", ",", "bounds", ",", "recursive", ")", ";", "west", ".", "accept", "(", "visitor", ",", "group", ",", "bounds", ",", "recursive", ")", ";", "}" ]
Apply the correct positions on all panning buttons, and render them.
[ "Apply", "the", "correct", "positions", "on", "all", "panning", "buttons", "and", "render", "them", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/PanButtonCollection.java#L104-L116
147,483
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/cache/tile/VectorTile.java
VectorTile.fetch
public void fetch(final String filter, final TileFunction<VectorTile> callback) { final GetVectorTileRequest request = createRequest(filter); GwtCommand command = new GwtCommand(GetVectorTileRequest.COMMAND); command.setCommandRequest(request); final VectorTile self = this; lastRequest = request; deferred = GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<GetVectorTileResponse>() { public void execute(GetVectorTileResponse tileResponse) { if (null == deferred || !deferred.isCancelled()) { org.geomajas.layer.tile.VectorTile tile = tileResponse.getTile(); for (TileCode relatedTile : tile.getCodes()) { codes.add(relatedTile); } code = tile.getCode(); contentType = tile.getContentType(); featureContent.setContent(tile.getFeatureContent()); labelContent.setContent(tile.getLabelContent()); try { callback.execute(self); } catch (Throwable t) { Log.logError("VectorTile: error calling the callback after a fetch.", t); } } deferred = null; } }); }
java
public void fetch(final String filter, final TileFunction<VectorTile> callback) { final GetVectorTileRequest request = createRequest(filter); GwtCommand command = new GwtCommand(GetVectorTileRequest.COMMAND); command.setCommandRequest(request); final VectorTile self = this; lastRequest = request; deferred = GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<GetVectorTileResponse>() { public void execute(GetVectorTileResponse tileResponse) { if (null == deferred || !deferred.isCancelled()) { org.geomajas.layer.tile.VectorTile tile = tileResponse.getTile(); for (TileCode relatedTile : tile.getCodes()) { codes.add(relatedTile); } code = tile.getCode(); contentType = tile.getContentType(); featureContent.setContent(tile.getFeatureContent()); labelContent.setContent(tile.getLabelContent()); try { callback.execute(self); } catch (Throwable t) { Log.logError("VectorTile: error calling the callback after a fetch.", t); } } deferred = null; } }); }
[ "public", "void", "fetch", "(", "final", "String", "filter", ",", "final", "TileFunction", "<", "VectorTile", ">", "callback", ")", "{", "final", "GetVectorTileRequest", "request", "=", "createRequest", "(", "filter", ")", ";", "GwtCommand", "command", "=", "new", "GwtCommand", "(", "GetVectorTileRequest", ".", "COMMAND", ")", ";", "command", ".", "setCommandRequest", "(", "request", ")", ";", "final", "VectorTile", "self", "=", "this", ";", "lastRequest", "=", "request", ";", "deferred", "=", "GwtCommandDispatcher", ".", "getInstance", "(", ")", ".", "execute", "(", "command", ",", "new", "AbstractCommandCallback", "<", "GetVectorTileResponse", ">", "(", ")", "{", "public", "void", "execute", "(", "GetVectorTileResponse", "tileResponse", ")", "{", "if", "(", "null", "==", "deferred", "||", "!", "deferred", ".", "isCancelled", "(", ")", ")", "{", "org", ".", "geomajas", ".", "layer", ".", "tile", ".", "VectorTile", "tile", "=", "tileResponse", ".", "getTile", "(", ")", ";", "for", "(", "TileCode", "relatedTile", ":", "tile", ".", "getCodes", "(", ")", ")", "{", "codes", ".", "add", "(", "relatedTile", ")", ";", "}", "code", "=", "tile", ".", "getCode", "(", ")", ";", "contentType", "=", "tile", ".", "getContentType", "(", ")", ";", "featureContent", ".", "setContent", "(", "tile", ".", "getFeatureContent", "(", ")", ")", ";", "labelContent", ".", "setContent", "(", "tile", ".", "getLabelContent", "(", ")", ")", ";", "try", "{", "callback", ".", "execute", "(", "self", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "Log", ".", "logError", "(", "\"VectorTile: error calling the callback after a fetch.\"", ",", "t", ")", ";", "}", "}", "deferred", "=", "null", ";", "}", "}", ")", ";", "}" ]
Fetch all data related to this tile. @param filter When fetching it is possible to filter the data with this filter object. Null otherwise. @param callback When this node's data comes from the server, it will be handled by this callback function.
[ "Fetch", "all", "data", "related", "to", "this", "tile", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/cache/tile/VectorTile.java#L85-L113
147,484
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/cache/tile/VectorTile.java
VectorTile.apply
public void apply(final String filter, final TileFunction<VectorTile> callback) { switch (getStatus()) { case EMPTY: fetch(filter, callback); break; case LOADING: if (needsReload(filter)) { deferred.cancel(); fetch(filter, callback); } else { final VectorTile self = this; deferred.addCallback(new AbstractCommandCallback<GetVectorTileResponse>() { public void execute(GetVectorTileResponse response) { callback.execute(self); } }); } break; case LOADED: if (needsReload(filter)) { // Check if the labels need to be fetched as well: fetch(filter, callback); } else { callback.execute(this); } break; default: throw new IllegalStateException("Unknown status " + getStatus()); } }
java
public void apply(final String filter, final TileFunction<VectorTile> callback) { switch (getStatus()) { case EMPTY: fetch(filter, callback); break; case LOADING: if (needsReload(filter)) { deferred.cancel(); fetch(filter, callback); } else { final VectorTile self = this; deferred.addCallback(new AbstractCommandCallback<GetVectorTileResponse>() { public void execute(GetVectorTileResponse response) { callback.execute(self); } }); } break; case LOADED: if (needsReload(filter)) { // Check if the labels need to be fetched as well: fetch(filter, callback); } else { callback.execute(this); } break; default: throw new IllegalStateException("Unknown status " + getStatus()); } }
[ "public", "void", "apply", "(", "final", "String", "filter", ",", "final", "TileFunction", "<", "VectorTile", ">", "callback", ")", "{", "switch", "(", "getStatus", "(", ")", ")", "{", "case", "EMPTY", ":", "fetch", "(", "filter", ",", "callback", ")", ";", "break", ";", "case", "LOADING", ":", "if", "(", "needsReload", "(", "filter", ")", ")", "{", "deferred", ".", "cancel", "(", ")", ";", "fetch", "(", "filter", ",", "callback", ")", ";", "}", "else", "{", "final", "VectorTile", "self", "=", "this", ";", "deferred", ".", "addCallback", "(", "new", "AbstractCommandCallback", "<", "GetVectorTileResponse", ">", "(", ")", "{", "public", "void", "execute", "(", "GetVectorTileResponse", "response", ")", "{", "callback", ".", "execute", "(", "self", ")", ";", "}", "}", ")", ";", "}", "break", ";", "case", "LOADED", ":", "if", "(", "needsReload", "(", "filter", ")", ")", "{", "// Check if the labels need to be fetched as well:", "fetch", "(", "filter", ",", "callback", ")", ";", "}", "else", "{", "callback", ".", "execute", "(", "this", ")", ";", "}", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Unknown status \"", "+", "getStatus", "(", ")", ")", ";", "}", "}" ]
Execute a TileFunction on this tile. If the tile is not yet loaded, attach it to the isLoaded event. @param filter filter which needs to be applied when fetching @param callback callback to call
[ "Execute", "a", "TileFunction", "on", "this", "tile", ".", "If", "the", "tile", "is", "not", "yet", "loaded", "attach", "it", "to", "the", "isLoaded", "event", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/cache/tile/VectorTile.java#L149-L179
147,485
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.moveToBack
public void moveToBack(Object parent, String name) { Element parentElement = getGroup(parent); if (parentElement == null) { throw new IllegalArgumentException("moveToBack failed: could not find parent group."); } Element element = getElement(parent, name); if (element == null) { throw new IllegalArgumentException("moveToBack failed: could not find element within group."); } if (parentElement.getFirstChildElement() != element) { parentElement.insertFirst(element); } }
java
public void moveToBack(Object parent, String name) { Element parentElement = getGroup(parent); if (parentElement == null) { throw new IllegalArgumentException("moveToBack failed: could not find parent group."); } Element element = getElement(parent, name); if (element == null) { throw new IllegalArgumentException("moveToBack failed: could not find element within group."); } if (parentElement.getFirstChildElement() != element) { parentElement.insertFirst(element); } }
[ "public", "void", "moveToBack", "(", "Object", "parent", ",", "String", "name", ")", "{", "Element", "parentElement", "=", "getGroup", "(", "parent", ")", ";", "if", "(", "parentElement", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"moveToBack failed: could not find parent group.\"", ")", ";", "}", "Element", "element", "=", "getElement", "(", "parent", ",", "name", ")", ";", "if", "(", "element", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"moveToBack failed: could not find element within group.\"", ")", ";", "}", "if", "(", "parentElement", ".", "getFirstChildElement", "(", ")", "!=", "element", ")", "{", "parentElement", ".", "insertFirst", "(", "element", ")", ";", "}", "}" ]
Within a certain group, move an element to the back. All siblings will be rendered after this one. @param object The group wherein to search for the element. @param name The name of the element to move to the back. @since 1.10.0
[ "Within", "a", "certain", "group", "move", "an", "element", "to", "the", "back", ".", "All", "siblings", "will", "be", "rendered", "after", "this", "one", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L381-L395
147,486
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.applyAbsolutePosition
private void applyAbsolutePosition(Element element, Coordinate position) { Dom.setStyleAttribute(element, "position", "absolute"); Dom.setStyleAttribute(element, "left", (int) position.getX() + "px"); Dom.setStyleAttribute(element, "top", (int) position.getY() + "px"); }
java
private void applyAbsolutePosition(Element element, Coordinate position) { Dom.setStyleAttribute(element, "position", "absolute"); Dom.setStyleAttribute(element, "left", (int) position.getX() + "px"); Dom.setStyleAttribute(element, "top", (int) position.getY() + "px"); }
[ "private", "void", "applyAbsolutePosition", "(", "Element", "element", ",", "Coordinate", "position", ")", "{", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"position\"", ",", "\"absolute\"", ")", ";", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"left\"", ",", "(", "int", ")", "position", ".", "getX", "(", ")", "+", "\"px\"", ")", ";", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"top\"", ",", "(", "int", ")", "position", ".", "getY", "(", ")", "+", "\"px\"", ")", ";", "}" ]
Apply an absolute position on an element. @param element The element that needs an absolute position. @param position The position as a Coordinate.
[ "Apply", "an", "absolute", "position", "on", "an", "element", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L492-L496
147,487
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.applyElementSize
private void applyElementSize(Element element, int width, int height, boolean addCoordSize) { if (width >= 0 && height >= 0) { if (addCoordSize) { Dom.setElementAttribute(element, "coordsize", width + " " + height); } Dom.setStyleAttribute(element, "width", width + "px"); Dom.setStyleAttribute(element, "height", height + "px"); } }
java
private void applyElementSize(Element element, int width, int height, boolean addCoordSize) { if (width >= 0 && height >= 0) { if (addCoordSize) { Dom.setElementAttribute(element, "coordsize", width + " " + height); } Dom.setStyleAttribute(element, "width", width + "px"); Dom.setStyleAttribute(element, "height", height + "px"); } }
[ "private", "void", "applyElementSize", "(", "Element", "element", ",", "int", "width", ",", "int", "height", ",", "boolean", "addCoordSize", ")", "{", "if", "(", "width", ">=", "0", "&&", "height", ">=", "0", ")", "{", "if", "(", "addCoordSize", ")", "{", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"coordsize\"", ",", "width", "+", "\" \"", "+", "height", ")", ";", "}", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"width\"", ",", "width", "+", "\"px\"", ")", ";", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"height\"", ",", "height", "+", "\"px\"", ")", ";", "}", "}" ]
Apply a size on an element. @param element The element that needs sizing. @param width The new width to apply on the element. @param height The new height to apply on the element. @param addCoordSize Should a coordsize attribute be added as well?
[ "Apply", "a", "size", "on", "an", "element", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L510-L518
147,488
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.parse
private String parse(Matrix matrix) { String transform = ""; if (matrix != null) { double dx = matrix.getDx(); double dy = matrix.getDy(); if (matrix.getXx() != 0 && matrix.getYy() != 0 && matrix.getXx() != 1 && matrix.getYy() != 1) { transform += "scale(" + matrix.getXx() + ", " + matrix.getYy() + ")"; // scale first // no space between 'scale' and '(' !!! dx /= matrix.getXx(); dy /= matrix.getYy(); } transform += " translate(" + (float) dx + ", " + (float) dy + ")"; // no space between 'translate' and '(' !!! } return transform; }
java
private String parse(Matrix matrix) { String transform = ""; if (matrix != null) { double dx = matrix.getDx(); double dy = matrix.getDy(); if (matrix.getXx() != 0 && matrix.getYy() != 0 && matrix.getXx() != 1 && matrix.getYy() != 1) { transform += "scale(" + matrix.getXx() + ", " + matrix.getYy() + ")"; // scale first // no space between 'scale' and '(' !!! dx /= matrix.getXx(); dy /= matrix.getYy(); } transform += " translate(" + (float) dx + ", " + (float) dy + ")"; // no space between 'translate' and '(' !!! } return transform; }
[ "private", "String", "parse", "(", "Matrix", "matrix", ")", "{", "String", "transform", "=", "\"\"", ";", "if", "(", "matrix", "!=", "null", ")", "{", "double", "dx", "=", "matrix", ".", "getDx", "(", ")", ";", "double", "dy", "=", "matrix", ".", "getDy", "(", ")", ";", "if", "(", "matrix", ".", "getXx", "(", ")", "!=", "0", "&&", "matrix", ".", "getYy", "(", ")", "!=", "0", "&&", "matrix", ".", "getXx", "(", ")", "!=", "1", "&&", "matrix", ".", "getYy", "(", ")", "!=", "1", ")", "{", "transform", "+=", "\"scale(\"", "+", "matrix", ".", "getXx", "(", ")", "+", "\", \"", "+", "matrix", ".", "getYy", "(", ")", "+", "\")\"", ";", "// scale first", "// no space between 'scale' and '(' !!!", "dx", "/=", "matrix", ".", "getXx", "(", ")", ";", "dy", "/=", "matrix", ".", "getYy", "(", ")", ";", "}", "transform", "+=", "\" translate(\"", "+", "(", "float", ")", "dx", "+", "\", \"", "+", "(", "float", ")", "dy", "+", "\")\"", ";", "// no space between 'translate' and '(' !!!", "}", "return", "transform", ";", "}" ]
Parse a matrix object into a string, suitable for the SVG 'transform' attribute. @param matrix The matrix to parse. @return The transform string.
[ "Parse", "a", "matrix", "object", "into", "a", "string", "suitable", "for", "the", "SVG", "transform", "attribute", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L527-L542
147,489
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.createGroup
protected Element createGroup(String namespace, Object parent, Object group, String type) { Element parentElement; if (parent == null) { parentElement = getRootElement(); } else { parentElement = getGroup(parent); } if (parentElement == null) { return null; } else { Element element; String id = Dom.createUniqueId(); if (group instanceof PaintableGroup) { id = Dom.assembleId(id, ((PaintableGroup) group).getGroupName()); } groupToId.put(group, id); idToGroup.put(id, group); if (Dom.NS_HTML.equals(namespace)) { element = Dom.createElement("div", id); } else { element = Dom.createElementNS(namespace, type, id); } parentElement.appendChild(element); return element; } }
java
protected Element createGroup(String namespace, Object parent, Object group, String type) { Element parentElement; if (parent == null) { parentElement = getRootElement(); } else { parentElement = getGroup(parent); } if (parentElement == null) { return null; } else { Element element; String id = Dom.createUniqueId(); if (group instanceof PaintableGroup) { id = Dom.assembleId(id, ((PaintableGroup) group).getGroupName()); } groupToId.put(group, id); idToGroup.put(id, group); if (Dom.NS_HTML.equals(namespace)) { element = Dom.createElement("div", id); } else { element = Dom.createElementNS(namespace, type, id); } parentElement.appendChild(element); return element; } }
[ "protected", "Element", "createGroup", "(", "String", "namespace", ",", "Object", "parent", ",", "Object", "group", ",", "String", "type", ")", "{", "Element", "parentElement", ";", "if", "(", "parent", "==", "null", ")", "{", "parentElement", "=", "getRootElement", "(", ")", ";", "}", "else", "{", "parentElement", "=", "getGroup", "(", "parent", ")", ";", "}", "if", "(", "parentElement", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "Element", "element", ";", "String", "id", "=", "Dom", ".", "createUniqueId", "(", ")", ";", "if", "(", "group", "instanceof", "PaintableGroup", ")", "{", "id", "=", "Dom", ".", "assembleId", "(", "id", ",", "(", "(", "PaintableGroup", ")", "group", ")", ".", "getGroupName", "(", ")", ")", ";", "}", "groupToId", ".", "put", "(", "group", ",", "id", ")", ";", "idToGroup", ".", "put", "(", "id", ",", "group", ")", ";", "if", "(", "Dom", ".", "NS_HTML", ".", "equals", "(", "namespace", ")", ")", "{", "element", "=", "Dom", ".", "createElement", "(", "\"div\"", ",", "id", ")", ";", "}", "else", "{", "element", "=", "Dom", ".", "createElementNS", "(", "namespace", ",", "type", ",", "id", ")", ";", "}", "parentElement", ".", "appendChild", "(", "element", ")", ";", "return", "element", ";", "}", "}" ]
Generic creation method for group elements. @param namespace the name space (HTML, SVG or VML,...) @param parent the parent group @param group group @param type type @return the newly created group element or null if creation failed
[ "Generic", "creation", "method", "for", "group", "elements", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L793-L818
147,490
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.getElement
protected Element getElement(Object parent, String name) { if (name == null) { return null; } String id; if (parent == null) { id = getRootElement().getId(); } else { id = groupToId.get(parent); } return Dom.getElementById(Dom.assembleId(id, name)); }
java
protected Element getElement(Object parent, String name) { if (name == null) { return null; } String id; if (parent == null) { id = getRootElement().getId(); } else { id = groupToId.get(parent); } return Dom.getElementById(Dom.assembleId(id, name)); }
[ "protected", "Element", "getElement", "(", "Object", "parent", ",", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "String", "id", ";", "if", "(", "parent", "==", "null", ")", "{", "id", "=", "getRootElement", "(", ")", ".", "getId", "(", ")", ";", "}", "else", "{", "id", "=", "groupToId", ".", "get", "(", "parent", ")", ";", "}", "return", "Dom", ".", "getElementById", "(", "Dom", ".", "assembleId", "(", "id", ",", "name", ")", ")", ";", "}" ]
Returns the element that is a child of the specified parent and has the specified local group name. @param parent the parent group @param name the local group name @return the element or null if it does not exist or the name was null
[ "Returns", "the", "element", "that", "is", "a", "child", "of", "the", "specified", "parent", "and", "has", "the", "specified", "local", "group", "name", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L829-L840
147,491
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.createElement
protected Element createElement(Object parent, String name, String type, Style style, boolean generateId) { if (null == name) { return null; } Element parentElement; if (parent == null) { parentElement = getRootElement(); } else { parentElement = getGroup(parent); } if (parentElement == null) { return null; } else { Element element; String id = generateId ? Dom.assembleId(parentElement.getId(), name) : name; elementToName.put(id, name); switch (namespace) { case SVG: element = Dom.createElementNS(Dom.NS_SVG, type, id); if (style != null) { applyStyle(element, style); } break; case VML: element = Dom.createElementNS(Dom.NS_VML, type, id); Element stroke = Dom.createElementNS(Dom.NS_VML, "stroke"); element.appendChild(stroke); Element fill = Dom.createElementNS(Dom.NS_VML, "fill"); element.appendChild(fill); if ("shape".equals(name)) { // Set the size .....if the parent has a coordsize defined, take it over: String coordsize = parentElement.getAttribute("coordsize"); if (coordsize != null && coordsize.length() > 0) { element.setAttribute("coordsize", coordsize); } } Dom.setStyleAttribute(element, "position", "absolute"); VmlStyleUtil.applyStyle(element, style); break; case HTML: default: element = Dom.createElementNS(Dom.NS_HTML, type, id); if (style != null) { applyStyle(element, style); } } parentElement.appendChild(element); Dom.setElementAttribute(element, "id", id); return element; } }
java
protected Element createElement(Object parent, String name, String type, Style style, boolean generateId) { if (null == name) { return null; } Element parentElement; if (parent == null) { parentElement = getRootElement(); } else { parentElement = getGroup(parent); } if (parentElement == null) { return null; } else { Element element; String id = generateId ? Dom.assembleId(parentElement.getId(), name) : name; elementToName.put(id, name); switch (namespace) { case SVG: element = Dom.createElementNS(Dom.NS_SVG, type, id); if (style != null) { applyStyle(element, style); } break; case VML: element = Dom.createElementNS(Dom.NS_VML, type, id); Element stroke = Dom.createElementNS(Dom.NS_VML, "stroke"); element.appendChild(stroke); Element fill = Dom.createElementNS(Dom.NS_VML, "fill"); element.appendChild(fill); if ("shape".equals(name)) { // Set the size .....if the parent has a coordsize defined, take it over: String coordsize = parentElement.getAttribute("coordsize"); if (coordsize != null && coordsize.length() > 0) { element.setAttribute("coordsize", coordsize); } } Dom.setStyleAttribute(element, "position", "absolute"); VmlStyleUtil.applyStyle(element, style); break; case HTML: default: element = Dom.createElementNS(Dom.NS_HTML, type, id); if (style != null) { applyStyle(element, style); } } parentElement.appendChild(element); Dom.setElementAttribute(element, "id", id); return element; } }
[ "protected", "Element", "createElement", "(", "Object", "parent", ",", "String", "name", ",", "String", "type", ",", "Style", "style", ",", "boolean", "generateId", ")", "{", "if", "(", "null", "==", "name", ")", "{", "return", "null", ";", "}", "Element", "parentElement", ";", "if", "(", "parent", "==", "null", ")", "{", "parentElement", "=", "getRootElement", "(", ")", ";", "}", "else", "{", "parentElement", "=", "getGroup", "(", "parent", ")", ";", "}", "if", "(", "parentElement", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "Element", "element", ";", "String", "id", "=", "generateId", "?", "Dom", ".", "assembleId", "(", "parentElement", ".", "getId", "(", ")", ",", "name", ")", ":", "name", ";", "elementToName", ".", "put", "(", "id", ",", "name", ")", ";", "switch", "(", "namespace", ")", "{", "case", "SVG", ":", "element", "=", "Dom", ".", "createElementNS", "(", "Dom", ".", "NS_SVG", ",", "type", ",", "id", ")", ";", "if", "(", "style", "!=", "null", ")", "{", "applyStyle", "(", "element", ",", "style", ")", ";", "}", "break", ";", "case", "VML", ":", "element", "=", "Dom", ".", "createElementNS", "(", "Dom", ".", "NS_VML", ",", "type", ",", "id", ")", ";", "Element", "stroke", "=", "Dom", ".", "createElementNS", "(", "Dom", ".", "NS_VML", ",", "\"stroke\"", ")", ";", "element", ".", "appendChild", "(", "stroke", ")", ";", "Element", "fill", "=", "Dom", ".", "createElementNS", "(", "Dom", ".", "NS_VML", ",", "\"fill\"", ")", ";", "element", ".", "appendChild", "(", "fill", ")", ";", "if", "(", "\"shape\"", ".", "equals", "(", "name", ")", ")", "{", "// Set the size .....if the parent has a coordsize defined, take it over:", "String", "coordsize", "=", "parentElement", ".", "getAttribute", "(", "\"coordsize\"", ")", ";", "if", "(", "coordsize", "!=", "null", "&&", "coordsize", ".", "length", "(", ")", ">", "0", ")", "{", "element", ".", "setAttribute", "(", "\"coordsize\"", ",", "coordsize", ")", ";", "}", "}", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"position\"", ",", "\"absolute\"", ")", ";", "VmlStyleUtil", ".", "applyStyle", "(", "element", ",", "style", ")", ";", "break", ";", "case", "HTML", ":", "default", ":", "element", "=", "Dom", ".", "createElementNS", "(", "Dom", ".", "NS_HTML", ",", "type", ",", "id", ")", ";", "if", "(", "style", "!=", "null", ")", "{", "applyStyle", "(", "element", ",", "style", ")", ";", "}", "}", "parentElement", ".", "appendChild", "(", "element", ")", ";", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"id\"", ",", "id", ")", ";", "return", "element", ";", "}", "}" ]
Generic creation method for non-group elements. @param parent the parent group @param name local group name of the element (should be unique within the group) @param type the type of the element (tag name, e.g. 'image') @param style The style to apply on the element. @param generateId true if a unique id may be generated, otherwise the name will be used as id @return the newly created element or null if creation failed or the name was null
[ "Generic", "creation", "method", "for", "non", "-", "group", "elements", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L857-L907
147,492
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.deleteGroup
public void deleteGroup(Object object) { Element element = getGroup(object); if (element != null) { Element parent = (Element) element.getParentElement(); if (parent != null) { deleteRecursively(parent, element); } } }
java
public void deleteGroup(Object object) { Element element = getGroup(object); if (element != null) { Element parent = (Element) element.getParentElement(); if (parent != null) { deleteRecursively(parent, element); } } }
[ "public", "void", "deleteGroup", "(", "Object", "object", ")", "{", "Element", "element", "=", "getGroup", "(", "object", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "Element", "parent", "=", "(", "Element", ")", "element", ".", "getParentElement", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "deleteRecursively", "(", "parent", ",", "element", ")", ";", "}", "}", "}" ]
Delete this group from the graphics DOM structure. @param object The group's object.
[ "Delete", "this", "group", "from", "the", "graphics", "DOM", "structure", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L933-L941
147,493
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.applyStyle
public void applyStyle(Element element, Style style) { if (element != null && style != null) { switch (namespace) { case VML: VmlStyleUtil.applyStyle(element, style); break; case SVG: if (style instanceof ShapeStyle) { applySvgStyle(element, (ShapeStyle) style); } else if (style instanceof FontStyle) { applySvgStyle(element, (FontStyle) style); } else if (style instanceof PictureStyle) { applySvgStyle(element, (PictureStyle) style); } break; case HTML: if (style instanceof ShapeStyle) { applyHtmlStyle(element, (ShapeStyle) style); } else if (style instanceof FontStyle) { applyHtmlStyle(element, (FontStyle) style); } else if (style instanceof PictureStyle) { applyHtmlStyle(element, (PictureStyle) style); } break; } } }
java
public void applyStyle(Element element, Style style) { if (element != null && style != null) { switch (namespace) { case VML: VmlStyleUtil.applyStyle(element, style); break; case SVG: if (style instanceof ShapeStyle) { applySvgStyle(element, (ShapeStyle) style); } else if (style instanceof FontStyle) { applySvgStyle(element, (FontStyle) style); } else if (style instanceof PictureStyle) { applySvgStyle(element, (PictureStyle) style); } break; case HTML: if (style instanceof ShapeStyle) { applyHtmlStyle(element, (ShapeStyle) style); } else if (style instanceof FontStyle) { applyHtmlStyle(element, (FontStyle) style); } else if (style instanceof PictureStyle) { applyHtmlStyle(element, (PictureStyle) style); } break; } } }
[ "public", "void", "applyStyle", "(", "Element", "element", ",", "Style", "style", ")", "{", "if", "(", "element", "!=", "null", "&&", "style", "!=", "null", ")", "{", "switch", "(", "namespace", ")", "{", "case", "VML", ":", "VmlStyleUtil", ".", "applyStyle", "(", "element", ",", "style", ")", ";", "break", ";", "case", "SVG", ":", "if", "(", "style", "instanceof", "ShapeStyle", ")", "{", "applySvgStyle", "(", "element", ",", "(", "ShapeStyle", ")", "style", ")", ";", "}", "else", "if", "(", "style", "instanceof", "FontStyle", ")", "{", "applySvgStyle", "(", "element", ",", "(", "FontStyle", ")", "style", ")", ";", "}", "else", "if", "(", "style", "instanceof", "PictureStyle", ")", "{", "applySvgStyle", "(", "element", ",", "(", "PictureStyle", ")", "style", ")", ";", "}", "break", ";", "case", "HTML", ":", "if", "(", "style", "instanceof", "ShapeStyle", ")", "{", "applyHtmlStyle", "(", "element", ",", "(", "ShapeStyle", ")", "style", ")", ";", "}", "else", "if", "(", "style", "instanceof", "FontStyle", ")", "{", "applyHtmlStyle", "(", "element", ",", "(", "FontStyle", ")", "style", ")", ";", "}", "else", "if", "(", "style", "instanceof", "PictureStyle", ")", "{", "applyHtmlStyle", "(", "element", ",", "(", "PictureStyle", ")", "style", ")", ";", "}", "break", ";", "}", "}", "}" ]
Apply the style. @param element DOM element @param style style
[ "Apply", "the", "style", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L974-L1000
147,494
telegram-s/telegram-mt
src/main/java/org/telegram/mtproto/backoff/ExponentalBackoff.java
ExponentalBackoff.onFailure
public void onFailure() throws InterruptedException { int val = currentFailureCount.incrementAndGet(); if (val > 50) { currentFailureCount.compareAndSet(val, MAX_FAILURE_COUNT); val = MAX_FAILURE_COUNT; } int delay = MIN_DELAY + ((MAX_DELAY - MIN_DELAY) / MAX_FAILURE_COUNT) * val; synchronized (this) { Logger.d(TAG, "onFailure: wait " + delay + " ms"); wait(delay); } }
java
public void onFailure() throws InterruptedException { int val = currentFailureCount.incrementAndGet(); if (val > 50) { currentFailureCount.compareAndSet(val, MAX_FAILURE_COUNT); val = MAX_FAILURE_COUNT; } int delay = MIN_DELAY + ((MAX_DELAY - MIN_DELAY) / MAX_FAILURE_COUNT) * val; synchronized (this) { Logger.d(TAG, "onFailure: wait " + delay + " ms"); wait(delay); } }
[ "public", "void", "onFailure", "(", ")", "throws", "InterruptedException", "{", "int", "val", "=", "currentFailureCount", ".", "incrementAndGet", "(", ")", ";", "if", "(", "val", ">", "50", ")", "{", "currentFailureCount", ".", "compareAndSet", "(", "val", ",", "MAX_FAILURE_COUNT", ")", ";", "val", "=", "MAX_FAILURE_COUNT", ";", "}", "int", "delay", "=", "MIN_DELAY", "+", "(", "(", "MAX_DELAY", "-", "MIN_DELAY", ")", "/", "MAX_FAILURE_COUNT", ")", "*", "val", ";", "synchronized", "(", "this", ")", "{", "Logger", ".", "d", "(", "TAG", ",", "\"onFailure: wait \"", "+", "delay", "+", "\" ms\"", ")", ";", "wait", "(", "delay", ")", ";", "}", "}" ]
Called on failure, wait required time before exiting method @throws InterruptedException if waiting was interrupted
[ "Called", "on", "failure", "wait", "required", "time", "before", "exiting", "method" ]
57e3f635a6508705081eba9396ae24db050bc943
https://github.com/telegram-s/telegram-mt/blob/57e3f635a6508705081eba9396ae24db050bc943/src/main/java/org/telegram/mtproto/backoff/ExponentalBackoff.java#L37-L50
147,495
telegram-s/telegram-mt
src/main/java/org/telegram/mtproto/backoff/ExponentalBackoff.java
ExponentalBackoff.onFailureNoWait
public void onFailureNoWait() { Logger.d(TAG, "onFailureNoWait"); int val = currentFailureCount.incrementAndGet(); if (val > 50) { currentFailureCount.compareAndSet(val, MAX_FAILURE_COUNT); val = MAX_FAILURE_COUNT; } }
java
public void onFailureNoWait() { Logger.d(TAG, "onFailureNoWait"); int val = currentFailureCount.incrementAndGet(); if (val > 50) { currentFailureCount.compareAndSet(val, MAX_FAILURE_COUNT); val = MAX_FAILURE_COUNT; } }
[ "public", "void", "onFailureNoWait", "(", ")", "{", "Logger", ".", "d", "(", "TAG", ",", "\"onFailureNoWait\"", ")", ";", "int", "val", "=", "currentFailureCount", ".", "incrementAndGet", "(", ")", ";", "if", "(", "val", ">", "50", ")", "{", "currentFailureCount", ".", "compareAndSet", "(", "val", ",", "MAX_FAILURE_COUNT", ")", ";", "val", "=", "MAX_FAILURE_COUNT", ";", "}", "}" ]
onFailure without waiting
[ "onFailure", "without", "waiting" ]
57e3f635a6508705081eba9396ae24db050bc943
https://github.com/telegram-s/telegram-mt/blob/57e3f635a6508705081eba9396ae24db050bc943/src/main/java/org/telegram/mtproto/backoff/ExponentalBackoff.java#L55-L62
147,496
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/editing/EditController.java
EditController.showGeometricInfo
public void showGeometricInfo() { FeatureTransaction ft = getFeatureTransaction(); if (infoLabel == null && ft != null && ft.getNewFeatures() != null && ft.getNewFeatures().length > 0) { infoLabel = new GeometricInfoLabel(); infoLabel.addClickHandler(new DestroyLabelInfoOnClick()); infoLabel.setGeometry(ft.getNewFeatures()[0].getGeometry()); infoLabel.animateMove(mapWidget.getWidth() - 155, 10); } }
java
public void showGeometricInfo() { FeatureTransaction ft = getFeatureTransaction(); if (infoLabel == null && ft != null && ft.getNewFeatures() != null && ft.getNewFeatures().length > 0) { infoLabel = new GeometricInfoLabel(); infoLabel.addClickHandler(new DestroyLabelInfoOnClick()); infoLabel.setGeometry(ft.getNewFeatures()[0].getGeometry()); infoLabel.animateMove(mapWidget.getWidth() - 155, 10); } }
[ "public", "void", "showGeometricInfo", "(", ")", "{", "FeatureTransaction", "ft", "=", "getFeatureTransaction", "(", ")", ";", "if", "(", "infoLabel", "==", "null", "&&", "ft", "!=", "null", "&&", "ft", ".", "getNewFeatures", "(", ")", "!=", "null", "&&", "ft", ".", "getNewFeatures", "(", ")", ".", "length", ">", "0", ")", "{", "infoLabel", "=", "new", "GeometricInfoLabel", "(", ")", ";", "infoLabel", ".", "addClickHandler", "(", "new", "DestroyLabelInfoOnClick", "(", ")", ")", ";", "infoLabel", ".", "setGeometry", "(", "ft", ".", "getNewFeatures", "(", ")", "[", "0", "]", ".", "getGeometry", "(", ")", ")", ";", "infoLabel", ".", "animateMove", "(", "mapWidget", ".", "getWidth", "(", ")", "-", "155", ",", "10", ")", ";", "}", "}" ]
Show an overview of geometric attributes of the geometry that's being edited.
[ "Show", "an", "overview", "of", "geometric", "attributes", "of", "the", "geometry", "that", "s", "being", "edited", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/editing/EditController.java#L132-L140
147,497
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/editing/EditController.java
EditController.updateGeometricInfo
public void updateGeometricInfo() { FeatureTransaction ft = getFeatureTransaction(); if (infoLabel != null && ft != null && ft.getNewFeatures() != null && ft.getNewFeatures().length > 0) { infoLabel.setGeometry(ft.getNewFeatures()[0].getGeometry()); } }
java
public void updateGeometricInfo() { FeatureTransaction ft = getFeatureTransaction(); if (infoLabel != null && ft != null && ft.getNewFeatures() != null && ft.getNewFeatures().length > 0) { infoLabel.setGeometry(ft.getNewFeatures()[0].getGeometry()); } }
[ "public", "void", "updateGeometricInfo", "(", ")", "{", "FeatureTransaction", "ft", "=", "getFeatureTransaction", "(", ")", ";", "if", "(", "infoLabel", "!=", "null", "&&", "ft", "!=", "null", "&&", "ft", ".", "getNewFeatures", "(", ")", "!=", "null", "&&", "ft", ".", "getNewFeatures", "(", ")", ".", "length", ">", "0", ")", "{", "infoLabel", ".", "setGeometry", "(", "ft", ".", "getNewFeatures", "(", ")", "[", "0", "]", ".", "getGeometry", "(", ")", ")", ";", "}", "}" ]
Update the overview of geometric attributes of the geometry that's being edited.
[ "Update", "the", "overview", "of", "geometric", "attributes", "of", "the", "geometry", "that", "s", "being", "edited", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/editing/EditController.java#L145-L150
147,498
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/menu/CancelEditingAction.java
CancelEditingAction.onClick
public void onClick(MenuItemClickEvent event) { FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction(); if (featureTransaction != null) { controller.cleanup(); mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE); mapWidget.getMapModel().getFeatureEditor().stopEditing(); } }
java
public void onClick(MenuItemClickEvent event) { FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction(); if (featureTransaction != null) { controller.cleanup(); mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE); mapWidget.getMapModel().getFeatureEditor().stopEditing(); } }
[ "public", "void", "onClick", "(", "MenuItemClickEvent", "event", ")", "{", "FeatureTransaction", "featureTransaction", "=", "mapWidget", ".", "getMapModel", "(", ")", ".", "getFeatureEditor", "(", ")", ".", "getFeatureTransaction", "(", ")", ";", "if", "(", "featureTransaction", "!=", "null", ")", "{", "controller", ".", "cleanup", "(", ")", ";", "mapWidget", ".", "render", "(", "featureTransaction", ",", "RenderGroup", ".", "VECTOR", ",", "RenderStatus", ".", "DELETE", ")", ";", "mapWidget", ".", "getMapModel", "(", ")", ".", "getFeatureEditor", "(", ")", ".", "stopEditing", "(", ")", ";", "}", "}" ]
Cancels editing, and also removes the FeatureTransaction object from the map. @param event The {@link MenuItemClickEvent} from clicking the action.
[ "Cancels", "editing", "and", "also", "removes", "the", "FeatureTransaction", "object", "from", "the", "map", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/CancelEditingAction.java#L57-L64
147,499
geomajas/geomajas-project-client-gwt
plugin/widget-utility/utility-gwt-example-jar/src/main/java/org/geomajas/widget/utility/gwt/example/client/MyCustomRibbonColumn.java
MyCustomRibbonColumn.configure
public void configure(String key, String value) { if ("x".equalsIgnoreCase(key)) { xText = value; } else if ("y".equalsIgnoreCase(key)) { yText = value; } }
java
public void configure(String key, String value) { if ("x".equalsIgnoreCase(key)) { xText = value; } else if ("y".equalsIgnoreCase(key)) { yText = value; } }
[ "public", "void", "configure", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "\"x\"", ".", "equalsIgnoreCase", "(", "key", ")", ")", "{", "xText", "=", "value", ";", "}", "else", "if", "(", "\"y\"", ".", "equalsIgnoreCase", "(", "key", ")", ")", "{", "yText", "=", "value", ";", "}", "}" ]
Can accept "X and "Y" text values to be printed out.
[ "Can", "accept", "X", "and", "Y", "text", "values", "to", "be", "printed", "out", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt-example-jar/src/main/java/org/geomajas/widget/utility/gwt/example/client/MyCustomRibbonColumn.java#L83-L89