List of usage examples for com.google.gwt.user.client.ui HTML HTML
protected HTML(Element element)
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.EPSSEditScreen.java
License:Apache License
/** * display Renders the EPSS Edit screen using appropriate templates and assigns handlers *//* ww w . j av a 2s .co m*/ @Override public void display() { PageAssembler.ready(new HTML(templates().getEPSSEdit().getText())); PageAssembler.buildContents(); populateTemplate(); assetSearchHandler = new ESBSearchHandler(); assetSearchHandler.hook("r-projectAssetSearch", "epssAssetPanel", ESBSearchHandler.ASSET_TYPE); PageAssembler.attachHandler("epssExportButton", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { RootPanel.get("epssDownloadArea").clear(); } }); PageAssembler.attachHandler("epssUpdate", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { saveProject0(); } }); PageAssembler.attachHandler("epssCancel", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { dispatcher().loadFeatureScreen(FeatureScreen.PROJECTS_TYPE); } }); PageAssembler.attachHandler("epssSaveProperties", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { saveProject0(); PageAssembler.closePopup("projectProperties"); } }); PageAssembler.attachHandler("epssCancelProperties", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { fillPropData0(); PageAssembler.closePopup("projectProperties"); } }); PageAssembler.attachHandler("epssCloseProperties", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { fillPropData0(); PageAssembler.closePopup("projectProperties"); } }); PageAssembler.attachHandler("epssSaveAs", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Window.alert(Constants.INCOMPLETE_FEATURE_MESSAGE); } }); for (int sectionIndex = 1; sectionIndex <= pfmNow.projectSections.size(); sectionIndex++) { final int lockedSectionIndex = sectionIndex; PageAssembler.attachHandler("section" + lockedSectionIndex, Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { fillSectionNotes0("section" + lockedSectionIndex, lockedSectionIndex - 1); } }); } PageAssembler.attachHandler("epssExportSCORM", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { saveProject0(); EPSSPackBuilder epb = new EPSSPackBuilder(pfmNow); FormPanel fp = ((FormPanel) PageAssembler.elementToWidget("epssExportSCORMForm", PageAssembler.FORM)); fp.setAction(RusselApi.getESBActionURL("exportToZip")); fp.setMethod(CommunicationHub.POST); fp.setEncoding(FormPanel.ENCODING_MULTIPART); ESBPacket postData = epb.buildPackIE(); postData.put("sessionId", RusselApi.sessionId); ((Hidden) PageAssembler.elementToWidget("epssExportSCORMPayload", PageAssembler.HIDDEN)) .setValue(postData.toString()); fp.addSubmitHandler(new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { StatusWindowHandler.createMessage( StatusWindowHandler .getZipExportMessageDone(pfmNow.projectTitle.replaceAll(" ", "_") + ".zip"), StatusRecord.ALERT_SUCCESS); RootPanel.get("epssDownloadArea").clear(); PageAssembler.closePopup("exportProjectModal"); } }); fp.submit(); RootPanel.get("epssDownloadArea").add(new Image("images/orbit/loading.gif")); } }); PageAssembler.attachHandler("epssActiveAddAsset", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { addAssetTrigger(); } }); PageAssembler.attachHandler("epssActiveRemoveAsset", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { removeAssetTrigger(); } }); fillData0(); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.EPSSEditScreen.java
License:Apache License
/** * buildAssetTile0 Creates a new tile to represent an asset * @param assetsDiv String target div name for the tile * @param nodeId String /*w w w . ja v a2 s .c o m*/ * @param filename String */ private void buildAssetTile0(String assetsDiv, String nodeId, String filename) { Element td = null; RootPanel rp = RootPanel.get(assetsDiv); if (rp != null) { td = DOM.createTD(); td.setId(PageAssembler.getIdCount() + "-assetNote"); td.appendChild(new HTML(templates().getEPSSNoteAssetObjectWidget().getText()).getElement()); Vector<String> iDs = PageAssembler.merge(assetsDiv, "x", td); String idPrefix = iDs.firstElement().substring(0, iDs.firstElement().indexOf("-")); RUSSELFileRecord ap = new RUSSELFileRecord(); ap.setGuid(nodeId); ap.setFilename(filename); new TileHandler(null, idPrefix, ESBSearchHandler.NOTES_TYPE, ap).refreshTile(null); } }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.EPSSEditScreen.java
License:Apache License
/** * fillSectionNotes0 Retrieves section notes and search terms * @param elementId String/* w w w . j a v a 2 s . c om*/ * @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(templates().getEPSSEditSectionWidgets().getText()).getElement()); activeSection = DOM.getElementById(elementId).getInnerText(); activeSectionId = elementId; PageAssembler.attachHandler("inputSectionNotes", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { pfmNow.addSectionNotes(activeSection, cleanString0( ((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) { Hidden activeAssetFilename = ((Hidden) PageAssembler.elementToWidget("epssActiveAddAsset", PageAssembler.HIDDEN)); activeAssetId = activeAssetFilename.getValue().substring(0, activeAssetFilename.getValue().indexOf(",")); activeFilename = activeAssetFilename.getValue() .substring(activeAssetFilename.getValue().indexOf(",") + 1); pfmNow.addAsset(activeSection, activeAssetId, activeFilename, cleanString0( ((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)); 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)); DOM.getElementById("helptext-asset") .setInnerText(new ESBPacket(pfmNow.projectSections.get(sectionIndex).isObject()) .getString(ProjectRecord.TEMPLATE_SECTION_GUIDENCE)); 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()); } }); } if (pfmNow.projectSectionNotes != null) ((TextBox) PageAssembler.elementToWidget("inputSectionNotes", PageAssembler.TEXT)) .setText(pfmNow.projectSectionNotes.getSectionNotes(activeSection)); if (pfmNow.projectSectionAssets != null) { Vector<RUSSELFileRecord> assets = pfmNow.projectSectionAssets.getSectionAssets(activeSection); for (int x = 0; x < assets.size(); x++) { buildAssetTile0(sectionPanel, assets.get(x).getGuid(), assets.get(x).getFilename()); } PageAssembler.runCustomJSHooks(); } }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.EPSSScreen.java
License:Apache License
/** * display Renders the EPSS Edit screen using appropriate templates and assigns handlers *///from w w w .j av a2s . c o m @Override public void display() { PageAssembler.ready(new HTML(Russel.htmlTemplates.getEPSSEdit().getText())); PageAssembler.buildContents(); DOM.getElementById("r-menuWorkspace").getParentElement().removeClassName("active"); DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active"); DOM.getElementById("r-menuProjects").getParentElement().addClassName("active"); DOM.getElementById("template-name").setInnerText(currentProject.getTemplateName()); for (int sectionIndex = 0; sectionIndex < currentProject.getSections().size(); sectionIndex++) insertSection0(DOM.getElementById("template-sections-area"), new ESBPacket(currentProject.getSections().get(sectionIndex).isObject()) .getString(ProjectRecord.TEMPLATE_SECTION_SHORT_TITLE), sectionIndex); PageAssembler.inject("flowContainer", "x", new HTML(Russel.htmlTemplates.getDetailModal().getText()), true); PageAssembler.inject("objDetailPanelWidget", "x", new HTML(Russel.htmlTemplates.getDetailPanel().getText()), true); assetSearchHandler = new SearchHandler(this, true); assetSearchHandler.hookAndClear("r-projectAssetSearch", "epssAssetPanel", SearchHandler.TYPE_ASSET); PageAssembler.attachHandler("r-projectAssetSearch", Event.ONKEYUP, new EventCallback() { @Override public void onEvent(Event event) { generateQuery(); } }); PageAssembler.attachHandler("epssExportButton", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { RootPanel.get("epssDownloadArea").clear(); } }); PageAssembler.attachHandler("epssUpdate", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { saveProject0(); } }); PageAssembler.attachHandler("epssCancel", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new FeatureScreen(FeatureScreen.PROJECTS_TYPE), true); } }); PageAssembler.attachHandler("epssSaveProperties", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { saveProject0(); PageAssembler.closePopup("projectProperties"); } }); PageAssembler.attachHandler("epssCancelProperties", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { fillPropData0(); PageAssembler.closePopup("projectProperties"); } }); PageAssembler.attachHandler("epssCloseProperties", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { fillPropData0(); PageAssembler.closePopup("projectProperties"); } }); for (int sectionIndex = 0; sectionIndex < currentProject.getSections().size(); sectionIndex++) { final int lockedSectionIndex = sectionIndex; PageAssembler.attachHandler("section" + lockedSectionIndex, Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { fillSectionNotes0("section" + lockedSectionIndex, lockedSectionIndex); } }); } PageAssembler.attachHandler("epssExportSCORM", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { saveProject0(); ESBPacket postData = new ESBPacket(); FormPanel fp = ((FormPanel) PageAssembler.elementToWidget("epssExportSCORMForm", PageAssembler.FORM)); fp.setAction(RusselApi.getESBActionURL("zipResources")); fp.setMethod(CommunicationHub.POST); fp.setEncoding(FormPanel.ENCODING_MULTIPART); postData.put("sessionid", RusselApi.sessionId); JSONArray ja = new JSONArray(); int c = 0; for (String key : currentProject.getAssets().keySet()) ja.set(c++, new JSONString(key)); ja.set(c++, new JSONString(currentProject.getGuid())); postData.put("resourcemetadata", ja); postData.put("resourceid", currentProject.getTitle().replaceAll(" ", "_") + ".zip"); ((Hidden) PageAssembler.elementToWidget("epssExportSCORMPayload", PageAssembler.HIDDEN)) .setValue(postData.toString()); ((Hidden) PageAssembler.elementToWidget("epssExportImsmanifestPayload", PageAssembler.HIDDEN)) .setValue(SCORMTemplates.INSTANCE.getImsmanifest().getText()); ((Hidden) PageAssembler.elementToWidget("epssExportInitPagePayload", PageAssembler.HIDDEN)) .setValue(SCORMTemplates.INSTANCE.getInitPage().getText()); fp.addSubmitHandler(new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { StatusHandler.createMessage( StatusHandler.getZipExportMessageDone( currentProject.getTitle().replaceAll(" ", "_") + ".zip"), StatusRecord.ALERT_SUCCESS); RootPanel.get("epssDownloadArea").clear(); PageAssembler.closePopup("exportProjectModal"); } }); fp.submit(); RootPanel.get("epssDownloadArea").add(new Image("images/orbit/loading.gif")); } }); fillData0(); }
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 . ja va 2 s . c om*/ * @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.FeatureScreen.java
License:Apache License
/** * display Renders the Feature home screen using appropriate templates and sets up handlers *//*from w w w . jav a2 s . c o m*/ public void display() { PageAssembler.ready(new HTML(Russel.htmlTemplates.getFeatureHomePanel().getText())); PageAssembler.buildContents(); PageAssembler.inject("flowContainer", "x", new HTML(Russel.htmlTemplates.getDetailModal().getText()), true); PageAssembler.inject("objDetailPanelWidget", "x", new HTML(Russel.htmlTemplates.getDetailPanel().getText()), true); DOM.getElementById("r-menuWorkspace").getParentElement().removeClassName("active"); DOM.getElementById("r-menuProjects").getParentElement().removeClassName("active"); DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active"); ash = new SearchHandler(this, true); if (featureType.equals(PROJECTS_TYPE)) { pageTitle = "Projects"; DOM.getElementById("r-menuProjects").getParentElement().addClassName("active"); DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active"); DOM.getElementById("r-MyFilesTile").addClassName("hidden"); DOM.getElementById("r-FLRfilesTile").addClassName("hidden"); DOM.getElementById("r-newEntityFront").setInnerHTML("<p class='title'>New Project</p>"); DOM.getElementById("r-newEntityBack").setInnerHTML( "<p class='status'><span class='status-label'>Click to create a new project...</span></p>"); DOM.getElementById("r-newEntityAction").setTitle("Start a new project"); ash.hookAndClear("r-menuSearchBar", "searchObjectPanelScroll", SearchHandler.TYPE_PROJECT); } else if (featureType.equals(COLLECTIONS_TYPE)) { pageTitle = "Collections"; DOM.getElementById("r-menuCollections").getParentElement().addClassName("active"); DOM.getElementById("r-menuProjects").getParentElement().removeClassName("active"); DOM.getElementById("r-MyFilesTile").addClassName("hidden"); DOM.getElementById("r-FLRfilesTile").removeClassName("hidden"); Element e = (Element) DOM.getElementById("newProjectModal"); if (e != null) e.removeFromParent(); DOM.getElementById("r-newEntityFront").setInnerHTML("<p class='title'>Collection</p>"); DOM.getElementById("r-newEntityBack") .setInnerHTML("<p class='status'><span class='status-label'>Open My Files...</span></p>"); DOM.getElementById("r-newEntityAction").setTitle("Collection"); PageAssembler.attachHandler("r-newEntityAction", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new SearchScreen(SearchHandler.TYPE_COLLECTION), true); } }); ash.hookAndClear("r-menuSearchBar", "searchPanelWidgetScroll", SearchHandler.TYPE_SEARCH); } PageAssembler.attachHandler("r-menuSearchBar", Event.ONCHANGE, new EventCallback() { @Override public void onEvent(Event event) { generateQuery(); } }); DOM.getElementById("r-pageTitle").setInnerHTML("<h4>" + pageTitle + "</h4>"); // Handlers for EPSS Home Screen PageAssembler.attachHandler("epss-gagne", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { PageAssembler.closePopup("newProjectModal"); ProjectRecord pr = new ProjectRecord(Russel.epssTemplates.getGagneTemplate().getText(), new RUSSELFileRecord()); Russel.screen.loadScreen(new EPSSScreen(pr), true); } }); PageAssembler.attachHandler("epss-sim", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { PageAssembler.closePopup("newProjectModal"); ProjectRecord pr = new ProjectRecord(Russel.epssTemplates.getSimulationTemplate().getText(), new RUSSELFileRecord()); Russel.screen.loadScreen(new EPSSScreen(pr), true); } }); // Handlers for Collections Home Screen PageAssembler.attachHandler("myFiles", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new SearchScreen(SearchHandler.TYPE_COLLECTION), true); } }); PageAssembler.attachHandler("FLRFiles", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen( new SearchScreen(SearchHandler.TYPE_COLLECTION, SearchScreen.RESOURCE_LINK), true); } }); generateQuery(); }
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 *///from w w w .j a v a 2s.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.eduworks.russel.ui.client.pagebuilder.screen.HomeScreen.java
License:Apache License
/** * display Renders the RUSSEL home screen using appropriate templates and sets up handlers *//*w w w .j ava2s .com*/ public void display() { ((Label) PageAssembler.elementToWidget("r-menuUserName", PageAssembler.LABEL)).setText(RusselApi.username); PageAssembler.ready(new HTML(Russel.htmlTemplates.getMenuBar().getText())); PageAssembler.ready(new HTML(Russel.htmlTemplates.getObjectPanel().getText())); PageAssembler.buildContents(); PageAssembler.inject("flowContainer", "x", new HTML(Russel.htmlTemplates.getDetailModal().getText()), true); PageAssembler.inject("objDetailPanelWidget", "x", new HTML(Russel.htmlTemplates.getDetailPanel().getText()), true); DOM.getElementById("r-menuWorkspace").getParentElement().addClassName("active"); DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active"); DOM.getElementById("r-menuProjects").getParentElement().removeClassName("active"); PageAssembler.attachHandler("r-uploadContentTile", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new EditScreen(), true); } }); PageAssembler.attachHandler("r-projectsTile", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new FeatureScreen(FeatureScreen.PROJECTS_TYPE), true); } }); PageAssembler.attachHandler("r-menuProjects", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new FeatureScreen(FeatureScreen.PROJECTS_TYPE), true); } }); PageAssembler.attachHandler("r-menuCollections", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new FeatureScreen(FeatureScreen.COLLECTIONS_TYPE), true); } }); PageAssembler.attachHandler("r-collectionsTile", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new FeatureScreen(FeatureScreen.COLLECTIONS_TYPE), true); } }); PageAssembler.attachHandler("r-manageUsersTile", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new UserScreen(), true); } }); PageAssembler.attachHandler("r-groupTile", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new GroupScreen(), true); } }); PageAssembler.attachHandler("r-menuHelp", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { String help = PageAssembler.getHelp(); if (help != null && help != "") Window.open(PageAssembler.getHelp(), "_blank", null); else Window.alert("Help has not been configured for this installation of RUSSEL."); } }); ((TextBox) PageAssembler.elementToWidget("r-menuSearchBar", PageAssembler.TEXT)).setFocus(true); ash.hookAndClear("r-menuSearchBar", "searchObjectPanelScroll", SearchHandler.TYPE_RECENT); Date currentDate = new Date(); Date pastDate = new Date(); pastDate.setDate(pastDate.getDate() - 10); ash.query(RUSSELFileRecord.UPDATED_DATE + ":[" + pastDate.getTime() + " TO " + currentDate.getTime() + "]"); PageAssembler.attachHandler("r-menuSearchBar", Event.ONKEYUP, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new SearchScreen(SearchHandler.TYPE_SEARCH), true); } }); PageAssembler.attachHandler("r-objectEditSelected", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { Russel.screen.loadScreen(new EditScreen(ash.getSelected()), true); } }); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.LoginScreen.java
License:Apache License
/** * display Renders the Login screen./* www. j ava2 s . c om*/ */ public void display() { PageAssembler.setTemplate("", "", "contentPane"); PageAssembler.ready(new HTML(Russel.htmlTemplates.getLoginWidget().getText())); PageAssembler.buildContents(); PageAssembler.attachHandler("loginButton", Event.ONCLICK, loginListener); PageAssembler.attachHandler("loginPassword", Event.ONKEYUP, loginListener); ((TextBox) PageAssembler.elementToWidget("loginName", PageAssembler.TEXT)).setFocus(true); }
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 *//*ww w.j a va 2 s . c o 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(); } }); }