本文整理汇总了Java中org.openide.explorer.propertysheet.PropertyEnv类的典型用法代码示例。如果您正苦于以下问题:Java PropertyEnv类的具体用法?Java PropertyEnv怎么用?Java PropertyEnv使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyEnv类属于org.openide.explorer.propertysheet包,在下文中一共展示了PropertyEnv类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: vetoableChange
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
@Override
public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException {
// should only be done if this property editor is the selected one
if (property.getCurrentEditor() != this) return;
if (PropertyEnv.PROP_STATE.equals(ev.getPropertyName())) {
boolean excludeRes = false;
if (resourcePanel != null) {
ResourceValue resValue;
if (propertyValue instanceof ResourceValue
&& (resValue = resourcePanel.getResource()) != null)
{ // make sure we have the latest resource value
if (resValue.getValue() == ResourceValue.IGNORED_VALUE) {
throw new PropertyVetoException("Invalid resource value", ev);
// TODO: message dialog about invalid value
}
if (resValue != propertyValue) {
setValue(resValue);
}
} else {
excludeRes = true; // have resource panel, but just using plain value
}
}
ResourceSupport.setExcludedProperty(property, excludeRes);
}
}
示例2: commitChanges
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
/**
* Used by PropertyAction to mimic property sheet behavior - trying to invoke
* PropertyEnv listener of the current property editor (we can't create our
* own PropertyEnv instance).
*
* @return current value
* @throws java.beans.PropertyVetoException if someone vetoes this change.
*/
public Object commitChanges() throws PropertyVetoException {
int currentIndex = editorsCombo.getSelectedIndex();
PropertyEditor currentEditor = currentIndex > -1 ? allEditors[currentIndex] : null;
if (currentEditor instanceof ExPropertyEditor) {
// we can only guess - according to the typical pattern the propetry
// editor itself or the custom editor usually implement the listener
// registered in PropertyEnv
PropertyChangeEvent evt = new PropertyChangeEvent(
this, PropertyEnv.PROP_STATE, null, PropertyEnv.STATE_VALID);
if (currentEditor instanceof VetoableChangeListener) {
((VetoableChangeListener)currentEditor).vetoableChange(evt);
}
Component currentCustEd = currentIndex > -1 ? allCustomEditors[currentIndex] : null;
if (currentCustEd instanceof VetoableChangeListener) {
((VetoableChangeListener)currentCustEd).vetoableChange(evt);
}
if (currentEditor instanceof PropertyChangeListener) {
((PropertyChangeListener)currentEditor).propertyChange(evt);
}
if (currentCustEd instanceof PropertyChangeListener) {
((PropertyChangeListener)currentCustEd).propertyChange(evt);
}
}
return commitChanges0();
}
示例3: attachEnv
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
/**
* This method is called by the IDE to pass
* the environment to the property editor.
*/
@Override
public void attachEnv(PropertyEnv env) {
this.env = env;
type = env.getFeatureDescriptor().getValue(CUSTOM_EDITOR_TYPE);
if (type == null) {
type = FULL_CUSTOM_EDITOR;
} else if (ACCESS_MODIFIERS_CUSTOM_EDITOR.equals(type)) {
type = ACCESS_MODIFIERS_CUSTOM_EDITOR;
} else if (OTHERS_MODIFIERS_CUSTOM_EDITOR.equals(type)) {
type = OTHERS_MODIFIERS_CUSTOM_EDITOR;
} else {
type = FULL_CUSTOM_EDITOR;
}
}
示例4: vetoableChange
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
@Override
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
logger.log(Level.FINE, "ValuePropertyEditor.Validate.vetoableChange({0})", evt);
if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName())) {
Object newValue = delegatePropertyEditor.getValue();
logger.log(Level.FINE, " vetoableChange: delegate PE value = {0}", newValue);
if (newValue != delegateValue && !(newValue instanceof String)) {
setVarFromMirror(((MutableVariable) currentValue), newValue);
/*
try {
((MutableVariable) currentValue).setFromMirrorObject(newValue);
} catch (InvalidObjectException ex) {
throw new PropertyVetoException(ex.getLocalizedMessage(), evt);
}
*/
}
}
}
示例5: HostPropertyCustomEditor
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
/** Creates new form HostEditorPanel */
public HostPropertyCustomEditor (HostPropertyEditor ed, PropertyEnv env) {
editor = ed;
initComponents ();
initAccessibility();
anyRadioButton.addActionListener (this);
selectedRadioButton.addActionListener (this);
setPreferredSize (new java.awt.Dimension (300, 200));
// set values from PropertyEditor
HttpServerSettings.HostProperty hp = (HttpServerSettings.HostProperty)editor.getValue ();
if (HttpServerSettings.ANYHOST.equals (hp.getHost ())) {
anyRadioButton.setSelected (true);
grantTextArea.setText (""); // NOI18N
}
else if (HttpServerSettings.LOCALHOST.equals (hp.getHost ())) {
selectedRadioButton.setSelected (true);
grantTextArea.setText (hp.getGrantedAddresses ());
}
env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
env.addPropertyChangeListener(this);
}
示例6: vetoableChange
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName())
&& isVisible()) {
I18nString i18nString = getI18nString();
if (i18nString == null
|| !(i18nString instanceof FormI18nMnemonic)
|| i18nString.getSupport().getResourceHolder().getResource() == null
|| i18nString.getKey() == null) {
// Notify user that invalid value set.
throw new PropertyVetoException(bundle.getString("MSG_InvalidValue"), evt); // NOI18N
}
// Try to add new key into resource bundle first.
i18nString.getSupport().getResourceHolder().addProperty(
i18nString.getKey(),
i18nString.getValue(),
i18nString.getComment(),
false //#19137 do not destroy existing locale values
);
FormI18nMnemonicEditor.this.setValue(i18nString);
}
}
示例7: commonInit
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
private void commonInit( String panelTitle, PropertyEnv env ) {
getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PointCustomEditor.class, "ACSD_PointCustomEditor"));
setBorder (new javax.swing.border.EmptyBorder(12, 12, 0, 11));
insidePanel.setBorder (new javax.swing.border.CompoundBorder (
new javax.swing.border.TitledBorder (
new javax.swing.border.EtchedBorder (),
" " + panelTitle + " "
),
new javax.swing.border.EmptyBorder (new java.awt.Insets(5, 5, 5, 5))));
env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
env.addPropertyChangeListener(this);
setPanel( insidePanel );
xField.addKeyListener(this);
yField.addKeyListener(this);
getMap().put( xField , xLabel );
getMap().put( yField , yLabel );
}
示例8: NbProcessDescriptorCustomEditor
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
/** Creates new NbProcessDescriptorCustomEditor
* @param editor the NbProcessDescriptorEditor
*/
public NbProcessDescriptorCustomEditor (NbProcessDescriptorEditor editor, PropertyEnv env) {
this.editor = editor;
initComponents ();
if ( editor.pd != null ) {
processField.setText (editor.pd.getProcessName ());
argumentsArea.setText (editor.pd.getArguments ());
hintArea.setText (editor.pd.getInfo ());
}
processField.getAccessibleContext().setAccessibleDescription(getString("ACSD_NbProcessDescriptorCustomEditor.processLabel"));
argumentsArea.getAccessibleContext().setAccessibleDescription(getString("ACSD_NbProcessDescriptorCustomEditor.argumentsLabel"));
hintArea.getAccessibleContext().setAccessibleDescription(getString("ACSD_NbProcessDescriptorCustomEditor.argumentKeyLabel"));
jButton1.getAccessibleContext().setAccessibleDescription(getString("ACSD_NbProcessDescriptorCustomEditor.jButton1"));
getAccessibleContext().setAccessibleDescription(getString("ACSD_CustomNbProcessDescriptorEditor"));
HelpCtx.setHelpIDString (this, NbProcessDescriptorCustomEditor.class.getName ());
env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
env.addPropertyChangeListener(this);
}
示例9: CustomAttributeEditortest
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
public CustomAttributeEditortest(Object value, PropertyEditor editor, PropertyEnv env) {
this.env = env;
this.editor = editor;
this.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
this.env.addPropertyChangeListener(this);
initComponents();
DefaultListSelectionModel dlsm = (DefaultListSelectionModel) this.jTableAttribute.getSelectionModel();
dlsm.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
jTablePropertiesListSelectionValueChanged(e);
}
});
if (value != null && value instanceof Map) {
this.setPropertiesMap((Map) value);
} else if (value != null && value instanceof List) {
this.setPropertiesList((List) value);
}
}
示例10: CustomAttributeEditor
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
public CustomAttributeEditor(Object value, PropertyEditor editor, PropertyEnv env) {
this.env = env;
this.editor = editor;
this.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
this.env.addPropertyChangeListener(this);
initComponents();
DefaultListSelectionModel dlsm = (DefaultListSelectionModel) this.jTableAttribute.getSelectionModel();
dlsm.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
jTablePropertiesListSelectionValueChanged(e);
}
});
if (value != null && value instanceof Map) {
this.setPropertiesMap((Map) value);
} else if (value != null && value instanceof List) {
this.setPropertiesList((List) value);
}
}
示例11: SortFieldPropertyCustomEditor
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
/** Create a StringCustomEditor.
* @param value the initial value for the string
* @param editable whether to show the editor in read only or read-write mode (NOT USED)
* @param oneline whether the text component should be a single-line or multi-line component (NOT USED)
* @param instructions any instructions that should be displayed (NOT USED)
*/
public SortFieldPropertyCustomEditor(
String value,
PropertyEditor editor,
PropertyEnv env
)
{
super();
this.env = env;
this.editor = editor;
this.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
this.env.addPropertyChangeListener(this);
this.setDataset((JRDesignDataset) this.env.getFeatureDescriptor().getValue("dataset"));
this.setSelectedValue(value);
}
示例12: JRItemLabelPropertyCustomEditor
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
/** Create a StringCustomEditor.
* @param value the initial value for the string
* @param editable whether to show the editor in read only or read-write mode (NOT USED)
* @param oneline whether the text component should be a single-line or multi-line component (NOT USED)
* @param instructions any instructions that should be displayed (NOT USED)
*/
public JRItemLabelPropertyCustomEditor(
JRChart chart,
JRItemLabel value,
boolean editable,
boolean oneline,
String instructions,
PropertyEditor editor,
PropertyEnv env
)
{
super();
setChart(chart);
this.oneline = oneline;
this.instructions = instructions;
this.env = env;
this.editor = editor;
this.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
this.env.addPropertyChangeListener(this);
this.setItemLabel(value);
}
示例13: JRPenPropertyCustomEditor
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
/** Create a StringCustomEditor.
* @param value the initial value for the string
* @param editable whether to show the editor in read only or read-write mode (NOT USED)
* @param oneline whether the text component should be a single-line or multi-line component (NOT USED)
* @param instructions any instructions that should be displayed (NOT USED)
*/
JRPenPropertyCustomEditor (JRPen value, boolean oneline, String instructions, PropertyEditor editor, PropertyEnv env) {
super();
this.oneline = oneline;
this.instructions = instructions;
this.env = env;
this.editor = editor;
this.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
this.env.addPropertyChangeListener(this);
if (value != null)
{
this.setPen(value);
}
}
示例14: JRLineBoxPropertyCustomEditor
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
/** Create a StringCustomEditor.
* @param value the initial value for the string
* @param editable whether to show the editor in read only or read-write mode (NOT USED)
* @param oneline whether the text component should be a single-line or multi-line component (NOT USED)
* @param instructions any instructions that should be displayed (NOT USED)
*/
public JRLineBoxPropertyCustomEditor(
JRLineBox value,
PropertyEditor editor,
PropertyEnv env
)
{
super();
this.env = env;
this.editor = editor;
this.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
this.env.addPropertyChangeListener(this);
this.setLineBox(value);
}
示例15: attachEnv
import org.openide.explorer.propertysheet.PropertyEnv; //导入依赖的package包/类
public void attachEnv(PropertyEnv env) {
FeatureDescriptor desc = env.getFeatureDescriptor();
if (desc instanceof Node.Property){
Node.Property prop = (Node.Property)desc;
//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
}
this.env = env;
}