|
What this is
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is Forte for Java, Community Edition. The Initial
* Developer of the Original Code is Sun Microsystems, Inc. Portions
* Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.mdrxml.looks;
import java.util.Collection;
import java.util.Iterator;
import org.netbeans.api.looks.*;
import org.netbeans.spi.looks.*;
import org.netbeans.api.mdr.*;
import org.openide.util.NbBundle;
import xmlmodel.TextNode;
/**
*
* @author Tomas Zezula
*/
public class TextNodeLook extends ElementNodeLook {
private static final String ICON = "org/netbeans/modules/mdrxml/resources/textNode";
/** Creates a new instance of TextNodeLook */
public TextNodeLook() {
super(NbBundle.getMessage(TextNodeLook.class, "TXT_TextNodeLook"));
}
/** Overrides NodeLook.getName to truncate the
* string, if its lengt is greater than 20 chars.
*/
public String getName(Look.NodeSubstitute substitute) {
try {
String result = ((TextNode)substitute.getRepresentedObject()).getName();
if (result == null)
result = ""; // NoI18N
if (result.length() > 20)
result = result.substring(0,20)+ "...";
return result;
}catch (javax.jmi.reflect.InvalidObjectException ioe) {
return new String();
}
}
public String iconBase(Look.NodeSubstitute substitute) {
return ICON;
}
}
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.