List of usage examples for com.google.gwt.user.client.ui UIObject getStyleName
public String getStyleName()
From source file:com.dianaui.universal.core.client.ui.base.helper.StyleHelper.java
License:Apache License
public static boolean removeStyleNameStartsWith(final UIObject uiObject, final String prefix) { if (uiObject.getStyleName() == null || prefix == null) { return false; }//from ww w .ja v a2 s .com final String[] styles = uiObject.getStyleName().split("\\s"); boolean result = false; for (final String s : styles) { if (s.startsWith(prefix)) { uiObject.removeStyleName(s); result = true; } } return result; }
From source file:com.dianaui.universal.core.client.ui.base.mixin.ActiveMixin.java
License:Apache License
public static boolean isActive(final UIObject uiObject) { return StyleHelper.containsStyle(uiObject.getStyleName(), Styles.ACTIVE); }
From source file:com.dianaui.universal.core.client.ui.base.mixin.PullMixin.java
License:Apache License
public static Pull getPull(final UIObject uiObject) { return Pull.fromStyleName(uiObject.getStyleName()); }
From source file:com.facebook.tsdb.tsdash.client.ui.CssHelper.java
License:Apache License
public static void toggleClass(UIObject el, String cssClass) { if (el == null) { return;/* www . j a v a 2 s. c o m*/ } if (el.getStyleName().contains(cssClass)) { el.removeStyleName(cssClass); } else { el.addStyleName(cssClass); } }
From source file:com.facebook.tsdb.tsdash.client.ui.CssHelper.java
License:Apache License
public static void replaceClass(UIObject el, String cssClass, String replacement) { if (el == null) { return;//w ww . j a va 2 s .co m } if (el.getStyleName().contains(cssClass)) { el.removeStyleName(cssClass); } // add the replacement anyway el.addStyleName(replacement); }
From source file:com.facebook.tsdb.tsdash.client.ui.MetricWidget.java
License:Apache License
@Override public boolean isPressed(Object toggleButton) { if (toggleButton != rightAxis && toggleButton != rate) { return false; }/*from w w w. ja v a2s.c om*/ UIObject button = (UIObject) toggleButton; return button.getStyleName().contains(style.pressedToggleButton()); }
From source file:com.facebook.tsdb.tsdash.client.ui.MetricWidget.java
License:Apache License
@Override public void pressToggleButton(Object toggleButton, boolean pressed) { if (toggleButton != rightAxis && toggleButton != rate) { return;/*from w ww . j a v a 2 s. co m*/ } UIObject button = (UIObject) toggleButton; if (pressed && !button.getStyleName().contains(style.pressedToggleButton())) { button.addStyleName(style.pressedToggleButton()); } else if (!pressed && button.getStyleName().contains(style.pressedToggleButton())) { button.removeStyleName(style.pressedToggleButton()); } }
From source file:com.qualogy.qafe.gwt.client.ui.renderer.RendererHelper.java
License:Apache License
public static void addStyle(ComponentGVO vo, UIObject ui) { if (vo != null) { String styles = vo.getStyleClass(); if (styles != null && !ui.getStyleName().contains(styles)) { ui.addStyleName(styles);/* w w w . j a v a 2 s .c om*/ } if (ui != null) { setStyleForElement(ui.getElement(), vo.getStyleProperties()); } } }
From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.SetValueExecute.java
License:Apache License
public static void processValue(UIObject uiObject, Object valueToSet, SetValueGVO setValue, DataContainerGVO valueDTC) {//from w w w. j a v a 2s. com if (uiObject != null) { if (uiObject instanceof HasText) { if (uiObject instanceof QRadioButton) { QRadioButton qRadioButton = (QRadioButton) uiObject; qRadioButton.reset(); if (valueToSet != null) { qRadioButton.setValue(valueToSet.toString()); } } else if (uiObject instanceof CheckBox) { CheckBox checkBox = (CheckBox) uiObject; String checkedValue = DOM.getElementAttribute(checkBox.getElement(), CheckBoxGVO.CHECKED_VALUE_ATTRIBUTE_TAG); String unCheckedValue = DOM.getElementAttribute(checkBox.getElement(), CheckBoxGVO.UNCHECKED_VALUE_ATTRIBUTE_TAG); String checkedValueDomain = DOM.getElementAttribute(checkBox.getElement(), CheckBoxGVO.CHECKED_VALUE_DOMAIN_ATTRIBUTE_TAG); String unCheckedValueDomain = DOM.getElementAttribute(checkBox.getElement(), CheckBoxGVO.UNCHECKED_VALUE_DOMAIN_ATTRIBUTE_TAG); if (valueToSet != null) { if (checkedValue != null && checkedValue.equals(valueToSet)) { checkBox.setChecked(true); } else if (unCheckedValue != null && unCheckedValue.equals(valueToSet)) { checkBox.setChecked(false); } else if (isInDomain(valueToSet.toString(), checkedValueDomain)) { checkBox.setChecked(true); } else if (isInDomain(valueToSet.toString(), unCheckedValueDomain)) { checkBox.setChecked(false); } } else { checkBox.setChecked(false); } } else if (uiObject instanceof HTML) { HTML html = (HTML) uiObject; if (valueToSet != null) { html.setHTML(valueToSet.toString()); } else { html.setHTML(""); } } else if (uiObject instanceof PushButton) { ((PushButton) uiObject).getUpFace().setText(valueToSet.toString()); ((PushButton) uiObject).getDownFace().setText(valueToSet.toString()); } else if (uiObject instanceof RichTextArea) { RichTextArea richTextArea = (RichTextArea) uiObject; richTextArea.setHTML(valueToSet.toString()); } else { HasText hasText = (HasText) uiObject; if (valueDTC != null) { if (valueDTC.getKind() == DataContainerGVO.KIND_STRING) { if (valueDTC.getStringDataType() == DataContainerGVO.TYPE_DATE) { if (uiObject instanceof QDatePicker) { ((QDatePicker) uiObject).setValue(valueDTC.getDateData()); } } else { hasText.setText(valueToSet.toString()); uiObject.setStyleName(uiObject.getStyleName().replaceAll("qafe_invalid_field", "qafe_valid_field")); } } else { hasText.setText(valueToSet.toString()); } } else if (valueToSet != null) { hasText.setText(valueToSet.toString()); } else { hasText.setText(""); } } } else if (uiObject instanceof Frame) { Frame frame = (Frame) uiObject; if (valueToSet != null) { frame.setUrl(valueToSet.toString()); } else { frame.setUrl(""); } } if (uiObject instanceof ListBox) { ListBox listBox = (ListBox) uiObject; // If it is needed to populate data and select a data from dropdown it should be seperate calls. if (valueDTC != null && valueDTC.getListofDC() != null) { processListBox(setValue, uiObject, valueDTC); } else { processValue4ListBox(listBox, valueToSet, setValue.getAction()); } } if (uiObject instanceof Image) { Image image = (Image) uiObject; if (valueToSet != null) { image.setUrl(valueToSet.toString()); } } if (uiObject instanceof QDatePicker) { QDatePicker qDatePicker = (QDatePicker) uiObject; if (valueDTC != null) { qDatePicker.setValue(valueDTC.getDateData(), true); } } if (uiObject instanceof QSliderBar) { QSliderBar slider = (QSliderBar) uiObject; slider.setValue(valueToSet); } if (uiObject instanceof HasDataGridMethods) { HasDataGridMethods dataGrid = (HasDataGridMethods) uiObject; List<DataContainerGVO> listOfDataMap = new ArrayList<DataContainerGVO>(); if (valueDTC.getKind() == DataContainerGVO.KIND_MAP) { listOfDataMap.add(new DataContainerGVO(valueDTC.getDataMap())); dataGrid.insertData(listOfDataMap, false, setValue.getSenderId(), setValue.getListenerType()); } else if (valueDTC.getKind() == DataContainerGVO.KIND_COLLECTION) { listOfDataMap = valueDTC.getListofDC(); dataGrid.insertData(listOfDataMap, false, setValue.getSenderId(), setValue.getListenerType()); } else if (valueDTC.getKind() == DataContainerGVO.KIND_STRING) { String cellOnRowToSet = setValue.getComponentId(); listOfDataMap.add(new DataContainerGVO(valueDTC.getDataString())); dataGrid.setDataToCell(new DataContainerGVO(valueDTC.getDataString()), false, setValue.getSenderId(), cellOnRowToSet); } dataGrid.redraw(); } } }
From source file:com.qualogy.qafe.gwt.client.vo.handlers.SetValueHandler.java
License:Apache License
private void processValue(UIObject uiObject, Object value, SetValueGVO setValueGVO, DataContainerGVO dataContainerGVO) { if (uiObject != null) { if (uiObject instanceof HasText) { if (uiObject instanceof QRadioButton) { QRadioButton qRadioButton = (QRadioButton) uiObject; qRadioButton.reset();/* w ww .j av a2 s. c o m*/ if (value != null) { qRadioButton.setValue(value.toString()); } } else if (uiObject instanceof CheckBox) { CheckBox checkBox = (CheckBox) uiObject; String checkedValue = DOM.getElementAttribute(checkBox.getElement(), CheckBoxGVO.CHECKED_VALUE_ATTRIBUTE_TAG); String unCheckedValue = DOM.getElementAttribute(checkBox.getElement(), CheckBoxGVO.UNCHECKED_VALUE_ATTRIBUTE_TAG); String checkedValueDomain = DOM.getElementAttribute(checkBox.getElement(), CheckBoxGVO.CHECKED_VALUE_DOMAIN_ATTRIBUTE_TAG); String unCheckedValueDomain = DOM.getElementAttribute(checkBox.getElement(), CheckBoxGVO.UNCHECKED_VALUE_DOMAIN_ATTRIBUTE_TAG); if (value != null) { if (checkedValue != null && checkedValue.equals(value)) { checkBox.setChecked(true); } else if (unCheckedValue != null && unCheckedValue.equals(value)) { checkBox.setChecked(false); } else if (isInDomain(value.toString(), checkedValueDomain)) { checkBox.setChecked(true); } else if (isInDomain(value.toString(), unCheckedValueDomain)) { checkBox.setChecked(false); } } else { checkBox.setChecked(false); } } else if (uiObject instanceof HTML) { HTML html = (HTML) uiObject; if (value != null) { html.setHTML(value.toString()); } else { html.setHTML(""); } } else if (uiObject instanceof PushButton) { ((PushButton) uiObject).getUpFace().setText(value.toString()); ((PushButton) uiObject).getDownFace().setText(value.toString()); } else if (uiObject instanceof RichTextArea) { RichTextArea richTextArea = (RichTextArea) uiObject; richTextArea.setHTML(value.toString()); } else { HasText hasText = (HasText) uiObject; if (dataContainerGVO != null) { if (dataContainerGVO.getKind() == DataContainerGVO.KIND_STRING) { if (dataContainerGVO.getStringDataType() == DataContainerGVO.TYPE_DATE) { if (uiObject instanceof QDatePicker) { ((QDatePicker) uiObject).setValue(dataContainerGVO.getDateData()); } } else { hasText.setText(value.toString()); uiObject.setStyleName(uiObject.getStyleName().replaceAll("qafe_invalid_field", "qafe_valid_field")); } } else { hasText.setText(value.toString()); } } else if (value != null) { hasText.setText(value.toString()); } else { hasText.setText(""); } } } else if (uiObject instanceof Frame) { Frame frame = (Frame) uiObject; if (value != null) { frame.setUrl(value.toString()); } else { frame.setUrl(""); } } if (uiObject instanceof ListBox) { ListBox listBox = (ListBox) uiObject; // If it is needed to populate data and select a data from dropdown it should be seperate calls. if (dataContainerGVO != null && dataContainerGVO.getListofDC() != null) { processListBox(uiObject, setValueGVO, dataContainerGVO); } else { processValue4ListBox(listBox, value, setValueGVO.getAction()); } } if (uiObject instanceof Image) { Image image = (Image) uiObject; if (value != null) { image.setUrl(value.toString()); } } if (uiObject instanceof QDatePicker) { QDatePicker qDatePicker = (QDatePicker) uiObject; if (dataContainerGVO != null) { qDatePicker.setValue(dataContainerGVO.getDateData(), true); } } if (uiObject instanceof QSliderBar) { QSliderBar slider = (QSliderBar) uiObject; slider.setValue(value); } if (uiObject instanceof HasDataGridMethods) { HasDataGridMethods dataGrid = (HasDataGridMethods) uiObject; List<DataContainerGVO> listOfDataMap = new ArrayList<DataContainerGVO>(); if (dataContainerGVO.getKind() == DataContainerGVO.KIND_MAP) { listOfDataMap.add(new DataContainerGVO(dataContainerGVO.getDataMap())); dataGrid.insertData(listOfDataMap, false, setValueGVO.getSenderId(), setValueGVO.getListenerType()); } else if (dataContainerGVO.getKind() == DataContainerGVO.KIND_COLLECTION) { listOfDataMap = dataContainerGVO.getListofDC(); dataGrid.insertData(listOfDataMap, false, setValueGVO.getSenderId(), setValueGVO.getListenerType()); } else if (dataContainerGVO.getKind() == DataContainerGVO.KIND_STRING) { String cellOnRowToSet = setValueGVO.getComponentId(); listOfDataMap.add(new DataContainerGVO(dataContainerGVO.getDataString())); dataGrid.setDataToCell(new DataContainerGVO(dataContainerGVO.getDataString()), false, setValueGVO.getSenderId(), cellOnRowToSet); } dataGrid.redraw(); } } }