-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hey guys,
I generated a tree with java.
/** * Applies the menu filter */ public void filterMenus() { explorerGrid.setVisible(true); menuListbox.setHeight("24px"); explorerTree.setVisible(true); Long regions = (Long)regionFilter.getSelectedItem().getValue(); Long regionId = regions; MenuDMO[] menus = msUtils.getFilteredMenuDefinition(regionId); List<MenuInfoLine> lines = msUtils.getMenuInfoLinesFromMenus(menus); MenuDMO selectedMenu = getSelectedMenu(); if (selectedMenu != null) { for (MenuInfoLine line : lines) { line.setSelected(line.getMenuId() == selectedMenu.getMenuId()); } } setMenus(lines); reloadMenuDefinition(); renderMenuItems(); changeExportLink(); } private void reloadMenuDefinitions() { AnnotateDataBinder binder = (AnnotateDataBinder)menuListbox.getVariable("binder", false); binder.loadAll(); } /** * Returns the selected menuitem * * @return the selected menuitem */ private MenuitemDMO getSelectedMenuitem() { MenuitemDMO retval = null; Treeitem item = explorerTree.getSelectedItem(); if (item != null) { retval = (MenuitemDMO)item.getValue(); } return retval;
<row style="border-width:0px 0px 0px 0px"> <tree id="explorerTree" visible="false" zclass="z-dottree" sclass="ds-dottree" width="100%" fixedLayout="true" style="border:none;"> <treecols sizable="false"> <treecol label="Name" width="45%" /> <treecol label="Von" /> <treecol label="Bis" /> <treecol align="center" label="Priorität" /> </treecols> </tree> </row> </rows> </grid
Now I would like open a popup window by clicking on one item in tree.
How can I do this? Do I have to use java?
thanks for your replies...
I have not tried this, but if You add an "onSelect" event to the tree, directing it to a java method (either in java or in a zscript). In this method You can get the selected item and then create/show a popup:
<zscript> void onSelect() { Treeitem item = tree.getSelectedItem(); my_popup.open(item); } </zscript> <popup id="my_popup"> <label>Clicked!</label> </popup>
It's not working, because the method can't find the id of the popup.
I built the popup with java:
private void openModalWindow(String zulName) { HashMap<String, Object> map = new HashMap<String, Object>(); Window win = (Window)Executions.createComponents(zulName, this, map); ZkUtils.setWindowModal(win); } public void openNewProjectPopup() { openModalWindow("ProjectNew.zul"); }
I think the problem is, because the popup is in a different zul file...
so what can I do now ???
I am not really sure what You want to accomplish here. As I interpret Your code, You do not use a zk-Popup but rather a standard window that You want to show as a modal window?
This should work too, of course, but not what I expected You to be after.
What does Your ProjectNew.zul look like?
@samchuang:
Sorry... I don't unerstand you...
I' using this in window: use="de.home.dip.MC" in the MC.zul
So you mean maybe if I'm doing the same in ProjectNew.zul it'll work ?
never used apply in the window...
@ Rico
yes that's exactly what I mean my popup Window schouldn't look like normal zk-popup
This popup is already working with menubar
MC.zul :
.... <menubar id="menubar" width="100%" style="border:'none'"> <menu label="Projekt" src="images/document.png"> <menupopup> <menuitem label="Neu" onClick="MC.openNewProjectPopup()" src="images/neu.png"/> .....
this is my ProjectNew.zul :
<?page title="ProjectNew" contentType="text/html;charset=UTF-8"?> <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./NeuesProjekt"?> <zk> <window id="NeuesProjekt" title="Neues Projekt" border="normal" closable="true" width="400px" sizable="true" shadow="none"> <tabbox> <tabs> <tab label="test1" /> <tab label="test2" /> </tabs> <tabpanels> <tabpanel> <hbox> <div width="10px" /> <vbox> <div height="40px" /> <hbox> <div width="150px" height="40px"> <label value="Projekt1" /> </div> <textbox width="150px" /> </hbox> <hbox> <div width="150px" height="40px"> <label value="Projekt2" /> </div> <datebox width="133px" /> </hbox> <hbox> <div width="150px" height="40px"> <label value="Projekt3" /> </div> <datebox width="133px" /> </hbox> <hbox> <div width="150px" height="40px"> <label value="Projekt4r" /> </div> <textbox /> </hbox> <hbox> <div width="150px" height="40px"> <label value="Projekt5" /> </div> <checkbox label="hoch" onCheck="doChecked()" /> <checkbox label="mittel" onCheck="doChecked()" /> <checkbox label="gering" onCheck="doChecked()" /> </hbox> <hbox> <div width="150px" height="40px"> <label value="Projekt6" /> </div> <textbox height="100px" multiline="true" width="150px" /> </hbox> <div height="40px" /> </vbox> </hbox> </tabpanel> <tabpanel> <hbox> <div width="10px" /> <vbox> <div height="40px" /> <hbox> <div width="150px" height="40px"> <label value="Projekt1" /> </div> <textbox width="150px" /> </hbox> <hbox> <div width="150px" height="40px"> <label value="Projekt2t" /> </div> <textbox width="150px" /> </hbox> <hbox> <div width="150px" height="40px"> <label value="Projekt3" /> </div> <textbox width="150px" /> </hbox> <hbox> <div width="150px" height="40px"> <label value="Projekt4" /> </div> <vbox> <checkbox label="noch nicht gestartet" onCheck="doChecked()" /> <checkbox label="in Bearbeitung" onCheck="doChecked()" /> <checkbox label="angehalten" onCheck="doChecked()" /> <checkbox label="hinter Zeitrahmen" onCheck="doChecked()" /> <checkbox label="fertig gestellt" onCheck="doChecked()" /> </vbox> </hbox> <div height="40px" /> </vbox> </hbox> </tabpanel> </tabpanels> </tabbox> <toolbar height="40px" mold="panel" align="center"> <button label="Abbrechen" style="align:center" width="50px" /> <button label="Projekt hinzufügen" style="align:center" width="50px" /> </toolbar> </window> </zk>
I know i have read about such a thing here in the forum. I found it !
So, only a hint!
you must give the menupopup a parent in this zul because it not exist this zul page if you not set a parent for it
Here is the thread.
best
Stephan
Asked: 2009-12-21 06:50:17 +0800
Seen: 1,082 times
Last updated: Dec 22 '09