本文整理匯總了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;
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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;
}
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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[] {};
}
示例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);
}
示例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);
}
示例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();
}
示例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)
};
}
示例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);
}
}