Vaadin Leaflet Map layers icon remove - java

I'm using V-Leaflet in the Java project I have:
LMap leafletMap = new LMap();
LOpenStreetMapLayer baseLayer = new LOpenStreetMapLayer();
leafletMap.addBaseLayer(baseLayer, null);
The map appearance and functionality is fine
except the tiles icon at the upper-right corner. How to remove it??
I'm using Vaadin 8 with Java.
TIA.

Extension extOut = null;
for(Extension ext : leafletMap.getExtensions()){
if(ext instanceof LLayers){
extOut = ext;
}
}
leafletMap.removeControl((AbstractControl)extOut);

Related

How do I get the value of Theme preference from Appearance preference page on Eclipse product?

On startup of eclipse product, I just want to get the eclipse UI preference value of Theme.
I tried with the below snippet, but it is returning an empty string value
Platform.getPreferencesService().getString("org.eclipse.ui.preferencePages.Views", "Theme", "",
null);
It would be great, If I am get this answer.
Thanks in Advance
You get this from the IThemeEngine:
IThemeEngine engine = PlatformUI.getWorkbench().getService(IThemeEngine.class);
if (engine != null) {
ITheme activeTheme = engine.getActiveTheme();
if (activeTheme != null) {
// The theme id
String themeId = activeTheme.getId();
// The display label
String label = activeTheme.getLabel();
...
}
}
IThemeEngine can also be injected in an e4 part or obtained from the IEclipseContext

vaadin grid inline editor not working

can someone please help me im a little bit flustered:
Im trying to just simply display a vaadin grid with 2 columns an test data an do an inline editing of the data.
But the Editor isn't shown correctly in the browser
Grid grid = new Grid();
grid.setCaption("Double click to edit");
grid.setSizeFull();
grid.setEditorEnabled(true);
grid.setSelectionMode(SelectionMode.NONE);
grid.addColumn("index", Integer.class).setRenderer(new NumberRenderer("%02d")).setHeaderCaption("##")
.setExpandRatio(0).setEditable(false).setWidth(50);
grid.addColumn("name", String.class).setExpandRatio(2);
Slider progressEditor = new Slider();
progressEditor.setWidth(100.0f, Unit.PERCENTAGE);
progressEditor.setMax(150.0);
progressEditor.setMin(1.0);
grid.addColumn("progress", Double.class).setRenderer(new ProgressBarRenderer() {
#Override
public JsonValue encode(Double value) {
if (value != null) {
value = (value - 1) / 149.0;
}
return super.encode(value);
}
}).setEditorField(progressEditor).setExpandRatio(2);
that's just the sample code from the vaadin demo page im using here.
But the output is this:
Anyone got the same problem or something similar an can help me out here?
regards
flo

GWT openlayers, DrawFeature line style

I am using gwt openlayers to draw some linestrings on the map. I would like to change the draw feature line appearance. I noticed that PathHandler class has setStyle method, but setting style using this method does not change the line appearance.
private DrawFeature createDrawFeature() {
DrawFeatureOptions options = new DrawFeatureOptions();
options.onFeatureAdded(getStyle());
PathHandler handler = new PathHandler();
handler.setStyle(style);
return new DrawFeature(layer, handler, options );
}
private Style getStyle() {
Style style = new Style();
style.setStrokeColor("#ffffff");
style.setStrokeWidth(2.0);
return style;
}
I was trying to set different style options but there was no effect.
Does anyone know how to change appearance of DrawFeature line?
The handler that does the drawing (Point, Path, or Polygon) is in charge if the style of your sketches (features before they are completed).
So to style the sketches you do :
//Create a style. We want a blue dashed line.
final Style drawStyle = new Style(); //create a Style to use
drawStyle.setFillColor("white");
drawStyle.setGraphicName("x");
drawStyle.setPointRadius(4);
drawStyle.setStrokeWidth(3);
drawStyle.setStrokeColor("#66FFFF");
drawStyle.setStrokeDashstyle("dash");
//create a StyleMap using the Style
StyleMap drawStyleMap = new StyleMap(drawStyle);
//Create PathHanlderOptions using this StyleMap
PathHandlerOptions phOpt = new PathHandlerOptions();
phOpt.setStyleMap(drawStyleMap);
//Create DrawFeatureOptions and set the PathHandlerOptions (that have the StyleMap, that have the Style we wish)
DrawFeatureOptions drawFeatureOptions = new DrawFeatureOptions();
drawFeatureOptions.setHandlerOptions(phOpt);
PathHandler pathHanlder = new PathHandler();
// Create the DrawFeature control to draw on the map, and pass the DrawFeatureOptions to control the style of the sketch
final DrawFeature drawLine = new DrawFeature(vectorLayer, pathHanlder, drawFeatureOptions);
map.addControl(drawLine);
drawLine.activate();
I also added an example to she showcase : http://demo.gwt-openlayers.org/gwt_ol_showcase/GwtOpenLayersShowcase.html?example=DrawFeature%20style%20example

