Is there a way to remove the gap/padding between the panels in DockLayoutPanels. I couldn't find anything online on how to do that. If using CSS is the way to go, what attribute do I have to configure. I try setting padding to 0px in css, that didn't work. Thanks in advance.
If you want to remove the extra padding and margin of the DockLayoutPanel then you can try any one as mentioned below
CSS:
.dockpanel{
margin: 0;
padding: 0;
}
JAVA:
DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.PX);
dockLayoutPanel.setWidth("200px");
//dockLayoutPanel.setStyleName("dockpanel");
//dockLayoutPanel.getElement().getStyle().setPaddingBottom(0, Unit.PX);
dockLayoutPanel.getElement().getStyle().setPadding(0, Unit.PX);
dockLayoutPanel.getElement().getStyle().setMargin(0, Unit.PX);
By default there is no extra padding and margin between its components. DockLayoutPanel fits the components as per their placement. It ignores component's preferred size.
For e.g.
Width is ignored for the component set in north or south
Height is ignored for the component set in the west or east.
Rest available space is covered by center component.
If still there is any gap then do the same for other components placed inside DockLayoutPanel.
Related
I want to set the left margin of a div by the position of the slider from the side-by-side plug in. It looks to be possible as the dividermove event built into the plug-in, but I haven't been able to figure out a method to feed that into the CSS for my div.
In the jsfiddle below, I basically want to dynamically set the left margin #year05 and #year15 using dividermove. I tried setting the #year05 class to inherit left from leaflet-sbs-divider but couldn't get it to work and I imagine is not the proper way to do it.
https://jsfiddle.net/x8r0pvg1/45/
If I understand correctly, you just want to position some text that follows the slider of Leaflet Side-by-Side plugin.
In that case, instead of trying to re-position your text / div on "dividermove" event, a very simple solution would be to append your div into the slider / divider itself, so that when the plugin adjusts the position of the latter, your div follows along automatically:
var yearsEl = document.getElementById('years'); // your div
document.querySelector('.leaflet-sbs-divider').appendChild(yearsEl);
Then you can center your div on the divider with your method of choice, e.g. using CSS:
#years {
width: 200px;
transform: translateX(-50%);
text-align: center;
}
Updated JSFiddle: https://jsfiddle.net/x8r0pvg1/47/
I need to render a TextArea in an exact pixel width for the special purposes of my GUI.
When I set its width to "250px", it comes out as 256px.
Is there a way to override this behavior so I can render it as 250px exactly?
When you use setWidth(), you're effectively setting the element's content width.
To get the offset width use UIObject#getOffsetWidth(). This will return the width including padding and border (but not margins).
References on W3C
Computing widths and margins
The box model
i have a small screen and i want the horizontal scrollbar on datagrid to appear automatically.
i've used:
dataGrid.setMinimumTableWidth(1500, Unit.PX);
this sets the width both the scrollbar still not appear
any tip?
I had a similar problem. When using DatGrid make sure you place it within a ResizeLayoutPanel. Set the height of the panel to xxx PX and the width to a yyy %. Then for the DataGrid just set width to 100%. Column widths units can be EM, PCT, or PX. In fact do not set all column widths to total 100%, otherwise you'll get funky display issues. Hope this helps.
So I tested out this code, both scrollbars show.
<g:ResizeLayoutPanel height="480px" width="760px">
<c:DataGrid width="100%" addStyleNames='{style.cellTable}' ui:field="testResultTable"/>
</g:ResizeLayoutPanel>
I would like to know the correct and generally accepted way of adding a top and bottom margin to a GtkTextView that is inside of a GtkScrolledWindow. There are functions to set the left and right margin, which I am using:
gtk_text_view_set_left_margin(GTK_TEXT_VIEW(editor_text_view), 2);
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(editor_text_view), 2);
But I can't seem to find any documentation on top and bottom. I've tried changing the border width of the GtkTextView with gtk_container_set_border_width but the border is not painted with the background color of the GtkTextView.
Basically - what I have is on the left and what I want is on the right.
You should use CSS for this things in GTK+ 3:
http://developer.gnome.org/gtk3/3.3/GtkCssProvider.html
Maybe you can use the view class:
.view {
padding: 3px;
}
Or only apply the style to the GtkTextView:
GtkTextView {
padding: 3px;
}
I'm using Ubuntu Natty with gtk+-3.2.3. and those CSS properties don't have any affect for some reason.
But you can use:
gtk_text_view_set_border_window_size( )
Along with: GTK_TEXT_WINDOW_TOP and GTK_TEXT_WINDOW_BOTTOM
And the border color will match the background of the GtkTextView.
http://developer.gnome.org/gtk3/3.4/GtkTextView.html#gtk-text-view-set-border-window-size
I just had to solve similar issue and I nested the text view in GtkAlignment - that gave me an option to set padding for all sides.
I am trying to create a DockLayoutPanel using GWT. It should occupy the complete screen.
DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.EM);
dockPanel.addSouth(new HTML("South"), 2);
dockPanel.addNorth(new HTML("North"), 2);
dockPanel.addEast(new HTML("Easat"), 2);
dockPanel.addWest(new HTML("West"), 2);
dockPanel.add(new HTML("Center"));
RootLayoutPanel.get().add(dockPanel);
I believe that the second parameter to the add methods is the width of the respective panels. How does the layout decide the height of the panel?
How can I style the layout, like add border to the panels, spacing between the panels, add panel headings in-line with the border?
Should the panel background colors be set using CSS, or is there a way to do so from java?
Can I make these panels as drag and drop panels?
1) The second parameter is really the size of the panel. It will be the width or the height, depending of the layout position. Use Unit.PX or Unit.PC for a clearer result, the EM unit maybe confusing at the beginning.
2) Use CSS styles.
3) Again, use CSS
4) It's not possible using GWT alone. Take a look to the GWT-Mosaic project. Specially to the "Drag & Drop Column/Row Layout": http://mosaic.analytical-labs.com/#CwDNDColumnRowLayout
1) The height and such are determined using normal HTML layout rules. The height and width of the panel is just the height and width of the containing div.
2) Style it using CSS just as you would any other div. UiBinder makes this pretty easy.
3) Yes, use CSS. You can call getElement() and getStyle() if you want to manipulate it directly or addStyleName() to add a CSS class. Regardless, UiBinder is probably the better bet than doing it in Java.
4) AFAIK, there's no way to do this out of the box. You'll have to write some code to handle that. SplitLayoutPanel will let you change the sizes of the panels, but not the positions.