Ignore:
Timestamp:
2010-10-09T15:35:42+02:00 (14 years ago)
Author:
guggis
Message:

Migrated to Java6 - making use of JTable::setFillsViewportHeight() and getting rid of former workarounds

Location:
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberColumnModel.java

    r23510 r23526  
    77import javax.swing.table.TableColumn;
    88
     9import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    910import org.openstreetmap.josm.tools.CheckParameterUtil;
    1011
     
    2223         col.setPreferredWidth(100);   
    2324         col.setCellEditor(new MemberRoleCellEditor());
    24          col.setCellRenderer(new RelationMemberRoleCellRenderer());
    2525         addColumn(col);
    2626         
     
    3030          col.setResizable(true);
    3131          col.setPreferredWidth(300);
    32           col.setCellRenderer(new RelationMemberTargetCellRenderer());
     32          col.setCellRenderer(new OsmPrimitivRenderer());
    3333          addColumn(col);         
    3434    }
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberEditorModel.java

    r23510 r23526  
    446446
    447447    public int getRowCount() {
    448         if (members.size() > 0) return members.size();
    449        
    450         // we display an empty row if the model is empty because otherwise
    451         // we can't drag/drop into the empty table.
    452         // FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
    453         // to Java 6.
    454         return 1;
     448        return members.size();
    455449    }
    456450
    457451    public Object getValueAt(int rowIndex, int columnIndex) {
    458         if (members.size() == 0 && rowIndex == 0){
    459             // we display an empty row if the model is empty because otherwise
    460             // we can't drag/drop into the empty table.
    461             // FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
    462             // to Java 6.
    463             return null;
    464         }
    465452        switch(columnIndex){
    466453        case 0: return members.get(rowIndex).getRole();
     
    472459    @Override
    473460    public boolean isCellEditable(int rowIndex, int columnIndex) {
    474         // we display an empty row if the model is empty because otherwise
    475         // we can't drag/drop into the empty table. This row isn't editable
    476         // FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
    477         // to Java 6.
    478         if (members.size() == 0 && rowIndex == 0) return false;
    479        
    480         // otherwise only the column with the member roles is editable
     461        // only the column with the member roles is editable
    481462        return columnIndex == 0;
    482463    }
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTable.java

    r23510 r23526  
    6363        setRowSelectionAllowed(true);
    6464        setColumnSelectionAllowed(true);
     65        setFillsViewportHeight(true); // make sure we can drag onto an empty table
    6566
    6667        // register the popup menu launcher
Note: See TracChangeset for help on using the changeset viewer.