Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.Widget


                content.remove(activeSection.getContent());
                sectionHead.remove(activeSection.getControls());
            }
            // update tab styles
            for (int i = 0; i < tabs.getWidgetCount(); i++) {
                Widget tab = tabs.getWidget(i);
                tab.setStyleDependentName(STYLENAME_SELECTED,
                        tab == section.getTabButton());
            }
            // add new stuff
            content.add(section.getContent());
            sectionHead.add(section.getControls());
View Full Code Here


    private CapsLockWarningRpc rpc = getRpcProxy(CapsLockWarningRpc.class);

    @Override
    protected void extend(ServerConnector target) {
        final Widget passwordWidget = ((ComponentConnector) target).getWidget();

        final VOverlay warning = new VOverlay();
        warning.setOwner(passwordWidget);
        warning.add(new HTML("Caps Lock is enabled!"));

        passwordWidget.addDomHandler(new KeyPressHandler() {
            @Override
            public void onKeyPress(KeyPressEvent event) {
                if (isEnabled() && isCapsLockOn(event)) {
                    warning.showRelativeTo(passwordWidget);
                    rpc.isCapsLockEnabled(true); // Added to send message to the
View Full Code Here

    public void setSpacing(boolean spacing) {
        Profiler.enter("VAOL.onConnectorHierarchyChange setSpacing");
        this.spacing = spacing;
        // first widget does not have spacing on
        // optimization to avoid looking up widget indices on every iteration
        Widget firstSlot = null;
        if (getWidgetCount() > 0) {
            firstSlot = getWidget(0);
        }
        for (Slot slot : widgetToSlot.values()) {
            slot.setSpacing(spacing && firstSlot != slot);
View Full Code Here

        // TODO place for optimization: check if any of these have changed
        // since last time, and only run those changes

        // Caption wrappers
        Widget widget = getWidget();
        final Element focusedElement = Util.getFocusedElement();
        // By default focus will not be lost
        boolean focusLost = false;
        if (captionText != null || icon != null || error != null || required) {
            if (caption == null) {
                caption = DOM.createDiv();
                captionWrap = DOM.createDiv();
                captionWrap.addClassName(StyleConstants.UI_WIDGET);
                captionWrap.addClassName("v-has-caption");
                getElement().appendChild(captionWrap);
                orphan(widget);
                captionWrap.appendChild(widget.getElement());
                adopt(widget);

                // Made changes to DOM. Focus can be lost if it was in the
                // widget.
                focusLost = (focusedElement == null ? false : widget
                        .getElement().isOrHasChild(focusedElement));
            }
        } else if (caption != null) {
            orphan(widget);
            getElement().appendChild(widget.getElement());
            adopt(widget);
            captionWrap.removeFromParent();
            caption = null;
            captionWrap = null;

            // Made changes to DOM. Focus can be lost if it was in the widget.
            focusLost = (focusedElement == null ? false : widget.getElement()
                    .isOrHasChild(focusedElement));
        }

        // Caption text
        if (captionText != null) {
View Full Code Here

        Collection<Node> children = node.getChildren();
        if (node.getName() == null || !children.isEmpty()) {
            SimpleTree tree = new SimpleTree(message);
            for (Node childNode : children) {
                Widget child = buildTree(childNode);
                tree.add(child);
            }
            return tree;
        } else {
            return new Label(message);
View Full Code Here

        }

        try {
            String exceptionText = getFormatter().format(record);

            Widget owner = null;

            if (!ApplicationConfiguration.getRunningApplications().isEmpty()) {
                /*
                 * Make a wild guess and use the first available
                 * ApplicationConnection. This is better than than leaving the
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public String getPathForElement(Element targetElement) {
        Element oldTarget = targetElement;
        Widget targetWidget = Util.findPaintable(client, targetElement)
                .getWidget();
        targetElement = targetWidget.getElement();

        // Find SubPart name if needed.
        String subPart = null;
        boolean hasSubParts = targetWidget instanceof SubPartAware;
        if (oldTarget != targetElement) {
View Full Code Here

    @Override
    public String getPathForElement(Element targetElement) {
        ComponentConnector connector = Util
                .findPaintable(client, targetElement);

        Widget w = null;
        if (connector != null) {
            // If we found a Paintable then we use that as reference. We should
            // find the Paintable for all but very special cases (like
            // overlays).
            w = connector.getWidget();

            /*
             * Still if the Paintable contains a widget that implements
             * SubPartAware, we want to use that as a reference
             */
            Widget targetParent = findParentWidget(targetElement, w);
            while (targetParent != w && targetParent != null) {
                if (targetParent instanceof SubPartAware) {
                    /*
                     * The targetParent widget is a child of the Paintable and
                     * the first parent (of the targetElement) that implements
                     * SubPartAware
                     */
                    w = targetParent;
                    break;
                }
                targetParent = targetParent.getParent();
            }
        }
        if (w == null) {
            // Check if the element is part of a widget that is attached
            // directly to the root panel
            RootPanel rootPanel = RootPanel.get();
            int rootWidgetCount = rootPanel.getWidgetCount();
            for (int i = 0; i < rootWidgetCount; i++) {
                Widget rootWidget = rootPanel.getWidget(i);
                if (rootWidget.getElement().isOrHasChild(targetElement)) {
                    // The target element is contained by this root widget
                    w = findParentWidget(targetElement, rootWidget);
                    break;
                }
            }
            if (w != null) {
                // We found a widget but we should still see if we find a
                // SubPartAware implementor (we cannot find the Paintable as
                // there is no link from VOverlay to its paintable/owner).
                Widget subPartAwareWidget = findSubPartAwareParentWidget(w);
                if (subPartAwareWidget != null) {
                    w = subPartAwareWidget;
                }
            }
        }
View Full Code Here

        // Note that this only works if baseElement can be mapped to a
        // widget to which the path is relative. Otherwise, the current
        // implementation simply interprets the path as if baseElement was
        // null.
        Widget baseWidget = Util.findWidget(baseElement, null);

        Widget w = getWidgetFromPath(widgetPath, baseWidget);
        if (w == null || !Util.isAttachedAndDisplayed(w)) {
            return null;
        }
        if (parts.length == 1) {
            int pos = widgetPath.indexOf("domChild");
            if (pos == -1) {
                return w.getElement();
            }

            // Contains dom reference to a sub element of the widget
            String subPath = widgetPath.substring(pos);
            return getElementByDOMPath(w.getElement(), subPath);
        } else if (parts.length == 2) {
            if (w instanceof SubPartAware) {
                return ((SubPartAware) w).getSubPartElement(parts[1]);
            }
        }
View Full Code Here

            return PARENTCHILD_SEPARATOR + "VWindow[" + indexOfSubWindow + "]";
        } else if (w instanceof RootPanel) {
            return ROOT_ID;
        }

        Widget parent = w.getParent();

        String basePath = getPathForWidget(parent);
        if (basePath == null) {
            return null;
        }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.Widget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.