Changeset 6216


Ignore:
Timestamp:
2003-12-10T17:07:27+13:00 (20 years ago)
Author:
jmt12
Message:

Addressed the bug with table columns having no height under MacOS and also removed one wastefull table resize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java

    r6173 r6216  
    6666import org.greenstone.gatherer.util.PatternTokenizer;
    6767import org.greenstone.gatherer.util.StaticStrings;
     68import org.greenstone.gatherer.util.TableUtils;
    6869import org.greenstone.gatherer.util.TreeSynchronizer;
    6970import org.greenstone.gatherer.util.Utility;
     
    7778    extends JPanel
    7879    implements ActionListener, ListSelectionListener, TreeSelectionListener, MSMListener {
     80
     81    static private Dimension BUTTON_SIZE = new Dimension(190, 25);
     82    static private Dimension CONTROL_SIZE = new Dimension(560, 240);
     83    static private Dimension MINIMUM_SIZE = new Dimension(100, 100);
     84    static private Dimension TABLE_SIZE = new Dimension(560, 25);
     85    static private Dimension TREE_SIZE = new Dimension(250, 500);
     86    static private int MINIMUM_TABLE_HEADER_SIZE = 15;
     87    /** The name of the panel containing the metadata table. */
     88    static final private String CARD_ONE  = "Card One";
     89    /** The name of the panel containing the 'no file' placeholder for the metadata table. */
     90    static final private String CARD_TWO = "Card Two";
     91    /** The name of the panel containing the 'no metadata' placeholder for the metadata table. */
     92    static final private String CARD_ZERO = "Card Zero";
     93    /** The name of the panel containing the placeholder for the value tree. */
     94    static final private String TOOLS_OFF = "Tools Off";
     95    /** The name of the panel containing the value tree. */
     96    static final private String TOOLS_ON  = "Tools On";
     97
    7998    /** The GValueTree graphically shows the available metadata that has been previously assigned, and provides controls for adding, updating and removing metadata, depending on the users selections in the other important components. */
    8099    private GValueTree tree = null;
     
    116135    /** Provide synchronization between the collection trees in this view and the collection pane view. */
    117136    private TreeSynchronizer tree_sync = null;
    118     static private Dimension BUTTON_SIZE = new Dimension(190, 25);
    119     static private Dimension CONTROL_SIZE = new Dimension(560, 240);
    120     static private Dimension MINIMUM_SIZE = new Dimension(100, 100);
    121     static private Dimension TABLE_SIZE = new Dimension(560, 25);
    122     static private Dimension TREE_SIZE = new Dimension(250, 500);
    123     /** The name of the panel containing the metadata table. */
    124     static final private String CARD_ONE  = "Card One";
    125     /** The name of the panel containing the 'no file' placeholder for the metadata table. */
    126     static final private String CARD_TWO = "Card Two";
    127     /** The name of the panel containing the 'no metadata' placeholder for the metadata table. */
    128     static final private String CARD_ZERO = "Card Zero";
    129     /** The name of the panel containing the placeholder for the value tree. */
    130     static final private String TOOLS_OFF = "Tools Off";
    131     /** The name of the panel containing the value tree. */
    132     static final private String TOOLS_ON  = "Tools On";
    133137
    134138    /** Constructor.
     
    308312    public void afterDisplay() {
    309313    external_split.setDividerLocation(0.3);
    310     if(table != null) {
    311         Dimension table_size = table.getPreferredSize();
    312         TableColumnModel column_model = table.getColumnModel();
    313 
    314         TableColumn inherited_column = column_model.getColumn(0);
    315         inherited_column.setPreferredWidth(20);
    316         inherited_column.setCellRenderer(new TableCellRenderer(model));
    317 
    318         TableColumn element_column = column_model.getColumn(1);
    319         element_column.setPreferredWidth(table_size.width / 4);
    320         element_column.setCellRenderer(new TableCellRenderer(model));
    321 
    322         TableColumn value_column = column_model.getColumn(2);
    323         value_column.setPreferredWidth(((3 * table_size.width) / 4) - 15);
    324         value_column.setCellRenderer(new TableCellRenderer(model));
    325     }
    326     table.doLayout();
    327     model.fireTableDataChanged();
    328314    }
    329315    /** Called whenever a significant change has occured in the state of the currently loaded collection.
     
    507493    table.addMouseListener(new TableMouseInputHandler());
    508494
     495    // We also have to ensure that the table column header hasn't gone on a severe Jenny Craig binge and has somehow lost 7/8th of its component size (15 -> 2 pixels high).
     496    JTableHeader table_header = table.getTableHeader();
     497    Dimension table_header_preferred_size = table_header.getPreferredSize();
     498    if(table_header_preferred_size.height < MINIMUM_TABLE_HEADER_SIZE) {
     499        table_header_preferred_size.setSize(table_header_preferred_size.width, MINIMUM_TABLE_HEADER_SIZE);
     500        table_header.setPreferredSize(table_header_preferred_size);
     501    }
     502
    509503    JScrollPane table_scroll = new JScrollPane(table);
    510504    table_scroll.getViewport().setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
     
    806800    }
    807801
    808     table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    809802    if(table != null) {
     803        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    810804        Dimension table_size = table.getPreferredSize();
    811805        TableColumnModel column_model = table.getColumnModel();
     
    816810
    817811        TableColumn element_column = column_model.getColumn(1);
    818         element_column.setPreferredWidth(TABLE_SIZE.width / 4);
     812        element_column.setPreferredWidth((TABLE_SIZE.width / 4) - 15);
    819813        element_column.setCellRenderer(new TableCellRenderer(model));
    820814
    821815        TableColumn value_column = column_model.getColumn(2);
    822         value_column.setPreferredWidth(((3 * TABLE_SIZE.width) / 4) - 15);
     816        value_column.setPreferredWidth(((3 * TABLE_SIZE.width) / 4) - 30);
    823817        value_column.setCellRenderer(new TableCellRenderer(model));
    824818    }
Note: See TracChangeset for help on using the changeset viewer.