Changeset 6216
- Timestamp:
- 2003-12-10T17:07:27+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java
r6173 r6216 66 66 import org.greenstone.gatherer.util.PatternTokenizer; 67 67 import org.greenstone.gatherer.util.StaticStrings; 68 import org.greenstone.gatherer.util.TableUtils; 68 69 import org.greenstone.gatherer.util.TreeSynchronizer; 69 70 import org.greenstone.gatherer.util.Utility; … … 77 78 extends JPanel 78 79 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 79 98 /** 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. */ 80 99 private GValueTree tree = null; … … 116 135 /** Provide synchronization between the collection trees in this view and the collection pane view. */ 117 136 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";133 137 134 138 /** Constructor. … … 308 312 public void afterDisplay() { 309 313 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();328 314 } 329 315 /** Called whenever a significant change has occured in the state of the currently loaded collection. … … 507 493 table.addMouseListener(new TableMouseInputHandler()); 508 494 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 509 503 JScrollPane table_scroll = new JScrollPane(table); 510 504 table_scroll.getViewport().setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 806 800 } 807 801 808 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);809 802 if(table != null) { 803 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); 810 804 Dimension table_size = table.getPreferredSize(); 811 805 TableColumnModel column_model = table.getColumnModel(); … … 816 810 817 811 TableColumn element_column = column_model.getColumn(1); 818 element_column.setPreferredWidth( TABLE_SIZE.width / 4);812 element_column.setPreferredWidth((TABLE_SIZE.width / 4) - 15); 819 813 element_column.setCellRenderer(new TableCellRenderer(model)); 820 814 821 815 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); 823 817 value_column.setCellRenderer(new TableCellRenderer(model)); 824 818 }
Note:
See TracChangeset
for help on using the changeset viewer.