I have got a DisclourePanel with a button on it. But when I call button.getParent()
I always get a SimplePanel. With other Panel like VerticalPanel it works.
Does Anyone know why?
DisclosurePanel extends type Composite meaning it is a widget that can be composed of many widgets. It consists of a header and a SimplePanel both stacked in a VerticalPanel. Any content you give it, is placed in this SimplePanel, in your case a button, thus SimplePanel is returned by getParent()
Related
Let say, I got a VerticalPanel that have some widgets (label, button, ...) that were added into it. How can i loop that VerticalPanel & access the widgets in it?
Well you can use iterator,As i explained in the question How get all widgets of certain type?.
Iterator<Widget> widgets= vpanel.iterator();
Point to remember:
This method only gives the widgets added to the panel.
You have to iterate over child panels also(if its contains).
Or otherwise pick #Manolo's answer from same thread,If you are using GWT third party library GQuery.
I need to have a DisclosurePanel with a FlexTable widget as the header and include the arrow icon with animation.
When adding a Widget to a DisclosurePanel, the arrow icon is disabled/replaced by the widget.
I've decided I need to either create a new class that extends FlexTable and has a cell with the arrow icon & the appropriate click handler to animate the icon, or create a wrapper class for DisclosurePanel (as it is a final class). Do either of these seem like a viable solution?
I would create a more generic Composite widget called HeaderWidgetWithArrow that contains
The down arrow image
Any arbitrary widget (such as a FlexTable)
The way if you want to include the arrow for a disclosure panel and say, a HorizontalPanel, you could just re-use the HeaderWidgetWithArrow for that.
Either way, I would not recommend extending FlexTable or DisclosurePanel. You should favor composition over inheritance.
I'm using a PopupPanel but by default it cannot be dragged on the screen. Is the way to make id draggable or I should use whole another component?
The DialogBox class is draggable, by its title bar (which a PopupPanel doesn't have; also note that DialogBox extends DecoratedPopupPanel, not just PopupPanel, and sizing works differently than for PopupPanel).
Is it possible to add DockLayoutPanel inside another panel other than the RootLayoutPanel?
If so, how would you do it?
I attempted to add it inside HTMLPanel, and only north of the DockLayoutPanel shows.
Then I tried it inside LayoutPanel, it failed again.
I thought it would have work for LayoutPanel because RootLayoutPanel is a subclass of LayoutPanel.
Any answers welcome.
Thanks,
DockLayoutPanel is a RequiresResize widget, so either you put it inside a ProvidesResize widget (any so called layout panel) or you give it an explicit size.
See the Using a LayoutPanel without RootLayoutPanel section in http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#Recipes
Hi I am quite unsure if the spacing on top of the VerticalPanel widget in my app is a bug or not.
For simplicity, I have this kind of code:
public class MainWidget extends Composite {
private VerticalPanel mainPanel = new VerticalPanel();
public MainWidget() {
mainPanel.add(new Button("Test button"));
initWidget(mainPanel);
}
}
When run, the rendered view has this spacing on top of the widget inside the VerticalPanel, about the same height of the button, but not exactly that.
However, if I just put initWidget(new Button("Test)); the view is rendered properly which the spacing is gone and that the button fits exactly on the top-left of the browser's client area.
I've been struggling to fix this, I have tried DockPanel also but the result is the same.
Any ideas?
It appears that this bug is caused by a GWT framework I included in the project which causes this.