package org.aplikator.client.shared.descriptor; import java.util.ArrayList; import java.util.List; import org.aplikator.client.local.widgets.HasFields; import org.aplikator.client.local.widgets.PaneWidget; import com.google.gwt.user.client.ui.Widget; @SuppressWarnings("serial") //@JsonTypeName("panel") //@Portable public class PanelDTO extends WidgetDTO { public static final String TYPE_KEY = "panel"; private List children = new ArrayList(); private boolean frame = false; private boolean horizontal = false; @SuppressWarnings("unused") public PanelDTO() { } //TODO custom marshaller public PanelDTO(boolean horizontal) { this.horizontal = horizontal; } @Override public Widget getWidget(HasFields form) { PaneWidget pane = new PaneWidget(getLocalizedName(), frame, horizontal, getSize()); for (Object chobj : children) { WidgetDTO childDescriptor = (WidgetDTO) chobj; pane.add(childDescriptor.getWidget(form)); } return pane; } @SuppressWarnings("unchecked") public PanelDTO addChild(WidgetDTO child) { children.add(child); return this; } public List getChildren() { return this.children; } public void setChildren(List children) { this.children = children; } public void setFrame(boolean frame) { this.frame = frame; } public boolean isFrame() { return frame; } public boolean isHorizontal() { return horizontal; } public void setHorizontal(boolean horizontal) { this.horizontal = horizontal; } }