private Button createAddBtn() { Button btn = new Button(); btn.setImage("images/easyicon_add.png"); btn.setTooltiptext("添加"); btn.addEventListener(Events.ON_CLICK, AddValueBtnEventListener); return btn; }
public void afterCompose() { Components.wireVariables(this, this); Components.addForwards(this, this); user = (WkTUser) Sessions.getCurrent().getAttribute("user"); userListbox.setItemRenderer(new UserDetailListRenderer()); addUser.addEventListener( Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { final UserNewWindow w = (UserNewWindow) Executions.createComponents("/admin/system/user/userNew.zul", null, null); w.doHighlighted(); w.setClosable(true); w.initWindow(getDept()); w.addEventListener( Events.ON_CHANGE, new EventListener() { public void onEvent(Event arg0) throws Exception { reloadDeptTree(); w.detach(); } }); } }); }
private Button createEnterBtn(CfgValue cfgValue) { Button btn = new Button(); btn.setAttribute("cfgValue", cfgValue); btn.setImage("images/easyicon_open.png"); btn.setTooltiptext("打开"); btn.addEventListener(Events.ON_CLICK, EnterBtnEventListener); return btn; }
private Button createCopyElementBtn(CfgValue origValue) { Button btn = new Button(); btn.setAttribute("cfgValue", origValue); btn.setImage("images/easyicon_copy.png"); btn.setTooltiptext("复制"); btn.addEventListener(Events.ON_CLICK, CopyValueBtnEventListener); return btn; }
private Button createDeleteBtn(CfgValue cfgValue, Component partPane) { Button btn = new Button(); btn.setAttribute("cfgValue", cfgValue); btn.setImage("images/easyicon_remove.png"); btn.setTooltiptext("删除"); btn.addEventListener(Events.ON_CLICK, DeleteValueBtnEventListener); btn.setAttribute("partPane", partPane); return btn; }
private Button createAddPartBtn(CfgInfo cfgInfo) { Button btn = new Button(); btn.setAttribute("cfgInfo", cfgInfo); btn.setLabel(cfgInfo.getLabelOrId()); btn.setImage("images/easyicon_add.png"); btn.setTooltiptext("添加"); btn.addEventListener(Events.ON_CLICK, AddPartBtnEventListener); return btn; }
@Override protected Button createRightCaptionButton( final String label, final String sClass, final HtmlBasedComponent parent, final org.zkoss.zk.ui.event.EventListener listener) { final Button button = new Button(label); button.setSclass(sClass); button.addEventListener(Events.ON_CLICK, listener); parent.appendChild(button); return button; }
/// Showd Data on grid table public void showgrid() { for (Component c : find(this.getPage(), "#showsell > rows > row")) { c.detach(); } float sumallprice = 0; for (int i = 0; i < pointcount; i++) { Row r = new Row(); r.appendChild(new Label(Integer.toString(idpro.get(i)))); r.appendChild(new Label(nameproduct.get(i))); r.appendChild(new Label(Integer.toString(qty.get(i)))); r.appendChild(new Label(Integer.toString(unitprice.get(i)))); r.appendChild(new Label(Integer.toString(price.get(i)))); r.appendChild(new Label(namecus.get(i))); Button but = new Button("Delete"); but.setId("" + i); but.addEventListener( "onClick", new EventListener() { public void onEvent(Event ee) { nameproduct.remove(Integer.parseInt(ee.getTarget().getId())); qty.remove(Integer.parseInt(ee.getTarget().getId())); unitprice.remove(Integer.parseInt(ee.getTarget().getId())); price.remove(Integer.parseInt(ee.getTarget().getId())); namecus.remove(Integer.parseInt(ee.getTarget().getId())); pointcount--; txtsum.setValue("0"); txtvat.setValue("0"); idsumprice.setValue("0"); showgrid(); } }); r.appendChild(but); Component v = find(this.getPage(), "#showsell > rows").get(0); v.appendChild(r); sumallprice = sumallprice + price.get(i); float vatc1; String vatc2; for (Customereng vc : Customereng.findAllCustomerengs()) { vatc2 = vc.getTax(); vatc1 = Float.parseFloat(vatc2); float vat = (sumallprice * vatc1) / 100; float sumtotal = vat + sumallprice; txtsum.setValue(Float.toString(sumallprice)); txtvat.setValue(Float.toString(vat)); idsumprice.setValue(Float.toString(sumtotal)); } } }
private void appendOperations(final Row row) { Button buttonRemove = new Button(); buttonRemove.setParent(row); buttonRemove.setClass("icono"); buttonRemove.setImage("/common/img/ico_borrar1.png"); buttonRemove.setHoverImage("/common/img/ico_borrar.png"); buttonRemove.setTooltiptext(_("Delete")); buttonRemove.addEventListener(Events.ON_CLICK, new EventListener() { @Override public void onEvent(Event event) { confirmRemove((TaskQualityForm) row.getValue()); } }); }
private void createSaveBtn() { if (!embed) { saveBtn = new Button("保存"); saveBtn.addEventListener( Events.ON_CLICK, new EventListener<MouseEvent>() { @Override public void onEvent(MouseEvent event) throws Exception { saveValue(); } }); mainPanel.appendChild(saveBtn); } }
public void render(Listitem item, Object data) throws Exception { WkTUser u = (WkTUser) data; Integer status = Integer.parseInt(u.getKuStatus()); String[] statsString = {"未审查", "正常", "查封"}; item.setValue(u); item.setHeight("25px"); Listcell c0 = new Listcell(item.getIndex() + 1 + ""); Listcell c1 = new Listcell(u.getKuLid()); Listcell c2 = new Listcell(u.getKuName()); Listcell c3 = new Listcell(u.getKuEmail()); Listcell c4 = new Listcell(statsString[status]); Listcell c5 = new Listcell(DateUtil.getDateString(u.getKuRegdate())); Listcell c6 = new Listcell(DateUtil.getTimeString(u.getKuLtime())); Button b = new Button("角色"); Listcell c7 = new Listcell(); c7.appendChild(b); b.addEventListener( Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { Listitem c = (Listitem) event.getTarget().getParent().getParent(); WkTUser u = (WkTUser) c.getValue(); final UserRoleSelectWindow w = (UserRoleSelectWindow) Executions.createComponents( "/admin/system/user/userRoleSelect.zul", null, null); w.doHighlighted(); w.initWindow(u); } }); c7.setTooltiptext("点击进行角色管理"); c1.addEventListener(Events.ON_CLICK, new InnerListener()); c2.addEventListener(Events.ON_CLICK, new InnerListener()); c1.setTooltiptext("点击进行用户编辑"); c2.setTooltiptext("点击进行用户编辑"); item.appendChild(c0); item.appendChild(c1); item.appendChild(c2); item.appendChild(c3); item.appendChild(c4); item.appendChild(c5); item.appendChild(c6); item.appendChild(c7); }
@Override public void doAfterCompose(Component comp) throws Exception { // TODO Auto-generated method stub timeplot = new Timeplot(); ValueGeometry vg = new DefaultValueGeometry(); vg.setGridColor("#000000"); vg.setAxisLabelsPlacement("left"); TimeGeometry tg = new DefaultTimeGeometry(); tg.setGridStep(2 * 60 * 60 * 1000); tg.setAxisLabelsPlacement("bottom"); tg.setGridStepRange(30 * 60 * 1000); timeplot.setWidth("100%"); timeplot.setHeight("300px"); plotinfo = new Plotinfo(); plotinfo.setShowValues(true); ListModelList dataModel = new ListModelList(initDataMode()); plotinfo.setDataModel(dataModel); plotinfo.setParent(timeplot); plotinfo.setTimeGeometry(tg); plotinfo.setValueGeometry(vg); timeplot.setParent(comp); Button btn = new Button("click"); btn.setParent(comp); btn.addEventListener( "onClick", new EventListener() { @Override public void onEvent(Event event) throws Exception { // TODO Auto-generated method stub ListModelList dml = (ListModelList) plotinfo.getDataModel(); TimeplotData td = new TimeplotData(); td.setTime(new Date(time + 1000 * 60 * 60 * 8)); td.setValue(10f); dml.add(td); } }); }
@Override protected HtmlBasedComponent createAdvancedArea() { final Div previewDataAreaDiv = new Div(); previewDataAreaDiv.setStyle( "min-height: 40px; width: 100%; background: white; border-bottom: 1px solid #ccc"); final Div attributesDiv = new Div(); attributesDiv.setSclass("clearfix"); attributesDiv.setStyle("text-align: left; width: 100%; "); renderEditors(attributesDiv); final Div attrContainerDiv = new Div(); attrContainerDiv.setStyle("max-height: 265px; overflow-y: auto;"); attrContainerDiv.appendChild(attributesDiv); previewDataAreaDiv.appendChild(attrContainerDiv); final Div buttonDiv = new Div(); buttonDiv.setStyle( "padding: 3px 20px 3px 24px; text-align:left; height: 26px; position:relative"); final Button applyButton = new Button(Labels.getLabel("general.apply")); applyButton.setStyle("position:absolute; right:20px; top: 4px"); applyButton.addEventListener( Events.ON_CLICK, new org.zkoss.zk.ui.event.EventListener() { @Override public void onEvent(final Event event) throws Exception // NOPMD: ZK Specific { updatePreviewData(); } }); buttonDiv.appendChild(applyButton); previewDataAreaDiv.appendChild(buttonDiv); return previewDataAreaDiv; }
public ProfileComponent() { super(); final PlayerProfileData player = getPlayerFacade().getCurrentPlayer(); final Grid profileGrid = new Grid(); profileGrid.setSclass("profileGrid"); final Rows profileRows = new Rows(); profileGrid.appendChild(profileRows); final Row idRow = new Row(); idRow.setSclass("profileRow"); idRow.appendChild(new Label(Labels.getLabel("profile.id"))); idRow.appendChild(new Label(player.getId())); profileRows.appendChild(idRow); final Row nameRow = new Row(); nameRow.setSclass("profileRow"); nameRow.appendChild(new Label(Labels.getLabel("profile.name"))); final Textbox nameBox = new Textbox(player.getName()); nameBox.setConstraint( new SimpleConstraint(SimpleConstraint.NO_EMPTY, Labels.getLabel("register.error.noname"))); nameRow.appendChild(nameBox); profileRows.appendChild(nameRow); final Row mailRow = new Row(); mailRow.setSclass("profileRow"); mailRow.appendChild(new Label(Labels.getLabel("profile.email"))); final Textbox mailBox = new Textbox(player.getEMail()); mailBox.setConstraint("/.+@.+\\.[a-z]+/: " + Labels.getLabel("register.error.noemail")); mailRow.appendChild(mailBox); profileRows.appendChild(mailRow); final Row pwdRow = new Row(); pwdRow.setSclass("profileRow"); pwdRow.appendChild(new Label(Labels.getLabel("profile.password"))); final Textbox pwdBox = new Textbox(player.getPassword()); // pwdBox.setConstraint(new SimpleConstraint(SimpleConstraint.NO_EMPTY, // Labels.getLabel("register.error.nopassword"))); pwdBox.setType("password"); pwdRow.appendChild(pwdBox); profileRows.appendChild(pwdRow); final Row pwd2Row = new Row(); pwd2Row.setSclass("profileRow"); pwd2Row.appendChild(new Label(Labels.getLabel("profile.passwordagain"))); final Textbox pwd2Box = new Textbox(player.getPassword()); pwd2Box.setConstraint( new Constraint() { @Override public void validate(final Component comp, final Object value) throws WrongValueException { if (!(pwdBox.getValue().equals(value))) { throw new WrongValueException( comp, Labels.getLabel("register.error.unequalpassword")); } } }); pwd2Box.setType("password"); pwd2Row.appendChild(pwd2Box); profileRows.appendChild(pwd2Row); final Row countryRow = new Row(); countryRow.setSclass("profileRow"); countryRow.appendChild(new Label(Labels.getLabel("profile.country"))); final Combobox countryBox = new Combobox(); countryBox.setConstraint( new SimpleConstraint( SimpleConstraint.NO_EMPTY, Labels.getLabel("register.error.nocountry"))); countryBox.setAutodrop(true); countryBox.setReadonly(true); fillCombo(countryBox, player.getLocale()); countryRow.appendChild(countryBox); profileRows.appendChild(countryRow); final Row avCompetitionsRow = new Row(); avCompetitionsRow.setSclass("competitionsRow"); avCompetitionsRow.appendChild(new Label(Labels.getLabel("profile.availableCompetitions"))); final Listbox listbox = new Listbox(); listbox.setSclass("competitionsListbox"); avCompetitionsRow.appendChild(listbox); listbox.setCheckmark(true); listbox.setMultiple(true); final List<CompetitionData> comps = getPlayerFacade().getAllCompetitions(); for (final CompetitionData cmpData : comps) { final Listitem listItem = new Listitem(cmpData.getName()); listItem.setValue(cmpData); listItem.setSelected(cmpData.isActive()); listItem.setDisabled( !cmpData.isDeactivatable() || (cmpData.isCurrentCompetition() && comps.size() != 1)); listbox.appendChild(listItem); } profileRows.appendChild(avCompetitionsRow); final Row buttonRow = new Row(); buttonRow.setSclass("profileRow"); final Button button = new Button(Labels.getLabel("profile.submit")); button.addEventListener( Events.ON_CLICK, new EventListener() { @Override public void onEvent(final Event event) { player.setEMail(mailBox.getValue()); player.setName(nameBox.getValue()); if (StringUtils.isNotBlank(pwdBox.getValue()) && pwdBox.getValue().equals(pwd2Box.getValue())) { player.setPassword(pwdBox.getValue()); } player.setLocale((Locale) countryBox.getSelectedItem().getValue()); final List<CompetitionData> cmps = new ArrayList<CompetitionData>(); for (final Object listItem : listbox.getSelectedItems()) { if (listItem instanceof Listitem) { final Object value = ((Listitem) listItem).getValue(); if (value instanceof CompetitionData) { cmps.add((CompetitionData) value); } } } getPlayerFacade().setActiveCompetitions(cmps); getPlayerFacade().updatePlayer(player); try { Messagebox.show(Labels.getLabel("profile.update.success")); // TODO proper update mechanism Executions.sendRedirect("/"); } catch (final InterruptedException e) { LOG.warn("Error while showing messagebox: ", e); } } }); buttonRow.appendChild(button); profileRows.appendChild(buttonRow); this.appendChild(profileGrid); final Div detailsDiv = new Div(); detailsDiv.setSclass("rankingUserDetails"); final Img img = new Img(); final Div imgCnt = new Div(); imgCnt.appendChild(img); imgCnt.setSclass("rankingUserDetailsImg"); img.setDynamicProperty("src", player.getPictureUrl()); detailsDiv.appendChild(imgCnt); final Button uploadButton = new Button(Labels.getLabel("profile.upload")); uploadButton.setSclass("btngreen profileUserDetailsUpload"); detailsDiv.appendChild(uploadButton); uploadButton.addEventListener( Events.ON_CLICK, new EventListener() { @Override public void onEvent(final Event event) throws InterruptedException { final Object media = Fileupload.get(); if (media instanceof Image) { final Image image = (Image) media; player.setPictureUrl( getPlayerFacade().uploadProfilePicture(image.getByteData(), image.getName())); img.setDynamicProperty("src", player.getPictureUrl()); } else if (media != null) { Messagebox.show("Not an image: " + media, "Error", Messagebox.OK, Messagebox.ERROR); } } }); this.appendChild(detailsDiv); }
public void inicializarEventos( Button agregar, Button verMas, Button editar, Button eliminar, final Button filtrar, final Component... component) { if (filtrar != null) { filtrar.setAutodisable(filtrar.getId()); filtrar.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { if (ismenupopupEnabled) { if (component[2] != null) { ((Menupopup) component[2]).open(filtrar); agreagarEventoMenupopUp(filtrar, ((Menupopup) component[2])); } } else { agregarEventoFiltrar(); } } }); filtrar.setAutodisable(filtrar.getId()); } if (component != null && component.length > 0) { if (component[0] != null) { component[0].addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { execute(); } }); } if (component[1] != null) { component[1].addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { onGuardarDetalle(); } }); } } if (agregar != null) { agregar.setAutodisable(agregar.getId()); agregar.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { onAgregarDetalle(); } }); agregar.setAutodisable(agregar.getId()); } if (editar != null) { editar.setAutodisable(editar.getId()); editar.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { if (listaDetalle.getSelectedItem() != null) onEditarMaestro((IBeanAbstracto) listaDetalle.getSelectedItem().getValue()); } }); editar.setAutodisable(editar.getId()); } if (verMas != null) { verMas.setAutodisable(verMas.getId()); verMas.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { if (listaDetalle.getSelectedItem() != null) onVerMasMaestro((IBeanAbstracto) listaDetalle.getSelectedItem().getValue()); } }); verMas.setAutodisable(verMas.getId()); } if (eliminar != null) { eliminar.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { if (listaDetalle.getSelectedItem() != null) onBorrarMaestro((IBeanAbstracto) listaDetalle.getSelectedItem().getValue()); } }); eliminar.setAutodisable(eliminar.getId()); } }
public CreateProcessController( final MainController mainC, final HashMap<String, String> formats_ext) throws SuspendNotAllowedException, InterruptedException, ExceptionAllUsers, ExceptionDomains { this.mainC = mainC; this.createProcessW = (Window) Executions.createComponents("macros/editprocessdata.zul", null, null); this.createProcessW.setTitle("Create new process "); Rows rows = (Rows) this.createProcessW.getFirstChild().getFirstChild().getFirstChild().getNextSibling(); Row processNameR = (Row) rows.getFirstChild(); this.processNameT = (Textbox) processNameR.getFirstChild().getNextSibling(); Row versionNameR = (Row) processNameR.getNextSibling(); this.versionNumberT = (Textbox) versionNameR.getFirstChild().getNextSibling(); Row domainR = (Row) versionNameR.getNextSibling(); Row ownerR = (Row) domainR.getNextSibling(); Row nativeTypesR = (Row) ownerR.getNextSibling(); this.nativeTypesLB = (Listbox) nativeTypesR.getFirstChild().getNextSibling(); Row rankingR = (Row) nativeTypesR.getNextSibling(); Radiogroup rankingRG = (Radiogroup) rankingR.getFirstChild().getNextSibling(); Row publicR = (Row) rankingR.getNextSibling(); this.makePublicCb = (Checkbox) publicR.getFirstChild().getNextSibling(); Row buttonsR = (Row) publicR.getNextSibling().getNextSibling(); Div buttonsD = (Div) buttonsR.getFirstChild(); Button okB = (Button) buttonsD.getFirstChild(); Button cancelB = (Button) okB.getNextSibling(); Button resetB = (Button) cancelB.getNextSibling(); List<String> domains = this.mainC.getDomains(); this.domainCB = new SelectDynamicListController(domains); this.domainCB.setReference(domains); this.domainCB.setAutodrop(true); this.domainCB.setWidth("85%"); this.domainCB.setHeight("100%"); this.domainCB.setAttribute("hflex", "1"); domainR.appendChild(domainCB); List<String> usernames = this.mainC.getUsers(); SelectDynamicListController ownerCB = new SelectDynamicListController(usernames); ownerCB.setReference(usernames); ownerCB.setAutodrop(true); ownerCB.setWidth("85%"); ownerCB.setHeight("100%"); ownerCB.setAttribute("hflex", "1"); ownerR.appendChild(ownerCB); // set row visibility at creation time nativeTypesR.setVisible(true); versionNameR.setVisible(false); rankingR.setVisible(false); // default values ownerCB.setValue(UserSessionManager.getCurrentUser().getUsername()); Set<String> extensions = formats_ext.keySet(); List<String> sorted = CollectionUtil.asSortedList(extensions); Iterator<String> it = sorted.iterator(); Listitem cbi; while (it.hasNext()) { cbi = new Listitem(); this.nativeTypesLB.appendChild(cbi); cbi.setLabel(formats_ext.get(it.next())); if ("BPMN 2.0".compareTo(cbi.getLabel()) == 0) { cbi.setSelected(true); } } // empty fields reset(); okB.addEventListener( "onClick", new EventListener<Event>() { @Override public void onEvent(final Event event) throws Exception { createProcess(); } }); this.createProcessW.addEventListener( "onOK", new EventListener<Event>() { @Override public void onEvent(final Event event) throws Exception { createProcess(); } }); cancelB.addEventListener( "onClick", new EventListener<Event>() { @Override public void onEvent(final Event event) throws Exception { cancel(); } }); resetB.addEventListener( "onClick", new EventListener<Event>() { @Override public void onEvent(final Event event) throws Exception { reset(); } }); this.createProcessW.doModal(); }
@Override public void render(final Row row, Object object) throws Exception { if (inputfmtcombo != null) { inputRateSelected = inputfmtcombo.getText(); if (!inputRateSelected.contains("VFI_")) inputRateSelected = "VFI_" + inputRateSelected; } final DefaultFormatMapEntries fmtMapEntry = (DefaultFormatMapEntries) object; final Combobox inputFormatCombo = new Combobox(); inputFormatCombo.setReadonly(true); String rateFormat = fmtMapEntry.getRateFormat(); if (rateFormat.contains("VF_")) rateFormat = rateFormat.replaceAll("VF_", ""); inputFormatCombo.setText(rateFormat); rateForamatSelected.add(rateFormat); if (fmtMapEntry.isOnEdit()) inputFormatCombo.setDisabled(true); final Collection<String> comboRateArray = new ArrayList<String>(); if (inputRateSelected.equals("VFI_480i")) { comboRateArray.add(VideoFormatT.findByValue(21).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(22).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(23).toString().replaceAll("VF_", "")); } else { comboRateArray.add(VideoFormatT.findByValue(1).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(2).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(3).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(4).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(5).toString().replaceAll("VF_", "")); } comboRateArray.removeAll(rateForamatSelected); inputFormatCombo.setModel(new ListModelList(comboRateArray)); ComboitemRenderer renderer = new ComboitemRenderer() { @Override public void render(Comboitem item, Object data) throws Exception { String audiotype = data.toString(); item.setLabel(audiotype); } }; inputFormatCombo.setItemRenderer(renderer); inputFormatCombo.addEventListener( Events.ON_OPEN, new EventListener() { public void onEvent(Event event) throws Exception { // inputFormatCombo.getModel().getSize(); comboRateArray.removeAll(rateForamatSelected); inputFormatCombo.setModel(new ListModelList(comboRateArray)); } }); inputFormatCombo.addEventListener( Events.ON_CHANGE, new EventListener() { public void onEvent(Event event) throws Exception { String rateformtname = inputFormatCombo.getText(); if (!rateformtname.contains("VF_")) rateformtname = "VF_" + rateformtname; fmtMapEntry.setRateFormat(rateformtname); System.out.println("......." + rateForamatSelected + rateformtname); rateForamatSelected.add(inputFormatCombo.getText()); inputFormatCombo.setDisabled(true); } }); inputFormatCombo.setParent(row); final Intbox bitrateIntBox = new Intbox(); bitrateIntBox.setMaxlength(5); bitrateIntBox.setConstraint(new IntValueConstraint()); bitrateIntBox.setText(fmtMapEntry.getBitRate()); bitrateIntBox.addEventListener( Events.ON_CHANGE, new EventListener() { public void onEvent(Event event) throws Exception { try { fmtMapEntry.setBitRate(bitrateIntBox.getText()); } catch (Exception e) { e.printStackTrace(); } } }); bitrateIntBox.setParent(row); final Button cancelBtn = new Button(); cancelBtn.setSclass("check_off"); cancelBtn.setTooltiptext("Delete"); cancelBtn.addEventListener( Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { if (row.getGrid().getListModel().getSize() > 1) { removeRow(row); } else { Messagebox.show( "Sorry,You will not be able to delete this row.!", "Aereo", Messagebox.OK, Messagebox.INFORMATION); } } }); cancelBtn.setParent(row); }
public ProcessMergeController( MainController mainC, Map<ProcessSummaryType, List<VersionSummaryType>> selectedProcessVersions) throws SuspendNotAllowedException, InterruptedException, ExceptionAllUsers, ExceptionDomains { this.mainC = mainC; this.processMergeW = (Window) Executions.createComponents("macros/processmerge.zul", null, null); this.processMergeW.setTitle("Merge processes."); Row processNameR = (Row) this.processMergeW.getFellow("mergednamep"); this.processNameT = (Textbox) processNameR.getFirstChild().getNextSibling(); Row versionNameR = (Row) this.processMergeW.getFellow("mergednamev"); this.versionNameT = (Textbox) versionNameR.getFirstChild().getNextSibling(); this.versionNameT.setValue(Constants.INITIAL_VERSION); Row mergeDomainR = (Row) this.processMergeW.getFellow("mergeddomainR"); List<String> domains = this.mainC.getDomains(); this.domainCB = new SelectDynamicListController(domains); this.domainCB.setReference(domains); this.domainCB.setAutodrop(true); this.domainCB.setWidth("85%"); this.domainCB.setHeight("100%"); this.domainCB.setAttribute("hflex", "1"); mergeDomainR.appendChild(domainCB); Row removeEntR = (Row) this.processMergeW.getFellow("removeEnt"); Row makePubicR = (Row) this.processMergeW.getFellow("makePublic"); Row algoChoiceR = (Row) this.processMergeW.getFellow("mergeAlgoChoice"); this.OKbutton = (Button) this.processMergeW.getFellow("mergeOKButton"); Button cancelButton = (Button) this.processMergeW.getFellow("mergeCancelButton"); this.selectedProcessVersions = selectedProcessVersions; this.removeEnt = (Checkbox) removeEntR.getFirstChild().getNextSibling(); this.makePublic = (Checkbox) makePubicR.getFirstChild().getNextSibling(); this.mergethreshold = (Row) this.processMergeW.getFellow("mergethreshold"); this.labelthreshold = (Row) this.processMergeW.getFellow("labelthreshold"); this.contextthreshold = (Row) this.processMergeW.getFellow("contextthreshold"); this.skipeweight = (Row) this.processMergeW.getFellow("skipeweight"); this.skipnweight = (Row) this.processMergeW.getFellow("skipnweight"); this.subnweight = (Row) this.processMergeW.getFellow("subnweight"); this.algosLB = (Listbox) algoChoiceR.getFirstChild().getNextSibling(); Listitem listItem = new Listitem(); listItem.setLabel("Greedy"); this.algosLB.appendChild(listItem); listItem.setSelected(true); listItem = new Listitem(); listItem.setLabel("Hungarian"); this.algosLB.appendChild(listItem); updateActions(); this.processNameT.addEventListener( "onChange", new EventListener<Event>() { public void onEvent(Event event) throws Exception { updateActions(); } }); this.versionNameT.addEventListener( "onChange", new EventListener<Event>() { public void onEvent(Event event) throws Exception { updateActions(); } }); this.algosLB.addEventListener( "onSelect", new EventListener<Event>() { public void onEvent(Event event) throws Exception { updateActions(); } }); this.OKbutton.addEventListener( "onClick", new EventListener<Event>() { public void onEvent(Event event) throws Exception { mergeProcesses(); } }); this.OKbutton.addEventListener( "onOK", new EventListener<Event>() { public void onEvent(Event event) throws Exception { mergeProcesses(); } }); cancelButton.addEventListener( "onClick", new EventListener<Event>() { public void onEvent(Event event) throws Exception { cancel(); } }); this.processMergeW.doModal(); }
/** Creates the components..<br> */ private void createComponents() { /** * !! Windows as NameSpaceContainer to prevent not unique id's error from other dashboard module * buttons or other used components. */ Window win = new Window(); win.setBorder("none"); win.setParent(this); Groupbox gb = new Groupbox(); gb.setMold("3d"); gb.setClosable(false); gb.setParent(win); Caption cap = new Caption(); cap.setImage("/images/icons/new_icons_10.gif"); cap.setLabel(Labels.getLabel("common.Application.History")); cap.setStyle("padding: 0px;"); cap.setParent(gb); // Buttons Toolbar/Timer Div div = new Div(); div.setSclass("z-toolbar"); div.setStyle("padding: 0px"); div.setParent(cap); Hbox hbox = new Hbox(); hbox.setPack("stretch"); hbox.setSclass("hboxRemoveWhiteStrips"); hbox.setWidth("100%"); hbox.setParent(div); Toolbar toolbarRight = new Toolbar(); toolbarRight.setAlign("end"); toolbarRight.setStyle("float:right; border-style: none;"); toolbarRight.setParent(hbox); Hbox hboxBtn = new Hbox(); hboxBtn.setSclass("hboxRemoveWhiteStrips"); hboxBtn.setWidth("100%"); hboxBtn.setParent(toolbarRight); // Paging paging = new Paging(); // paging.setParent(hboxBtn); // paging.setDetailed(true); if (isTimerControl()) { Button btnTimer = new Button(); btnTimer.setId("btnTimer"); btnTimer.setHeight("22px"); btnTimer.setImage("/images/icons/clock1_16x16.gif"); // convert to seconds int seconds = (int) Math.round(getDelay() / 1000); if (seconds > 60) { // convert to minutes and set localization to minutes int minutes = (int) Math.round((getDelay() / 1000) / 60); btnTimer.setTooltiptext( Labels.getLabel("btnTimer.tooltiptext") + " " + minutes + " " + Labels.getLabel("common.Minutes")); } else // set localization to seconds btnTimer.setTooltiptext( Labels.getLabel("btnTimer.tooltiptext") + " " + seconds + " " + Labels.getLabel("common.Seconds")); btnTimer.addEventListener("onClick", new BtnClickListener()); btnTimer.setParent(hboxBtn); } Button btnRefresh = new Button(); btnRefresh.setId("btnRefresh"); btnRefresh.setHeight("22px"); btnRefresh.setLabel("!"); btnRefresh.setTooltiptext(Labels.getLabel("btnRefresh.tooltiptext")); btnRefresh.addEventListener("onClick", new BtnClickListener()); btnRefresh.setParent(hboxBtn); // END Buttons Toolbar/Timer // body Borderlayout bl = new Borderlayout(); bl.setHeight(getModulHeight() + "px"); bl.setParent(gb); Center ct = new Center(); ct.setSclass("FDCenterNoBorder"); ct.setStyle("background-color: white"); ct.setFlex(true); ct.setParent(bl); // Listbox listbox = new Listbox(); listbox.setStyle("border: none;"); listbox.setHeight("100%"); listbox.setVisible(true); listbox.setParent(ct); listbox.setItemRenderer(new ItemRenderer()); Listhead listhead = new Listhead(); listhead.setParent(listbox); Listheader listheader1 = new Listheader(); listheader1.setWidth("100px"); listheader1.setHeight("0px"); listheader1.setParent(listhead); Listheader listheader2 = new Listheader(); listheader2.setWidth("100%"); listheader1.setHeight("0px"); listheader2.setParent(listhead); doReadData(); }
private void initList() { // incList List<GenericListHeaderType> header = new LinkedList<GenericListHeaderType>(); header.add( new GenericListHeaderType( Labels.getLabel("common.code"), 0, "", true, "String", true, true, false, false)); header.add( new GenericListHeaderType( Labels.getLabel("common.relation"), 130, "", true, "String", true, true, false, false)); header.add( new GenericListHeaderType( Labels.getLabel("common.code"), 0, "", true, "String", true, true, false, false)); List<GenericListRowType> dataList = new LinkedList<GenericListRowType>(); /*for (MetadataParameter meta : valueSet.getMetadataParameters()) { GenericListRowType row = createRowFromMetadataParameter(meta); dataList.add(row); }*/ // Liste initialisieren Include inc = (Include) getFellow("incList"); Window winGenericList = (Window) inc.getFellow("winGenericList"); genericList = (GenericList) winGenericList; // genericList.setUserDefinedId("1"); genericList.setListActions(this); genericList.setButton_new(false); genericList.setButton_edit(false); genericList.setButton_delete(true); genericList.setListHeader(header); genericList.setDataList(dataList); genericList.removeCustomButtons(); Button buttonAuto = new Button( Labels.getLabel("common.automatic") + "...", "/rsc/img/design/automatic_16x16.png"); buttonAuto.addEventListener( Events.ON_CLICK, new EventListener<Event>() { public void onEvent(Event t) throws Exception { automaticAssociations(); } }); buttonAuto.setAttribute("disabled", false); buttonAuto.setAttribute("right", true); genericList.addCustomButton(buttonAuto); Button button = new Button(Labels.getLabel("common.save"), "/rsc/img/design/save_16x16.png"); button.addEventListener( Events.ON_CLICK, new EventListener<Event>() { public void onEvent(Event t) throws Exception { saveAssociations(); } }); button.setAttribute("disabled", false); button.setAttribute("right", true); genericList.addCustomButton(button); }
@SuppressWarnings("unchecked") public void carregaInterface() { Vbox candidatos = new Vbox(); candidatos.setParent(this); new Label("Disponíveis:").setParent(candidatos); lbDisponiveis.setParent(candidatos); lbDisponiveis.setHeight("300px"); lbDisponiveis.setRows(10); lbDisponiveis.setMultiple(true); lbDisponiveis.appendChild(defineCabecalho()); botoes.setSpacing("15px"); botoes.setAlign("center"); botoes.setPack("center"); botoes.setParent(this); btSelecionaTodos.setParent(botoes); btSelecionaTodos.setLabel(">>"); btSelecionaTodos.addEventListener( "onClick", new EventListener() { @Override public void onEvent(Event arg0) throws Exception { List<Listitem> itens = new ArrayList<Listitem>(); itens.addAll(lbDisponiveis.getItems()); for (Listitem listitem : itens) { listitem.setParent(lbSelecionados); } } }); btSelecionaUm.setParent(botoes); btSelecionaUm.setLabel(">"); btSelecionaUm.addEventListener( "onClick", new EventListener() { @Override public void onEvent(Event arg0) throws Exception { List<Listitem> itens = new ArrayList<Listitem>(); itens.addAll(lbDisponiveis.getSelectedItems()); for (Listitem listitem : itens) { listitem.setParent(lbSelecionados); } } }); btRemoveUm.setParent(botoes); btRemoveUm.setLabel("<"); btRemoveUm.addEventListener( "onClick", new EventListener() { @Override public void onEvent(Event arg0) throws Exception { List<Listitem> itens = new ArrayList<Listitem>(); itens.addAll(lbSelecionados.getSelectedItems()); for (Listitem listitem : itens) { listitem.setParent(lbDisponiveis); } } }); btRemoveTodos.setParent(botoes); btRemoveTodos.setLabel("<<"); btRemoveTodos.addEventListener( "onClick", new EventListener() { @Override public void onEvent(Event arg0) throws Exception { List<Listitem> itens = new ArrayList<Listitem>(); itens.addAll(lbSelecionados.getItems()); for (Listitem listitem : itens) { listitem.setParent(lbDisponiveis); } } }); Vbox selecionados = new Vbox(); selecionados.setParent(this); new Label("Selecionados:").setParent(selecionados); lbSelecionados.setParent(selecionados); lbSelecionados.setHeight("300px"); lbSelecionados.setMultiple(true); lbSelecionados.appendChild(defineCabecalho()); preencheListbox(); }