Example usage for com.vaadin.client UIDL getTag

List of usage examples for com.vaadin.client UIDL getTag

Introduction

In this page you can find the example usage for com.vaadin.client UIDL getTag.

Prototype

public native String getTag()
;

Source Link

Document

Gets the name of this UIDL section, as created with PaintTarget#startTag(String) PaintTarget.startTag() in the server-side Component#paint(PaintTarget) Component.paint() or (usually) com.vaadin.ui.AbstractComponent#paintContent(PaintTarget) AbstractComponent.paintContent() .

Usage

From source file:annis.gui.widgets.gwt.client.ui.VAnnotationGrid.java

License:Apache License

/**
 * Called whenever an update is received from the server
 *///  w w  w .  j  av a 2 s  . c o  m
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {

    // This call should be made first.
    // It handles sizes, captions, tooltips, etc. automatically.
    if (client.updateComponent(this, uidl, true)) {
        // If client.updateComponent returns true there has been no changes and we
        // do not need to update anything.
        return;
    }

    // Save reference to server connection object to be able to send
    // user interaction later
    this.gClient = client;

    // Save the client side identifier (paintable id) for the widget
    paintableId = uidl.getId();

    try {
        if (uidl.hasAttribute("escapeHTML")) {
            this.escapeHTML = uidl.getBooleanAttribute("escapeHTML");
        }

        UIDL rows = uidl.getChildByTagName("rows");
        if (rows != null) {
            // clear all old table cells
            table.removeAllRows();
            highlighted.clear();
            position2id.clear();

            for (int i = 0; i < rows.getChildCount(); i++) {
                UIDL row = rows.getChildUIDL(i);
                if ("row".equals(row.getTag())) {
                    addRow(row, i);
                }
            }
        } // end if rows not null

        // add end events if necessary to have a nicely aligned regular grid
        int maxCellCount = 0;
        for (int row = 0; row < table.getRowCount(); row++) {
            maxCellCount = Math.max(maxCellCount, getRealColumnCount(row));
        }

        for (int row = 0; row < table.getRowCount(); row++) {
            int isValue = getRealColumnCount(row);

            if (isValue < maxCellCount) {
                int diff = maxCellCount - isValue;
                table.setHTML(row, table.getCellCount(row) + diff - 1, "");
            }
        }

    } catch (Exception ex) {
        VConsole.log(ex);
    }
}

From source file:annis.gui.widgets.gwt.client.ui.VSimpleCanvas.java

License:Apache License

