Example usage for com.google.gwt.user.client Element cast

List of usage examples for com.google.gwt.user.client Element cast

Introduction

In this page you can find the example usage for com.google.gwt.user.client Element cast.

Prototype

@Override
    public <T extends JavascriptObjectEquivalent> T cast() 

Source Link

Usage

From source file:asquare.gwt.tk.client.ui.ImagePrototype.java

License:Apache License

@Override
public ImagePrototypeElement createElement() {
    Element result = DOM.createImg();
    applyTo(result.<ImagePrototypeElement>cast());
    return result.cast();
}

From source file:com.devbliss.gwtbliss.client.ui.NoDivPanel.java

License:Apache License

@Override
public void add(final Widget widget, final Element elem) {
    final com.google.gwt.user.client.Element clientElem = elem.cast();
    super.add(widget, clientElem);
}

From source file:com.github.gwtbootstrap.client.ui.CheckBox.java

License:Apache License

private Element asOld(com.google.gwt.dom.client.Element elem) {
    Element oldSchool = elem.cast();
    return oldSchool;
}

From source file:com.googlecode.gflot.client.PlotFactory.java

License:Open Source License

static Element getPlotContainer(String id) {
    com.google.gwt.dom.client.Element docElement = Document.get().getElementById(id);
    Element element = null;//from  ww  w . java2s  . co m
    if (null == docElement) {
        element = DOM.createDiv();
        element.setId(id);
    } else {
        element = docElement.cast();
    }
    return element;
}

From source file:org.jbpm.console.ng.pr.client.editors.instance.list.dash.DataSetProcessInstanceListViewImpl.java

License:Apache License

@Override
public void initSelectionModel() {

    final ExtendedPagedTable extendedPagedTable = getListGrid();
    extendedPagedTable.setEmptyTableCaption(constants.No_Process_Instances_Found());
    extendedPagedTable.getRightActionsToolbar().clear();
    initExtraButtons(extendedPagedTable);
    initBulkActions(extendedPagedTable);
    selectionModel = new NoSelectionModel<ProcessInstanceSummary>();
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override/*from  w  w  w  .  jav a  2 s.  c om*/
        public void onSelectionChange(SelectionChangeEvent event) {

            boolean close = false;
            if (selectedRow == -1) {
                extendedPagedTable.setRowStyles(selectedStyles);
                selectedRow = extendedPagedTable.getKeyboardSelectedRow();
                extendedPagedTable.redraw();

            } else if (extendedPagedTable.getKeyboardSelectedRow() != selectedRow) {
                extendedPagedTable.setRowStyles(selectedStyles);
                selectedRow = extendedPagedTable.getKeyboardSelectedRow();
                extendedPagedTable.redraw();
            } else {
                close = true;
            }

            selectedItem = selectionModel.getLastSelectedObject();

            PlaceStatus status = placeManager
                    .getStatus(new DefaultPlaceRequest("Process Instance Details Multi"));

            if (status == PlaceStatus.CLOSE) {
                placeManager.goTo("Process Instance Details Multi");
                processInstanceSelected.fire(new ProcessInstanceSelectionEvent(selectedItem.getDeploymentId(),
                        selectedItem.getProcessInstanceId(), selectedItem.getProcessId(),
                        selectedItem.getProcessName(), selectedItem.getState()));
            } else if (status == PlaceStatus.OPEN && !close) {
                processInstanceSelected.fire(new ProcessInstanceSelectionEvent(selectedItem.getDeploymentId(),
                        selectedItem.getProcessInstanceId(), selectedItem.getProcessId(),
                        selectedItem.getProcessName(), selectedItem.getState()));
            } else if (status == PlaceStatus.OPEN && close) {
                placeManager.closePlace("Process Instance Details Multi");
            }

        }
    });

    noActionColumnManager = DefaultSelectionEventManager
            .createCustomManager(new DefaultSelectionEventManager.EventTranslator<ProcessInstanceSummary>() {

                @Override
                public boolean clearCurrentSelection(CellPreviewEvent<ProcessInstanceSummary> event) {
                    return false;
                }

                @Override
                public DefaultSelectionEventManager.SelectAction translateSelectionEvent(
                        CellPreviewEvent<ProcessInstanceSummary> event) {
                    NativeEvent nativeEvent = event.getNativeEvent();
                    if (BrowserEvents.CLICK.equals(nativeEvent.getType())) {
                        // Ignore if the event didn't occur in the correct column.
                        if (extendedPagedTable.getColumnIndex(actionsColumn) == event.getColumn()) {
                            return DefaultSelectionEventManager.SelectAction.IGNORE;
                        }
                        //Extension for checkboxes
                        Element target = nativeEvent.getEventTarget().cast();
                        if ("input".equals(target.getTagName().toLowerCase())) {
                            final InputElement input = target.cast();
                            if ("checkbox".equals(input.getType().toLowerCase())) {
                                // Synchronize the checkbox with the current selection state.
                                if (!selectedProcessInstances.contains(event.getValue())) {
                                    selectedProcessInstances.add(event.getValue());
                                    input.setChecked(true);
                                } else {
                                    selectedProcessInstances.remove(event.getValue());
                                    input.setChecked(false);
                                }
                                controlBulkOperations();
                                return DefaultSelectionEventManager.SelectAction.IGNORE;
                            }
                        }
                    }

                    return DefaultSelectionEventManager.SelectAction.DEFAULT;
                }

            });

    extendedPagedTable.setSelectionModel(selectionModel, noActionColumnManager);
    extendedPagedTable.setRowStyles(selectedStyles);
}

