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


Java Property类代码示例

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


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

示例1: prepareRenderer

import org.openide.nodes.Node.Property; //导入依赖的package包/类
@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
    Component result = super.prepareRenderer(renderer, row, col);

    if ((row < 0) || (row >= getRowCount())) {
        return result;
    }

    Object value = getValueAt(row, col);

    if ((result != null) && value instanceof Property && (col == 1)) {
        result.setEnabled(((Property) value).canWrite());
    }

    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:SheetTable.java

示例2: run

import org.openide.nodes.Node.Property; //导入依赖的package包/类
@Override
public void run() {

    // create panel (implementing ExplorerManager.Provider) with TTV
    MyPanel panel = new MyPanel();
    panel.setLayout(new GridLayout(1, 2));
    ttv = new TreeTableView();
    ttv.setProperties(new Property[]{fakeProp});
    fakeProp = null;
    panel.add(ttv);

    // set root and keep the same root
    panel.setExplorerManagerRoot(root);

    ttv.expandNode(root);

    //cleare property and root
    ttv.setProperties(new Property[0]);
    panel.setExplorerManagerRoot(Node.EMPTY);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TreeTableViewMemoryLeak2Test.java

示例3: setConnectedProperty

import org.openide.nodes.Node.Property; //导入依赖的package包/类
private boolean setConnectedProperty(Property property, 
                                     RADConnectionPropertyEditor.RADConnectionDesignValue value,
                                     String beanName,
                                     org.w3c.dom.Node propNode) {
    if(connectedProperties==null) {
        connectedProperties = new ConnectedProperties();
    }
    int type = value.getType();
    if(type == RADConnectionPropertyEditor.RADConnectionDesignValue.TYPE_PROPERTY ||
       type == RADConnectionPropertyEditor.RADConnectionDesignValue.TYPE_METHOD ||
       (type == RADConnectionPropertyEditor.RADConnectionDesignValue.TYPE_BEAN && value.getDesignValue() == FormDesignValue.IGNORED_VALUE)) // Issue 155654
    {    
        // makes sense only for PROPERTY, and METHOD type ...                    
        connectedProperties.put(property, value, beanName, propNode);        
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:GandalfPersistenceManager.java

示例4: loadBeanProperty

import org.openide.nodes.Node.Property; //导入依赖的package包/类
private void loadBeanProperty(BeanPropertyEditor beanPropertyEditor, org.w3c.dom.Node valueNode)
           throws PersistenceException {	
if(beanPropertyEditor.valueIsBeanProperty()) {
    org.w3c.dom.NodeList children = valueNode.getChildNodes();	
    Node.Property[] allBeanProperties = beanPropertyEditor.getProperties();
    org.w3c.dom.Node node;		
    FormProperty prop;

    for (int i=0; i<children.getLength(); i++) {
	node = children.item(i);	  
	if (node != null && node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) { 
	    prop = (FormProperty) getPropertyOfName(allBeanProperties, getAttribute(node, ATTR_PROPERTY_NAME));
	    if(prop != null) {
		loadProperty(node, null, prop);								
	    }	    
	}	  
    }		    
}	
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:GandalfPersistenceManager.java

示例5: setProperties

import org.openide.nodes.Node.Property; //导入依赖的package包/类
/** Set columns.
 * @param props each column is constructed from Node.Property
 */
public void setProperties(Property[] props) {
    tableModel.setProperties(props);
    treeColumnProperty.setProperty(tableModel.propertyForColumn(-1));

    if (treeColumnProperty.isComparable() || tableModel.existsComparableColumn()) {
        setAllowSortingByColumn(true);

        if (treeColumnProperty.isSortingColumn()) {
            getSortedNodeTreeModel().setSortedByName(true, !treeColumnProperty.isSortOrderDescending());
        } else {
            int index = tableModel.getSortingColumn();

            if (index != -1) {
                getSortedNodeTreeModel().setSortedByProperty(
                    tableModel.propertyForColumnEx(index), !tableModel.isSortOrderDescending()
                );
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:TreeTableView.java

示例6: getPropertyFor

import org.openide.nodes.Node.Property; //导入依赖的package包/类
/** Returns node property if found in nodes property sets. Could be overriden to
 * return property which is not in nodes property sets.
 * @param node represents single row
 * @param prop represents column
 * @return nodes property
 */
protected Property getPropertyFor(Node node, Property prop) {
    Node.PropertySet[] propSets = node.getPropertySets();

    for (int i = 0; i < propSets.length; i++) {
        Node.Property[] props = propSets[i].getProperties();

        for (int j = 0; j < props.length; j++) {
            if (prop.equals(props[j])) {
                return props[j];
            }
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:NodeTableModel.java

示例7: testBadBean

import org.openide.nodes.Node.Property; //导入依赖的package包/类
/** Regression test to reproduce bug #21858. */
public void testBadBean() throws Exception {

    BeanNode bn = new BeanNode( new BadBeanHidden() );
    Node.PropertySet ps[] = bn.getPropertySets();
    
    try {
        for (int i = 0; i < ps.length; i++) {
             Set<Property> props = new HashSet<Property>( 
                Arrays.asList(ps[i].getProperties()));
        }
    }
    catch ( NullPointerException e ) {
        assertTrue( "The NullPointerException thrown", false );
    }
    
    assertTrue( true );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:BeanNodeBug21285.java

示例8: removePropertyColumn

import org.openide.nodes.Node.Property; //导入依赖的package包/类
/**
 * Remove the first property column for properties named <code>name</code>
 * @param name The <i>programmatic</i> name of the Property, i.e. the
 * return value of <code>Property.getName()</code>
 *
 * @return true if a column was removed
 * @since 6.25
 */
public final boolean removePropertyColumn(String name) {
    Parameters.notNull("name", name); //NOI18N
    Property[] props = rowModel.getProperties();
    List<Property> nue = new LinkedList<Property>(Arrays.asList(props));
    boolean found = false;
    for (Iterator<Property> i=nue.iterator(); i.hasNext();) {
        Property p = i.next();
        if (name.equals(p.getName())) {
            found = true;
            i.remove();
            break;
        }
    }
    if (found) {
        props = nue.toArray(new Property[props.length - 1]);
        setProperties (props, false);
    }
    return found;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:OutlineView.java

示例9: createProperty

import org.openide.nodes.Node.Property; //导入依赖的package包/类
/**
 * Creates a node property of the given key (same as the column keys)
 * and specific getter/setter methods on the given object.
 *
 * @param  key     property name (same as matching column).
 * @param  type    Class of the property (e.g. String.class).
 * @param  inst    object on which to reflect.
 * @param  getter  name of getter method for property value.
 * @param  setter  name of setter method for property value (may be null).
 * @return  new property.
 */
private Node.Property createProperty(String key, Class type, Object inst,
        String getter, String setter) {
    Property prop = null;
    try {
        prop = new Reflection(inst, type, getter, setter);
        prop.setName(key);
        prop.setDisplayName(NbBundle.getMessage(
                ExternalReferenceDataNode.class,
                "CTL_SchemaPanel_Column_Name_" + key));
        prop.setShortDescription(NbBundle.getMessage(
                ExternalReferenceDataNode.class,
                "CTL_SchemaPanel_Column_Desc_" + key));
    }  catch (NoSuchMethodException nsme) {
        ErrorManager.getDefault().notify(nsme);
    }
    return prop;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ExternalReferenceDataNode.java

示例10: getTableCellEditorComponent

import org.openide.nodes.Node.Property; //导入依赖的package包/类
/** Returns editor of property.
 * @param table
 * @param value
 * @param isSelected
 * @param r row
 * @param c column
 * @return <code>PropertyPanel</code>
 */
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int r, int c) {
    prop = (Property) value;
    node = tableModel.nodeForRow(r);
    node.addPropertyChangeListener(this);
    tableModel.addTableModelListener(this);

    // create property panel
    PropertyPanel propPanel = getEditor(prop, node);

    propPanel.setBackground(table.getSelectionBackground());
    propPanel.setForeground(table.getSelectionForeground());

    //Fix for 35534, text shifts when editing.  Maybe better fix possible
    //in EditablePropertyDisplayer or InplaceEditorFactory.
    propPanel.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, table.getSelectionBackground()));

    return propPanel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:TableSheetCell.java

示例11: getTableCellEditorComponent

import org.openide.nodes.Node.Property; //导入依赖的package包/类
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    Component result = null;

    //since you can't change the model, no worries
    SheetTable stb = (SheetTable) table;
    lastUpdateSuccess = true;

    //fetch the property from the set model
    Property p = (Property) stb.getSheetModel().getPropertySetModel().getFeatureDescriptor(row);

    result = getEditorComponent(
            p, this, table.getForeground(), table.getBackground(), table.getSelectionBackground(),
            table.getSelectionForeground()
        );

    if (result instanceof ButtonPanel) {
        ((ButtonPanel) result).setButtonAction(stb.getCustomEditorAction());
    }

    if (result != null) {
        result.setFont(stb.getFont());
    }

    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:SheetCellEditor.java

示例12: compare

import org.openide.nodes.Node.Property; //导入依赖的package包/类
@Override
public int compare(Node.Property l, Node.Property r) {

    Class t1 = l.getValueType();
    Class t2 = r.getValueType();
    String s1 = (t1 != null) ? t1.getName() : ""; //NOI18N
    String s2 = (t2 != null) ? t2.getName() : ""; //NOI18N

    int s = s1.compareToIgnoreCase(s2);

    if (s != 0) {
        return s;
    }

    s1 = l.getDisplayName();
    s2 = r.getDisplayName();

    return s1.compareToIgnoreCase(s2);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PropUtils.java

示例13: createSheet

import org.openide.nodes.Node.Property; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    sheet.put(set);

    try {
        Property nameProp = new PropertySupport.Reflection<String>(getDataNode(), String.class, "getName", "setName");
        nameProp.setName(CompetenceElement.caName);
        nameProp.setDisplayName("Name of competence atom");
        
        Property retriesProp = new PropertySupport.Reflection<Integer>(getDataNode(), Integer.class, "getRetries", "setRetries");
        retriesProp.setName(CompetenceElement.caRetries);
        retriesProp.setDisplayName("Number of retries");

        Property commentProp = new PropertySupport.Reflection<String>(getDataNode(), String.class, "getComment", "setComment");
        commentProp.setName(CompetenceElement.caComment);
        commentProp.setDisplayName("Comment");

        set.put(new Property[]{nameProp, retriesProp, commentProp});
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }
    return sheet;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:26,代码来源:SimpleCompetenceElementWidget.java

示例14: shallBeRDVEnabled

import org.openide.nodes.Node.Property; //导入依赖的package包/类
/**
 * Returns if the "Restore Default Value" action should be enabled for the
 * given <code>Node.Property</code>. If the properties is not null, is
 * instanceof Node.Property, supportsDefaultValue() and isDefaultValue()
 * returns true the property shall be enabled. Otherwise not.
 * <p>
 * Note that due to the backward compatibilty we return true also for
 * properties which only override Node.Property.supportsDefaultValue() to
 * return true and don't override Node.Property.isDefaultValue(). The
 * isDefaultValue() return false by default.<br>
 * For more information and detailed reason why we do so see
 * <a href="http://www.netbeans.org/issues/show_bug.cgi?id=51907">
 * Issue 51907</a>.
 */
static boolean shallBeRDVEnabled(Node.Property property) {
    if ((property == null) || !property.supportsDefaultValue()) {
        return false;
    }

    try {
        if (property.getClass().getMethod("isDefaultValue").getDeclaringClass() == Node.Property.class) {
            // if the given property didn't override isDefaultValue method
            // but override supportsDefaultValue the RDV should be always
            // enabled
            return true;
        } else {
            return !property.isDefaultValue();
        }
    } catch (NoSuchMethodException e) {
        // cannot happen since isDefaultValue is defined in Node.Property
        assert false : "No isDefaultValue in " + property.getClass() + ": " + e;

        return true; // satisfy compiler for case when assertion is disabled
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:PropUtils.java

示例15: createSheet

import org.openide.nodes.Node.Property; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    sheet.put(set);

    try {
        Property nameProp = new PropertySupport.Reflection<String>(apNode, String.class, "getNodeName", "setNodeName");
        nameProp.setName(ActionPattern.apName);
        nameProp.setDisplayName("Name of action pattern");

        Property commentProp = new PropertySupport.Reflection<String>(apNode, String.class, "getNodeComment", "setNodeComment");
        commentProp.setName(ActionPattern.apComment);
        commentProp.setDisplayName("Comment about node");
        commentProp.setShortDescription("It is difficult to keep track about what part of POSH plan does what and that is where comments come in.");

        set.put(new Property[]{nameProp, commentProp});
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }
    return sheet;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:23,代码来源:SimpleRoleActionPatternWidget.java


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