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


Java Property.getValue方法代码示例

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


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

示例1: setShowCustomEditorButton

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
public final void setShowCustomEditorButton(boolean val) {
    //If the property descriptor explicitly says it does not
    //want a custom editor button, this overrides anything set on
    //the PropertyPanel.
    if (getProperty() != null) {
        Property p = getProperty();
        Boolean explicit = (Boolean) p.getValue("suppressCustomEditor"); //NOI18N

        if (explicit != null) {
            val = explicit.booleanValue();
            System.err.println("Found explicit value: " + val);
        }
    }

    if (showCustomEditorButton != val) {
        showCustomEditorButton = val;
        replaceInner();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:EditorPropertyDisplayer.java

示例2: setToolTip

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
private void setToolTip(Component renderer, Property<?> property)
        throws IllegalAccessException, InvocationTargetException {
    if (renderer instanceof JLabel) {
        Object val = property.getValue();
        if (val != null) {
            ((JLabel) renderer).setToolTipText(val.toString());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ResultsOutlineCellRenderer.java

示例3: isComparableColumnEx

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
/**
 * If true, column property should be comparable - allows sorting
 * @param column Index to the array of all properties
 */
boolean isComparableColumnEx(int column) {
    Property p = allPropertyColumns[column].getProperty();
    Object o = p.getValue(ATTR_COMPARABLE_COLUMN);

    if ((o != null) && o instanceof Boolean) {
        return ((Boolean) o).booleanValue();
    }

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

示例4: isSortingColumnEx

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
/**
 * If true, column is currently used for sorting
 * @param Index to the array of all properties (the column may not be visible)
 */
boolean isSortingColumnEx(int column) {
    Property p = allPropertyColumns[column].getProperty();
    Object o = p.getValue(ATTR_SORTING_COLUMN);

    if ((o != null) && o instanceof Boolean) {
        return ((Boolean) o).booleanValue();
    }

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

示例5: isSortOrderDescending

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
boolean isSortOrderDescending() {
    if (sortColumn == -1) {
        return false;
    }

    Property p = allPropertyColumns[sortColumn].getProperty();
    Object o = p.getValue(ATTR_DESCENDING_ORDER);

    if ((o != null) && o instanceof Boolean) {
        return ((Boolean) o).booleanValue();
    }

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

示例6: isVisible

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
/** Helper method to ask if column representing a property should be
 * visible
 */
private boolean isVisible(Property p) {
    Object o = p.getValue(ATTR_INVISIBLE);

    if ((o != null) && o instanceof Boolean) {
        return !((Boolean) o).booleanValue();
    }

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

示例7: getDisplayNameWithMnemonic

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
String getDisplayNameWithMnemonic( Property p ) {
    String res = null;
    Object displayNameWithMnemonic = p.getValue(ATTR_DISPLAY_NAME_WITH_MNEMONIC);
    if( null !=displayNameWithMnemonic && displayNameWithMnemonic.toString().length() > 0 ) {
        res = displayNameWithMnemonic.toString();
    } else {
        res = p.getDisplayName();
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NodeTableModel.java

示例8: makeAccessibleCheckBox

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
void makeAccessibleCheckBox(JCheckBox box, Property p) {
    box.getAccessibleContext().setAccessibleName(p.getDisplayName());
    box.getAccessibleContext().setAccessibleDescription(p.getShortDescription());

    Object mnemonicChar = p.getValue(ATTR_MNEMONIC_CHAR);

    if ((null != mnemonicChar) && (mnemonicChar.toString().length() > 0)) {
        box.setMnemonic(mnemonicChar.toString().charAt(0));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NodeTableModel.java

示例9: updateEdFromProp

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
/** Update a property editor from a Node.Property, such that the
 * value in the property editor will reflect the value of the property */
private static void updateEdFromProp(Property p, PropertyEditor ed, String title)
throws ProxyNode.DifferentValuesException, IllegalAccessException, InvocationTargetException {
    Object newValue = p.getValue();

    //IZ 44152, monstrous length strings from the debugger - skip the
    //equality test and blindly assign
    if (newValue instanceof String && (((String) newValue).length() > 2048)) {
        ed.setValue(newValue);

        return;
    }

    Object oldValue = ed.getValue();

    if ((newValue == null) && (oldValue == null)) {
        return;
    }

    // test if newValue is not equal to oldValue
    if (((newValue != null) && !newValue.equals(oldValue)) || ((newValue == null) && (oldValue != null))) {
        // <RAVE>
        // #5050567 Kind of mysterious livelock experienced here.
        // When updating arrays.
        // The question is whether the setter of the bean has to check if the value
        // is equal and not fire property change.. or is if the responsibility
        // is also here.
        if (
            oldValue instanceof Object[] && newValue instanceof Object[] &&
                Arrays.equals((Object[]) oldValue, (Object[]) newValue)
        ) {
            return;
        }

        // </RAVE>
        ed.setValue(newValue);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:PropUtils.java

示例10: isCellEditable

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
/**Overridden to do the assorted black magic by which one determines if
 * a property is editable */
@Override
public boolean isCellEditable(int row, int column) {
    if (column == 0) {
        return null != getCustomEditor( row );
    }

    FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(row);
    boolean result;

    if (fd instanceof PropertySet) {
        result = false;
    } else {
        Property p = (Property) fd;
        result = p.canWrite();

        if (result) {
            Object val = p.getValue("canEditAsText"); //NOI18N

            if (val != null) {
                result &= Boolean.TRUE.equals(val);
                if( !result ) {
                    //#227661 - combo box editor should be allowed to show its popup
                    PropertyEditor ped = PropUtils.getPropertyEditor(p);
                    result |= ped.getTags() != null;
                }
            }
        }
    }

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

示例11: getDisplayNameWithMnemonic

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
String getDisplayNameWithMnemonic( Property p ) {
    String res;
    Object displayNameWithMnemonic = p.getValue(ATTR_DISPLAY_NAME_WITH_MNEMONIC);
    if( null !=displayNameWithMnemonic && displayNameWithMnemonic.toString().length() > 0 ) {
        res = displayNameWithMnemonic.toString();
    } else {
        res = p.getDisplayName();
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NodeTableModel.java

示例12: getDisplayValue

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
String getDisplayValue(Property<?> p) throws IllegalAccessException,
        InvocationTargetException {
    Object value = p.getValue();
    return value != null ? value.toString() : ""; // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ResultsOutlineCellRenderer.java

示例13: getPropertyEditor

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
/** Gets a property editor appropriate to the property.
 *  This method centralizes all code for fetching property editors
 *  used by the property sheet, such that future alternative
 *  registration systems for property editors may be easily
 *  implemented.
 *  <P><strong>Note:</strong>  This method will return a property
 *  editor with the value of the property already assigned.  Client
 *  code need not set the value in the property editor unless it
 *  should be changed, as this can result in unnecessary event
 *  firing.
 */
static PropertyEditor getPropertyEditor(Property p, boolean updateEditor) {
    PropertyEditor result = p.getPropertyEditor();

    //XXX Next few lines replicate a hack in the original property sheet.
    //Correct solution is to move IndexedPropertyEditor & custom editor
    //to the Nodes package and just return an instance from
    //IndexedProperty.getPropertyEditor.  Appears to be here due to some
    //kind of dependancy avoidance.
    if (p instanceof Node.IndexedProperty && (result == null)) {
        result = new IndexedPropertyEditor();

        // indexed property editor does not want to fire immediately
        p.setValue(PropertyEnv.PROP_CHANGE_IMMEDIATE, Boolean.FALSE);
    }

    if (result == null) {
        result = getPropertyEditor(p.getValueType()); //XXX is this agood idea?
    }

    //handle a type with no registered property editor here
    if (result == null) {
        java.util.List<String> missing = getMissing();
        String type = p.getValueType().getName();

        if (!(missing.contains(type))) {
            Logger.getAnonymousLogger().fine(
                "No property editor registered for type " + type
            ); //NOI18N
            missing.add(type);
        }

        result = new NoPropertyEditorEditor();
    } else if (p.canRead()) {
        try {
            try {
                try {
                    if (
                        ((p.getValueType() == Boolean.class) || (p.getValueType() == Boolean.TYPE)) &&
                            (p.getValue() == null)
                    ) {
                        // Allows Module folder nodes that use null to 
                        // indicate indeterminate state to work
                        result = new Boolean3WayEditor();
                    }

                    if (updateEditor || null == result.getValue()) {
                        updateEdFromProp(p, result, p.getDisplayName());
                    }
                } catch (ProxyNode.DifferentValuesException dve) {
                    if ((p.getValueType() == Boolean.class) || (p.getValueType() == Boolean.TYPE)) {
                        result = new Boolean3WayEditor();
                    } else {
                         if(result instanceof ExPropertyEditor)
                             result = new ExDifferentValuesEditor(result);
                         else
                             result = new DifferentValuesEditor(result);
                    }
                }
            } catch (IllegalAccessException iae) {
                throw (IllegalStateException) new IllegalStateException("Error getting property value").initCause(iae);
            }
        } catch (InvocationTargetException ite) {
            throw (IllegalStateException) new IllegalStateException("Error getting property value").initCause(ite);
        }
    }

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

示例14: checkEditBoolean

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
/** In the case that an edit request is made on a boolean checkbox property, an
 *  edit request should simply toggle its state without instantiating a custom
 *  editor component.  Returns true if the state was toggled, in which case the
 *  editor instantiation portion of editCellAt() should be aborted  */
boolean checkEditBoolean(int row) {
    FeatureDescriptor fd = getSheetModel().getPropertySetModel().getFeatureDescriptor(row);

    if (fd != null && fd.getValue("stringValues") != null) {
        return false; //NOI18N
    }

    Property p = (fd instanceof Property) ? (Property) fd : null;

    if (p != null) {
        Class c = p.getValueType();

        //only do this if the property is supplying no special values for
        //the tags - if it is, we are using the radio button renderer
        if ((c == Boolean.class) || (c == boolean.class)) {
            if (!isCellEditable(row, 1)) {
                return true;
            }

            //Okay, try to toggle it
            try {
                Boolean b = null;

                //get the current value
                try {
                    Object value = p.getValue();
                    if( value instanceof Boolean ) {
                        b = (Boolean) value;
                    } else {
                        //150048 - somebody has sneaked in a wrong value
                        return false;
                    }
                } catch (ProxyNode.DifferentValuesException dve) {
                    //If we're represeting conflicting multi-selected 
                    //properties, we'll make them both true when we toggle
                    b = Boolean.FALSE;
                }

                if (isEditing()) {
                    removeEditor();
                }

                changeSelection(row, 1, false, false);

                //Toggle the value
                Boolean newValue = ((b == null) || Boolean.FALSE.equals(b)) ? Boolean.TRUE : Boolean.FALSE;
                p.setValue(newValue);

                //Force an event so we'll repaint
                /*
                tableChanged(new TableModelEvent (getSheetModel(), row,
                    row, 1, TableModelEvent.UPDATE));
                 */
                paintRow(row);

                return true;
            } catch (Exception ex) {
                //Something wrong, log it
                Exceptions.printStackTrace(ex);
            }
        }
    }

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

示例15: getRenderer

import org.openide.nodes.Node.Property; //导入方法依赖的package包/类
/** Get a renderer component appropriate to a given property */
public JComponent getRenderer(Property prop) {
    mdl.setProperty(prop);
    env.reset();

    PropertyEditor editor = preparePropertyEditor(mdl, env);

    if (editor instanceof ExceptionPropertyEditor) {
        return getExceptionRenderer((Exception) editor.getValue());
    }

    JComponent result = null;

    try {
        if (editor.isPaintable()) {
            result = prepareString(editor, env);
        } else {
            Class c = mdl.getPropertyType();

            if ((c == Boolean.class) || (c == boolean.class)) {
                //Special handling for hinting for org.netbeans.beaninfo.BoolEditor
                boolean useRadioRenderer = useRadioBoolean ||
                    (env.getFeatureDescriptor().getValue("stringValues") != null); //NOI18N

                if (useRadioRenderer) {
                    result = prepareRadioButtons(editor, env);
                } else {
                    result = prepareCheckbox(editor, env);
                }
            } else if (editor.getTags() != null) {
                String[] s = editor.getTags();
                boolean editAsText = Boolean.TRUE.equals(prop.getValue("canEditAsText"));

                if ((s.length <= radioButtonMax) && !editAsText) {
                    result = prepareRadioButtons(editor, env);
                } else {
                    result = prepareCombobox(editor, env);
                }
            } else {
                result = prepareString(editor, env);
            }
        }

        if ((result != radioRenderer) && (result != textFieldRenderer)) {
            if ((result != checkboxRenderer) && tableUI && !(result instanceof JComboBox)) {
                result.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
            } else if ((result instanceof JComboBox) && tableUI) {
                result.setBorder(BorderFactory.createEmptyBorder());
            } else if (!(result instanceof JComboBox) && (!(result instanceof JCheckBox))) {
                result.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
            }
        }
    } catch (Exception e) {
        result = getExceptionRenderer(e);
        Logger.getLogger(RendererFactory.class.getName()).log(Level.WARNING, null, e);
    }

    result.setEnabled(prop.canWrite());

    boolean propRequestsSuppressButton = Boolean.TRUE.equals(prop.getValue("suppressCustomEditor")); //NOI18N

    if (
        !(result instanceof JLabel) &&
            ((env.getState() == env.STATE_INVALID) || (prop.getValue("valueIcon") != null))
    ) { //NOI18N
        result = prepareIconPanel(editor, env, (InplaceEditor) result);
    }

    /* If we need a custom editor button, embed the resulting component in
     an instance of ButtonPanel and return that */
    if (
        editor.supportsCustomEditor() && !PropUtils.noCustomButtons && !suppressButton &&
            !propRequestsSuppressButton
    ) {
        ButtonPanel bp = buttonPanel();
        bp.setInplaceEditor((InplaceEditor) result);
        result = bp;
    }

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


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