Example usage for com.google.gwt.user.client.ui UIObject getElement

List of usage examples for com.google.gwt.user.client.ui UIObject getElement

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui UIObject getElement.

Prototype

public Element getElement() 

Source Link

Document

Gets a handle to the object's underlying DOM element.

Usage

From source file:com.qualogy.qafe.gwt.client.ui.renderer.RendererHelper.java

License:Apache License

public static String getGroupName(UIObject ui) {
    return DOM.getElementAttribute(ui.getElement(), KEYWORD_GROUP_ATTRIBUTE);
}

From source file:com.qualogy.qafe.gwt.client.ui.renderer.RendererHelper.java

License:Apache License

private static boolean checkIsComponentOfType(UIObject ui, String type) {
    if (ui != null) {
        String t = DOM.getElementAttribute(ui.getElement(), type);
        return (t != null && t.length() > 0);
    } else {//from   w ww .ja  va2  s  .  c o  m
        return false;
    }
}

From source file:com.qualogy.qafe.gwt.client.ui.renderer.RendererHelper.java

License:Apache License

public static void processEvents(ComponentGVO vo, UIObject ui, EventListenerGVO event,
        List<com.qualogy.qafe.gwt.client.vo.ui.event.InputVariableGVO> inputVariables, String appId) {
    if (ui != null) {
        String nonHandledEventName = null;
        String nonHandledEventMessage = null;
        if (event instanceof OnEnterEventListenerGVO) {
            if (ui instanceof HasAllKeyHandlers) {
                HasAllKeyHandlers hasAllKeyHandlers = (HasAllKeyHandlers) ui;
                hasAllKeyHandlers.addKeyDownHandler(EventFactory.createOnEnterListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONENTER;
            }/*w w  w  . j a v a 2s  .  c om*/
        }
        if (event instanceof OnFocusEventListenerGVO) {
            if (ui instanceof HasFocusHandlers) {
                HasFocusHandlers hasFocusHandlers = (HasFocusHandlers) ui;
                hasFocusHandlers.addFocusHandler(EventFactory.createFocusListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONFOCUS;
            }
        }
        if (event instanceof OnExitEventListenerGVO) {
            if (ui instanceof HasBlurHandlers) {
                HasBlurHandlers hasBlurHandlers = (HasBlurHandlers) ui;
                hasBlurHandlers.addBlurHandler(EventFactory.createOnExitListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONEXIT;
            }
        }
        if (event instanceof ClickEventListenerGVO) {
            if (ui instanceof HasClickHandlers) {
                ui.addStyleName("qafe_hand");
                HasClickHandlers hasClickHandlers = (HasClickHandlers) ui;
                hasClickHandlers.addClickHandler(EventFactory.createClickListener(event, inputVariables));
            } else if (ui instanceof MenuItem) {
                MenuItem menuItem = (MenuItem) ui;
                menuItem.setCommand(EventFactory.createCommandListener(menuItem, event, inputVariables));
                ui.addStyleName("qafe_hand");
            } else if (ui instanceof AreaWidget) {
                AreaWidget area = (AreaWidget) ui;
                area.setCommand(EventFactory.createCommandListener(area, event, inputVariables));
                ui.addStyleName("qafe_hand");
            } else if (ui instanceof TabPanel) {
                TabPanel tabPanel = (TabPanel) ui;
                String eventComponentId = event.getEventComponentId();
                String[] components = eventComponentId.split("\\.");
                if (components.length == 1) {
                    tabPanel.addSelectionHandler(
                            EventFactory.createTabPanelListener(tabPanel, event, inputVariables));
                    ui.addStyleName("qafe_hand");
                }
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONCLICK;
            }
        }
        if (event instanceof DoubleClickEventListenerGVO) {
            if (ui instanceof HasDoubleClickHandlers) {
                //ui.addStyleName("qafe_hand");
                HasDoubleClickHandlers hasDoubleClickHandlers = (HasDoubleClickHandlers) ui;
                hasDoubleClickHandlers
                        .addDoubleClickHandler(EventFactory.createDoubleClickListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONDBLCLICK;
            }
        }
        if (event instanceof OnChangeEventListenerGVO) {
            if (ui instanceof QSuggestBox) {
                QSuggestBox suggestionBox = (QSuggestBox) ui;
                suggestionBox.addKeyUpHandler(
                        EventFactory.createSuggestionOnKeyUpHandler(suggestionBox, event, inputVariables));
            } else if (ui instanceof QDatePicker && ui instanceof HasValueChangeHandlers) {
                HasValueChangeHandlers hasValueChangeHandlers = (HasValueChangeHandlers) ui;
                hasValueChangeHandlers.addValueChangeHandler(
                        (EventFactory.createOnValueChangeHandler(event, inputVariables)));
            } else if (ui instanceof HasDataChangeHandlers) {
                HasDataChangeHandlers hasDataChangeHandlers = (HasDataChangeHandlers) ui;
                hasDataChangeHandlers
                        .addDataChangeHandler((EventFactory.createOnDataChangeHandler(event, inputVariables)));
            } else if (ui instanceof HasChangeHandlers) {
                HasChangeHandlers hasChangeHandlers = (HasChangeHandlers) ui;
                hasChangeHandlers
                        .addChangeHandler((EventFactory.createOnChangeListener(event, inputVariables)));
            } else if (ui instanceof SourcesChangeEvents) {
                SourcesChangeEvents sourcesChangeEvents = (SourcesChangeEvents) ui;
                sourcesChangeEvents
                        .addChangeListener(EventFactory.createLegacyOnChangeListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONCHANGE;
            }
        }
        if (event instanceof OnMouseEnterEventListenerGVO) {
            if (ui instanceof HasAllMouseHandlers) {
                HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui;
                hasAllMouseHandlers
                        .addMouseOverHandler(EventFactory.createOnMouseEnterListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_ENTER;
            }
        }
        if (event instanceof OnMouseExitEventListenerGVO) {
            if (ui instanceof HasAllMouseHandlers) {
                HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui;
                hasAllMouseHandlers
                        .addMouseOutHandler(EventFactory.createOnMouseExitListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_EXIT;
            }
        }
        if (event instanceof OnMouseMoveEventListenerGVO) {
            if (ui instanceof HasAllMouseHandlers) {
                HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui;
                hasAllMouseHandlers
                        .addMouseMoveHandler(EventFactory.createOnMouseMoveListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_MOVE;
            }
        }
        if (event instanceof OnMouseUpEventListenerGVO) {
            if (ui instanceof HasAllMouseHandlers) {
                HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui;
                hasAllMouseHandlers
                        .addMouseUpHandler(EventFactory.createOnMouseUpListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_UP;
            }
        }
        if (event instanceof OnMouseDownEventListenerGVO) {
            if (ui instanceof HasAllMouseHandlers) {
                HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui;
                hasAllMouseHandlers
                        .addMouseDownHandler(EventFactory.createOnMouseDownListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_DOWN;
            }
        }
        if (event instanceof OnKeyPressEventListenerGVO) {
            if (ui instanceof HasAllKeyHandlers) {
                HasAllKeyHandlers hasAllKeyHandlers = (HasAllKeyHandlers) ui;
                hasAllKeyHandlers
                        .addKeyPressHandler(EventFactory.createOnKeyPressListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONKEYPRESS;
            }
        }
        if (event instanceof OnKeyDownEventListenerGVO) {
            if (ui instanceof HasAllKeyHandlers) {
                HasAllKeyHandlers hasAllKeyHandlers = (HasAllKeyHandlers) ui;
                hasAllKeyHandlers
                        .addKeyDownHandler(EventFactory.createOnKeyDownListener(event, inputVariables));
            } else if (ui instanceof HasNativeKeyHandlers) {
                HasNativeKeyHandlers hasNativeKeyHandlers = (HasNativeKeyHandlers) ui;
                hasNativeKeyHandlers.addNativeKeyDownHandler(
                        EventFactory.createOnNativeKeyDownListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONKEYDOWN;
            }
        }
        if (event instanceof OnKeyUpEventListenerGVO) {
            if (ui instanceof HasAllKeyHandlers) {
                HasAllKeyHandlers hasAllKeyHandlers = (HasAllKeyHandlers) ui;
                hasAllKeyHandlers.addKeyUpHandler(EventFactory.createOnKeyUpListener(event, inputVariables));
            } else if (ui instanceof HasNativeKeyHandlers) {
                HasNativeKeyHandlers hasNativeKeyHandlers = (HasNativeKeyHandlers) ui;
                hasNativeKeyHandlers
                        .addNativeKeyUpHandler(EventFactory.createOnNativeKeyUpListener(event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONKEYUP;
            }
        }
        if (event instanceof OnLoadEventListenerGVO) {
            if (!(vo instanceof WindowGVO)) {
                nonHandledEventName = QAMLConstants.EVENT_ONLOAD;
                nonHandledEventMessage = "Support on Window only.";
            }
        }
        if (event instanceof OnUnLoadEventListenerGVO) {
            if (!(vo instanceof WindowGVO)) {
                nonHandledEventName = QAMLConstants.EVENT_ONUNLOAD;
                nonHandledEventMessage = "Support on Window only.";
            }
        }
        if (event instanceof OnFinishEventListenerGVO) {
            if (ui instanceof FormPanel) {
                FormPanel formPanel = (FormPanel) ui;
                formPanel.addSubmitCompleteHandler(
                        EventFactory.createSubmitCompleteHandler(ui, event, inputVariables));
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONFINISH;
            }
        }
        if (event instanceof OnTimerEventListenerGVO) {
            //check a timer is already scheduled for this event- this happens when there are multiple component reference mentioned in that event
            if (!ClientApplicationContext.getInstance().isTimerScheduledForEvent(appId, vo.getWindow(),
                    event.getEventId())) {
                OnTimerHandler timerHandler = new OnTimerHandler();
                timerHandler.processOnTimer(ui, vo, appId, event, inputVariables);
            } else {
                nonHandledEventName = QAMLConstants.EVENT_ONTIMER;
                nonHandledEventMessage = "Timer is already scheduled.";
            }
        }
        if (nonHandledEventName != null) {
            if (nonHandledEventMessage == null) {
                nonHandledEventMessage = "";
            }
            ClientApplicationContext.getInstance()
                    .log("The component [" + DOM.getElementAttribute(ui.getElement(), "id") + "] for event ["
                            + event.getEventId() + "] does not support " + nonHandledEventName + " listener. "
                            + nonHandledEventMessage, null);
        }
    }
}

From source file:com.qualogy.qafe.gwt.client.ui.renderer.TileListRenderer.java

License:Apache License

private void assignParent(UIObject uiObject, String parent) {
    DOM.setElementAttribute(uiObject.getElement(), "pc", parent);
    if (uiObject instanceof HasWidgets) {
        HasWidgets hasWidgets = (HasWidgets) uiObject;
        for (Widget widget : hasWidgets) {
            assignParent(widget, parent);
        }/*from  www  . j a  v  a2s.  c  o m*/
    }
}

From source file:com.qualogy.qafe.gwt.client.util.QEffects.java

License:Apache License

public static void fadeIn(final UIObject ui, final int delay, final int startIn) {
    final Effects a = $(ui.getElement()).as(Effects.Effects);
    new Timer() {

        @Override// w ww  .ja v  a2s. c o  m
        public void run() {
            $(ui.getElement()).fadeIn(delay, new Function() {
                public void f(Element e) {
                    //a.fadeIn();

                }
            });

        }

    }.schedule(startIn);
}

From source file:com.qualogy.qafe.gwt.client.util.QEffects.java

License:Apache License

public static void fadeOut(final UIObject ui, final int delay, final int startIn,
        final boolean visibleAfterFadingOut) {
    final Effects a = $(ui.getElement()).as(Effects.Effects);
    new Timer() {

        @Override//from w ww. ja  v  a  2  s.  co m
        public void run() {
            $(ui.getElement()).fadeOut(delay, new Function() {
                public void f(Element e) {
                    //a.fadeOut();
                    ui.setVisible(visibleAfterFadingOut);
                }
            });

        }

    }.schedule(startIn);
}

From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.ChangeStyleExecute.java

License:Apache License

public void execute(BuiltInFunctionGVO builtInFunction) {
    if (builtInFunction instanceof ChangeStyleGVO) {

        if (builtInFunction.getComponents() != null) {
            for (BuiltInComponentGVO builtInComponentGVO : builtInFunction.getComponents()) {

                String component = builtInComponentGVO.getComponentIdUUID();
                List<UIObject> uiObjects = null;
                if (component != null) {
                    uiObjects = RendererHelper.getComponent(component);
                } else {
                    uiObjects = RendererHelper.getNamedComponent(builtInComponentGVO.getComponentName());
                }//from  w  ww  .j  av a 2 s. co  m

                if (uiObjects == null) { // Components within a window are not found. Check for SDI.
                    if (!(ClientApplicationContext.getInstance().isMDI())) {
                        UIObject mainPanel = ClientApplicationContext.getInstance().getMainPanel().getWidget();
                        uiObjects = new ArrayList<UIObject>();
                        if (mainPanel != null) {
                            uiObjects.add(mainPanel);
                        }
                    }
                }
                if (uiObjects != null) {
                    for (UIObject object : uiObjects) {

                        if (object != null) {
                            if (object instanceof QWindowPanel) {
                                object = ((QWindowPanel) object).getQRootPanel();
                            }
                            Element element = object.getElement();
                            if (element != null) {
                                ChangeStyleGVO changeStyle = (ChangeStyleGVO) builtInFunction;
                                if (changeStyle.getActions() != null) {
                                    for (ChangeStyleActionGVO changeStyleAction : changeStyle.getActions()) {

                                        if ("remove".equalsIgnoreCase(changeStyleAction.getAction())) {
                                            if (changeStyleAction.getKey() != null) {
                                                if (changeStyleAction.getKey().trim().length() > 0) {
                                                    RendererHelper.setStyleForElement(element,
                                                            changeStyleAction.getKey(), null);
                                                }
                                            }
                                            if (changeStyleAction.getStyle() != null) {
                                                if (changeStyleAction.getStyle().trim().length() > 0) {
                                                    // UIObject uiObject =
                                                    // RendererHelper.getComponent(component);
                                                    object.removeStyleName(changeStyleAction.getStyle());
                                                }
                                            }

                                        } else if ("set".equalsIgnoreCase(changeStyleAction.getAction())) {

                                            if (changeStyleAction.getKey() != null) {
                                                if (changeStyleAction.getKey().trim().length() > 0) {

                                                    RendererHelper.setStyleForElement(element,
                                                            changeStyleAction.getKey(),
                                                            changeStyleAction.getValue());
                                                }
                                            }
                                            if (changeStyleAction.getStyle() != null) {
                                                if (changeStyleAction.getStyle().trim().length() > 0) {
                                                    // UIObject uiObject =
                                                    // RendererHelper.getComponent(component);
                                                    //object.addStyleName(changeStyleAction.getStyle());
                                                    object.setStyleName(changeStyleAction.getStyle());
                                                }
                                            }

                                        }

                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
    }
    FunctionsExecutor.setProcessedBuiltIn(true);

}

From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.SetPropertyExecute.java

License:Apache License

private void processProperty(UIObject uiObject, BuiltInComponentGVO builtInComponentGVO,
        SetPropertyGVO setProperty) {//from   ww w . j ava 2 s. c  o m
    if (QAMLConstants.PROPERTY_ENABLED.equals(setProperty.getProperty())
            || QAMLConstants.PROPERTY_DISABLED.equals(setProperty.getProperty())) {
        boolean value = Boolean.valueOf(setProperty.getValue()).booleanValue();
        if (QAMLConstants.PROPERTY_DISABLED.equals(setProperty.getProperty())) {
            value = !value;
        }
        if (uiObject instanceof HasEnabled) {
            HasEnabled hasEnabled = (HasEnabled) uiObject;
            hasEnabled.setEnabled(value);
        } else if (uiObject instanceof HasWidgets) {
            SetMaskHelper.setMaskEnable(uiObject.getElement().getAttribute(QAMLConstants.PROPERTY_ID), value,
                    true);
            DOM.setElementPropertyBoolean(uiObject.getElement(), QAMLConstants.PROPERTY_DISABLED, !value);
        } else if (uiObject instanceof QSuggestBox) {
            QSuggestBox suggestField = (QSuggestBox) uiObject;
            suggestField.getTextBox().setEnabled(value);
        } else if (uiObject instanceof SpreadsheetCell) {
            SpreadsheetCell cell = (SpreadsheetCell) uiObject;
            cell.setEditable(value);
        }
    } else if (QAMLConstants.PROPERTY_EDITABLE.equals(setProperty.getProperty())) {
        boolean editable = Boolean.valueOf(setProperty.getValue()).booleanValue();
        HasEditable hasEditable = null;
        if (uiObject instanceof HasEditable) {
            hasEditable = (HasEditable) uiObject;
        } else if (uiObject instanceof TextBoxBase) {
            TextBoxBase textboxBase = (TextBoxBase) uiObject;
            if (textboxBase.getParent() instanceof HasEditable) {
                hasEditable = (HasEditable) textboxBase.getParent();
            } else {
                textboxBase.setReadOnly(!editable);
            }
        }
        if (hasEditable != null) {
            hasEditable.setEditable(editable);
        }
    } else if (QAMLConstants.PROPERTY_VISIBLE.equals(setProperty.getProperty())) {
        boolean value = Boolean.valueOf(setProperty.getValue()).booleanValue();
        if (uiObject instanceof HasVisible) {
            ((HasVisible) uiObject).processVisible(value);
        } else if (uiObject instanceof HasDataGridMethods) {
            HasDataGridMethods hasDataGridMethods = (HasDataGridMethods) uiObject;
            boolean resolved = false;
            String uuid = builtInComponentGVO.getComponentIdUUID();
            if (uuid != null) {
                boolean containsColumn = uuid.contains(".");
                if (containsColumn) {
                    String columnId = uuid.replaceFirst(".+\\.", "").replaceFirst("\\|.+", "");
                    hasDataGridMethods.setColumnVisible(columnId, value);
                    resolved = true;
                }
            }
            if (!resolved) {
                uiObject.setVisible(value);
                hasDataGridMethods.redraw();
            }
        } else {
            uiObject.setVisible(value);
            if (uiObject instanceof Panel) {
                Panel p = (Panel) uiObject;
                Widget parent = p.getParent();
                if (parent != null && parent instanceof DeckPanel) {
                    DeckPanel deckPanel = (DeckPanel) parent;
                    int widgetIndex = deckPanel.getWidgetIndex(p);
                    if (widgetIndex != -1) {
                        if (deckPanel.getParent() != null && deckPanel.getParent().getParent() != null
                                && deckPanel.getParent().getParent() instanceof TabPanel) {
                            TabPanel tabs = ((TabPanel) (deckPanel.getParent().getParent()));
                            TabPanelRenderer.setTabVisibility(tabs, widgetIndex, value, uiObject);
                        }
                    }
                }
            }
        }
    } else if (QAMLConstants.PROPERTY_HEIGHT.equals(setProperty.getProperty())) {
        try {
            String height = setProperty.getValue();
            if (!QAMLUtil.containsUnitIdentifier(height)) {
                height += QAMLUtil.DEFAULT_UNIT;
            }
            uiObject.setHeight(height);
        } catch (Exception e) {
            ClientApplicationContext.getInstance().log("Set Property on height failed",
                    "Please check value of height (" + setProperty.getValue() + ")", true);
        }
    } else if (QAMLConstants.PROPERTY_WIDTH.equals(setProperty.getProperty())) {
        try {
            String width = setProperty.getValue();
            if (!QAMLUtil.containsUnitIdentifier(width)) {
                width += QAMLUtil.DEFAULT_UNIT;
            }
            uiObject.setWidth(width);
        } catch (Exception e) {
            ClientApplicationContext.getInstance().log("Set Property on width failed",
                    "Please check value of width (" + setProperty.getValue() + ")", true);
        }
    } else if (QAMLConstants.PROPERTY_TOOLTIP.equals(setProperty.getProperty())) {
        uiObject.setTitle(setProperty.getValue());
    } else if (QAMLConstants.PROPERTY_TITLE.equals(setProperty.getProperty())) {
        if (uiObject instanceof CaptionPanel) {
            CaptionPanel p = (CaptionPanel) uiObject;
            p.setCaptionText(setProperty.getValue());
        }
    } else if (QAMLConstants.PROPERTY_DISPLAYNAME.equals(setProperty.getProperty())) {
        if (uiObject instanceof HasDataGridMethods) {
            HasDataGridMethods hasDataGridMethods = (HasDataGridMethods) uiObject;
            String uuid = builtInComponentGVO.getComponentIdUUID();
            if (uuid != null) {
                boolean containsColumn = uuid.contains(".");
                if (containsColumn) {
                    String columnId = uuid.replaceFirst(".+\\.", "").replaceFirst("\\|.+", "");
                    String value = setProperty.getValue();
                    hasDataGridMethods.setColumnLabel(columnId, value);
                }
            }
        } else if (uiObject instanceof PushButton) {
            ((PushButton) uiObject).getUpFace().setText(setProperty.getValue());
            ((PushButton) uiObject).getDownFace().setText(setProperty.getValue());
        } else if (uiObject instanceof HasText) {
            HasText t = (HasText) uiObject;
            t.setText(setProperty.getValue());
        } else if (uiObject instanceof VerticalPanel) {
            VerticalPanel vp = (VerticalPanel) uiObject;
            Widget tabPanelWidget = vp.getParent().getParent().getParent();
            if (tabPanelWidget instanceof TabPanel) {
                TabPanel tp = (TabPanel) tabPanelWidget;
                TabBar tb = tp.getTabBar();
                int tabCount = tp.getWidgetCount();
                for (int i = 0; i < tabCount; i++) {
                    Widget w = tp.getWidget(i);
                    if (w == vp) {
                        tb.setTabText(i, setProperty.getValue());
                    }
                }
            }
        } else if (uiObject instanceof QWindowPanel) {
            QWindowPanel p = (QWindowPanel) uiObject;
            p.setCaption(setProperty.getValue());
        }
    } else if (QAMLConstants.PROPERTY_SELECTED_ROW.equals(setProperty.getProperty())) {
        if (uiObject instanceof HasDataGridMethods) {
            HasDataGridMethods hasDataGridMethods = (HasDataGridMethods) uiObject;
            try {
                int rowNr = Integer.parseInt(setProperty.getValue());
                hasDataGridMethods.selectRow(rowNr);
            } catch (Exception e) {
                ClientApplicationContext.getInstance()
                        .log("Set property on the datagrid selected row: the value (" + setProperty.getValue()
                                + ") cannot be translated into an integer", e);
            }
        }
    } else if (QAMLConstants.PROPERTY_SELECTED.equals(setProperty.getProperty())) {
        if (uiObject instanceof CheckBox) {
            boolean value = Boolean.valueOf(setProperty.getValue()).booleanValue();
            ((CheckBox) (uiObject)).setValue(value);
        } else if (uiObject instanceof ListBox) {
            ListBox listBox = (ListBox) uiObject;
            int size = listBox.getItemCount();
            boolean selected = false;
            for (int i = 0; i < size && !selected; i++) {
                if (listBox.getValue(i).equals(setProperty.getValue())) {
                    selected = true;
                    listBox.setSelectedIndex(i);
                }
            }
        }
    } else if (QAMLConstants.PROPERTY_CURRENT_PAGE.equals(setProperty.getProperty())) {
        if (uiObject instanceof HasDataGridMethods) {
            HasDataGridMethods dataGridSortableTable = (HasDataGridMethods) uiObject;
            try {
                if (setProperty.getValue() != null) {
                    dataGridSortableTable.setCurrentPage(Integer.parseInt(setProperty.getValue()));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    } else if (QAMLConstants.PROPERTY_PAGESIZE.equals(setProperty.getProperty())) {
        if (uiObject instanceof HasDataGridMethods) {
            HasDataGridMethods dataGridSortableTable = (HasDataGridMethods) uiObject;
            try {
                if (setProperty.getValue() != null) {
                    dataGridSortableTable.setPageSize(Integer.parseInt(setProperty.getValue()));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    } else if (QAMLConstants.PROPERTY_MAX_TICKS.equals(setProperty.getProperty())) {
        if (uiObject instanceof QSliderBar) {
            QSliderBar slider = (QSliderBar) uiObject;
            slider.setMaxValue(Double.valueOf(setProperty.getValue()));
        }
    } else if (QAMLConstants.PROPERTY_MIN_TICKS.equals(setProperty.getProperty())) {
        if (uiObject instanceof QSliderBar) {
            QSliderBar slider = (QSliderBar) uiObject;
            slider.setMinValue(Double.valueOf(setProperty.getValue()));
        }
    } else if (QAMLConstants.PROPERTY_TICKSIZE.equals(setProperty.getProperty())) {
        if (uiObject instanceof QSliderBar) {
            QSliderBar slider = (QSliderBar) uiObject;
            slider.setStepSize(Integer.valueOf(setProperty.getValue()));
        }
    } else if (QAMLConstants.PROPERTY_TICK_LABELS.equals(setProperty.getProperty())) {
        if (uiObject instanceof QSliderBar) {
            QSliderBar slider = (QSliderBar) uiObject;
            slider.setTickLabels(Integer.valueOf(setProperty.getValue()));
        }
    }
}

From source file:com.qualogy.qafe.gwt.client.vo.handlers.BuiltinHandlerHelper.java

License:Apache License

private static Object getDataGridValue(UIObject sender) {
    String id = DOM.getElementAttribute(sender.getElement(), "id");
    String row = id.substring(0,/*from  w  w w . j  a v a 2s.c o  m*/
            id.lastIndexOf(QAMLConstants.TOKEN_INDEXING) + QAMLConstants.TOKEN_INDEXING.length());
    row = row.replace(QAMLConstants.TOKEN_INDEXING, "");

    String datagridUUID = id
            .substring(id.lastIndexOf(QAMLConstants.TOKEN_INDEXING) + QAMLConstants.TOKEN_INDEXING.length());
    ;
    String postfix = datagridUUID.substring(datagridUUID.indexOf("|") + 1);
    String prefix = datagridUUID.substring(0, datagridUUID.indexOf("|"));
    if (prefix.contains(".")) {
        prefix = prefix.substring(0, prefix.indexOf("."));
    }
    DataContainerGVO dtc = null;
    List<UIObject> ui = ComponentRepository.getInstance().getComponent(prefix + "|" + postfix);
    if (ui != null) {
        for (UIObject u : ui) {
            if (u instanceof QPagingScrollTable) {
                QPagingScrollTable qps = (QPagingScrollTable) u;
                dtc = qps.getRowValue(Integer.valueOf(row));

            }
        }
    }

    return dtc;
}

From source file:com.qualogy.qafe.gwt.client.vo.handlers.BuiltinHandlerHelper.java

License:Apache License

private static boolean isDataGridField(UIObject uiObject) {
    String id = DOM.getElementAttribute(uiObject.getElement(), "id");
    return (id != null && id.startsWith(QAMLConstants.TOKEN_INDEXING));
}