/** Constructs a new support. * @param name the name of the property * @param type the class type of the property * @param displayName the display name of the property * @param canR whether the property is readable * @param canW whether the property is writable */ public PropertySupport( String name, Class<T> type, String displayName, String shortDescription, boolean canR, boolean canW ) { super(type); this.setName(name); setDisplayName(displayName); setShortDescription(shortDescription); this.canR = canR; this.canW = canW; }
public E getIndexedValue(int index) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!canIndexedRead()) { throw new IllegalAccessException(); } Object validInstance = Beans.getInstanceOf(instance, indexedGetter.getDeclaringClass()); return PropertySupport.cast(getElementType(), indexedGetter.invoke(validInstance, index)); }
@Override public Object getValue(String attributeName) { return super.getValue(attributeName); }
result.setValue("oneline", Boolean.TRUE); // NOI18N return result;
@Override public PropertyEditor getPropertyEditor() { if (propertyEditor != null) { return propertyEditor; } return super.getPropertyEditor(); }
public boolean isDefaultValue() { if (propertyEditor instanceof DesignPropertyEditor) { return ((DesignPropertyEditor) propertyEditor).isDefaultValue(); } return super.isDefaultValue(); }
public boolean canWrite() { if (propertyEditor instanceof DesignPropertyEditor) { return ((DesignPropertyEditor) propertyEditor).canWrite(); } return super.canWrite(); }
@Override public Object getValue(String attributeName) { if (attributeName.equals("canEditAsText")) // NOI18N return Boolean.FALSE; return super.getValue(attributeName); }
@SuppressWarnings("unchecked") // NOI18N public final void invokeSaveToModel() { try { propertySupport.setValue(getValue()); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } catch (InvocationTargetException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } }
@Override public PropertyEditor getPropertyEditor() { PropertyEditor propertyEditor = null; switch (option.getType()) { case CHECK_BOX: // We pass a Boolean.class above propertyEditor = super.getPropertyEditor(); break; case DIRECTORY: propertyEditor = new OptionDirectoryEditor(this, base, JFileChooser.DIRECTORIES_ONLY, fileSystem); break; case DIRECTORIES: propertyEditor = new OptionDirectoriesEditor(this, base, fileSystem); break; case FILE: propertyEditor = new OptionDirectoryEditor(this, base, JFileChooser.FILES_ONLY); break; case TEXT_AREA: case RADIO_BUTTON: case COMBO_BOX: propertyEditor = new OptionEnumEditor(this); break; default: break; } return propertyEditor; }
/** Constructs a new support. * @param name the name of the property * @param type the class type of the property * @param displayName the display name of the property * @param canR whether the property is readable * @param canW whether the property is writable */ public PropertySupport(String name, Class type, String displayName, String shortDescription, boolean canR, boolean canW) { super(type); this.setName(name); setDisplayName(displayName); setShortDescription(shortDescription); this.canR = canR; this.canW = canW; }
@Override public Object getValue(String attributeName) { if (attributeName.equals("canAutoComplete")) { //NOI18N return Boolean.FALSE; } return super.getValue(attributeName); }
result.setValue("oneline", Boolean.TRUE); // NOI18N return result;
public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!canRead()) { throw new IllegalAccessException(); } Object validInstance = Beans.getInstanceOf(instance, getter.getDeclaringClass()); return PropertySupport.cast(getValueType(), getter.invoke(validInstance)); }
/** Constructs a new support. * @param name the name of the property * @param type the class type of the property * @param displayName the display name of the property * @param canR whether the property is readable * @param canW whether the property is writable */ public PropertySupport(String name, Class type, String displayName, String shortDescription, boolean canR, boolean canW) { super(type); this.setName(name); setDisplayName(displayName); setShortDescription(shortDescription); this.canR = canR; this.canW = canW; }
@Override public Object getValue(String attributeName) { if (attributeName.equals("canEditAsText")) { // NOI18N return Boolean.FALSE; } return super.getValue(attributeName); } }
private PropertySupport<String> createQMakeCommandProperty() { PropertySupport<String> result = new PropertySupport.ReadWrite<String>(PROP_CMAKE_COMMAND, String.class, getString("PROP_CMAKE_COMMAND"), getString("HINT_CMAKE_COMMAND")) { // NOI18N @Override public String getValue() { return getCMakeCommand(); } @Override public void setValue(String val) { setCMakeCommand(val); } @Override public boolean supportsDefaultValue() { return true; } @Override public void restoreDefaultValue() { setValue(null); } @Override public boolean canWrite() { return getEntry().getFile().getParent().canWrite(); } }; //String editor hint to use a JTextField, not a JTextArea for the //custom editor. Arguments can't be multiline anyway. result.setValue("oneline", Boolean.TRUE);// NOI18N return result; }
public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (getter == null) { throw new IllegalAccessException(); } Object valideInstance = Beans.getInstanceOf(instance, getter.getDeclaringClass()); try { try { return cast(getValueType(), getter.invoke(valideInstance)); } catch (IllegalAccessException ex) { try { getter.setAccessible(true); return cast(getValueType(), getter.invoke(valideInstance)); } finally { getter.setAccessible(false); } } } catch (IllegalArgumentException iae) { //Provide a better message for debugging StringBuffer sb = new StringBuffer("Attempted to invoke method "); sb.append(getter.getName()); sb.append(" from class "); sb.append(getter.getDeclaringClass().getName()); sb.append(" on an instance of "); sb.append(valideInstance.getClass().getName()); sb.append(" Problem:"); sb.append(iae.getMessage()); throw (IllegalArgumentException) new IllegalArgumentException(sb.toString()).initCause(iae); } }
@Override public Object getValue(String attributeName) { if (attributeName.equals("canEditAsText")) // NOI18N return Boolean.FALSE; return super.getValue(attributeName); }
private PropertySupport<String> createQMakeCommandProperty() { PropertySupport<String> result = new PropertySupport.ReadWrite<String>(PROP_QMAKE_COMMAND, String.class, getString("PROP_QMAKE_COMMAND"), getString("HINT_QMAKE_COMMAND")) { // NOI18N @Override public String getValue() { return getQMakeCommand(); } @Override public void setValue(String val) { setQMakeCommand(val); } @Override public boolean supportsDefaultValue() { return true; } @Override public void restoreDefaultValue() { setValue(null); } @Override public boolean canWrite() { return getEntry().getFile().getParent().canWrite(); } }; //String editor hint to use a JTextField, not a JTextArea for the //custom editor. Arguments can't be multiline anyway. result.setValue("oneline", Boolean.TRUE);// NOI18N return result; }