@Override public Object getValueAt(int rowIndex, int columnIndex) { Object result; if (rowIndex == -1) { result = null; } else { result = model.getFeatureDescriptor(rowIndex); } return result; }
public Object getValueAt(int rowIndex, int columnIndex) { Object result; if (rowIndex == -1) { result = null; } else { result = model.getFeatureDescriptor (rowIndex); } return result; }
public Object getValueAt(int rowIndex, int columnIndex) { Object result; if (rowIndex == -1) { result = null; } else { result = model.getFeatureDescriptor (rowIndex); } return result; }
public boolean isCellEditable(int rowIndex, int columnIndex) { //if column is 0, it's the property name - can't edit that if (columnIndex == 0) return false; if (columnIndex == 1) { FeatureDescriptor fd = model.getFeatureDescriptor(rowIndex); //no worries, editCellAt() will expand it and return before //this method is called if (fd instanceof PropertySet) return false; return ((Property) fd).canWrite(); } throw new IllegalArgumentException("Illegal row/column: " + Integer.toString(rowIndex) + Integer.toString(columnIndex)); //NOI18N }
public boolean isCellEditable(int rowIndex, int columnIndex) { //if column is 0, it's the property name - can't edit that if (columnIndex == 0) return false; if (columnIndex == 1) { FeatureDescriptor fd = model.getFeatureDescriptor(rowIndex); //no worries, editCellAt() will expand it and return before //this method is called if (fd instanceof PropertySet) return false; return ((Property) fd).canWrite(); } throw new IllegalArgumentException("Illegal row/column: " + Integer.toString(rowIndex) + Integer.toString(columnIndex)); //NOI18N }
@Override public boolean isCellEditable(int rowIndex, int columnIndex) { //if column is 0, it's the property name - can't edit that if (columnIndex == 0) { return false; } if (columnIndex == 1) { FeatureDescriptor fd = model.getFeatureDescriptor(rowIndex); //no worries, editCellAt() will expand it and return before //this method is called if (fd instanceof PropertySet) { return false; } return ((Property) fd).canWrite(); } throw new IllegalArgumentException( "Illegal row/column: " + Integer.toString(rowIndex) + Integer.toString(columnIndex) ); //NOI18N }
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex == 0) { throw new IllegalArgumentException("Cannot set property names."); } try { FeatureDescriptor fd = model.getFeatureDescriptor(rowIndex); if (fd instanceof Property) { Property p = (Property) fd; p.setValue(aValue); } else { throw new IllegalArgumentException( "Index " + Integer.toString(rowIndex) + Integer.toString(columnIndex) + " does not represent a property. " ); //NOI18N } } catch (IllegalAccessException iae) { Logger.getLogger(SheetTableModel.class.getName()).log(Level.WARNING, null, iae); } catch (java.lang.reflect.InvocationTargetException ite) { Logger.getLogger(SheetTableModel.class.getName()).log(Level.WARNING, null, ite); } }
@Override public void actionPerformed(ActionEvent ae) { int i = getSelectedRow(); if (i != -1) { FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(i); if (fd instanceof Property) { java.beans.PropertyEditor ped = PropUtils.getPropertyEditor((Property) fd); System.err.println(ped.getClass().getName()); } else { System.err.println("PropertySets - no editor"); //NOI18N } } else { System.err.println("No selection"); //NOI18N } }
public void actionPerformed (ActionEvent ae) { int i = getSelectedRow(); if (i != -1) { FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor (i); if (fd instanceof Property) { java.beans.PropertyEditor ped = PropUtils.getPropertyEditor((Property) fd); System.err.println(ped.getClass().getName()); } else { System.err.println("PropertySets - no editor"); //NOI18N } } else { System.err.println("No selection"); //NOI18N } } public boolean isEnabled () {
public void actionPerformed (ActionEvent ae) { int i = getSelectedRow(); if (i != -1) { FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor (i); if (fd instanceof Property) { java.beans.PropertyEditor ped = PropUtils.getPropertyEditor((Property) fd); System.err.println(ped.getClass().getName()); } else { System.err.println("PropertySets - no editor"); //NOI18N } } else { System.err.println("No selection"); //NOI18N } } public boolean isEnabled () {
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; }
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; }
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex == 0) throw new IllegalArgumentException("Cannot set property names."); try { FeatureDescriptor fd = model.getFeatureDescriptor (rowIndex); if (fd instanceof Property) { Property p = (Property) fd; p.setValue(aValue); } else { throw new IllegalArgumentException ("Index " + Integer.toString (rowIndex) + Integer.toString (columnIndex) + " does not represent a property. "); //NOI18N } } catch (IllegalAccessException iae) { ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, iae); } catch (java.lang.reflect.InvocationTargetException ite) { ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, ite); } }
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex == 0) throw new IllegalArgumentException("Cannot set property names."); try { FeatureDescriptor fd = model.getFeatureDescriptor (rowIndex); if (fd instanceof Property) { Property p = (Property) fd; p.setValue(aValue); } else { throw new IllegalArgumentException ("Index " + Integer.toString (rowIndex) + Integer.toString (columnIndex) + " does not represent a property. "); //NOI18N } } catch (IllegalAccessException iae) { ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, iae); } catch (java.lang.reflect.InvocationTargetException ite) { ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, ite); } }
/** Internal implementation of getSelection() which returns the selected feature * descriptor whether or not the component has focus. */ public final FeatureDescriptor _getSelection() { int i = getSelectedRow(); FeatureDescriptor result; //Check bounds - a change can be fired after the model has been changed, but //before the table has received the event and updated itself, in which case //you get an AIOOBE if (i < getPropertySetModel().getCount()) { result = getSheetModel().getPropertySetModel().getFeatureDescriptor(getSelectedRow()); } else { result = null; } return result; }
/** Internal implementation of getSelection() which returns the selected feature * descriptor whether or not the component has focus. */ public final FeatureDescriptor _getSelection() { int i = getSelectedRow(); FeatureDescriptor result; //Check bounds - a change can be fired after the model has been changed, but //before the table has received the event and updated itself, in which case //you get an AIOOBE if (i < getPropertySetModel().getCount()) { result = getSheetModel().getPropertySetModel().getFeatureDescriptor(getSelectedRow()); } else { result = null; } return result; }
/** Internal implementation of getSelection() which returns the selected feature * descriptor whether or not the component has focus. */ public final FeatureDescriptor _getSelection() { int i = getSelectedRow(); FeatureDescriptor result; //Check bounds - a change can be fired after the model has been changed, but //before the table has received the event and updated itself, in which case //you get an AIOOBE if (i < getPropertySetModel().getCount()) { result = getSheetModel().getPropertySetModel().getFeatureDescriptor(getSelectedRow()); } else { result = null; } return result; }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component result = null; //since you can't change the model, no worries SheetTable stb = (SheetTable) table; lastUpdateSuccess = true; //fetch the property from the set model Property p = (Property) stb.getSheetModel().getPropertySetModel().getFeatureDescriptor(row); result = getEditorComponent( p, this, table.getForeground(), table.getBackground(), table.getSelectionBackground(), table.getSelectionForeground() ); if (result instanceof ButtonPanel) { ((ButtonPanel) result).setButtonAction(stb.getCustomEditorAction()); } if (result != null) { result.setFont(stb.getFont()); } return result; }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component result = null; //since you can't change the model, no worries SheetTable stb = (SheetTable) table; lastUpdateSuccess=true; //fetch the property from the set model Property p = (Property) stb.getSheetModel() .getPropertySetModel().getFeatureDescriptor(row); result = getEditorComponent (p, this, table.getForeground(), table.getBackground(), table.getSelectionBackground(), table.getSelectionForeground()); if (result instanceof ButtonPanel) { ((ButtonPanel) result).setButtonAction (stb.getCustomEditorAction()); } if (result != null) { result.setFont(stb.getFont()); } return result; }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component result = null; //since you can't change the model, no worries SheetTable stb = (SheetTable) table; lastUpdateSuccess=true; //fetch the property from the set model Property p = (Property) stb.getSheetModel() .getPropertySetModel().getFeatureDescriptor(row); result = getEditorComponent (p, this, table.getForeground(), table.getBackground(), table.getSelectionBackground(), table.getSelectionForeground()); if (result instanceof ButtonPanel) { ((ButtonPanel) result).setButtonAction (stb.getCustomEditorAction()); } if (result != null) { result.setFont(stb.getFont()); } return result; }