Examples of Paintable


Examples of com.vaadin.terminal.gwt.client.Paintable

            public void onMouseDown(MouseDownEvent event) {
                if (dragStarMode > 0) {
                    VTransferable transferable = new VTransferable();
                    transferable.setDragSource(VDragAndDropWrapper.this);

                    Paintable paintable;
                    Widget w = Util.findWidget((Element) event.getNativeEvent()
                            .getEventTarget().cast(), null);
                    while (w != null && !(w instanceof Paintable)) {
                        w = w.getParent();
                    }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

        ArrayList<UIDL> relativeSizeComponentUIDL = new ArrayList<UIDL>();

        int pos = 0;
        for (final Iterator<Object> it = uidl.getChildIterator(); it.hasNext();) {
            final UIDL childUIDL = (UIDL) it.next();
            final Paintable child = client.getPaintable(childUIDL);
            Widget widget = (Widget) child;

            // Create container for component
            ChildComponentContainer childComponentContainer = getComponentContainer(widget);
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

        // For all contained widgets
        for (final Iterator i = uidl.getChildIterator(); i.hasNext();) {
            final UIDL uidlForChild = (UIDL) i.next();
            if (uidlForChild.getTag().equals("location")) {
                final String location = uidlForChild.getStringAttribute("name");
                final Paintable child = client.getPaintable(uidlForChild
                        .getChildUIDL(0));
                try {
                    setWidget((Widget) child, location);
                    child.updateFromUIDL(uidlForChild.getChildUIDL(0), client);
                } catch (final IllegalArgumentException e) {
                    // If no location is found, this component is not visible
                }
                oldWidgets.remove(child);
            }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

            }
            ChildComponentContainer remove = widgetToComponentContainer
                    .remove(widget);
            remove(child);
            if (!relocated) {
                Paintable p = (Paintable) widget;
                client.unregisterPaintable(p);
            }
        }

    }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

                final Object cell = cells.next();
                if (cell instanceof String) {
                    tBody.setWidget(curRowIndex, colIndex, new BodyCell(row,
                            (String) cell));
                } else {
                    final Paintable cellContent = client
                            .getPaintable((UIDL) cell);
                    final BodyCell bodyCell = new BodyCell(row);
                    bodyCell.setWidget((Widget) cellContent);
                    tBody.setWidget(curRowIndex, colIndex, bodyCell);
                }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

            return;
        }

        // Draw this application level window
        UIDL childUidl = uidl.getChildUIDL(childIndex);
        final Paintable lo = client.getPaintable(childUidl);

        if (layout != null) {
            if (layout != lo) {
                // remove old
                client.unregisterPaintable(layout);
                // add new
                setWidget((Widget) lo);
                layout = lo;
            }
        } else {
            setWidget((Widget) lo);
            layout = lo;
        }

        layout.updateFromUIDL(childUidl, client);
        if (!childUidl.getBooleanAttribute("cached")) {
            updateParentFrameSize();
        }

        // Save currently open subwindows to track which will need to be closed
        final HashSet<VWindow> removedSubWindows = new HashSet<VWindow>(
                subWindows);

        // Handle other UIDL children
        while ((childUidl = uidl.getChildUIDL(++childIndex)) != null) {
            String tag = childUidl.getTag().intern();
            if (tag == "actions") {
                if (actionHandler == null) {
                    actionHandler = new ShortcutActionHandler(id, client);
                }
                actionHandler.updateActionMap(childUidl);
            } else if (tag == "execJS") {
                String script = childUidl.getStringAttribute("script");
                eval(script);
            } else if (tag == "notifications") {
                for (final Iterator it = childUidl.getChildIterator(); it
                        .hasNext();) {
                    final UIDL notification = (UIDL) it.next();
                    String html = "";
                    if (notification.hasAttribute("icon")) {
                        final String parsedUri = client
                                .translateVaadinUri(notification
                                        .getStringAttribute("icon"));
                        html += "<img src=\"" + parsedUri + "\" />";
                    }
                    if (notification.hasAttribute("caption")) {
                        html += "<h1>"
                                + notification.getStringAttribute("caption")
                                + "</h1>";
                    }
                    if (notification.hasAttribute("message")) {
                        html += "<p>"
                                + notification.getStringAttribute("message")
                                + "</p>";
                    }

                    final String style = notification.hasAttribute("style") ? notification
                            .getStringAttribute("style") : null;
                    final int position = notification
                            .getIntAttribute("position");
                    final int delay = notification.getIntAttribute("delay");
                    new VNotification(delay).show(html, position, style);
                }
            } else {
                // subwindows
                final Paintable w = client.getPaintable(childUidl);
                if (subWindows.contains(w)) {
                    removedSubWindows.remove(w);
                } else {
                    subWindows.add((VWindow) w);
                }
                w.updateFromUIDL(childUidl, client);
            }
        }

        // Close old windows which where not in UIDL anymore
        for (final Iterator<VWindow> rem = removedSubWindows.iterator(); rem
                .hasNext();) {
            final VWindow w = rem.next();
            client.unregisterPaintable(w);
            subWindows.remove(w);
            w.hide();
        }

        if (uidl.hasAttribute("focused")) {
            // set focused component when render phase is finished
            DeferredCommand.addCommand(new Command() {
                public void execute() {
                    final Paintable toBeFocused = uidl.getPaintableAttribute(
                            "focused", connection);

                    /*
                     * Two types of Widgets can be focused, either implementing
                     * GWT HasFocus of a thinner Vaadin specific Focusable
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

     */
    void scrollIntoView(final UIDL uidl) {
        if (uidl.hasAttribute("scrollTo")) {
            DeferredCommand.addCommand(new Command() {
                public void execute() {
                    final Paintable paintable = uidl.getPaintableAttribute(
                            "scrollTo", connection);
                    ((Widget) paintable).getElement().scrollIntoView();
                }
            });
        }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

            int i = 0;
            for (final Iterator it = uidl.getChildIterator(); it.hasNext(); i++) {
                prepareCell(i, 1);
                final UIDL childUidl = (UIDL) it.next();
                final Paintable p = client.getPaintable(childUidl);
                Caption caption = componentToCaption.get(p);
                if (caption == null) {
                    caption = new Caption(p, client,
                            getStylesFromUIDL(childUidl));
                    caption.addClickHandler(this);
                    componentToCaption.put(p, caption);
                }
                ErrorFlag error = componentToError.get(p);
                if (error == null) {
                    error = new ErrorFlag();
                    componentToError.put(p, error);
                }
                prepareCell(i, COLUMN_WIDGET);
                final Paintable oldComponent = (Paintable) getWidget(i,
                        COLUMN_WIDGET);
                if (oldComponent == null) {
                    setWidget(i, COLUMN_WIDGET, (Widget) p);
                } else if (oldComponent != p) {
                    client.unregisterPaintable(oldComponent);
                    setWidget(i, COLUMN_WIDGET, (Widget) p);
                }
                getCellFormatter().setStyleName(i, COLUMN_WIDGET,
                        CLASSNAME + "-contentcell");
                getCellFormatter().setStyleName(i, COLUMN_CAPTION,
                        CLASSNAME + "-captioncell");
                setWidget(i, COLUMN_CAPTION, caption);

                setContentWidth(i);

                getCellFormatter().setStyleName(i, COLUMN_ERRORFLAG,
                        CLASSNAME + "-errorcell");
                setWidget(i, COLUMN_ERRORFLAG, error);

                p.updateFromUIDL(childUidl, client);

                String rowstyles = CLASSNAME + "-row";
                if (i == 0) {
                    rowstyles += " " + CLASSNAME + "-firstrow";
                }
                if (!it.hasNext()) {
                    rowstyles += " " + CLASSNAME + "-lastrow";
                }

                getRowFormatter().setStyleName(i, rowstyles);

            }

            while (getRowCount() > i) {
                final Paintable p = (Paintable) getWidget(i, COLUMN_WIDGET);
                client.unregisterPaintable(p);
                componentToCaption.remove(p);
                removeRow(i);
            }
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

        while (tabCount-- > index) {
            removeTab(index);
        }

        for (int i = 0; i < getTabCount(); i++) {
            Paintable p = getTab(i);
            oldPaintables.remove(p);
        }

        // Perform unregister for any paintables removed during update
        for (Iterator iterator = oldPaintables.iterator(); iterator.hasNext();) {
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.Paintable

        if (u.getChildCount() == 0) {
          log(1, "No contents for info window");
        } else if (u.getChildCount() == 1) {
          // Only one component in the info window -> no tabbing
          UIDL paintableUIDL = u.getChildUIDL(0).getChildUIDL(0);
          Paintable paintable = client.getPaintable(paintableUIDL);

          map.getInfoWindow().open(marker.getLatLng(),
              new InfoWindowContent((Widget) paintable));

          // Update components in the info window after adding them to
          // DOM so that size calculations can succeed
          paintable.updateFromUIDL(paintableUIDL, client);
        } else {
          int tabs = u.getChildCount();
          // More than one component, show them in info window tabs
          InfoWindowContent.InfoWindowTab[] infoTabs = new InfoWindowContent.InfoWindowTab[tabs];

          Paintable[] paintables = new Paintable[tabs];
          UIDL[] uidls = new UIDL[tabs];

          int selectedId = 0;
          for (int i = 0; i < u.getChildCount(); i++) {
            UIDL childUIDL = u.getChildUIDL(i);
            if (selectedId == 0
                && childUIDL.getBooleanAttribute("selected")) {
              selectedId = i;
            }

            String label = childUIDL.getStringAttribute("label");

            UIDL paintableUIDL = childUIDL.getChildUIDL(0);
            Paintable paintable = client
                .getPaintable(paintableUIDL);

            paintables[i] = paintable;
            uidls[i] = paintableUIDL;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.