JTextPane - HTMLDocument: when adding/removing a new style, other attributes also changes

I have a JTextPane (or JEditorPane) in which I want to add some buttons to format text (as shown in the picture).
When I change the selected text to Bold (making a new Style), the font family (and others attributes) also changes. Why? I want to set (or remove) the bold attribute in the selected text and other stays unchanged, as they were.
This is what I'm trying:
private void setBold(boolean flag){
HTMLDocument doc = (HTMLDocument) editorPane.getDocument();
int start = editorPane.getSelectionStart();
int end = editorPane.getSelectedText().length();
StyleContext ss = doc.getStyleSheet();
//check if BoldStyle exists and then add / remove it
Style style = ss.getStyle("BoldStyle");
if(style == null){
style = ss.addStyle("BoldStyle", null);
style.addAttribute(StyleConstants.Bold, true);
} else {
style.addAttribute(StyleConstants.Bold, false);
ss.removeStyle("BoldStyle");
}
doc.setCharacterAttributes(start, end, style, true);
}
But as I explained above, other attributes also change:
Any help will be appreciated. Thanks in advance!
http://oi40.tinypic.com/riuec9.jpg
What you are trying to do can be accomplished with one of the following two lines of code:
new StyledEditorKit.BoldAction().actionPerformed(null);
or
editorPane.getActionMap().get("font-bold").actionPerformed(null);
... where editorPane is an instance of JEditorPane of course.
Both will seamlessly take care of any attributes already defined and supports text selection.
Regarding your code, it does not work with previously styled text because you are overwriting the corresponding attributes with nothing. I mean, you never gather the values for the attributes already set for the current selected text using, say, the getAttributes() method. So, you are effectively resetting them to whatever default the global stylesheet specifies.
The good news is you don't need to worry about all this if you use one of the snippets above. Hope that helps.
I made some minor modifications to your code and it worked here:
private void setBold(boolean flag){
HTMLDocument doc = (HTMLDocument) editorPane.getDocument();
int start = editorPane.getSelectionStart();
int end = editorPane.getSelectionEnd();
if (start == end) {
return;
}
if (start > end) {
int life = start;
start = end;
end = life;
}
StyleContext ss = doc.getStyleSheet();
//check if BoldStyle exists and then add / remove it
Style style = ss.getStyle(editorPane.getSelectedText());
if(style == null){
style = ss.addStyle(editorPane.getSelectedText(), null);
style.addAttribute(StyleConstants.Bold, true);
} else {
style.addAttribute(StyleConstants.Bold, false);
ss.removeStyle(editorPane.getSelectedText());
}
doc.setCharacterAttributes(start, end - start, style, true);
}

add GWT-Highchart to Tab in TabSet

This is my code :
HighChart chart = new HighChart(title, PIE, data);
VLayout vlayout = new VLayout(title);
vlayout.setHeight100();
vlayout.setWidth100();
vlayout.addMember(chart);
Tab tab = new Tab();
tab.setTitle(title);
tab.setPane(vlayout);
tab.setCanClose(true);
tabset.addTab(tab);
The HighChart class contain the showcase example code.
The result is an empty tab, any solutions?
I solved the problem, the ​​RootLayoutPanel who did not accept the chart display, a simple replacement by a layout.draw(); did the trick

Categories