当前位置: 首页>>代码示例>>Java>>正文


Java Tree类代码示例

本文整理汇总了Java中com.vaadin.ui.Tree的典型用法代码示例。如果您正苦于以下问题:Java Tree类的具体用法?Java Tree怎么用?Java Tree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Tree类属于com.vaadin.ui包,在下文中一共展示了Tree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getView

import com.vaadin.ui.Tree; //导入依赖的package包/类
@Override
public Component getView(final WidgetContext widgetContext) {
	
	Tree tree = new Tree("Services", new FilterableHierarchicalContainer(new NCSServiceContainer(m_ncsComponentRepository)));
	tree.setMultiSelect(true);
	tree.setImmediate(true);
	tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);
	tree.setItemCaptionPropertyId("name");
	tree.addListener(new ValueChangeListener() {
		
		@Override
		public void valueChange(ValueChangeEvent event) {
			Collection<Long> selectedIds = (Collection<Long>) event.getProperty().getValue();
			
			Criteria criteria = NCSEdgeProvider.createCriteria(selectedIds);
			
			widgetContext.getGraphContainer().setCriteria(criteria);
		}
	});
	
	return tree;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:23,代码来源:NCSViewContribution.java

示例2: createOrganizationTree

import com.vaadin.ui.Tree; //导入依赖的package包/类
private Tree createOrganizationTree(Organization organization) {		        
	Tree organizationTree = new Tree();	
	organizationTree.setImmediate(false);
	organizationTree.setWidth("100.0%");
	organizationTree.setHeight("100.0%");
	organizationTree.setContainerDataSource(createDataSource(organization));
	organizationTree.setItemIconPropertyId("icon");
	organizationTree.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
	organizationTree.setItemCaptionPropertyId("description");
	
	// Expand all items that can be
       for (Object itemId: organizationTree.getItemIds())
       	organizationTree.expandItem(itemId);
       
       organizationTree.setData(organization);
       organizationTree.addActionHandler(this);
       
	return organizationTree;
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:20,代码来源:OrganizationView.java

示例3: getTabByOrganization

import com.vaadin.ui.Tree; //导入依赖的package包/类
private Tab getTabByOrganization(Organization organization) {
	@SuppressWarnings("rawtypes")
	Iterator itr = tabSheetOrganization.getComponentIterator();
	
	while(itr.hasNext()) {
	    Component cmp = (Component) itr.next();
	    Tree treeSelected = (Tree) cmp;
	    Organization organizationSelected = (Organization)treeSelected.getData();
	    
	    if (organizationSelected.equals(organization))
	    	return tabSheetOrganization.getTab(cmp);
	    
	} 

	return null;
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:17,代码来源:OrganizationView.java

示例4: setAsTreeContextMenu

import com.vaadin.ui.Tree; //导入依赖的package包/类
@Override
public void setAsTreeContextMenu(final Tree tree)
{
	this.tree = tree;
	extend(tree);
	setOpenAutomatically(false);

	tree.addContextClickListener(new ContextClickListener()
	{
		private static final long serialVersionUID = 1L;

		@Override
		public void contextClick(ContextClickEvent event)
		{
			if (event.getButton() == MouseButton.RIGHT)
			{
				openContext((TreeContextClickEvent) event);
				open(event.getClientX(), event.getClientY());
			}
		}
	});

}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:24,代码来源:TreeContextMenu.java

示例5: WebWidgetsTree

import com.vaadin.ui.Tree; //导入依赖的package包/类
public WebWidgetsTree() {
    component = new CubaWidgetsTree();
    component.setSelectable(false);
    component.setImmediate(true);
    component.setBeforePaintListener(() -> {
        Tree.ItemStyleGenerator generator = component.getItemStyleGenerator();
        if (generator instanceof WebAbstractTree.StyleGeneratorAdapter) {
            //noinspection unchecked
            ((StyleGeneratorAdapter) generator).resetExceptionHandledFlag();
        }
    });

    initComponent(component);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:WebWidgetsTree.java

示例6: buildMainLayout

import com.vaadin.ui.Tree; //导入依赖的package包/类
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// comboBox
	comboBox = new ComboBox();
	comboBox.setImmediate(false);
	comboBox.setWidth("-1px");
	comboBox.setHeight("-1px");
	mainLayout.addComponent(comboBox);
	
	// treeExpression
	treeExpression = new Tree();
	treeExpression.setImmediate(false);
	treeExpression.setWidth("100.0%");
	treeExpression.setHeight("-1px");
	mainLayout.addComponent(treeExpression);
	mainLayout.setExpandRatio(treeExpression, 1.0f);
	
	return mainLayout;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:32,代码来源:ExpressionEditorWindow.java

示例7: initView

import com.vaadin.ui.Tree; //导入依赖的package包/类
private void initView() {
	this.loadingSign = new ProgressBar();
	this.loadingSign.setIndeterminate(true);
	this.loadingSign.setId("loadingSign");
	Label title = new Label("Available models");
	title.setId("label_availableModels");
	addComponent(title);
	
	this.availableModelsTree = new Tree();
	this.availableModelsTree.setId("tree_availableModels");
	this.availableModelsTree.setWidth(30, Unit.EM);
	Tree tree = availableModelsTree;
       tree.addContainerProperty(CAPTION_PROPERTY, String.class, "");
       tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
       tree.setItemCaptionPropertyId(CAPTION_PROPERTY);
	this.buttonStartSession = new Button("Start");
	this.buttonStartSession.setId("button_start");
	this.buttonStartSession.addClickListener(new Button.ClickListener() {
		public void buttonClick(ClickEvent event) {
			String selectedModelPath = (String) tree.getValue();
			if(selectedModelPath.endsWith(".wtspec4m")) {
				startSession(selectedModelPath);
			} 
		}
	});
	addComponent(this.buttonStartSession);
	addComponent(this.loadingSign);

	Panel treeViewContainer = new Panel();
	treeViewContainer.setId("panel_treeViewContainer");
	treeViewContainer.setContent(this.availableModelsTree);
	addComponent(treeViewContainer);
}
 
开发者ID:FTSRG,项目名称:mondo-collab-framework,代码行数:34,代码来源:StartNewSessionPage.java

示例8: createTree

import com.vaadin.ui.Tree; //导入依赖的package包/类
private Tree createTree() {
    
    Tree tree = new Tree("Vertices");
    tree.setContainerDataSource(m_graphContainer.getVertexContainer());
    
    tree.setImmediate(true);
    
    for (Iterator<?> it = tree.rootItemIds().iterator(); it.hasNext();) {
        tree.expandItemsRecursively(it.next());
    }
    return tree;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:13,代码来源:TopologyWidgetTestApplication.java

示例9: withDataProvider

import com.vaadin.ui.Tree; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public default THIS withDataProvider(DataProvider<ITEM, ?> dataProvider) {
    ((Tree<ITEM>) this).setDataProvider(dataProvider);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:7,代码来源:FluentTree.java

示例10: ClassFeatureList

import com.vaadin.ui.Tree; //导入依赖的package包/类
public ClassFeatureList(Character character) {
    
    // class features
    FHorizontalLayout classFeatureLayout = new FHorizontalLayout().withFullWidth();
    Panel classFeaturePanel = new Panel("Dons de classe", classFeatureLayout);
    
    Tree<ClassFeature> classfeatureTree = new Tree<ClassFeature>();
    classfeatureTree.setItems(ClassUtil.getAllRootCharacterClassFeatures(character), ClassFeature::getChildren);
    classFeatureLayout.addComponent(classfeatureTree);
    
    DSLabel classFeatureDescription = new DSLabel();
    classFeatureLayout.addComponent(classFeatureDescription);
    classfeatureTree.addItemClickListener(event -> {
        if (event.getItem() != null) {
            classFeatureDescription.setValue(event.getItem().getDescription());
        } else {
            classFeatureDescription.setValue("");
        }
    });
    addComponent(classFeaturePanel);

    // feats
    if (!character.getFeats().isEmpty()) {
        FHorizontalLayout featLayout = new FHorizontalLayout().withFullWidth();
        Panel featPanel = new Panel("Dons", featLayout);
        Tree<Feat> featTree = new Tree<Feat>();
        featTree.setItems(character.getFeats());
        featLayout.addComponent(featTree);

        DSLabel featDescription = new DSLabel();
        featLayout.addComponent(featDescription);
        featTree.addItemClickListener(event -> {
            if (event.getItem() != null) {
                featDescription.setValue(event.getItem().getDescription());
            } else {
                featDescription.setValue("");
            }
        });
        addComponent(featPanel);
    }

}
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:43,代码来源:ClassFeatureList.java

示例11: createSelectComponent

import com.vaadin.ui.Tree; //导入依赖的package包/类
@Override
protected AbstractSelect createSelectComponent() {
  Tree tree = createTree();
  tree.setSizeFull();
  return tree;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:7,代码来源:AbstractTreePage.java

示例12: buildVerticalLayout_1

import com.vaadin.ui.Tree; //导入依赖的package包/类
@AutoGenerated
private VerticalLayout buildVerticalLayout_1() {
    // common part: create layout
    verticalLayout_1 = new VerticalLayout();
    verticalLayout_1.setImmediate(false);
    verticalLayout_1.setWidth("100.0%");
    verticalLayout_1.setHeight("-1px");
    verticalLayout_1.setMargin(true);
    verticalLayout_1.setSpacing(true);

    // label_4
    label_4 = new Label();
    label_4.setImmediate(false);
    label_4.setWidth("-1px");
    label_4.setHeight("-1px");
    label_4.setValue("Data Tree:");
    verticalLayout_1.addComponent(label_4);

    // dataTree
    dataTree = new Tree();
    dataTree.setImmediate(false);
    dataTree.setWidth("-1px");
    dataTree.setHeight("-1px");
    verticalLayout_1.addComponent(dataTree);

    // label_5
    label_5 = new Label();
    label_5.setImmediate(false);
    label_5.setWidth("-1px");
    label_5.setHeight("-1px");
    label_5.setValue("Sessions:");
    verticalLayout_1.addComponent(label_5);

    // sessionTree
    sessionTree = new Tree();
    sessionTree.setImmediate(false);
    sessionTree.setWidth("-1px");
    sessionTree.setHeight("-1px");
    verticalLayout_1.addComponent(sessionTree);

    return verticalLayout_1;
}
 
开发者ID:alenca,项目名称:zklogtool,代码行数:43,代码来源:SnapshotView.java

示例13: MibCompilerPanel

import com.vaadin.ui.Tree; //导入依赖的package包/类
/**
 * Instantiates a new MIB tree panel.
 *
 * @param dataCollectionDao the OpenNMS Data Collection Configuration DAO 
 * @param eventsDao the OpenNMS Events Configuration DAO
 * @param eventsProxy the OpenNMS Events Proxy
 * @param mibParser the MIB parser
 * @param logger the logger
 */
public MibCompilerPanel(final DataCollectionConfigDao dataCollectionDao, final EventConfDao eventsDao, final EventProxy eventsProxy, final MibParser mibParser, final Logger logger) {
    super("MIB Compiler");

    if (dataCollectionDao == null)
        throw new RuntimeException("dataCollectionDao cannot be null.");
    if (eventsProxy == null)
        throw new RuntimeException("eventProxy cannot be null.");
    if (eventsDao == null)
        throw new RuntimeException("eventsDao cannot be null.");

    this.eventsDao = eventsDao;
    this.eventsProxy = eventsProxy;
    this.dataCollectionDao = dataCollectionDao;

    logger.info("Reading MIBs from " + MIBS_ROOT_DIR);

    // Make sure MIB directories exist

    if (!MIBS_COMPILED_DIR.exists()) {
        if (!MIBS_COMPILED_DIR.mkdirs()) {
            throw new RuntimeException("Unable to create directory for compiled MIBs (" + MIBS_COMPILED_DIR + ")");
        }
    }
    if (!MIBS_PENDING_DIR.exists()) {
        if (!MIBS_PENDING_DIR.mkdirs()) {
            throw new RuntimeException("Unable to create directory for pending MIBs (" + MIBS_PENDING_DIR + ")");
        }
    }

    // Parser Configuration

    this.mibParser = mibParser;
    mibParser.setMibDirectory(MIBS_COMPILED_DIR);

    // Initialize Toolbar

    MibUploadButton upload = new MibUploadButton(MIBS_PENDING_DIR, MIBS_COMPILED_DIR, logger) {
        public void uploadHandler(String filename) {
            addTreeItem(filename, PENDING);
        }
    };
    addComponent(upload);

    // Initialize MIB Tree

    mibsTree = new Tree("MIB Tree");
    initMibTree(logger);
    final Label label = new Label("<p>Use the right-click context menu over the MIB tree files, to display the compiler operations.</p>");
    label.setContentMode(Label.CONTENT_XHTML);
    addComponent(label);
    addComponent(mibsTree);

    // Panel Setup

    setSizeFull();
    addStyleName(Runo.PANEL_LIGHT);
    ((VerticalLayout) getContent()).setComponentAlignment(upload, Alignment.TOP_RIGHT);
    ((VerticalLayout) getContent()).setExpandRatio(mibsTree, 1);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:69,代码来源:MibCompilerPanel.java

示例14: initTree

import com.vaadin.ui.Tree; //导入依赖的package包/类
private void initTree() {
	this.setSizeFull();
	this.setImmediate(true);
	this.setSelectable(true);
	this.addItemClickListener(this);
	this.addContainerProperty("", String.class, null);
	this.addContainerProperty(ACTIONS, HorizontalLayout.class, null	);
	this.addItem(new Object[] {TOOL, getActionLayout(false, false, TOOL)}, TOOL);
	this.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
		private static final long serialVersionUID = -1913286695570843896L;

		@Override
		public String generateDescription(Component source, Object itemId,
				Object propertyId) {
			String description = "Show all ";
			if(itemId.equals(TOOL))
				description += "elements";
			else if (itemId.equals(INPUTS))
				description += "inputs";
			else if (itemId.equals(OUTPUTS))
				description += "outputs";
			else if (itemId.equals(PARAMETERS))
				description += "parameters";
			else
				return null;
			return description;
		}
	});
	this.setCollapsed(TOOL, false);
	String[] rootToolElements = new String[] {INPUTS, OUTPUTS, PARAMETERS};
	for(String element : rootToolElements) {
		this.addItem(new Object[] {element, getActionLayout(true, false, element)}, element);
		this.setParent(element, TOOL);
		this.setCollapsed(element, false);
	}
	this.setDragMode(TableDragMode.ROW);
	this.setDropHandler(new DropHandler() {
		private static final long serialVersionUID = -4415321436294383112L;

		@Override
		public AcceptCriterion getAcceptCriterion() {
			return new Or(Tree.TargetItemAllowsChildren.get(), new Not(VerticalLocationIs.MIDDLE));
		}
		
		@Override
		public void drop(DragAndDropEvent event) {
            final Transferable t = event.getTransferable();
            if (t.getSourceComponent() != TreeToolEditor.this
                    || !(t instanceof DataBoundTransferable)) {
                return;
            }

            final AbstractSelectTargetDetails dropData = ((AbstractSelectTargetDetails) event.getTargetDetails());

            final Object sourceItemId = ((DataBoundTransferable) t).getItemId();
            final Object targetItemId = dropData.getItemIdOver();
            final VerticalDropLocation location = dropData.getDropLocation();

            moveNode(sourceItemId, targetItemId, location);
		}
	});

}
 
开发者ID:chipster,项目名称:chipster,代码行数:64,代码来源:TreeToolEditor.java

示例15: withCollapseListener

import com.vaadin.ui.Tree; //导入依赖的package包/类
/**
 * Adds a CollapseListener to this Tree.
 *
 * @see CollapseEvent
 *
 * @param listener
 *            the listener to add
 * @return this for method chaining
 * @see Tree#addCollapseListener(CollapseEvent.CollapseListener)
 */
@SuppressWarnings("unchecked")
public default THIS withCollapseListener(CollapseListener<ITEM> listener) {
    ((Tree<ITEM>) this).addCollapseListener(listener);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:16,代码来源:FluentTree.java


注:本文中的com.vaadin.ui.Tree类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。