}
}
- /**
- * Returns closest parent Widget in hierarchy that implements Container
- * interface
- *
- * @param component
- * @return closest parent Container
- */
- public static Container getLayout(Widget component) {
- Widget parent = component.getParent();
- while (parent != null && !(parent instanceof Container)) {
- parent = parent.getParent();
- }
- if (parent != null) {
- assert ((Container) parent).hasChildComponent(component);
-
- return (Container) parent;
- }
- return null;
- }
-
private static final Element escapeHtmlHelper = DOM.createDiv();
/**
}-*/;
- /**
- * Locates the child component of <literal>parent</literal> which contains
- * the element <literal>element</literal>. The child component is also
- * returned if "element" is part of its caption. If
- * <literal>element</literal> is not part of any child component, null is
- * returned.
- *
- * This method returns the immediate child of the parent that contains the
- * element. See
- * {@link #getPaintableForElement(ApplicationConnection, Container, Element)}
- * for the deepest nested paintable of parent that contains the element.
- *
- * @param client
- * A reference to ApplicationConnection
- * @param parent
- * The widget that contains <literal>element</literal>.
- * @param element
- * An element that is a sub element of the parent
- * @return The VPaintableWidget which the element is a part of. Null if the
- * element does not belong to a child.
- */
- public static VPaintableWidget getChildPaintableForElement(
- ApplicationConnection client, Container parent, Element element) {
- Element rootElement = ((Widget) parent).getElement();
- while (element != null && element != rootElement) {
- VPaintableWidget paintable = VPaintableMap.get(client)
- .getPaintable(element);
- if (paintable == null) {
- String ownerPid = VCaption.getCaptionOwnerPid(element);
- if (ownerPid != null) {
- paintable = (VPaintableWidget) VPaintableMap.get(client)
- .getPaintable(ownerPid);
- }
- }
-
- if (paintable != null
- && parent.hasChildComponent(paintable
- .getWidgetForPaintable())) {
- return paintable;
- }
-
- element = (Element) element.getParentElement();
- }
-
- return null;
- }
-
/**
* Locates the nested child component of <literal>parent</literal> which
* contains the element <literal>element</literal>. The child component is
* <literal>element</literal> is not part of any child component, null is
* returned.
*
- * This method returns the deepest nested VPaintableWidget. See
- * {@link #getChildPaintableForElement(ApplicationConnection, Container, Element)}
- * for the immediate child component of parent that contains the element.
+ * This method returns the deepest nested VPaintableWidget.
*
* @param client
* A reference to ApplicationConnection
private void printClientSideDetectedIssues(
Set<VPaintableWidget> zeroHeightComponents, ApplicationConnection ac) {
for (final VPaintableWidget paintable : zeroHeightComponents) {
- final Container layout = Util.getLayout(paintable
- .getWidgetForPaintable());
+ final Widget layout = paintable.getParent().getWidgetForPaintable();
VerticalPanel errorDetails = new VerticalPanel();
errorDetails.add(new Label("" + Util.getSimpleName(paintable)
emphasisInUi.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (paintable != null) {
- Element element2 = ((Widget) layout).getElement();
+ Element element2 = layout.getElement();
Widget.setStyleName(element2, "invalidlayout",
emphasisInUi.getValue());
}
import com.google.gwt.user.client.ui.KeyboardListenerCollection;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
-import com.vaadin.terminal.gwt.client.Container;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VPaintableWidget;
public class ShortcutActionHandler {
/**
- * An interface implemented by those users (most often {@link Container}s,
- * but HasWidgets at least) of this helper class that want to support
- * special components like {@link VRichTextArea} that don't properly
+ * An interface implemented by those users of this helper class that want to
+ * support special components like {@link VRichTextArea} that don't properly
* propagate key down events. Those components can build support for
* shortcut actions by traversing the closest
* {@link ShortcutActionHandlerOwner} from the component hierarchy an