Esempio n. 1
0
 /**
  * Set the subject bean to check for properties.
  *
  * @param o the subject bean
  */
 public void setObject(Object o) {
   if (o != props.getObject()) {
     if (getTable().isEditing()) {
       getTable().editingStopped(new ChangeEvent(this));
     }
     getTable().editingCanceled(new ChangeEvent(this));
     props.setObject(o);
     getTableModel().fireTableStructureChanged();
     getTable().setRowHeightToMaximumPreferredHeight();
   }
 }
Esempio n. 2
0
  /** Create a new, empty property sheet. */
  public PropertySheet() {
    super(new EnhancedTable());
    this.getPreferredSize();
    props = new ForClassPropertyList();

    // Add bean change event listener
    props.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            // XXX Should I fire a 'stop editing' event here?
            refresh();
          }
        });

    // Add table
    JTable table = getTable();
    MyTableModel tableModel = new MyTableModel();
    table.setModel(tableModel);
    table.setDefaultRenderer(InstancePropertyDescriptor.class, new MyCellRenderer());
    table.setDefaultEditor(InstancePropertyDescriptor.class, new MyCellEditor());
  }
Esempio n. 3
0
 /** Refresh the properties from the bound object. */
 public void refresh() {
   props.refresh();
   getTableModel().fireTableDataChanged();
 }
Esempio n. 4
0
 /**
  * Gets the bound subject bean.
  *
  * @return the subject
  */
 public Object getObject() {
   return props.getObject();
 }
Esempio n. 5
0
 /**
  * Sets the preference manager associated with this property sheet. This is necessary for
  * localization and determining extended properties.
  *
  * @param manager the preference manager
  */
 public void setPrefs(PrefsManager manager) {
   props.setPrefs(manager);
 }
Esempio n. 6
0
 /**
  * Gets the preference manager associated with this property sheet.
  *
  * @return the preference manager
  */
 public PrefsManager getPrefs() {
   return props.getPrefs();
 }