List of usage examples for com.google.gwt.user.client.ui SimplePanel getWidget
public Widget getWidget()
From source file:cc.alcina.framework.gwt.client.widget.FlowTabBar.java
License:Apache License
/** * Gets the specified tab's HTML.// www . ja v a 2 s. c o m * * @param index * the index of the tab whose HTML is to be retrieved * @return the tab's HTML */ public String getTabHTML(int index) { if (index >= getTabCount()) { return null; } ClickDelegatePanel delPanel = tabs.get(index); SimplePanel focusablePanel = delPanel.getFocusablePanel(); Widget widget = focusablePanel.getWidget(); if (widget instanceof HTML) { return ((HTML) widget).getHTML(); } else if (widget instanceof Label) { return ((Label) widget).getText(); } else { // This will be a focusable panel holding a user-supplied widget. return focusablePanel.getElement().getParentElement().getInnerHTML(); } }
From source file:com.agnie.gwt.common.client.widget.BreadCrumbPanel.java
License:Open Source License
/** * Sets a BreadCrumb's text contents.//from w w w . ja va2s . c o m * * @param index * the index of the BreadCrumb whose text is to be set * @param text * the object's new text */ public void setBreadCrumbText(int index, String text) { assert (index >= 0) && (index < getBreadCrumbCount()) : "BreadCrumb index out of bounds"; ClickDelegatePanel delPanel = (ClickDelegatePanel) panel.getWidget(index); SimplePanel focusablePanel = delPanel.getFocusablePanel(); ((Anchor) focusablePanel.getWidget()).setText(text); }
From source file:com.agnie.gwt.common.client.widget.BreadCrumbPanel.java
License:Open Source License
public String getBreadCrumbText(int index) { if (index >= getBreadCrumbCount()) { return null; }//w ww.j a v a2 s . c om ClickDelegatePanel delPanel = (ClickDelegatePanel) panel.getWidget(index); SimplePanel focusablePanel = delPanel.getFocusablePanel(); Widget widget = focusablePanel.getWidget(); if (widget instanceof Anchor) { return ((Anchor) widget).getText(); } else { // This will be a focusable panel holding a user-supplied widget. return focusablePanel.getElement().getParentElement().getInnerHTML(); } }
From source file:com.agnie.gwt.common.client.widget.TabBar.java
License:Open Source License
/** * Sets a tab's text contents./*w w w.ja v a2 s . co m*/ * * @param index * the index of the tab whose text is to be set * @param text * the object's new text */ public void setTabText(int index, String text) { assert (index >= 0) && (index < getTabCount()) : "Tab index out of bounds"; ClickDelegatePanel delPanel = (ClickDelegatePanel) panel.getWidget(index); SimplePanel focusablePanel = delPanel.getFocusablePanel(); ((Anchor) focusablePanel.getWidget()).setText(text); }
From source file:com.agnie.gwt.common.client.widget.TabBar.java
License:Open Source License
public String getTabText(int index) { if (index >= getTabCount()) { return null; }// w ww .java2 s . com ClickDelegatePanel delPanel = (ClickDelegatePanel) panel.getWidget(index); SimplePanel focusablePanel = delPanel.getFocusablePanel(); Widget widget = focusablePanel.getWidget(); if (widget instanceof Anchor) { return ((Anchor) widget).getText(); } else { // This will be a focusable panel holding a user-supplied widget. return focusablePanel.getElement().getParentElement().getInnerHTML(); } }
From source file:com.bearsoft.gwt.ui.containers.Toolbar.java
public Toolbar() { super();// w ww .j ava 2 s.c o m getElement().addClassName("toolbar"); chevron.getElement().addClassName("toolbar-chevron"); content.setHgap(0); content.getElement().addClassName("toolbar-content"); getElement().getStyle().setPosition(Style.Position.RELATIVE); content.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); content.getElement().getStyle().setHeight(100, Style.Unit.PCT); content.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); content.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN); chevron.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); chevron.getElement().getStyle().setHeight(100, Style.Unit.PCT); setWidget(content); getElement().appendChild(chevron.getElement()); chevron.addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final Map<Widget, String> lefts = new HashMap<>(); final Map<Widget, String> rights = new HashMap<>(); final Map<Widget, String> widths = new HashMap<>(); final Map<Widget, String> positions = new HashMap<>(); final Map<Widget, String> margins = new HashMap<>(); final VerticalPanel vp = new VerticalPanel(); vp.getElement().addClassName("toolbar-chevron-menu"); Widget[] widgets = new Widget[content.getWidgetCount()]; for (int i = 0; i < widgets.length; i++) { widgets[i] = content.getWidget(i); } for (int i = 0; i < widgets.length; i++) { Widget iw = widgets[i]; int rightMost = iw.getElement().getOffsetLeft() + iw.getElement().getOffsetWidth(); int bottomMost = iw.getElement().getOffsetTop() + iw.getElement().getOffsetHeight(); int parentWidth = iw.getElement().getParentElement().getOffsetWidth(); int parentHeight = iw.getElement().getParentElement().getOffsetHeight(); if (rightMost <= 0 || iw.getElement().getOffsetLeft() >= parentWidth || bottomMost <= 0 || iw.getElement().getOffsetTop() >= parentHeight) { lefts.put(iw, iw.getElement().getStyle().getLeft()); rights.put(iw, iw.getElement().getStyle().getRight()); widths.put(iw, iw.getElement().getStyle().getWidth()); positions.put(iw, iw.getElement().getStyle().getPosition()); margins.put(iw, iw.getElement().getStyle().getMarginLeft()); SimplePanel sp = new SimplePanel(); sp.getElement().addClassName("toolbar-chevron-menu-item"); sp.getElement().getStyle().setPadding(0, Style.Unit.PX); sp.getElement().getStyle().setBorderWidth(0, Style.Unit.PX); sp.getElement().getStyle().setPosition(Style.Position.RELATIVE); sp.setWidget(iw); vp.add(sp); } } if (vp.getWidgetCount() > 0) { PopupPanel pp = new PopupPanel(true); pp.getElement().getStyle().setPadding(0, Style.Unit.PX); pp.setWidget(vp); pp.setAnimationEnabled(false); pp.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { Widget[] widgets = new Widget[vp.getWidgetCount()]; for (int i = 0; i < widgets.length; i++) { widgets[i] = vp.getWidget(i); } for (int i = 0; i < widgets.length; i++) { Widget w = widgets[i]; assert w instanceof SimplePanel; Widget iw = ((SimplePanel) w).getWidget(); String oldLeft = lefts.remove(iw); if (oldLeft != null && !oldLeft.isEmpty()) { iw.getElement().getStyle().setProperty("left", oldLeft); } else { iw.getElement().getStyle().clearLeft(); } String oldRight = rights.remove(iw); if (oldRight != null && !oldRight.isEmpty()) { iw.getElement().getStyle().setProperty("right", oldRight); } else { iw.getElement().getStyle().clearRight(); } String oldPosition = positions.remove(iw); if (oldPosition != null && !oldPosition.isEmpty()) { iw.getElement().getStyle().setProperty("position", oldPosition); } else { iw.getElement().getStyle().clearPosition(); } String oldWidth = widths.remove(iw); if (oldWidth != null && !oldWidth.isEmpty()) { iw.getElement().getStyle().setProperty("width", oldWidth); } else { iw.getElement().getStyle().clearWidth(); } String oldMargin = margins.remove(iw); if (oldMargin != null && !oldMargin.isEmpty()) { iw.getElement().getStyle().setProperty("marginLeft", oldMargin); } else { iw.getElement().getStyle().clearMarginLeft(); } content.add(iw); } content.onResize(); } }); pp.showRelativeTo(chevron); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { for (int i = 0; i < vp.getWidgetCount(); i++) { Widget w = vp.getWidget(i); assert w instanceof SimplePanel; SimplePanel sp = (SimplePanel) w; Widget iw = sp.getWidget(); int width = sp.getElement().getOffsetWidth(); int height = iw.getElement().getOffsetHeight(); sp.getElement().getStyle().setWidth(width, Style.Unit.PX); sp.getElement().getStyle().setHeight(height, Style.Unit.PX); iw.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); iw.getElement().getStyle().setLeft(0, Style.Unit.PX); iw.getElement().getStyle().setRight(0, Style.Unit.PX); iw.getElement().getStyle().clearWidth(); iw.getElement().getStyle().clearMarginLeft(); //if (iw instanceof FocusWidget) { iw.getElement().getStyle().clearRight(); iw.getElement().getStyle().setWidth(100, Style.Unit.PCT); com.bearsoft.gwt.ui.CommonResources.INSTANCE.commons().ensureInjected(); iw.getElement().addClassName( com.bearsoft.gwt.ui.CommonResources.INSTANCE.commons().borderSized()); //} if (iw instanceof RequiresResize) { ((RequiresResize) iw).onResize(); } } } }); } } }, ClickEvent.getType()); getElement().<XElement>cast().addResizingTransitionEnd(this); }
From source file:com.eas.widgets.containers.Toolbar.java
public void showOverflowPopup() { final Map<Widget, String> lefts = new HashMap<>(); final Map<Widget, String> rights = new HashMap<>(); final Map<Widget, String> widths = new HashMap<>(); final Map<Widget, String> positions = new HashMap<>(); final Map<Widget, String> margins = new HashMap<>(); final VerticalPanel vp = new VerticalPanel(); vp.getElement().addClassName("toolbar-chevron-menu"); Widget[] widgets = new Widget[content.getWidgetCount()]; for (int i = 0; i < widgets.length; i++) { widgets[i] = content.getWidget(i); }//ww w. j a v a 2 s . co m for (int i = 0; i < widgets.length; i++) { Widget iw = widgets[i]; int rightMost = iw.getElement().getOffsetLeft() + iw.getElement().getOffsetWidth(); int bottomMost = iw.getElement().getOffsetTop() + iw.getElement().getOffsetHeight(); int parentWidth = iw.getElement().getParentElement().getClientWidth(); int parentHeight = iw.getElement().getParentElement().getClientHeight(); if (rightMost <= 0 || iw.getElement().getOffsetLeft() >= parentWidth || bottomMost <= 0 || iw.getElement().getOffsetTop() >= parentHeight) { lefts.put(iw, iw.getElement().getStyle().getLeft()); rights.put(iw, iw.getElement().getStyle().getRight()); widths.put(iw, iw.getElement().getStyle().getWidth()); positions.put(iw, iw.getElement().getStyle().getPosition()); margins.put(iw, iw.getElement().getStyle().getMarginLeft()); iw.getElement().getStyle().setHeight(parentHeight, Style.Unit.PX); SimplePanel sp = new SimplePanel(); sp.getElement().addClassName("toolbar-chevron-menu-item"); sp.getElement().getStyle().setPadding(0, Style.Unit.PX); sp.getElement().getStyle().setBorderWidth(0, Style.Unit.PX); sp.getElement().getStyle().setPosition(Style.Position.RELATIVE); sp.setWidget(iw); vp.add(sp); } } if (vp.getWidgetCount() > 0) { overflowPopup = new PopupPanel(true); overflowPopup.setStyleName("toolbar-chevron-popup"); overflowPopup.setWidget(vp); overflowPopup.setAnimationEnabled(false); overflowPopup.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { overflowPopup = null; Widget[] widgets = new Widget[vp.getWidgetCount()]; for (int i = 0; i < widgets.length; i++) { widgets[i] = vp.getWidget(i); } for (int i = 0; i < widgets.length; i++) { Widget w = widgets[i]; assert w instanceof SimplePanel; Widget iw = ((SimplePanel) w).getWidget(); String oldLeft = lefts.remove(iw); if (oldLeft != null && !oldLeft.isEmpty()) { iw.getElement().getStyle().setProperty("left", oldLeft); } else { iw.getElement().getStyle().clearLeft(); } String oldRight = rights.remove(iw); if (oldRight != null && !oldRight.isEmpty()) { iw.getElement().getStyle().setProperty("right", oldRight); } else { iw.getElement().getStyle().clearRight(); } String oldPosition = positions.remove(iw); if (oldPosition != null && !oldPosition.isEmpty()) { iw.getElement().getStyle().setProperty("position", oldPosition); } else { iw.getElement().getStyle().clearPosition(); } String oldWidth = widths.remove(iw); if (oldWidth != null && !oldWidth.isEmpty()) { iw.getElement().getStyle().setProperty("width", oldWidth); } else { iw.getElement().getStyle().clearWidth(); } String oldMargin = margins.remove(iw); if (oldMargin != null && !oldMargin.isEmpty()) { iw.getElement().getStyle().setProperty("marginLeft", oldMargin); } else { iw.getElement().getStyle().clearMarginLeft(); } iw.getElement().getStyle().setHeight(100, Style.Unit.PCT); content.add(iw); } content.onResize(); } }); overflowPopup.setPopupPosition(chevron.getAbsoluteLeft(), chevron.getAbsoluteTop()); overflowPopup.showRelativeTo(chevron); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { for (int i = 0; i < vp.getWidgetCount(); i++) { Widget w = vp.getWidget(i); assert w instanceof SimplePanel; SimplePanel sp = (SimplePanel) w; Widget iw = sp.getWidget(); int width = sp.getElement().getOffsetWidth(); int height = iw.getElement().getOffsetHeight(); sp.getElement().getStyle().setWidth(width, Style.Unit.PX); sp.getElement().getStyle().setHeight(height, Style.Unit.PX); iw.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); iw.getElement().getStyle().setLeft(0, Style.Unit.PX); iw.getElement().getStyle().setRight(0, Style.Unit.PX); iw.getElement().getStyle().clearWidth(); iw.getElement().getStyle().clearMarginLeft(); // if (iw instanceof FocusWidget) { iw.getElement().getStyle().clearRight(); iw.getElement().getStyle().setWidth(100, Style.Unit.PCT); com.eas.ui.CommonResources.INSTANCE.commons().ensureInjected(); iw.getElement().addClassName(com.eas.ui.CommonResources.INSTANCE.commons().borderSized()); // } if (iw instanceof RequiresResize) { ((RequiresResize) iw).onResize(); } } } }); } }
From source file:com.gwtmobile.ui.client.widgets.HeaderPanel.java
License:Apache License
public Button getLeftButton() { SimplePanel leftButton = (SimplePanel) getWidget(0); return (Button) leftButton.getWidget(); }
From source file:com.gwtmobile.ui.client.widgets.HeaderPanel.java
License:Apache License
public Button getRightButton() { SimplePanel rightButton = (SimplePanel) getWidget(2); return (Button) rightButton.getWidget(); }
From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.SetPanelExecute.java
License:Apache License
public void execute(BuiltInFunctionGVO builtInFunction) { if (builtInFunction instanceof SetPanelGVO) { SetPanelGVO setPanel = (SetPanelGVO) builtInFunction; List<UIObject> uiObjects = RendererHelper .getComponent(setPanel.getBuiltInComponentGVO().getComponentIdUUID()); if (uiObjects != null && uiObjects.iterator().hasNext()) { UIObject uiObject = uiObjects.iterator().next(); //for (UIObject uiObject : uiObjects) { // .getComponentId() ); if (uiObject instanceof SimplePanel) { SimplePanel simplePanel = (SimplePanel) uiObject; Widget innerComponent = simplePanel.getWidget(); if (innerComponent != null) { ComponentRepository.getInstance().clearContainerComponent(innerComponent); }/*from ww w . java2 s. c o m*/ UIObject ui = AnyComponentRenderer.getInstance().render(setPanel.getSrc(), setPanel.getUuid(), setPanel.getBuiltInComponentGVO().getWindowId(), setPanel.getSrc().getContext()); if (ui instanceof Widget) { simplePanel.setWidget((Widget) ui); } } } } }