List of usage examples for com.google.gwt.user.client Element getPropertyString
@Override
public String getPropertyString(String name)
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.GroupScreen.java
License:Apache License
/** * display Renders the Utility screen using appropriate templates and sets up handlers */// w w w .j av a 2 s .co m public void display() { PageAssembler.ready(new HTML(Russel.htmlTemplates.getGroupManagementPanel().getText())); PageAssembler.buildContents(); DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active"); DOM.getElementById("r-menuProjects").getParentElement().removeClassName("active"); DOM.getElementById("r-menuWorkspace").getParentElement().removeClassName("active"); PageAssembler.attachHandler("groupPermission", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new PermissionScreen(PermissionScreen.TYPE_GROUP, DOM.getElementById("groupSelect").getPropertyString("value")), false); } }); PageAssembler.attachHandler("groupUser", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new UserScreen(), true); } }); PageAssembler.attachHandler("groupSelect", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { fillGroupDetails(DOM.getElementById("groupSelect").getPropertyString("value")); } }); RusselApi.getGroups(new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { JSONArray jsonArray = esbPacket.getArray("obj"); for (int i = 0; i < jsonArray.size(); i++) { makeOption(jsonArray.get(i).isString().stringValue(), "groupSelect"); } if (jsonArray.size() > 0) fillGroupDetails(jsonArray.get(0).isString().stringValue()); } @Override public void onFailure(Throwable caught) { } }); PageAssembler.attachHandler("groupCreate", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { PageAssembler.openPopup("createGroupModal"); } }); PageAssembler.attachHandler("groupDelete", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { deleteGroup(DOM.getElementById("groupSelect").getPropertyString("value")); } }); PageAssembler.attachHandler("modalCreateCancel", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { DOM.getElementById("newGroupname").setPropertyString("value", ""); PageAssembler.closePopup("createGroupModal"); } }); PageAssembler.attachHandler("modalCreateGroup", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { createGroup(DOM.getElementById("newGroupname").getPropertyString("value")); PageAssembler.closePopup("createGroupModal"); DOM.getElementById("newGroupname").setPropertyString("value", ""); } }); PageAssembler.attachHandler("addMembers", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Element e = DOM.getElementById("userList"); JsArray entities = (JsArray) e.getPropertyObject("selectedOptions"); for (int i = 0; i < entities.length(); i++) { final Element a = (Element) entities.get(i); RusselApi.addGroupMemberUser(a.getPropertyString("value"), DOM.getElementById("groupSelect").getPropertyString("value"), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(ESBPacket esbPacket) { makeOption(a.getPropertyString("value"), "memberUserSelect"); } }); } int size = entities.length(); for (int i = 0; i < size; i++) ((Element) entities.get(0)).removeFromParent(); e = DOM.getElementById("groupList"); entities = (JsArray) e.getPropertyObject("selectedOptions"); for (int i = 0; i < entities.length(); i++) { final Element a = (Element) entities.get(i); RusselApi.addGroupMemberGroup(a.getPropertyString("value"), DOM.getElementById("groupSelect").getPropertyString("value"), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(ESBPacket esbPacket) { makeOption(a.getPropertyString("value"), "memberGroupSelect"); } }); } size = entities.length(); for (int i = 0; i < size; i++) ((Element) entities.get(0)).removeFromParent(); } }); PageAssembler.attachHandler("removeMembers", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Element e = DOM.getElementById("memberUserSelect"); JsArray entities = (JsArray) e.getPropertyObject("selectedOptions"); for (int i = 0; i < entities.length(); i++) { final Element a = (Element) entities.get(i); RusselApi.removeGroupMemberUser(a.getPropertyString("value"), DOM.getElementById("groupSelect").getPropertyString("value"), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(ESBPacket esbPacket) { makeOption(a.getPropertyString("value"), "userList"); } }); } int size = entities.length(); for (int i = 0; i < size; i++) ((Element) entities.get(0)).removeFromParent(); e = DOM.getElementById("memberGroupSelect"); entities = (JsArray) e.getPropertyObject("selectedOptions"); for (int i = 0; i < entities.length(); i++) { final Element a = (Element) entities.get(i); RusselApi.removeGroupMemberGroup(a.getPropertyString("value"), DOM.getElementById("groupSelect").getPropertyString("value"), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(ESBPacket esbPacket) { makeOption(a.getPropertyString("value"), "groupList"); } }); } size = entities.length(); for (int i = 0; i < size; i++) ((Element) entities.get(0)).removeFromParent(); } }); }
From source file:com.extjs.gxt.ui.client.widget.Component.java
License:sencha.com license
/** * Components delegate event handling to * {@link #onComponentEvent(ComponentEvent)}. Subclasses should not override. * /*from w ww . j a v a 2 s . c o m*/ * @param event the dom event */ public void onBrowserEvent(Event event) { if (disabled || disableEvents || disableBrowserEvents) { return; } int type = DOM.eventGetType(event); Element eventTarget = null; if (swallowEvents != null) { if (eventTarget == null) { eventTarget = (Element) event.getEventTarget().cast(); } for (SwallowEvent e : swallowEvents) { if (e.getEventType().getEventCode() == type && e.getElement().isOrHasChild(eventTarget)) { event.stopPropagation(); if (e.isPreventDefault()) { event.preventDefault(); } } } } // hack to receive keyboard events in safari if (GXT.isWebKit && focusable && type == Event.ONCLICK) { if (eventTarget == null) { eventTarget = (Element) event.getEventTarget().cast(); } if ("input".equalsIgnoreCase(getElement().getTagName()) || eventTarget.getPropertyString("__eventBits") == null) { focus(); } } ComponentEvent ce = createComponentEvent(event); ce.setEvent(event); // browser event listeners can cancel event if (!fireEvent(Events.BrowserEvent, ce)) { return; } EventType eventType = Events.lookupBrowserEvent(type); ce.setType(eventType); if (type == Event.ONCONTEXTMENU) { if (disableContextMenu) { event.preventDefault(); } onRightClick(ce); } // specialized support for mouse overs if (overElements != null && (type == Event.ONMOUSEOVER || type == Event.ONMOUSEOUT)) { Element target = ce.getTarget(); if (target != null) { String style = overElements.get(target.getId()); if (style != null) { fly(target).setStyleName(style, type == Event.ONMOUSEOVER); } } } onComponentEvent(ce); fireEvent(eventType, ce); DomEvent.fireNativeEvent(event, this, getElement()); }
From source file:com.extjs.gxt.ui.client.widget.ListView.java
License:sencha.com license
/** * Returns the index of the element./*from w ww. j a v a 2 s . co m*/ * * @param element the element * @return the index */ public int indexOf(Element element) { if (element.getPropertyString("viewIndex") != null) { return element.getPropertyInt("viewIndex"); } return all.indexOf(element); }
From source file:com.qualogy.qafe.mgwt.client.ui.renderer.AbstractEditableComponentRenderer.java
License:Apache License
private void resetInlineStyle(Element element) { if (element == null) { return;/*from w ww . j a va 2 s .co m*/ } String inlineStyleInit = element.getPropertyString(QAMLConstants.INTERNAL_STYLE_INIT); if ((inlineStyleInit == null) || (inlineStyleInit.length() == 0)) { inlineStyleInit = QAMLConstants.INTERNAL_EMPTY; if (element.hasAttribute(QAMLConstants.INTERNAL_STYLE)) { inlineStyleInit = element.getAttribute(QAMLConstants.INTERNAL_STYLE); } element.setPropertyString(QAMLConstants.INTERNAL_STYLE_INIT, inlineStyleInit); } else { if (QAMLConstants.INTERNAL_EMPTY.equals(inlineStyleInit)) { inlineStyleInit = ""; } element.setAttribute(QAMLConstants.INTERNAL_STYLE, inlineStyleInit); } }
From source file:edu.caltech.ipac.firefly.ui.table.BasicPagingTable.java
@Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEUP: if (DOM.eventGetButton(event) != Event.BUTTON_LEFT) { return; }//from w w w.ja v a2 s.co m // Get the actual column index Element cellElem = this.getHeaderTable().getEventTargetCell(event); if (cellElem != null) { // Check the colSpan String t = cellElem.getPropertyString("type"); if (t != null && (t.equals("units") || t.equals("filter"))) { return; } } } super.onBrowserEvent(event); }