From source file:org.openremote.modeler.client.gxtextends.CheckBoxListViewExt.java

License:Open Source License

/**
 * Selects a specific item in the view/* ww  w  .ja  va 2 s.c om*/
 * 
 * @param m the modeldata that should be checked
 * @param checked true to check
 */
public void setChecked(M m, boolean checked) {
    if (rendered) {
        NodeList<Element> nodes = el().select(checkBoxSelector);
        int index = store.indexOf(m);
        if (index != -1) {
            Element e = nodes.getItem(index);
            if (e != null) {
                ((InputElement) e.cast()).setChecked(checked);
            }
        }
    } else {
        if (checkedPreRender == null) {
            checkedPreRender = new ArrayList<M>();
        }
        if (checked) {
            if (!checkedPreRender.contains(m)) {
                checkedPreRender.add(m);
            }
        } else {
            checkedPreRender.remove(m);
        }
    }
}

From source file:org.semanticsoft.vaaclipse.widgets.client.ui.stackwidget.VStackWidget.java

License:Open Source License

private boolean hasSpace(Element toolbarElement) {
    Element tb = (Element) tabs.getChild(0);
    Element spacertd = (Element) tb.getChild(0).getChild(0).getLastChild();

    return tb.getOffsetWidth()
            - DOM.getElementPropertyInt((Element) spacertd.cast(), "offsetWidth") < getOffsetWidth()
                    - buttonPanel.getOffsetWidth() - toolbarElement.getOffsetWidth() - 10;
}

From source file:rocket.style.client.ComputedStyle.java

License:Apache License

static public ComputedStyle getComputedStyle(final Element element) {
    return element.cast();
}

From source file:rocket.style.client.InlineStyle.java

License:Apache License

static public InlineStyle getInlineStyle(final Element element) {
    return element.cast();
}

From source file:rocket.widget.client.RadioButton.java

License:Apache License

/**
 * Replace the current input element with a new one.
 * /* ww w .  j a v a2  s .c o  m*/
 * @param newElement
 *            the new input element
 */
protected void replaceInputElement(final Element newElement) {
    // Collect information we need to set

    final InputElement oldInputElement = this.getElement().cast();

    int tabIndex = getTabIndex();
    boolean checked = isChecked();
    boolean enabled = isEnabled();
    String uid = oldInputElement.getId();
    String accessKey = oldInputElement.getAccessKey();

    // Clear out the old input element
    setChecked(false);
    oldInputElement.setId("");
    oldInputElement.setAccessKey("");

    // Quickly do the actual replace
    final Element parent = oldInputElement.getParentElement().cast();
    final int index = DOM.getChildIndex(parent, (Element) oldInputElement.cast());
    parent.removeChild(oldInputElement);
    DOM.insertChild(parent, (Element) newElement.cast(), index);
    this.invokeReplaceElement(newElement);

    // Setup the new element
    DOM.sinkEvents((Element) oldInputElement.cast(), DOM.getEventsSunk(this.getElement()));
    DOM.setEventListener((Element) oldInputElement.cast(), this);
    oldInputElement.setId(uid);
    if (accessKey != "") {
        oldInputElement.setAccessKey(accessKey);
    }
    setTabIndex(tabIndex);
    setChecked(checked);
    setEnabled(enabled);
}