Example usage for com.vaadin.client UIDL getId

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

Introduction

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

Prototype

public String getId() 

Source Link

Document

Shorthand for getting the attribute named "id", which for Paintables is the essential paintableId which binds the server side component to the client side widget.

Usage

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

License:Apache License

/**
 * Called whenever an update is received from the server
 *//*from  w w  w.j  a va 2 s  .c  om*/
@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.VMediaPlayerBase.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    if (client.updateComponent(this, uidl, true)) {
        return;/*  w w  w  .  j a va 2  s. c o  m*/
    }

    // 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 (media == null) {
        VConsole.error("media not set!!!");
        return;
    }

    if (uidl.hasAttribute(SOURCE_URL)) {
        registerMetadataLoadedEvent(media);

        if (uidl.hasAttribute(MIME_TYPE)) {
            String mimeType = uidl.getStringAttribute(MIME_TYPE);
            VConsole.log(
                    "canPlayType for \"" + mimeType + "\"value is \"" + media.canPlayType(mimeType) + "\"");
            // check for correct mime type
            if (media.canPlayType(uidl.getStringAttribute(MIME_TYPE)).equals(MediaElement.CANNOT_PLAY)) {
                VConsole.log("CANNOT PLAY!!!");

                gClient.updateVariable(paintableId, CANNOT_PLAY, true, true);
            } else if (media.canPlayType(uidl.getStringAttribute(MIME_TYPE))
                    .equals(MediaElement.CAN_PLAY_MAYBE)) {
                gClient.updateVariable(paintableId, MIGHT_NOT_PLAY, true, true);
            }
        }
        media.setSrc(uidl.getStringAttribute(SOURCE_URL));
    }

    if (uidl.hasAttribute(PLAY)) {
        String[] time = uidl.getStringArrayAttribute(PLAY);
        if (time != null && time.length > 0) {
            if (time.length == 1) {
                try {
                    media.setCurrentTime(Double.parseDouble(time[0]));
                } catch (NumberFormatException ex) {
                    VConsole.error(ex);
                }
            } else if (time.length == 2) {
                try {
                    media.setCurrentTime(Double.parseDouble(time[0]));
                    setEndTimeOnce(media, Double.parseDouble(time[1]));
                } catch (NumberFormatException ex) {
                    VConsole.error(ex);
                }
            }
            media.play();
        }
    } else if (uidl.hasAttribute(PAUSE)) {
        media.pause();
    } else if (uidl.hasAttribute(STOP)) {
        media.pause();
        media.setSrc("");
    }
}

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 . j  a  v  a 2  s. com*/
                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 ww .  j  a  va 2  s  . c  om
            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();//from  ww  w.ja v a  2s .c  o 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 {//from ww w  .  j  a  v  a  2 s  .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);
            }
        }
    }
}

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));
                }//  w ww.j a v  a 2  s  .  co m
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }
}

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  w w  w .j a v  a2 s.  co 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);
            }
        }
    }

    getWidget().updateTableBodyScroll();
}

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.client.VMultiUpload.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    if (client.updateComponent(this, uidl, true)) {
        return;//  ww w.jav  a2  s  . com
    }
    addStyleName(CLASSNAME + "-immediate");

    this.client = client;
    paintableId = uidl.getId();
    receiverUri = client.translateVaadinUri(uidl.getStringVariable("target"));
    submitButton.setText(uidl.getStringAttribute("buttoncaption"));
    fu.setName(paintableId + "_file");

    if (uidl.hasAttribute("enabled")) {
        if (uidl.getBooleanAttribute("enabled")) {
            enableUpload();
        } else {
            disableUpload();
        }
    }

    if (uidl.hasAttribute("maxFileSize")) {
        maxFileSize = uidl.getLongAttribute("maxFileSize");
    }
    if (uidl.hasAttribute("sizeErrorMsg")) {
        sizeErrorMsg = uidl.getStringAttribute("sizeErrorMsg");
    }
    if (uidl.hasAttribute("mimeTypeErrorMsg")) {
        mimeTypeErrorMsg = uidl.getStringAttribute("mimeTypeErrorMsg");
    }
    if (uidl.hasAttribute("acceptFilter")) {
        getInput().setAccept(uidl.getStringAttribute("acceptFilter"));
    }
    if (uidl.hasAttribute("acceptedMimeTypes")) {
        acceptedMimeTypes = Arrays.asList(uidl.getStringArrayAttribute("acceptedMimeTypes"));
    }
    if (uidl.hasAttribute("interruptedFileIds")) {
        removeFromFileQueue(uidl.getIntArrayAttribute("interruptedFileIds"));
    }
    if (uidl.hasAttribute("ready")) {
        postNextFileFromQueue();
    }
}

From source file:org.opennms.features.topology.ssh.internal.gwt.client.ui.VTerminal.java

License:Open Source License

/**
 * The updateFromUIDL method handles all communication from the server and passes
 * the data along to the GwtTerminal widget which updates the client side view.
 *//*from   ww  w .j av  a 2 s.c  om*/
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {

    // This call should be made first. Ensure correct implementation,
    // and let the containing layout manage caption, etc.
    if (client.updateComponent(this, uidl, true)) {
        return;
    }

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

    // Save the UIDL identifier for the component
    this.uidlId = uidl.getId();

    // Check if the server wants the TermHandler to close, if so, send a
    // response back to the server that it was closed successfully
    if (uidl.getBooleanVariable("closeClient")) {
        termHandler.close();
        isClosed = true;
        sendBytes("");
    }

    // Check if the server wants the TermHandler to update manually
    if (uidl.getBooleanVariable("update"))
        update();
    if (uidl.getBooleanVariable("focus")) {
        super.focus();
        isFocused = true;
    }

    // Take the current representation of the Terminal from the server
    // and set the Inner HTML of the widget
    dump(uidl.getStringVariable("fromSSH"));
}