List of usage examples for com.google.gwt.user.client.ui Widget getParent
public Widget getParent()
From source file:annis.gui.widgets.gwt.client.ui.VGripDragComponent.java
License:Apache License
private boolean startDrag(NativeEvent event) { VTransferable transferable = new VTransferable(); transferable.setDragSource(ConnectorMap.get(client).getConnector(this)); Element targetElement = (Element) event.getEventTarget().cast(); Paintable paintable;//from w ww . j a v a2 s .co m Widget w = Util.findWidget(targetElement, null); if (!w.getStyleName().contains("drag-source-enabled")) { return false; } while (w != null && !(w instanceof Paintable)) { w = w.getParent(); } paintable = (Paintable) w; transferable.setData("component", paintable); VDragEvent dragEvent = VDragAndDropManager.get().startDrag(transferable, event, true); transferable.setData("clientX", event.getClientX()); transferable.setData("clientY", event.getClientY()); dragEvent.createDragImage(getElement(), true); return true; }
From source file:asquare.gwt.tk.client.ui.DropDownPanel.java
License:Apache License
@Override public boolean remove(Widget w) { if (w.getParent() != this) throw new IllegalArgumentException(); DOM.removeChild(m_contentDiv, w.getElement()); return super.remove(w); }
From source file:cc.alcina.framework.gwt.client.ide.widget.Toolbar.java
License:Apache License
@Override public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); if (sender.getParent() instanceof ToolbarButton) { ToolbarButton tb = (ToolbarButton) sender.getParent(); vetoableActionSupport.fireVetoableActionEvent(new PermissibleActionEvent(sender, tb.getAction())); }/*from w w w .j a v a 2 s . c o m*/ }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
@SuppressWarnings("unchecked") public static <W extends Widget> W getParentWidget(Widget w, Class<W> widgetClass) { while (w != null) { if (w.getClass() == widgetClass) { return (W) w; }//from w ww . ja v a2s.co m w = w.getParent(); } return null; }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
@SuppressWarnings("unchecked") public static <W extends Widget> W getParentWidget(Widget w, String widgetClassName) { while (w != null) { if (CommonUtils.simpleClassName(w.getClass()).equals(widgetClassName)) { return (W) w; }//from w ww . ja v a2 s . c o m w = w.getParent(); } return null; }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
@SuppressWarnings("unchecked") public static Widget getParentWidgetSatisfyingCallback(Widget w, CollectionFilter<Object> callback) { while (w != null) { if (callback.allow(w)) { return w; }//from w w w.j a va 2 s . c o m w = w.getParent(); } return null; }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
@SuppressWarnings("unchecked") public static <T extends Widget> T getParentWidgetSatisfyingTypedCallback(Widget w, CollectionFilter<Widget> callback) { while (w != null) { if (callback.allow(w)) { return (T) w; }// www .java 2 s . c om w = w.getParent(); } return null; }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
public static Widget getPositioningParent(Widget widget) { while (widget.getParent() != null) { String pos = getComputedStyle(widget.getElement(), "position"); if (pos != null && (pos.equals("relative") || pos.equals("absolute"))) { return widget; }/*from w w w . java 2s. c o m*/ widget = widget.getParent(); } return widget;// root panel }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
public static void maximiseWidget(Widget widget) { restoreFromMaximise();//from w w w . j a v a 2s . co m hiddenWidgets = new ArrayList<Widget>(); morphedWidgets = new ArrayList<SplitLayoutPanel>(); elementLayouts = new ArrayList<ElementLayout>(); Element e = widget.getElement(); while (widget.getParent() != null) { Widget parent = widget.getParent(); if (parent instanceof SplitLayoutPanel) { morphSplitPanel((SplitLayoutPanel) parent, widget, false); } else if (parent instanceof HasWidgets && !(parent instanceof TabPanel)) { HasWidgets hw = (HasWidgets) parent; for (Iterator<Widget> itr = hw.iterator(); itr.hasNext();) { Widget w = itr.next(); if (w != widget && w.isVisible()) { hiddenWidgets.add(w); w.setVisible(false); } } } widget = widget.getParent(); } while (e.getParentElement() != RootPanel.get().getElement()) { ElementLayout layout = new ElementLayout(e); elementLayouts.add(layout); layout.maximise(); e = e.getParentElement(); } }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
public static void replace(Widget current, Widget newWidget, Panel parent) { if (parent == null) { parent = (Panel) current.getParent(); }/*from ww w . ja v a 2s. com*/ if (current == null || current.getParent() != parent) { parent.add(newWidget); return; } if (parent instanceof SimplePanel) { ((SimplePanel) parent).setWidget(newWidget); return; } ComplexPanel cp = (ComplexPanel) parent; int index = cp.getWidgetIndex(current); cp.remove(index); if (cp instanceof FlowPanel) { FlowPanel fp = (FlowPanel) cp; fp.insert(newWidget, index); } }