use of org.zkoss.zul.Treerow in project spatial-portal by AtlasOfLivingAustralia.
the class PortalEvent method getTarget.
/**
* Get the treeItem marked as target in the event
*
* @param event
* @return
*/
protected Treeitem getTarget(Event event) {
Treecell treecell = (Treecell) event.getTarget();
Treerow treerow;
Treeitem target = null;
if (treecell != null) {
treerow = (Treerow) treecell.getParent();
if (treerow != null) {
target = (Treeitem) treerow.getParent();
}
}
return target;
}
use of org.zkoss.zul.Treerow in project adempiere by adempiere.
the class DPFavourites method onEvent.
public void onEvent(Event event) {
Component comp = event.getTarget();
String eventName = event.getName();
if (eventName.equals(Events.ON_CLICK)) {
if (comp instanceof Button) {
Button btn = (Button) comp;
int menuId = 0;
try {
menuId = Integer.valueOf(btn.getName());
} catch (NumberFormatException e) {
}
if (menuId > 0)
SessionManager.getAppDesktop().onMenuSelected(menuId);
}
} else // Elaine 2008/07/24
if (eventName.equals(Events.ON_DROP)) {
DropEvent de = (DropEvent) event;
Component dragged = de.getDragged();
if (comp instanceof Panelchildren) {
if (dragged instanceof Treerow) {
Treerow treerow = (Treerow) dragged;
Treeitem treeitem = (Treeitem) treerow.getParent();
addItem(treeitem);
}
} else if (comp instanceof Image) {
if (dragged instanceof Button) {
Button btn = (Button) dragged;
removeLink(btn);
}
}
}
//
}
use of org.zkoss.zul.Treerow in project adempiere by adempiere.
the class SimpleTreeModel method render.
/**
* @param ti
* @param node
*/
public void render(Treeitem ti, Object node, int index) {
Treecell tc = new Treecell(Objects.toString(node));
Treerow tr = null;
if (ti.getTreerow() == null) {
tr = new Treerow();
tr.setParent(ti);
if (isItemDraggable()) {
tr.setDraggable("true");
}
if (!onDropListners.isEmpty()) {
tr.setDroppable("true");
tr.addEventListener(Events.ON_DROP, this);
}
} else {
tr = ti.getTreerow();
tr.getChildren().clear();
}
tc.setParent(tr);
ti.setValue(node);
}
use of org.zkoss.zul.Treerow in project adempiere by adempiere.
the class NavBarDesktop method onEvent.
public void onEvent(Event event) {
Component comp = event.getTarget();
String eventName = event.getName();
if (eventName.equals(Events.ON_CLICK)) {
if (comp instanceof ToolBarButton) {
ToolBarButton btn = (ToolBarButton) comp;
int menuId = 0;
try {
menuId = Integer.valueOf(btn.getName());
} catch (Exception e) {
}
if (menuId > 0)
onMenuSelected(menuId);
}
} else if (eventName.equals(Events.ON_DROP)) {
DropEvent de = (DropEvent) event;
Component dragged = de.getDragged();
if (dragged instanceof Treerow) {
Treerow treerow = (Treerow) dragged;
Treeitem treeitem = (Treeitem) treerow.getParent();
favPanel.addItem(treeitem);
}
}
}
use of org.zkoss.zul.Treerow in project adempiere by adempiere.
the class MenuPanel method onEvent.
public void onEvent(Event event) {
Component comp = event.getTarget();
String eventName = event.getName();
if (eventName.equals(Events.ON_CLICK)) {
if (comp instanceof Treerow) {
Treeitem selectedItem = (Treeitem) comp.getParent();
if (selectedItem.getValue() != null) {
fireMenuSelectedEvent(selectedItem);
} else {
selectedItem.setOpen(!selectedItem.isOpen());
}
}
} else // Elaine 2009/02/27 - expand tree
if (eventName.equals(Events.ON_CHECK) && event.getTarget() == chkExpand) {
expandOnCheck();
}
//
}
Aggregations