示例#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();
   }
 }
示例#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());
  }
示例#3
0
 /** Refresh the properties from the bound object. */
 public void refresh() {
   props.refresh();
   getTableModel().fireTableDataChanged();
 }
示例#4
0
 /**
  * Gets the bound subject bean.
  *
  * @return the subject
  */
 public Object getObject() {
   return props.getObject();
 }
示例#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);
 }
示例#6
0
 /**
  * Gets the preference manager associated with this property sheet.
  *
  * @return the preference manager
  */
 public PrefsManager getPrefs() {
   return props.getPrefs();
 }