/**
 * Called whenever an update is received from the server 
 *//*from  w  ww  . j av  a2  s.  c o  m*/
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {

    // This call should be made first. 
    // It handles sizes, captions, tooltips, etc. automatically.
    if (client.updateComponent(this, uidl, true)) {
        // If client.updateComponent returns true there has been no changes and we
        // do not need to update anything.
        return;
    }

    // Save reference to server connection object to be able to send
    // user interaction later
    //this.gClient = client;

    // Save the client side identifier (paintable id) for the widget
    //paintableId = uidl.getId();

    if (context != null) {
        Iterator<Object> it = uidl.getChildIterator();
        while (it.hasNext()) {
            UIDL child = (UIDL) it.next();

            if ("clear".equals(child.getTag())) {
                context.clearRect(0, 0, context.getCanvas().getWidth(), context.getCanvas().getHeight());
            } else if ("line".equals(child.getTag())) {
                context.setGlobalAlpha(1.0);
                context.setLineWidth(1.0);
                context.setStrokeStyle("black");
                context.beginPath();
                context.moveTo(child.getIntAttribute("from_x"), child.getIntAttribute("from_y"));
                context.lineTo(child.getIntAttribute("to_x"), child.getIntAttribute("to_y"));
                context.closePath();
                context.stroke();
            }
            // todo: more commands :)
        }

    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.combobox.CubaComboBoxConnector.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    super.updateFromUIDL(uidl, client);

    // We may have actions attached to this text field
    if (uidl.getChildCount() > 0) {
        final int cnt = uidl.getChildCount();
        for (int i = 0; i < cnt; i++) {
            UIDL childUidl = uidl.getChildUIDL(i);
            if (childUidl.getTag().equals("actions")) {
                if (getWidget().getShortcutActionHandler() == null) {
                    getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client));
                }/*  w  w w  .  java 2s .c  om*/
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.cssactionslayout.CubaCssActionsLayoutConnector.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    final int cnt = uidl.getChildCount();
    for (int i = 0; i < cnt; i++) {
        UIDL childUidl = uidl.getChildUIDL(i);
        if (childUidl.getTag().equals("actions")) {
            if (getWidget().getShortcutHandler() == null) {
                getWidget().setShortcutHandler(new ShortcutActionHandler(uidl.getId(), client));
            }/*from w  w w .  ja  v a  2s .  co m*/
            getWidget().getShortcutHandler().updateActionMap(childUidl);
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.datefield.CubaDateFieldConnector.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    super.updateFromUIDL(uidl, client);

    getWidget().updateTextState();/*ww  w. j  a va 2s .  co  m*/

    // We may have actions attached to this text field
    if (uidl.getChildCount() > 0) {
        final int cnt = uidl.getChildCount();
        for (int i = 0; i < cnt; i++) {
            UIDL childUidl = uidl.getChildUIDL(i);
            if (childUidl.getTag().equals("actions")) {
                if (getWidget().getShortcutActionHandler() == null) {
                    getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client));
                }
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.table.CubaScrollTableConnector.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    super.updateFromUIDL(uidl, client);

    if (uidl.hasVariable("collapsedcolumns")) {
        getWidget().addStyleName("collapsing-allowed");
    } else {/* w ww.j  a v a  2s .c o  m*/
        getWidget().removeStyleName("collapsing-allowed");
    }

    // We may have actions attached to this table
    if (uidl.getChildCount() > 1) {
        final int cnt = uidl.getChildCount();
        for (int i = 1; i < cnt; i++) {
            UIDL childUidl = uidl.getChildUIDL(i);
            if (childUidl.getTag().equals("shortcuts")) {
                if (getWidget().getShortcutActionHandler() == null) {
                    getWidget().setShortcutActionHandler(
                            new CubaTableShortcutActionHandler(uidl.getId(), client, this));
                }
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.tree.CubaTreeConnector.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    super.updateFromUIDL(uidl, client);

    getWidget().setDoubleClickHandling(false);

    getWidget().nodeCaptionsAsHtml = uidl.getBooleanAttribute("nodeCaptionsAsHtml");

    // We may have actions attached to this tree
    if (uidl.getChildCount() > 1) {
        final int cnt = uidl.getChildCount();
        for (int i = 1; i < cnt; i++) {
            UIDL childUidl = uidl.getChildUIDL(i);
            if (childUidl.getTag().equals("shortcuts")) {
                if (getWidget().getShortcutActionHandler() == null) {
                    getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client));
                }//from   www  .j  ava2 s  .  c  o  m
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.tree.CubaTreeConnector.java

License:Apache License

@Override
protected boolean isNodeUidl(UIDL childUidl) {
    return !"shortcuts".equals(childUidl.getTag());
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.treetable.CubaTreeTableConnector.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    super.updateFromUIDL(uidl, client);

    if (uidl.hasVariable("collapsedcolumns")) {
        getWidget().addStyleName("collapsing-allowed");
    } else {/*from ww w .  j a v  a 2s.c om*/
        getWidget().removeStyleName("collapsing-allowed");
    }

    // We may have actions attached to this table
    if (uidl.getChildCount() > 1) {
        final int cnt = uidl.getChildCount();
        for (int i = 1; i < cnt; i++) {
            UIDL childUidl = uidl.getChildUIDL(i);
            if (childUidl.getTag().equals("shortcuts")) {
                if (getWidget().getShortcutActionHandler() == null) {
                    getWidget().setShortcutActionHandler(
                            new CubaTableShortcutActionHandler(uidl.getId(), client, this));
                }
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }

    getWidget().updateTableBodyScroll();
}

From source file:info.magnolia.ui.vaadin.gwt.client.grid.VMagnoliaTreeTable.java

License:Open Source License

@Override
protected String buildCaptionHtmlSnippet(UIDL uidl) {
    return (uidl.getTag().equals("column")) ? super.buildCaptionHtmlSnippet(uidl)
            : uidl.getStringAttribute("caption");
}