當前位置: 首頁>>代碼示例>>Java>>正文


Java Node.getDisplayName方法代碼示例

本文整理匯總了Java中org.openide.nodes.Node.getDisplayName方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.getDisplayName方法的具體用法?Java Node.getDisplayName怎麽用?Java Node.getDisplayName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.nodes.Node的用法示例。


在下文中一共展示了Node.getDisplayName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDisplayName

import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
public String getDisplayName (Object o) {
    Node n = Visualizer.findNode(o);
    String value = n.getDisplayName();
    T leafNode = convertNode(n);
    if (leafNode != null) {
        // do not set selected flag, outline view handles color in its own way
        // instead return fg color in getForeground
        String htmlDisplayName = DiffUtils.getHtmlDisplayName(leafNode, isModified(leafNode), false);
        htmlDisplayName = annotateName(leafNode, htmlDisplayName);
        if (htmlDisplayName != null) {
            value = "<html>" + htmlDisplayName; //NOI18N
        }
    }
    return value;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:FileTreeView.java

示例2: checkNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
private void checkNode (Node n, String name, RequestProcessor rp) {
    // init
    //assertEquals (null, n.getShortDescription ());
    Node[] ns = n.getChildren ().getNodes ();
    waitFinished (rp);
    
    ns = n.getChildren ().getNodes ();
    if (name.length () < 4) {
        assertEquals (name, 3, ns.length);
        checkNode (ns [0], name + "a", rp);
        checkNode (ns [1], name + "b", rp);
        checkNode (ns [2], name + "c", rp);
    } else
        assertEquals (ns.length, 0);
    
    if (name.length () > 0) {
        //assertEquals (name, n.getName ());
        n.getDisplayName ();
        String sd = n.getShortDescription ();
        n.getActions (false);
        waitFinished (rp);
        assertEquals (name, n.getDisplayName ());
        assertEquals (name + "WWW", sd);
        assertEquals (1, n.getActions (false).length);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:BasicTest.java

示例3: htmlDisplayName

import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
 * Builds a HTML display name for this component.
 *
 * @return  the created display name
 * @see  #displayName()
 */
private String htmlDisplayName() {
    if (bundleStructure.getNthEntry(0)==null) {
        bundleStructure.updateEntries();
    }
    final Node node = bundleStructure.getNthEntry(0).getDataObject().getNodeDelegate();
    String displayName = node.getHtmlDisplayName();
    if (displayName != null) {
        if (!displayName.startsWith("<html>")) {                //NOI18N
            displayName = "<html>" + displayName;               //NOI18N
        }
    } else {
        displayName = node.getDisplayName();
    }
    return DataEditorSupport.annotateName(displayName, true, isModified(), false);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:PropertiesOpen.java

示例4: expand

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static String expand(Node n) {
    Node[] kids = n.getChildren().getNodes(true);
    String nm = n.getDisplayName();
    if (kids.length == 0) {
        return nm;
    } else {
        SortedSet<String> under = new TreeSet<String>();
        for (Node kid : kids) {
            under.add(expand(kid));
        }
        StringBuilder b = new StringBuilder(nm).append('{');
        boolean first = true;
        for (String s : under) {
            if (first) {
                first = false;
            } else {
                b.append(' ');
            }
            b.append(s);
        }
        return b.append('}').toString();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:ViewTest.java

示例5: printTree

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static String printTree(Node n) {
    String name = n.getDisplayName();
    if (n.isLeaf()) {
        return name;
    } else {
        List<String> kidNames = new ArrayList<String>();
        for (Node kid : n.getChildren().getNodes(true)) {
            kidNames.add(printTree(kid));
        }
        return name + kidNames;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:PackageViewTest.java

示例6: assertDisplayName

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static void assertDisplayName(FileSystem fs, String message, String path, String label) throws Exception {
    FileObject file = fs.findResource(path);
    assertNotNull("found " + path, file);
    Node n = DataObject.find(file).getNodeDelegate();
    n.getDisplayName();
    BadgingSupport.RP.post(new Runnable() {public void run() {}}).waitFinished();
    assertEquals(message, label, n.getDisplayName());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:LayerUtilsTest.java

示例7: KeyNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
public KeyNode(Node orig, String bundlepath, String codenamebase, InstanceContent content) {
    super(orig, null, new AbstractLookup(content));
    content.add(this);

    disableDelegation(DELEGATE_GET_DISPLAY_NAME | DELEGATE_SET_DISPLAY_NAME
            | DELEGATE_GET_SHORT_DESCRIPTION | DELEGATE_SET_SHORT_DESCRIPTION
            | DELEGATE_GET_ACTIONS);

    this.key = orig.getDisplayName();
    this.bundlepath = bundlepath;
    this.codenamebase = codenamebase;

    cachedDisplayName = null;
    cachedHtmlDisplayName = null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ResourceBundleBrandingPanel.java

示例8: getDisplayName

import org.openide.nodes.Node; //導入方法依賴的package包/類
public String getDisplayName(Object o) {
    Node n = Visualizer.findNode(o);
    if (n == null) {
        throw new IllegalStateException("TreeNode must be VisualizerNode but was: " + o + " of class " + o.getClass().getName());
    }
    String text = n.getHtmlDisplayName();
    if( null == text )
        text = n.getDisplayName();
    return text;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:NodeRenderDataProvider.java

示例9: getDisplayName

import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
public String getDisplayName() {

    String retValue = null;
    DataFolder folder = (DataFolder)getCookie( DataFolder.class );
    if( null != folder ) {
        FileObject fob = folder.getPrimaryFile();
        Object catName = fob.getAttribute( CAT_NAME );
        if (catName instanceof String)
            retValue = catName.toString();
    } 
    if( null == retValue ) {
        retValue = super.getDisplayName();
    }
    // XXX poor impl; should not depend on org.openide.loaders.Bundle#FMT_shadowName:
    if( null != retValue && retValue.indexOf("\u2192") > 0 ) {
        DataShadow shadow = (DataShadow)getCookie( DataShadow.class );
        if( null != shadow ) {
            DataObject dobj = shadow.getOriginal();
            if( null != dobj ) {
                Node origNode = dobj.getNodeDelegate();
                if( null != origNode && null != origNode.getDisplayName() ) {
                    retValue = origNode.getDisplayName();
                }
            }
        }
    }
    return retValue;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:CategoryNode.java

示例10: createNodes

import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Creates nodes for nodes.
 */
@Override
protected Node[] createNodes(Node key) {
    Node n = key;
    String nodeName = n.getDisplayName();
    
    DataObject obj = null;
    DataShadow shadow = n.getCookie(DataShadow.class);
    if (shadow != null) {
        // I need DataNode here to get localized name of the
        // shadow, but without the ugly "(->)" at the end
        DataNode dn = new DataNode(shadow, Children.LEAF);
        nodeName = dn.getDisplayName();
        obj = shadow.getOriginal();
        n = obj.getNodeDelegate();
    }
    
    if (obj == null)
        obj = n.getCookie(DataObject.class);
    
    if (obj != null) {
        if (obj.isTemplate ()) {
            // on normal nodes stop recursion
            return new Node[] { new DataShadowFilterNode (n, Children.LEAF, nodeName) };
        }
    
        if (acceptDataObject (obj)) {
            // on folders use normal filtering
            return new Node[] { new DataShadowFilterNode (n, new DataShadowFilterChildren (n), nodeName) };
        }
    }
    return new Node[] {};
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:TemplateWizard1.java

示例11: testGetDisplayName

import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
 * Test of getDisplayName method, of class org.openide.loaders.InstanceNode.
 */
public void testGetDisplayName () throws Exception {
    Node instance = node;
    
    String expResult = "Ahoj";
    // node's name is calculated later, let's wait
    SwingUtilities.invokeAndWait (new Runnable () {
        public void run () {
            
        }
        
    });
    String result = instance.getDisplayName();
    assertEquals(expResult, result);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:InstanceNodeTest.java

示例12: inspectNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
private void inspectNode(Node n) {
    n.getDisplayName();
    n.getHtmlDisplayName();
    n.getShortDescription();
    n.getIcon(BeanInfo.ICON_COLOR_16x16);
    n.canCopy();
    n.canCut();
    n.canRename();
    n.getNewTypes();
    n.getActions(true);
    n.getPreferredAction();
    inspectProperties(n);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:AsynchronousTest.java

示例13: getDisplayName

import org.openide.nodes.Node; //導入方法依賴的package包/類
public String getDisplayName() {
    String retVal = null;
    DataObject dobj= (DataObject) getCookie (DataObject.class);
    if (dobj != null && dobj instanceof DataShadow) {
        DataShadow dsh = (DataShadow)dobj;
        Node origNode = dsh.getOriginal().getNodeDelegate();
        if (origNode != null) {
            retVal = origNode.getDisplayName();
        }
    }                        
    return (retVal != null) ? retVal : super.getDisplayName();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:SettingChildren.java

示例14: getMVTCDisplayName

import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
 * Returns display name of the multiview top component.
 * The first item of the array is normal display name,
 * the second item of the array is HTML display name.
 *
 * @param formDataObject form data object representing the multiview tc.
 * @return display names of the MVTC. The second item can be <code>null</code>.
 */
private static String[] getMVTCDisplayName(FormDataObject formDataObject) {
    Node node = formDataObject.getNodeDelegate();
    String title = node.getDisplayName();
    String htmlTitle = node.getHtmlDisplayName();
    if (htmlTitle == null) {
        try {
            htmlTitle = XMLUtil.toElementContent(title);
        } catch (CharConversionException x) {
            htmlTitle = "???";
        }
    }
    FormEditorSupport fes = (FormEditorSupport)formDataObject.getFormEditorSupport();
    if (fes != null) {
        FormDesignerTC designerTC = fes.getFormDesignerTC();
        if (designerTC != null && designerTC.isShowing()) {
            FormModel fm = fes.getFormModel();
            if (fm != null) {
                FormDesigner fd = FormEditor.getFormDesigner(fes.getFormModel());
                if (fd != null && fd.getFormModel() != null
                        && !fd.isTopRADComponent() && fd.getTopDesignComponent() != null) {
                    title = FormUtils.getFormattedBundleString(
                            "FMT_FormTitleWithContainerName", // NOI18N
                            new Object[] {title, fd.getTopDesignComponent().getName()});
                    htmlTitle = FormUtils.getFormattedBundleString(
                            "FMT_FormTitleWithContainerName", // NOI18N
                            new Object[] {htmlTitle, fd.getTopDesignComponent().getName()});
                }
            }
        }
    }
    boolean modified = formDataObject.isModified();
    boolean readOnly = readOnly(formDataObject);
    return new String[] {
        DataEditorSupport.annotateName(title, false, modified, readOnly),
        DataEditorSupport.annotateName(htmlTitle, true, modified, readOnly)
    };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:46,代碼來源:FormEditorSupport.java

示例15: performChange

import org.openide.nodes.Node; //導入方法依賴的package包/類
private void performChange(Node [] selectedNodes) {
    String text = "";
    Node projectNode = null;
    if( selectedNodes != null && selectedNodes.length > 0 ) {
        Node selectedNode = selectedNodes[0];
        Node originallySelectedNode = selectedNodes[0];
        Node rootNode = ProjectTab.this.manager.getRootContext();
        while ( selectedNode.getParentNode() != null && !selectedNode.getParentNode().equals(rootNode)) {
            selectedNode = selectedNode.getParentNode();
        }
        projectNode = selectedNode;
        //Tests whether other selected items have same project owner
        if( selectedNodes.length > 1 ) {
            for ( int i = 1; i < selectedNodes.length; i ++) {
                selectedNode = selectedNodes[i];                        
                while ( !selectedNode.getParentNode().equals(rootNode) ) {
                    selectedNode = selectedNode.getParentNode();
                }
                if ( !projectNode.equals(selectedNode) ) {
                    projectNode = null;
                    text = Bundle.MSG_nodes_from_more_projects();
                    break;
                }
            }
        }
        if ( projectNode != null ) {
            ProjectTab.this.btv.showOrHideNodeSelectionProjectPanel(projectNode, originallySelectedNode);
            text = projectNode.getDisplayName();
        }
    } else {
        text = Bundle.MSG_none_node_selected();
    }
    if ( this.actualProjectLabel != null ) {
        this.actualProjectLabel.setText(text);
        setSelectionLabelProperties(projectNode);
    } else {
        this.actualProjectLabel = new JLabel(text);
        setSelectionLabelProperties(projectNode);
        this.selectionsProjectPanel.add(actualProjectLabel);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:42,代碼來源:ProjectTab.java


注:本文中的org.openide.nodes.Node.getDisplayName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。