List of usage examples for com.google.gwt.user.client.ui UIObject getElement
public Element getElement()
From source file:com.qualogy.qafe.mgwt.client.ui.renderer.AbstractTextComponentRenderer.java
License:Apache License
protected void preInit(ComponentGVO component, UIObject widget, String uuid, String parent, String context, AbstractActivity activity) {//from w w w . j a v a 2 s . co m if (widget == null) { return; } // TODO use css widget.getElement().setAttribute("style", "margin: 5px; padding: 1px; border-radius: 4px; border: 1px solid #ABADB0"); }
From source file:com.qualogy.qafe.mgwt.client.ui.renderer.events.CallbackHandler.java
License:Apache License
final public static void createCallBack(final UIObject sender, final String listenerType, final EventListenerGVO eventGVO, List<InputVariableGVO> listOfInputVariables, Map<String, Object> internalVariables, Map<String, String> mouseInfo) { if (eventGVO != null) { String senderUUID = DOM.getElementProperty(sender.getElement(), "uuid"); String senderId = DOM.getElementAttribute(sender.getElement(), "id"); if (senderId != null && senderId.length() > 0) { String context = RendererHelper.getComponentContext(sender); String parent = RendererHelper.getParentComponent(sender); String senderName = RendererHelper.getNamedComponentName(sender); ClientApplicationContext.getInstance().setBusy(true); AsyncCallback<?> callback = createCallBack(listenerType); EventDataGVO eventDataObject = new EventDataGVO(); eventDataObject.setUuid(senderUUID); eventDataObject.setEventId(eventGVO.getEventId()); eventDataObject.setListenerType(listenerType); eventDataObject.setSenderName(senderName); eventDataObject.setUserUID(ClientApplicationContext.getInstance().getAppUUID()); eventDataObject.setWindowSession(ClientApplicationContext.getInstance().getWindowSession()); eventDataObject.setInternalVariables(internalVariables); eventDataObject.setParameters(ClientApplicationContext.getInstance().getParameters()); eventDataObject.setSender(senderId); eventDataObject.setOriginalSenderId(senderId); // unmanipulated Mouse Coordinates if (senderId.startsWith("#")) { eventDataObject/*from ww w. j a va 2 s.c o m*/ .setIndex(senderId.substring(senderId.indexOf("#") + 1, senderId.lastIndexOf("#"))); } if (mouseInfo != null) { eventDataObject.setMouseCoordinates(mouseInfo.get(EventDataI.MOUSE_X), mouseInfo.get(EventDataI.MOUSE_Y)); } // sender id eventDataObject.setParent(parent); if (eventGVO.getSourceId() != null) { eventDataObject.setSourceId(eventGVO.getSourceId()); if (!senderId.startsWith("||") && !senderId.startsWith("#")) { if (senderId.indexOf('|') > 0) { eventDataObject.setSourceIdValue(senderId.substring(0, senderId.indexOf('|'))); } } } if (eventGVO.getSourceName() != null) { eventDataObject.setSourceName(eventGVO.getSourceName()); if (RendererHelper.isNamedComponent(sender)) { eventDataObject.setSourceNameValue(RendererHelper.getNamedComponentName(sender)); } } if (eventGVO.getSourceValue() != null) { eventDataObject.setSourceValue(eventGVO.getSourceValue()); Object o = getValue(sender, sender, eventDataObject, true); if (o instanceof String) { eventDataObject.setSourceValueValue(o.toString()); } } if (eventGVO.getSourceListenerType() != null) { eventDataObject.setSourceListenerType(eventGVO.getSourceListenerType()); eventDataObject.setSourceListenerTypeValue(listenerType); } if (senderId.startsWith("||")) { // so this is a click from a table{ eventDataObject.setSender(senderId.substring(senderId.lastIndexOf("||") + 2)); } else if (senderId.startsWith("#")) { // so this is a click from a tile or an inner component in datagrid eventDataObject.setSender(senderId.substring(senderId.lastIndexOf("#") + 1)); } boolean error = false; List<InputVariableGVO> obsoleteInputVariables = new ArrayList<InputVariableGVO>(); if (listOfInputVariables != null) { try { for (InputVariableGVO inputVariables : listOfInputVariables) { String uuid = DOM.getElementProperty(sender.getElement(), "uuid"); String value = ""; DataContainerGVO dataContainerObject = null; String inputVariableReference = inputVariables.getReference(); if (hasAttribute(inputVariableReference)) { value = getAttributeValue(inputVariableReference, uuid, parent, context); } else if (inputVariableReference.contains(".$$")) { dataContainerObject = fetchDatagridRowValues(inputVariableReference, uuid, parent, context); } else { String key = RendererHelper.generateId(inputVariableReference, parent, context); // inputVariables[i][1] ClientApplicationContext.getInstance().log(key); List<UIObject> uiObjects = ComponentRepository.getInstance().getComponent(key); // since the parameter can be a complex object, we need to create a substitute for it. // This can only be used in the name variant though (namedcomponents) if (uiObjects != null) { for (UIObject uiObject : uiObjects) { value = null; Object o = getValue(uiObject, sender, eventDataObject, false); if (o instanceof String) { value = o.toString(); } else if (o instanceof DataContainerGVO) { dataContainerObject = (DataContainerGVO) o; } if (uiObject instanceof HasDataModel) { // Get also the data model behind HasDataModel hasDataModel = (HasDataModel) uiObject; if (hasDataModel.getDataModel() != null) { Object dataModel = hasDataModel.getDataModel(); String newInputVariableReference = inputVariableReference + QAMLConstants.DATAMODEL_POSTFIX; if (eventDataObject.getInternalVariables() == null) { eventDataObject .setInternalVariables(new HashMap<String, Object>()); } eventDataObject.getInternalVariables() .put(newInputVariableReference, dataModel); } } } } else { // so the object could not be found in the ComponentRepository, maybe we try by name to find it. ClientApplicationContext.getInstance() .log("Reference" + inputVariables.getReference()); String[] keysSet = inputVariables.getReference().split("[.]"); if (keysSet != null) { String searchKey = null; if (keysSet.length == 1) {// so only the key searchKey = key; } else { searchKey = RendererHelper.generateId(keysSet[0], parent, context); } if (searchKey != null) { uiObjects = ComponentRepository.getInstance() .getNamedComponent(searchKey); if (uiObjects != null) { for (UIObject uiObject : uiObjects) { // Collect all the data from a list of named components DataContainerGVO dataContainer = createDataContainer( inputVariables.getReference(), uiObject, sender, eventDataObject); if (dataContainerObject == null) { dataContainerObject = dataContainer; } else if (dataContainer != null) { if (dataContainer.getKind() == dataContainerObject .getKind()) { switch (dataContainer.getKind()) { case DataContainerGVO.KIND_MAP: { dataContainerObject.getDataMap() .putAll(dataContainer.getDataMap()); } break; } } } // Get value of a data member if (keysSet.length > 1) { if (dataContainerObject.getDataMap() .get(keysSet[1]) != null) { value = dataContainerObject.getDataMap().get(keysSet[1]) .getDataString(); } dataContainerObject = null; } } } else { // Apparently we have to search for the Group now. uiObjects = ComponentRepository.getInstance() .getGroupedComponent(key); if (uiObjects != null) { DataContainerGVO dataContainer = new DataContainerGVO(); dataContainer.setParameterName(inputVariables.getReference()); dataContainer.setKind(DataContainerGVO.KIND_MAP); DataMap dataMap = new DataMap(); dataContainer.setDataMap(dataMap); for (UIObject uiObject : uiObjects) { // Collect all the data from a list of named components fillDataContainerMapForGroup(dataMap, inputVariables.getReference(), uiObject, sender, eventDataObject); } dataContainerObject = dataContainer; } } } } } } String x = inputVariables.getComponentValue() != null ? inputVariables.getComponentValue() : value; if ((inputVariableReference != null) && inputVariableReference.startsWith("||")) { // so this is a click from a table inputVariableReference = (inputVariables.getReference() .substring(senderId.lastIndexOf("||") + 2)); } eventDataObject.getInputVariables() .add(new InputVariableGVO(inputVariables.getName(), inputVariableReference, inputVariables.getDefaultValue(), x, dataContainerObject)); } } catch (RequiredFieldException e) { ClientApplicationContext.getInstance().log("Required field not filled in: ", e.getMessage(), true, true, e); error = true; } catch (RequiredFieldMissingException e) { ClientApplicationContext.getInstance().log("Required field not filled in: ", e.getMessage(), true, true, e); error = true; } catch (TypeValidationException e) { ClientApplicationContext.getInstance().log("Validation Error: ", e.getMessage(), true, true, e); error = true; } } if (!error) { service.executeEvent(EnrichEventUtil.enrichEvent(eventDataObject), callback); } } else { ClientApplicationContext.getInstance() .log("Callbackhander: Trying to call event while id is empty !!"); } } else { ClientApplicationContext.getInstance().log("Callbackhander: eventGVO cannot be null !!"); } }
From source file:com.qualogy.qafe.mgwt.client.ui.renderer.events.CallbackHandler.java
License:Apache License
private static Object getDataGridValue(UIObject uiObject, UIObject sender, EventDataGVO eventDataObject) { String id = DOM.getElementAttribute(sender.getElement(), "id"); String row = id.substring(0, id.lastIndexOf("||") + 2); row = row.replace("||", ""); String datagridUUID = id.substring(id.lastIndexOf("||") + 2); ;//from w w w .j a va 2s.com 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.mgwt.client.ui.renderer.events.CallbackHandler.java
License:Apache License
private static boolean isDataGridField(UIObject uiObject) { String id = DOM.getElementAttribute(uiObject.getElement(), "id"); return (id != null && id.startsWith("||")); }
From source file:com.qualogy.qafe.mgwt.client.ui.renderer.RendererHelper.java
License:Apache License
public static Element getElement(UIObject uiObject) { if (uiObject != null) { // if(uiObject instanceof LabeledTextFieldWidget ) { // UIObject textBox = ((LabeledTextFieldWidget) uiObject).getTextbox(); // if(textBox != null) { // return ((LabeledTextFieldWidget) uiObject).getTextbox().getElement(); // } // } else if(uiObject instanceof LabeledPasswordFieldWidget ) { // return ((LabeledPasswordFieldWidget) uiObject).getDataComponent().getElement(); // } return uiObject.getElement(); }/*from w w w .jav a 2s . c o m*/ return null; }
From source file:com.sencha.gxt.core.client.dom.DefaultScrollSupport.java
License:sencha.com license
@Override public void ensureVisible(UIObject item) { Element element = item.getElement(); ensureVisibleImpl(scrollElement, element); }
From source file:com.square.client.gwt.client.composant.onglet.scroll.ExtendedScrollPanel.java
License:Open Source License
/** * Ensures that the specified item is visible, by adjusting the panel's scroll position. * @param item the item whose visibility is to be ensured *//* w w w . j av a 2 s . c o m*/ public void ensureVisible(UIObject item) { final Element scroll = scrollPanel.getElement(); final Element element = item.getElement(); ensureVisibleImpl(scroll, element); }
From source file:com.totsp.gwittir.client.fx.rebind.OpacitySetter.java
License:Open Source License
/** * Gets the current opacity value./*from www .ja va 2s.c o m*/ * @param o UIObject to inspect. * @return The current opacity between 0.0 and 1.0 */ public Double getOpacity(UIObject o) { String str = DOM.getStyleAttribute(o.getElement(), "opacity"); if ((str == null) || (str.length() == 0)) { return new Double(1.0); } else { return Double.valueOf(str); } }
From source file:com.totsp.gwittir.client.fx.rebind.OpacitySetter.java
License:Open Source License
/** * Sets the opactiy./*from w w w.j a v a2 s .c o m*/ * @param o The UIObject to set. * @param opacity The new opacity between 0.0 and 1.0 */ public void setOpacity(UIObject o, Double opacity) { if (opacity != null) { DOM.setStyleAttribute(o.getElement(), "opacity", opacity.toString()); } else { DOM.setStyleAttribute(o.getElement(), "opacity", "inherit"); } }
From source file:com.totsp.gwittir.client.fx.rebind.OpacitySetterIE6.java
License:Open Source License
/** * Gets the current opacity value.//w w w. j a v a 2 s. com * @param o UIObject to inspect. * @return The current opacity between 0.0 and 1.0 */ public Double getOpacity(UIObject o) { String str = DOM.getStyleAttribute(o.getElement(), FILTER_STYLE_NAME); str = parseOrReplace(str, null); if ((str == null) || (str.length() == 0)) { return new Double(1.0); } else { return new Double(Double.parseDouble(str) / 100D); } }