本文整理汇总了Java中org.zkoss.zul.Treeitem类的典型用法代码示例。如果您正苦于以下问题:Java Treeitem类的具体用法?Java Treeitem怎么用?Java Treeitem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Treeitem类属于org.zkoss.zul包,在下文中一共展示了Treeitem类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCorrespondingCanvasComponent
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
/**
* Retrieves the selected Treeitem and
* returns the corresponding Component
* from the Canvas.
* @return The corresponding canvas component
*/
public Component getCorrespondingCanvasComponent(Treeitem item)
{
if (item == null)
return null;
// get the Canvas component's Id, by removig the prefix
// 'id_' from the Treeitem Id
String sComponentId = ((DesignerTreeItem)item).getComponentId();
// get the corresponding Component from the canvas
DesignerCanvas canvas = developer.getDesignerCanvas();
Component selectedComponent = canvas.getCanvasComponent(sComponentId);
// return the component from the canvas
return selectedComponent;
}
示例2: onEvent
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
@Override
public void onEvent(MouseEvent evnt) throws Exception {
Treeitem item = (Treeitem) evnt.getTarget();
final DBConnection dbc = (DBConnection) item.getValue();
final AddConnectionDialog dialog = new AddConnectionDialog(dbc);
developer.getDesigner().appendChild(dialog);
dialog.addEventListener(Events.ON_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event arg0) throws Exception {
if (dialog.getSelectedAction() == AddConnectionDialog.DD_OK) {
dbc.setClassName(dialog.getClassName());
dbc.setConnectionString(dialog.getConnectionString());
ConfigLoader.getInstance().getDBConnections().update(dbc);
}
}
});
dialog.doModal();
}
示例3: render
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
/**
* Renderiza nodo.
*/
public void render(final Treeitem item, final Object data, final int index) {
final Object pt = ((TreeNode) data).getData();
UnidadAdministrativa ua = (UnidadAdministrativa) pt;
item.setValue(data);
final Treerow tr = new Treerow();
tr.setParent(item);
item.appendChild(tr);
item.setOpen(ua.getCodigoPadre() == null);
tr.appendChild(new Treecell(ua.getDescripcion()));
}
示例4: btnEditFormXML_onClick
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
/**
* Edit xml form definitions
* @throws UnsupportedEncodingException
*/
private void btnEditFormXML_onClick() throws UnsupportedEncodingException {
final Treeitem selected = trModelTree.getSelectedItem();
if (selected != null) {
Object value = selected.getValue();
// Check selected item type
if (value instanceof FormTreeNode) {
final Form frm = (Form) ((FormTreeNode)value).getForm();
final ExpandWindow dialog = new ExpandWindow();
dialog.setMode(CodeMirror.XML);
dialog.setText(StringEscapeUtils.escapeXml10(beautyHTML(frm.getView())));
dialog.addEventListener(Events.ON_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event arg0) throws Exception {
if (dialog.getSelectedAction() == ExpandWindow.DD_OK) {
frm.setView(beautyHTML(dialog.getText()));
ConfigLoader.getInstance().getForms().update(frm);
}
}
});
this.appendChild(dialog);
dialog.doModal();
}
}
}
示例5: getSelectedTable
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
/**
* Get the selected table
* @return The selected table or null
*/
public TableTreeNode getSelectedTable() {
Treeitem item = trModelTree.getSelectedItem();
if (item == null)
return null;
Object val = item.getValue();
if (val == null)
return null;
if(val instanceof TableTreeNode) {
return (TableTreeNode) val;
}
return null;
}
示例6: getSelectedComponent
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
/**
* Retrieves the selected Treeitem and
* returns the corresponding Component
* from the Canvas.
* @return The corresponding canvas component
*/
public Component getSelectedComponent()
{
// get the selected Treeitem
Treeitem selectedItem = getTree().getSelectedItem();
if (selectedItem == null)
return null;
// get the corresponding Component from the canvas
Component selectedComponent = getCorrespondingCanvasComponent(selectedItem);
// return the component from the canvas
return selectedComponent;
}
示例7: onEvent
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
@Override
public void onEvent(MouseEvent evnt) throws Exception {
Treeitem item = (Treeitem) evnt.getTarget();
FormTreeNode node = (FormTreeNode) item.getValue();
Form form = node.getForm();
developer.FormTreeNode_onDoubleClick(form);
}
示例8: onEvent
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
@Override
public void onEvent(MouseEvent evnt) throws Exception {
Treeitem item = (Treeitem) evnt.getTarget();
MenuTreeNode node = (MenuTreeNode) item.getValue();
Object menu = node.getMenu();
developer.MenuTreeNode_onDoubleClick(menu);
}
示例9: render
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
@Override
public void render(Treeitem item, Object data, int index) throws Exception {
Treerow treerow = new Treerow();
if (data instanceof String)
renderValue(treerow, (String) data);
else if (data instanceof FieldValue)
renderField(treerow, (FieldValue) data);
else if (data instanceof FieldValueItem)
renderValue(treerow, (FieldValueItem) data);
treerow.setParent(item);
}
示例10: render
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
public void render(final Treeitem item, final Object data, final int index) {
final Object pt = ((TreeNode) data).getData();
item.setValue(data);
final Treerow tr = new Treerow();
tr.setParent(item);
item.appendChild(tr);
item.setOpen(true);
NodoArbolVersionTramite nodo = (NodoArbolVersionTramite) pt;
switch (nodo.getTipo()) {
case PROPIEDADES_VERSION:
tr.appendChild(new Treecell(Labels.getLabel("tree.propiedades")));
break;
case CONTROL_ACCESO:
tr.appendChild(new Treecell(Labels.getLabel("tree.controlAcceso")));
break;
case MENSAJES_VALIDACION:
tr.appendChild(new Treecell(Labels.getLabel("tree.mensajes")));
break;
case LISTA_PASOS:
tr.appendChild(new Treecell(Labels.getLabel("tree.pasos")));
break;
case DEBE_SABER:
tr.appendChild(new Treecell(Labels.getLabel("tree.pasoDebeSaber")));
break;
case RELLENAR:
tr.appendChild(new Treecell(Labels.getLabel("tree.pasoRellenar")));
break;
case FORMULARIO:
tr.appendChild(new Treecell(getDescripcionDocumento(nodo.getIdentificador())));
break;
case ANEXAR:
tr.appendChild(new Treecell(Labels.getLabel("tree.pasoAnexar")));
break;
case ANEXO:
tr.appendChild(new Treecell(getDescripcionDocumento(nodo.getIdentificador())));
break;
case PAGAR:
tr.appendChild(new Treecell(Labels.getLabel("tree.pasoPagar")));
break;
case PAGO:
tr.appendChild(new Treecell(getDescripcionDocumento(nodo.getIdentificador())));
break;
case REGISTRAR:
tr.appendChild(new Treecell(Labels.getLabel("tree.pasoRegistrar")));
break;
}
}
示例11: onEvent
import org.zkoss.zul.Treeitem; //导入依赖的package包/类
@Override
public void onEvent(DropEvent event) throws Exception {
if (developer.getCurrentForm() == null) {
Messagebox.show("Create or open form first.");
}
try {
tree = developer.getDesignerTree();
if (tree == null)
return;
canvas = developer.getDesignerCanvas();
// get the selected component from the Canvas
selectedComponent = tree.getSelectedComponent();
// check the type of dragged item
/*** Dragged: New component --> Target: Tree ***/
if (event.getDragged() instanceof IElementDesc)
{
// insert the selected toolkit Component
// into the canvas model
addComponentToModel(event);
return;
}
/*** Dragged: Treerow --> Target: Treerow ***/
if (event.getDragged() instanceof Treeitem)
{
// move the dragged component to the new position
// display the 'Move Component' dialog
final MoveItemDialog wndMove = new MoveItemDialog();
final DropEvent dropEvent = event;
developer.getDesigner().appendChild(wndMove);
wndMove.addEventListener(Events.ON_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event evnt) throws Exception {
// TODO Auto-generated method stub
// get the selected move type
int nMoveType = wndMove.getSelectedMove();
moveComponent(dropEvent, nMoveType);
}
});
// display it as modal
wndMove.doModal();
return;
}
}
catch (Exception e) {
e.printStackTrace();
}
}