本文整理匯總了Java中org.openide.nodes.Node.Property方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.Property方法的具體用法?Java Node.Property怎麽用?Java Node.Property使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.nodes.Node
的用法示例。
在下文中一共展示了Node.Property方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: undoEventHandlerRemoval
import org.openide.nodes.Node; //導入方法依賴的package包/類
private void undoEventHandlerRemoval() {
Event event = getComponentEvent();
if (event == null)
return;
getFormModel().getFormEvents().attachEvent(
event,
getEventHandler(),
getEventHandlerContent(),
getEventHandlerAnnotation());
// hack: set the event property to update the property sheet
Node.Property prop = getComponent().getPropertyByName(event.getId());
if (prop != null) {
try {
prop.setValue(getEventHandler());
}
catch (Exception ex) { // should not happen
Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex);
}
}
}
示例2: setSortedByProperty
import org.openide.nodes.Node; //導入方法依賴的package包/類
void setSortedByProperty(Node.Property prop) {
if (sortedByProperty == prop) {
return;
}
sortedByProperty = prop;
if (prop == null) {
rowComparator = null;
} else {
sortedByName = false;
}
sortingChanged();
}
示例3: initializeSheet
import org.openide.nodes.Node; //導入方法依賴的package包/類
public static void initializeSheet(final Properties properties, Sheet s) {
Sheet.Set set1 = Sheet.createPropertiesSet();
set1.setDisplayName("Properties");
for (final Property p : properties) {
Node.Property<String> prop = new Node.Property<String>(String.class) {
@Override
public boolean canRead() {
return true;
}
@Override
public String getValue() throws IllegalAccessException, InvocationTargetException {
return p.getValue();
}
@Override
public boolean canWrite() {
return false;
}
@Override
public void setValue(String arg0) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
properties.setProperty(p.getName(), arg0);
}
};
prop.setName(p.getName());
set1.put(prop);
}
s.put(set1);
}
示例4: undoComponentLayoutChange
import org.openide.nodes.Node; //導入方法依賴的package包/類
private void undoComponentLayoutChange() {
if (getComponent() instanceof RADVisualComponent) {
((RADVisualComponent)getComponent()).getConstraintsProperties();
Node.Property prop =
getComponent().getPropertyByName(getPropertyName());
if (prop != null)
try {
prop.setValue(getOldPropertyValue());
}
catch (Exception ex) { // should not happen
Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex);
}
}
}
示例5: readPropertyExpression
import org.openide.nodes.Node; //導入方法依賴的package包/類
public static void readPropertyExpression(CodeExpression expression,
Node.Property property,
boolean allowChangeFiring)
{
FormProperty fProperty = property instanceof FormProperty ?
(FormProperty) property : null;
if (fProperty != null) {
if (!allowChangeFiring) {
if (fProperty.isChangeFiring())
fProperty.setChangeFiring(false);
else
allowChangeFiring = true; // just not to set firing back
}
Object metaOrigin = expression.getOrigin().getMetaObject();
if (metaOrigin instanceof PropertyEditor)
fProperty.setCurrentEditor((PropertyEditor)metaOrigin);
}
try {
property.setValue(expression.getOrigin().getValue());
}
catch (Exception ex) { // ignore
org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ex);
}
expression.setOrigin(createOrigin(property));
if (fProperty != null && !allowChangeFiring)
fProperty.setChangeFiring(true);
}
示例6: testRestoreDefaultValueBehaviour
import org.openide.nodes.Node; //導入方法依賴的package包/類
public void testRestoreDefaultValueBehaviour() {
System.out.println("testRestoreDefaultValueBehaviour");
Node.Property trueProp = new OldModulePropertyWithSDVReturningTrue();
assertTrue("OldModuleProperty doesn't know about Node.Property.isDefaultValue()" +
" therefore it should be enabled in every case.",
PropUtils.shallBeRDVEnabled(trueProp));
Node.Property falseProp = new PropertyWithSDVReturningFalse();
assertFalse("Property doesn't support default value. It should be " +
"disabled", PropUtils.shallBeRDVEnabled(falseProp));
Node.Property newIDVFalseProp = new BothMethodsOverridedPropertyWithIDSReturningFalse();
assertTrue("Correctly implemented property with isDefaultValue() " +
"returning false should be enable.",
PropUtils.shallBeRDVEnabled(newIDVFalseProp));
Node.Property newIDVTrueProp = new BothMethodsOverridedPropertyWithIDSReturningTrue();
assertFalse("Correctly implemented property with isDefaultValue() " +
"returning true should be disabled.",
PropUtils.shallBeRDVEnabled(newIDVTrueProp));
Node.Property noneOverrided = new DefaultTestProperty();
assertFalse("Correctly implemented property which doesn't override any " +
"of the two method should be disabled",
PropUtils.shallBeRDVEnabled(noneOverrided));
}
示例7: CustomCodeEditor
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Creates new form CustomCodeEditor */
public CustomCodeEditor(Node.Property property, DataObject dataObject) {
initComponents();
codeEditorPane.setContentType("text/x-java"); // NOI18N
try {
codeEditorPane.setText((String) property.getValue());
}
catch (Exception ex) { // ignore - should not happen
ex.printStackTrace();
}
java.util.ResourceBundle bundle =
org.openide.util.NbBundle.getBundle(CustomCodeEditor.class);
jLabel1.setText(bundle.getString("CustomCodeEditor.label1")); // NOI18N
jLabel1.setDisplayedMnemonic(
bundle.getString("CustomCodeEditor.label1.mnemonic").charAt(0)); // NOI18N
jLabel1.setLabelFor(codeEditorPane);
codeEditorPane.getDocument().putProperty(Document.StreamDescriptionProperty, dataObject);
codeEditorPane.setPreferredSize(new java.awt.Dimension(440, 200));
codeEditorPane.requestFocus();
codeEditorPane.getCaret().setVisible(codeEditorPane.hasFocus());
codeEditorPane.getAccessibleContext().setAccessibleDescription(
bundle.getString("ACSD_CustomCodeEditor.label1")); // NOI18N
getAccessibleContext().setAccessibleDescription(
bundle.getString("ACSD_CustomCodeEditor")); // NOI18N
}
示例8: testCreateTheShadow
import org.openide.nodes.Node; //導入方法依賴的package包/類
public void testCreateTheShadow () throws Exception {
DataShadow shade = original.createShadow (folder);
Node node = shade.createNodeDelegate();
final AtomicBoolean modified = new AtomicBoolean();
shade.getPrimaryFile().addFileChangeListener(new FileChangeAdapter() {
@Override
public void fileChanged (FileEvent fe) {
modified.set(true);
}
});
String originName = node.getName();
PropertySet[] props = node.getPropertySets();
Node.Property p = null;
for (PropertySet propSet : props) {
for (Node.Property prop : propSet.getProperties()) {
if ("OriginalName".equals(prop.getName())) {
p = prop;
break;
}
}
}
assertNotNull(p);
// set name to the same value
p.setValue(originName);
// nothing should happen
assertFalse(modified.get());
assertEquals(originName, original.getName());
// set name to the same value
p.setValue(originName + ".txt");
// link should be changed
assertTrue(modified.get());
assertEquals(originName + ".txt", original.getName());
}
示例9: SchemaImportGUI
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Creates new form SchemaPanel */
public SchemaImportGUI(TemplateWizard tw) {
initComponents();
initAccessibility();
this.templateWizard = tw;
registeredNodes = new HashMap();
decorator = new ExternalReferenceDecorator(this);
// View for selecting an external reference.
TreeTableView locationView = new LocationView();
locationView.setDefaultActionAllowed(false);
locationView.setPopupAllowed(false);
locationView.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
locationView.setRootVisible(false);
locationView.getAccessibleContext().setAccessibleName(locationLabel.getToolTipText());
locationView.getAccessibleContext().setAccessibleDescription(locationLabel.getToolTipText());
Node.Property[] columns = new Node.Property[] {
new Column(ExternalReferenceDataNode.PROP_NAME, String.class, true),
new ImportColumn(referenceTypeName()),
//new Column(ExternalReferenceDataNode.PROP_PREFIX, String.class, false),
};
locationView.setProperties(columns);
locationView.setTreePreferredWidth(200);
locationView.setTableColumnPreferredWidth(0, 25);
// locationView.setTableColumnPreferredWidth(1, 25);
locationPanel.add(locationView, BorderLayout.CENTER);
explorerManager = new ExplorerManager();
explorerManager.addPropertyChangeListener(this);
explorerManager.setRootContext(createRootNode());
}
示例10: getBeanName
import org.openide.nodes.Node; //導入方法依賴的package包/類
String getBeanName() {
if (beans != null) {
if ((beans.length == 1) && beans[0] instanceof Node.Property) {
return ((Node.Property) beans[0]).getDisplayName();
}
}
return null;
}
示例11: setupColumns
import org.openide.nodes.Node; //導入方法依賴的package包/類
private void setupColumns() {
Node.Property[] columns = new Node.Property[1];
String columnName = NbBundle.getMessage(ProjectsView.class, "LBL_Path");
String columnDesc = NbBundle.getMessage(ProjectsView.class, "LBL_PathDesc");
columns[0] = new ColumnDescriptor<String>(ProjectNode.PROPERTY_NAME_PATH, String.class, columnName, columnDesc); // NOI18N
setProperties(columns);
}
示例12: getValueFromProperty
import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
* Of the parameter is of type Node.Property this methods
* calls getValue on the property and returns the value.
* If the parameter is something else <code>null</code>
* is returned.
*/
public static Object getValueFromProperty(Object property) {
if (property instanceof Node.Property) {
Node.Property prop = (Node.Property)property;
try {
return prop.getValue();
} catch (Exception x) {
ErrorManager.getDefault().getInstance(
PropertiesRowModel.class.getName()).notify(
ErrorManager.INFORMATIONAL, x);
}
}
return null;
}
示例13: copyPropertyAttrs
import org.openide.nodes.Node; //導入方法依賴的package包/類
private static void copyPropertyAttrs(Node.Property sourceProp, Node.Property targetProp, String[] attrs) {
for (String attr : attrs) {
Object value = sourceProp.getValue(attr);
if (value != null) {
targetProp.setValue(attr, value);
}
}
}
示例14: updateDetailsPanel
import org.openide.nodes.Node; //導入方法依賴的package包/類
private void updateDetailsPanel() {
detailsPanel.removeAll();
if (!showingDetails) {
remove(detailsPanel);
revalidateDetailsPanel();
return;
}
Node[] selN = getExplorerManager().getSelectedNodes();
if ((selN == null) || (selN.length == 0)) {
revalidateDetailsPanel();
return;
}
Node n = selN[0];
if (n == rootNode) {
revalidateDetailsPanel();
return;
}
if (selN.length > 1) {
n = new ProxyNode(selN);
}
// beware - this will function only if the DisplayIndexedNode has
// one property on the first sheet and the property is of type
// ValueProp
Node.Property prop = n.getPropertySets()[0].getProperties()[0];
PropertyPanel p = new PropertyPanel(prop);
p.setPreferences(PropertyPanel.PREF_CUSTOM_EDITOR);
if (isEditorScrollable(p)) {
detailsPanel.add(p, java.awt.BorderLayout.CENTER);
} else {
jScrollPane1.setViewportView(p);
detailsPanel.add(jScrollPane1, java.awt.BorderLayout.CENTER);
}
revalidateDetailsPanel();
}
示例15: attachEnv
import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
* This method is called by the IDE to pass
* the environment to the property editor.
* @param env Environment passed by the ide.
*/
public void attachEnv(PropertyEnv env) {
this.env = env;
// clearing to defaults
directories = true;
files = true;
fileFilter = null;
fileHiding = false;
Object dirs = env.getFeatureDescriptor().getValue(PROPERTY_SHOW_DIRECTORIES);
if (dirs instanceof Boolean) {
directories = ((Boolean)dirs).booleanValue();
} // XXX else if != null, warn
Object fil = env.getFeatureDescriptor().getValue(PROPERTY_SHOW_FILES);
if (fil instanceof Boolean) {
files = ((Boolean)fil).booleanValue();
} // XXX else if != null, warn
Object filter = env.getFeatureDescriptor().getValue(PROPERTY_FILTER);
if (filter instanceof FilenameFilter) {
fileFilter = new DelegatingFilenameFilter((FilenameFilter)filter);
} else if (filter instanceof javax.swing.filechooser.FileFilter) {
fileFilter = (javax.swing.filechooser.FileFilter)filter;
} else if (filter instanceof java.io.FileFilter) {
fileFilter = new DelegatingFileFilter((java.io.FileFilter)filter);
} // XXX else if != null, warn
Object curDir = env.getFeatureDescriptor().getValue(PROPERTY_CURRENT_DIR);
if (curDir instanceof File) {
currentDirectory = (File)curDir;
if(! currentDirectory.isDirectory()) {
Logger.getAnonymousLogger().warning("java.io.File will not accept currentDir=" + currentDirectory); // NOI18N
currentDirectory = null;
}
} // XXX else if != null, warn
Object baseDir = env.getFeatureDescriptor().getValue(PROPERTY_BASE_DIR);
if(baseDir instanceof File) {
baseDirectory = (File)baseDir;
// As baseDir accept only directories in their absolute form.
if(!baseDirectory.isDirectory() || !baseDirectory.isAbsolute()) {
Logger.getAnonymousLogger().warning("java.io.File will not accept baseDir=" + baseDirectory); // NOI18N
baseDirectory = null;
}
} // XXX else if != null, warn
if (files) {
mode = directories ? JFileChooser.FILES_AND_DIRECTORIES :
JFileChooser.FILES_ONLY;
} else {
mode = directories ? JFileChooser.DIRECTORIES_ONLY :
JFileChooser.FILES_AND_DIRECTORIES; // both false, what now? XXX warn
}
Object fileHide = env.getFeatureDescriptor().getValue(PROPERTY_FILE_HIDING);
if (fileHide instanceof Boolean) {
fileHiding = ((Boolean)fileHide).booleanValue();
}
if (env.getFeatureDescriptor() instanceof Node.Property){
Node.Property prop = (Node.Property)env.getFeatureDescriptor();
editable = prop.canWrite();
}
}