本文整理匯總了Java中java.beans.FeatureDescriptor.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java FeatureDescriptor.getValue方法的具體用法?Java FeatureDescriptor.getValue怎麽用?Java FeatureDescriptor.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.beans.FeatureDescriptor
的用法示例。
在下文中一共展示了FeatureDescriptor.getValue方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ModelProperty
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
/** Creates a new instance of ModelProperty */
private ModelProperty(PropertyModel pm) {
super(pm.getPropertyType());
this.mdl = pm;
if (mdl instanceof ExPropertyModel) {
FeatureDescriptor fd = ((ExPropertyModel) mdl).getFeatureDescriptor();
Boolean result = (Boolean) fd.getValue("canEditAsText"); // NOI18N
if (result != null) {
this.setValue("canEditAsText", result);
}
}
//System.err.println(
//"Created ModelProperty wrapper for mystery PropertyModel " + pm);
}
示例2: readEnv
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
void readEnv (FeatureDescriptor desc) {
if (desc instanceof Node.Property){
Node.Property prop = (Node.Property)desc;
editable = prop.canWrite();
//enh 29294 - support one-line editor & suppression of custom
//editor
instructions = (String) prop.getValue ("instructions"); //NOI18N
oneline = Boolean.TRUE.equals (prop.getValue ("oneline")); //NOI18N
customEd = !Boolean.TRUE.equals (prop.getValue
("suppressCustomEditor")); //NOI18N
}
Object obj = desc.getValue(ObjectEditor.PROP_NULL);
if (Boolean.TRUE.equals(obj)) {
nullValue = NbBundle.getMessage(StringEditor.class, "CTL_NullValue");
} else {
if (obj instanceof String) {
nullValue = (String)obj;
} else {
nullValue = null;
}
}
}
示例3: __addFeatureValues
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
/**
* Add all of the attributes of one FeatureDescriptor to thos
* of another, replacing any attributes that conflict.
*/
static void __addFeatureValues(
FeatureDescriptor addingDescriptor,
FeatureDescriptor destinationDescriptor
)
{
Enumeration<String> keys = addingDescriptor.attributeNames();
if (keys != null)
{
while (keys.hasMoreElements())
{
String key = keys.nextElement();
Object value = addingDescriptor.getValue(key);
destinationDescriptor.setValue(key, value);
}
}
}
示例4: print
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
private static void print(FeatureDescriptor descriptor) {
String name = descriptor.getName();
String display = descriptor.getDisplayName();
String description = descriptor.getShortDescription();
System.out.println("name: " + name);
if (!Objects.equals(name, display)) {
System.out.println("display name: " + display);
}
if (!Objects.equals(display, description)) {
System.out.println("description: " + description.trim());
}
print("expert", descriptor.isExpert());
print("hidden", descriptor.isHidden());
print("preferred", descriptor.isPreferred());
TreeMap<String,Object> map = new TreeMap<>();
Enumeration<String> enumeration = descriptor.attributeNames();
while (enumeration.hasMoreElements()) {
String id = enumeration.nextElement();
Object value = descriptor.getValue(id);
if (value.getClass().isArray()) {
TreeSet<String> set = new TreeSet<>();
int index = 0;
int length = Array.getLength(value);
while (index < length) {
set.add(Array.get(value, index++) + ", " +
Array.get(value, index++) + ", " +
Array.get(value, index++));
}
value = set.toString();
}
map.put(id, value);
}
for (Entry<String,Object> entry : map.entrySet()) {
System.out.println(entry.getKey() + ": " + entry.getValue());
}
}
示例5: getCustomRenderer
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
private TableCellRenderer getCustomRenderer( int row ) {
FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(row);
if (fd instanceof PropertySet)
return null;
Object res = fd.getValue( "custom.cell.renderer"); //NOI18N
if( res instanceof TableCellRenderer ) {
prepareCustomEditor( res );
return ( TableCellRenderer ) res;
}
return null;
}
示例6: getCustomEditor
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
private TableCellEditor getCustomEditor( int row ) {
FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(row);
if (fd instanceof PropertySet)
return null;
Object res = fd.getValue( "custom.cell.editor"); //NOI18N
if( res instanceof TableCellEditor ) {
prepareCustomEditor( res );
return ( TableCellEditor ) res;
}
return null;
}
示例7: checkEditBoolean
import java.beans.FeatureDescriptor; //導入方法依賴的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;
}
示例8: getTableCellRendererComponent
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
public Component getTableCellRendererComponent(
JTable table, Object value, boolean selected, boolean hasFocus, int row, int column
) {
FeatureDescriptor fd = (FeatureDescriptor) value;
Component result;
//Use selection color for both columns
selected |= (hasFocus && (table.getSelectedRow() == row));
if (fd == null || fd instanceof PropertySet) {
//#118372 - don't return null, SynthLaF asks for some properties from
//the renderer component under JDK1.6_05
return new JLabel();
} else {
if (column == 0) {
String txt = ((Property) fd).getHtmlDisplayName();
boolean isHtml = txt != null;
if (!isHtml) {
txt = fd.getDisplayName();
}
JLabel lbl = htmlLabel;
HtmlRenderer.Renderer ren = (HtmlRenderer.Renderer) lbl;
ren.setHtml(isHtml);
lbl.setText(txt);
if (selected) {
lbl.setBackground(table.getSelectionBackground());
lbl.setForeground(table.getSelectionForeground());
} else {
lbl.setBackground(table.getBackground());
lbl.setForeground(table.getForeground());
}
lbl.setOpaque(selected);
if (includeMargin) {
lbl.setBorder(
BorderFactory.createMatteBorder(0, PropUtils.getMarginWidth() + 2, 0, 0, lbl.getBackground())
);
} else {
lbl.setBorder(
BorderFactory.createMatteBorder(0, PropUtils.getTextMargin(), 0, 0, lbl.getBackground())
);
}
//Support for name marking with icon requested by form editor
Object o = fd.getValue("nameIcon"); //NOI18N
if (o instanceof Icon) {
lbl.setIcon((Icon) o);
} else if (o instanceof Image) {
lbl.setIcon(new ImageIcon((Image) o));
} else {
lbl.setIcon(null);
}
result = lbl;
} else {
result = factory().getRenderer((Property) fd);
if (selected) {
result.setBackground(table.getSelectionBackground());
result.setForeground(table.getSelectionForeground());
} else {
result.setBackground(table.getBackground());
result.setForeground(table.getForeground());
}
((JComponent) result).setOpaque(selected);
}
}
return result;
}
示例9: attachEnv
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
public void attachEnv (PropertyEnv env) {
FeatureDescriptor d = env.getFeatureDescriptor ();
if (d instanceof Node.Property) {
canWrite = ((Node.Property)d).canWrite ();
}
Object o;
Image imgs [] = null;
Integer vals [] = null;
String descs [] = null;
o = d.getValue (PROP_IMAGES);
if (o instanceof Image []) {
imgs = (Image [])o;
}
o = d.getValue (PROP_VALUES);
if (o instanceof Integer []) {
vals = (Integer [])o;
}
o = d.getValue (PROP_DESCRIPTIONS);
if (o instanceof String []) {
descs = (String [])o;
}
if (imgs != null && vals != null) {
int length = length = imgs.length;
if(vals.length < length) {
length = vals.length;
}
if (descs != null && descs.length < length) {
length = descs.length;
}
images = new Image [length];
values = new Integer [length];
descriptions = new String [length];
for (int i = 0; i < length; i++) {
images [i] = imgs [i];
values [i] = vals [i];
descriptions [i] = descs == null ? vals [i].toString () : descs [i];
}
}
}
示例10: test
import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
private static void test(Object expected, FeatureDescriptor fd) {
System.out.println(fd.getName());
Object actual = fd.getValue("transient"); // NON-NLS: the attribute name
if ((actual == null) ? (expected != null) : !actual.equals(expected))
throw new Error("expected " + expected + " value, but actual value is " + actual);
}