Example usage for com.vaadin.client VConsole error

List of usage examples for com.vaadin.client VConsole error

Introduction

In this page you can find the example usage for com.vaadin.client VConsole error.

Prototype

public static void error(String msg) 

Source Link

Usage

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;//from w w w  .  java  2s  .c om
    }

    // 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.eternach.client.RichOptionGroupWidget.java

License:Apache License

public TooltipInfo getTooltipInfo(final Element element) {
    Element lookupElement = element;
    while (lookupElement != getWidget().getElement()) {
        if (elementsToDescription.containsKey(lookupElement)) {
            return new TooltipInfo(elementsToDescription.get(lookupElement));
        }//w  w w  . jav a  2  s  . c  o m
        lookupElement = lookupElement.getParentElement();
        VConsole.error(element.toString());
    }
    return null;
}

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

License:Apache License

@Override
public void updateColumnProperties(UIDL uidl) {
    super.updateColumnProperties(uidl);

    if (uidl.hasAttribute("colcubaids") && uidl.hasAttribute("vcolorder")) {
        try {//from   w  w w .ja v a2 s .  co m
            String[] vcolorder = uidl.getStringArrayAttribute("vcolorder");
            String[] colcubaids = uidl.getStringArrayAttribute("colcubaids");

            Map<String, HeaderCell> headerCellMap = new HashMap<>();
            for (int i = 0; i < getHead().getVisibleCellCount(); i++) {
                HeaderCell headerCell = getHead().getHeaderCell(i);
                if (headerCell.getColKey() != null) {
                    headerCellMap.put(headerCell.getColKey(), headerCell);
                }
            }

            for (int i = 0; i < vcolorder.length; i++) {
                String key = vcolorder[i];
                HeaderCell headerCell = headerCellMap.get(key);

                if (headerCell != null) {
                    headerCell.getElement().setAttribute("cuba-id", "column_" + colcubaids[i]);
                }
            }
        } catch (Exception e) {
            VConsole.error("Unable to init cuba-ids for columns " + e.getMessage());
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.tableshared.TableWidgetDelegate.java

License:Apache License

public void requestFocus(final String itemKey, final String columnKey) {
    Scheduler.get().scheduleDeferred(() -> {
        try {//  w ww  .j a  v  a 2 s. c  o m
            setFocus(itemKey, columnKey);
        } catch (Exception e) {
            VConsole.error(e);
        }
    });
}

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDragDropUtil.java

License:Apache License

/**
 * Creates a transferable from a mouse down event. Returns null if creation
 * was not successful.//from  w  ww.j  av  a  2 s.  com
 * 
 * @param event
 *            The mouse down event
 * @param root
 *            The root layout from where the component is dragged
 * @return A transferable or NULL if something failed
 */
public static VTransferable createLayoutTransferableFromMouseDown(NativeEvent event, Widget root,
        Widget target) {

    // NPE check
    if (target == null) {
        VConsole.error("Could not find widget");
        return null;
    }

    VConsole.log("Creating transferable for root:" + root.getElement() + "\t target:" + target.getElement());

    // Special treatment for Tabsheet
    if (root instanceof VDDTabSheet) {
        VDDTabSheet tabsheet = (VDDTabSheet) root;
        TabCaption tab = WidgetUtil.findWidget(target.getElement(), TabCaption.class);
        if (tab != null && tabsheet.getElement().isOrHasChild(tab.getElement())) {
            return createTabsheetTransferableFromMouseDown(tabsheet, tab, event);
        } else {
            // Not a tab
            VConsole.error("Not on tab");
            return null;
        }
    }

    // Special treatment for Accordion
    if (root instanceof VDDAccordion) {
        VDDAccordion accordion = (VDDAccordion) root;
        StackItem tab = WidgetUtil.findWidget(target.getElement(), StackItem.class);
        if (tab != null && accordion.getElement().isOrHasChild(tab.getElement())) {
            return createAccordionTransferableFromMouseDown(accordion, tab, event);
        } else {
            // Not on tab
            VConsole.error("Not on tab");
            return null;
        }
    }

    // Ensure we have the right widget
    target = getTransferableWidget(target);

    // Find the containing layout of the component
    ComponentConnector widgetConnector = Util.findConnectorFor(target);
    if (widgetConnector == null) {
        VConsole.error("No connector found for " + target);
        return null;
    }

    // Iterate until parent either is the root or a layout with drag and
    // drop enabled
    ComponentConnector layoutConnector = (ComponentConnector) widgetConnector.getParent();
    Widget layout = layoutConnector.getWidget();
    while (layout != root && layout != null && layoutConnector != null) {
        if (isDraggingEnabled(layoutConnector, target)) {
            // Found parent layout with support for drag and drop
            break;
        }
        target = layout;
        widgetConnector = layoutConnector;

        layoutConnector = (ComponentConnector) layoutConnector.getParent();
        if (layoutConnector == null) {
            break;
        }

        layout = layoutConnector.getWidget();
    }

    // Consistency check
    if (target == null) {
        VConsole.error("Target was null");
        return null;
    }
    if (root == target) {
        /*
         * Dispatch event again so parent layout can handle the drag of the
         * root
         */
        target.getElement().dispatchEvent(createMouseDownEvent(event));
        return null;
    }
    if (layoutConnector == null) {
        VConsole.error("No layout connector was found");
        return null;
    }

    return createTransferable(layoutConnector, widgetConnector, event);
}

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

License:Apache License

private boolean checkSize() {
    try {//w  w w  .  java 2  s  . c om
        InputElement ie = (InputElement) fu.getElement().cast();
        JsArray<VHtml5File> files = getFiles(ie);
        for (int i = 0; i < files.length(); i++) {
            VHtml5File file = files.get(i);
            if (!isValidFileSize(file) || !isValidMimeType(file)) {
                return false;
            }
        }
    } catch (Exception e) {
        VConsole.error("Detecting file size failed");
    }
    return true;
}

From source file:org.dussan.vaadin.dcharts.client.events.EventProcessor.java

License:Apache License

private static <T> void fire(HasValueChangeHandlers<T> source, T value) {
    try {//  w  ww . ja  v a2s .c o  m
        ValueChangeEvent.fire(source, value);
    } catch (IndexOutOfBoundsException e) {
        VConsole.error("Failed to fire event.");
    }
}