List of usage examples for com.google.gwt.user.client Element getId
@Override
public String getId()
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.EPSSScreen.java
License:Apache License
/** * addAssetTrigger Adds the currently active asset to the project section and changes the Update button to unsaved state *//*from www. j a v a2 s . c om*/ public void addAssetToProject(RUSSELFileRecord r) { Element td = DOM.createTD(); int prefix = DOM.getElementById("epssCurrentSection").getChildCount() - 2; PageAssembler.merge("epssCurrentSection", "x", td); td.setId(prefix + "-assetNote"); assetSearchHandler.buildTile(r, SearchHandler.TYPE_PROJECT_ASSET, td.getId()).fillTile(null); DOM.getElementById("epssUpdate").removeClassName("white"); DOM.getElementById("epssUpdate").addClassName("blue"); DOM.getElementById("r-save-alert").removeClassName("hide"); currentProject.addAsset(activeSection, r); DOM.getElementById("section" + activeSection).removeClassName("empty"); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.EPSSScreen.java
License:Apache License
/** * fillSectionNotes0 Retrieves section notes and search terms * @param elementId String/*from w w w . j a va2 s.c o m*/ * @param sectionIndex int */ private void fillSectionNotes0(final String elementId, final int sectionIndex) { ((TextBox) PageAssembler.elementToWidget("inputSectionNotes", PageAssembler.TEXT)).setText(""); ((TextBox) PageAssembler.elementToWidget("inputDevNotes", PageAssembler.TEXT)).setText(""); String sectionPanel = "epssCurrentSection"; Element currentSection = DOM.getElementById(sectionPanel); searchTerms = new Vector<String>(); int elementCount = currentSection.getChildCount(); for (int elementIndex = 0; elementIndex < elementCount; elementIndex++) currentSection.getChild(0).removeFromParent(); mergeSection0(currentSection, (Element) new HTML(Russel.htmlTemplates.getEPSSEditSectionWidgets().getText()).getElement()); activeSection = sectionIndex; PageAssembler.attachHandler("sectionTool2", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { generateQuery(); } }); PageAssembler.attachHandler("inputSectionNotes", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { currentProject.setSectionNotes(activeSection, ((TextBox) PageAssembler.elementToWidget("inputSectionNotes", PageAssembler.TEXT)) .getText()); DOM.getElementById("epssUpdate").removeClassName("white"); DOM.getElementById("epssUpdate").addClassName("blue"); DOM.getElementById("r-save-alert").removeClassName("hide"); DOM.getElementById(elementId).removeClassName("empty"); } }); PageAssembler.attachHandler("inputDevNotes", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { currentProject.addAssetText(activeSection, activeAsset, ((TextBox) PageAssembler.elementToWidget("inputDevNotes", PageAssembler.TEXT)).getText()); DOM.getElementById("epssUpdate").removeClassName("white"); DOM.getElementById("epssUpdate").addClassName("blue"); DOM.getElementById("r-save-alert").removeClassName("hide"); DOM.getElementById(elementId).removeClassName("empty"); } }); Element searchArea = DOM.getElementById("searchTerms"); int termCount = searchArea.getChildCount(); for (int termIndex = 0; termIndex < termCount; termIndex++) searchArea.removeChild(searchArea.getChild(0)); DOM.getElementById("helptext-asset") .setInnerText(new ESBPacket(currentProject.getSections().get(sectionIndex).isObject()) .getString(ProjectRecord.TEMPLATE_SECTION_GUIDENCE)); JSONObject jo = currentProject.getAssets(); for (String key : currentProject.getSectionAssets().get(activeSection).isObject().keySet()) { RUSSELFileRecord r = new RUSSELFileRecord(new ESBPacket(jo.get(key).isObject())); Element td = DOM.createTD(); int prefix = DOM.getElementById("epssCurrentSection").getChildCount() - 2; PageAssembler.merge("epssCurrentSection", "x", td); td.setId(prefix + "-assetNote"); assetSearchHandler.buildTile(r, SearchHandler.TYPE_PROJECT_ASSET, td.getId()).fillTile(null); } // String[] searchTerms = new ESBPacket(pfmNow.projectSections.get(sectionIndex).isObject()).getString(ProjectRecord.TEMPLATE_SECTION_TERMS).split(", "); // for (int termsIndex=0;termsIndex<searchTerms.length;termsIndex++) // PageAssembler.merge("searchTerms", // "x", // (Element)new HTML("<a id=\"epssTerm" + (termsIndex+1) + "\" class=\"searchTerm small white button finger\">" + // searchTerms[termsIndex] + "</a>").getElement().getChild(0)); // for (int termIndex=1;termIndex<=searchTerms.length;termIndex++) { // final int lockedTermIndex = termIndex; // PageAssembler.attachHandler("epssTerm" + lockedTermIndex, // Event.ONCLICK, // new EventCallback() { // @Override // public void onEvent(Event event) { // toggleSearchTerms0("epssTerm" + lockedTermIndex, // ((Anchor)PageAssembler.elementToWidget("epssTerm" + lockedTermIndex, PageAssembler.A)).getText()); // } // }); // } ((TextBox) PageAssembler.elementToWidget("inputSectionNotes", PageAssembler.TEXT)) .setText(currentProject.getSectionNotes().get(activeSection).isString().stringValue()); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.PermissionScreen.java
License:Apache License
/** * display Renders the Utility screen using appropriate templates and sets up handlers *//*w w w. j a v a2s. co m*/ public void display() { if (source == null || source == "") return; if (DOM.getElementById("permissionModal") == null) PageAssembler.inject("flowContainer", "x", new HTML(Russel.htmlTemplates.getPermissionManagementPanelWidget().getText()), true); PageAssembler.openPopup("permissionModal"); DOM.getElementById(SOURCE_TYPE).setInnerText(type); DOM.getElementById(SOURCE).setInnerText(source); if (type.equals(TYPE_RESOURCE)) { hide("optionService"); hide("stdPermissionTitle"); show("resourcePermissionTitle"); show("resourceShareWith"); } DOM.getElementById("permissionGroup").removeAllChildren(); DOM.getElementById("permissionResource").removeAllChildren(); DOM.getElementById("permissionSearch").removeAllChildren(); DOM.getElementById("permissionService").removeAllChildren(); DOM.getElementById("permissionUser").removeAllChildren(); PageAssembler.attachHandler("resourceShareWith", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { final Element e = DOM.getElementById("resourceShareWith"); final String s = e.getInnerText(); RusselApi.toggleResourceSearch(source, DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value"), s.equals("Searchable") ? true : false, new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { Element e = DOM.getElementById("resourceShareWith"); if (!s.equals("Searchable")) { PageAssembler.addClass(e.getId(), "blue"); PageAssembler.removeClass(e.getId(), "white"); } else { PageAssembler.removeClass(e.getId(), "blue"); PageAssembler.addClass(e.getId(), "white"); } e.setInnerText(s.equals("Searchable") ? "Unsearchable" : "Searchable"); } @Override public void onFailure(Throwable caught) { } }); } }); PageAssembler.attachHandler("r-apply", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { PageAssembler.closePopup("permissionModal"); } }); PageAssembler.attachHandler("r-cancel", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { PageAssembler.closePopup("permissionModal"); } }); RusselApi.getServicePermissions(new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { fillServicePermissions(esbPacket.getObject("obj")); fillTarget(); } @Override public void onFailure(Throwable caught) { } }); PageAssembler.attachHandler("destinationType", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { fillTarget(); } }); PageAssembler.attachHandler("destination", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { togglePermissions(); } }); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.PermissionScreen.java
License:Apache License
private void show(Element name) { PageAssembler.removeClass(name.getId(), "hidden"); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.PermissionScreen.java
License:Apache License
private void hide(Element name) { PageAssembler.addClass(name.getId(), "hidden"); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.PermissionScreen.java
License:Apache License
private void checkShared() { RusselApi.checkSharedWith(source, DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value"), new ESBCallback<ESBPacket>() { @Override//from w w w . j a v a 2s . c om public void onSuccess(ESBPacket esbPacket) { Element e = DOM.getElementById("resourceShareWith"); boolean b = Boolean.parseBoolean(esbPacket.getString("obj")); if (!b) { PageAssembler.addClass(e.getId(), "blue"); PageAssembler.removeClass(e.getId(), "white"); } else { PageAssembler.removeClass(e.getId(), "blue"); PageAssembler.addClass(e.getId(), "white"); } e.setInnerText(b ? "Unsearchable" : "Searchable"); } @Override public void onFailure(Throwable caught) { } }); }
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. * /* ww w . ja v a 2s.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.form.ComboBox.java
License:sencha.com license
@SuppressWarnings("rawtypes") protected void initList() { if (listView == null) { listView = new ListView<D>(); }//from ww w. jav a 2 s . c o m String style = listStyle; listView.setStyleAttribute("overflowX", "hidden"); listView.addStyleName(style + "-inner"); listView.setStyleAttribute("padding", "0px"); listView.setItemSelector(itemSelector != null ? itemSelector : "." + style + "-item"); listView.setSelectOnOver(true); listView.setBorders(false); listView.setLoadingText(SafeGxt.fromNullableString(getMessages().getLoadingText())); listView.getSelectionModel().addListener(Events.SelectionChange, new Listener<SelectionChangedEvent<D>>() { public void handleEvent(SelectionChangedEvent<D> se) { selectedItem = listView.getSelectionModel().getSelectedItem(); if (GXT.isAriaEnabled()) { Element e = listView.getElement(listView.getStore().indexOf(selectedItem)); ComboBox.this.setAriaState("aria-activedescendant", e.getId()); } } }); listView.addListener(Events.Select, new Listener<ListViewEvent<D>>() { public void handleEvent(ListViewEvent<D> le) { onViewClick(le, true); } }); if (renderer == null) { renderer = new ComboBoxListRenderer<>(listStyle, new ModelPropertyRenderer<D>(getDisplayField())); } if (pageTb != null) { pageTb.bind((PagingLoader) store.getLoader()); } list = new LayoutContainer() { @Override protected void doAttachChildren() { super.doAttachChildren(); ComponentHelper.doAttach(ComboBox.this.pageTb); } @Override protected void doDetachChildren() { super.doDetachChildren(); ComponentHelper.doDetach(ComboBox.this.pageTb); } @Override protected void onRender(Element parent, int index) { super.onRender(parent, index); eventPreview.getIgnoreList().add(getElement()); el().makePositionable(true); setAriaRole("presentation"); if (pageTb != null) { footer = list.el().createChild("<div class='" + listStyle + "-ft'></div>"); pageTb.setBorders(false); pageTb.render(footer.dom); } } }; list.setScrollMode(Scroll.NONE); list.setShim(true); list.setShadow(true); list.setBorders(true); list.setStyleName(style); list.hide(); list.addStyleName("x-ignore"); assert store != null : "ComboBox needs a store"; list.add(listView); listView.setRenderer(renderer); listView.setSelectStyle(selectedStyle); bindStore(store); if (!lazyRender) { createList(true); } }
From source file:com.extjs.gxt.ui.client.widget.ListView.java
License:sencha.com license
protected void onHighlightRow(int index, boolean highLight) { Element e = getElement(index); if (e != null) { fly(e).setStyleName("x-view-highlightrow", highLight); if (highLight && GXT.isAriaEnabled()) { setAriaState("aria-activedescendant", e.getId()); }// w w w .j av a 2 s .c om } }
From source file:com.extjs.gxt.ui.client.widget.ListView.java
License:sencha.com license
protected void onSelectChange(M model, boolean select) { if (rendered && all != null) { int index = store.indexOf(model); if (index != -1 && index < all.getCount()) { Element e = all.getElement(index); fly(e).setStyleName(selectStyle, select); fly(e).removeStyleName(overStyle); if (GXT.isAriaEnabled()) { e.setAttribute("aria-selected", "" + select); if (select) { setAriaState("aria-activedescendant", e.getId()); }/*from w ww .jav a 2 s.co m*/ } } } }