unexplained spacing in horizontal panel in GWT
Posted
by special0ne
on Stack Overflow
See other posts from Stack Overflow
or by special0ne
Published on 2010-01-14T22:56:09Z
Indexed on
2010/05/31
20:03 UTC
Read the original article
Hit count: 284
hi, i am adding widgets to a horizontal panel, and i want them to be all once next to the other on the left corner.
even though i have set the spacing=0 and alignment= left the widgets still have space between them. they are spread evenly in the panel.
please see the code here for the widget C'tor and the function that adds a new tab (toggle button) tabsPanel is a horizontalPanel, that you can see is aligned to left/right according to the locale
any advise would be appreciated thanks....
public TabsWidgetManager(int width, int height, int tabs_shift_direction){
DecoratorPanel decorContent = new DecoratorPanel();
DecoratorPanel decorTitle = new DecoratorPanel();
widgetPanel.setSize(Integer.toString(width), Integer.toString(height));
tabsPanel.setSize(Integer.toString(UIConst.USER_CONTENT_WIDTH), Integer.toString(UIConst.TW_DEFAULT_TAB_HEIGHT));
tabsPanel.setSpacing(0);
if (tabs_shift_direction==1)
tabsPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
else
tabsPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
decorTitle.add(tabsPanel);
contentPanel.setSize(Integer.toString(UIConst.USER_CONTENT_WIDTH), Integer.toString(UIConst.USER_CONTENT_MINUS_TABS_HEIGHT));
decorContent.add(contentPanel);
widgetPanel.add(decorTitle, 0, 0);
widgetPanel.add(decorContent, 0, UIConst.TW_DEFAULT_TAB_HEIGHT+15);
initWidget(widgetPanel);
}
public void addTab(String title, Widget widget){
widget.setVisible(false);
ToggleButton tab = new ToggleButton(title);
tabsList.add(tab);
tab.setSize(Integer.toString(UIConst.TW_TAB_DEFAULT_WIDTH), Integer.toString(UIConst.TW_TAB_DEFAULT_HEIGHT));
tab.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
handleTabClick((ToggleButton)event.getSource());
}
});
//adding to the map
tabToWidget.put(tab, widget);
// adding to the tabs bar
tabsPanel.add(tab);
//adding to the content
contentPanel.add(widget);
}
© Stack Overflow or respective owner