Search in sources :

Example 1 with Treerow

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;
}
Also used : Treecell(org.zkoss.zul.Treecell) Treeitem(org.zkoss.zul.Treeitem) Treerow(org.zkoss.zul.Treerow)

Example 2 with Treerow

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);
            }
        }
    }
//
}
Also used : DropEvent(org.zkoss.zk.ui.event.DropEvent) Treeitem(org.zkoss.zul.Treeitem) Button(org.adempiere.webui.component.Button) Panelchildren(org.zkoss.zul.Panelchildren) Component(org.zkoss.zk.ui.Component) Image(org.zkoss.zul.Image) Treerow(org.zkoss.zul.Treerow)

Example 3 with Treerow

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);
}
Also used : Treecell(org.zkoss.zul.Treecell) Treerow(org.zkoss.zul.Treerow)

Example 4 with Treerow

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);
        }
    }
}
Also used : DropEvent(org.zkoss.zk.ui.event.DropEvent) Treeitem(org.zkoss.zul.Treeitem) ToolBarButton(org.adempiere.webui.component.ToolBarButton) Component(org.zkoss.zk.ui.Component) IOException(java.io.IOException) Treerow(org.zkoss.zul.Treerow)

Example 5 with Treerow

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();
    }
//
}
Also used : Treeitem(org.zkoss.zul.Treeitem) Component(org.zkoss.zk.ui.Component) Treerow(org.zkoss.zul.Treerow)

Aggregations

Treerow (org.zkoss.zul.Treerow)5 Treeitem (org.zkoss.zul.Treeitem)4 Component (org.zkoss.zk.ui.Component)3 DropEvent (org.zkoss.zk.ui.event.DropEvent)2 Treecell (org.zkoss.zul.Treecell)2 IOException (java.io.IOException)1 Button (org.adempiere.webui.component.Button)1 ToolBarButton (org.adempiere.webui.component.ToolBarButton)1 Image (org.zkoss.zul.Image)1 Panelchildren (org.zkoss.zul.Panelchildren)1