Changeset 11780


Ignore:
Timestamp:
2006-05-09T11:28:19+12:00 (18 years ago)
Author:
mdewsnip
Message:

Added a "no collection loaded" message to the collection area when no collection is open.

File:
1 edited

Legend:

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

    r11651 r11780  
    7373    implements ActionListener
    7474{
     75    private CardLayout card_layout = null;
     76    private JPanel card_pane = null;
     77    /** The name of the panel containing the "collection loaded" (collection tree) card. */
     78    private String COLLECTION_LOADED_CARD = "";
     79    /** The name of the panel containing the "no collection loaded" placeholder */
     80    private String NO_COLLECTION_LOADED_CARD = "No collection loaded";
    7581    /** The group encompassing all of the components available as drop targets for drag and drop actions. Required so that only one component renders the ghost and higlights itself as a target, which the other members are restored to their original, pristine, condition. */
    7682    private DragGroup group               =  null;
     
    217223    workspace_filter = workspace_tree.getFilter();
    218224
     225    card_layout = new CardLayout();
     226
    219227    // Collection Tree
    220228    collection_pane = new JPanel();
     
    225233    collection_label = new JLabel();
    226234    collection_label.setOpaque(true);
    227     Dictionary.registerText(collection_label, "Collection.No_Collection");
     235    Dictionary.registerText(collection_label, "Collection.Collection");
    228236
    229237    collection_tree = Gatherer.c_man.getCollectionTree();
     
    234242    tree_pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    235243
     244    // No collection loaded pane
     245    JPanel no_collection_pane = new JPanel();
     246    no_collection_pane.setBackground(Color.lightGray);
     247
     248    JLabel no_collection_label = new JLabel();
     249    no_collection_label.setBackground(Color.lightGray);
     250    no_collection_label.setForeground(Color.black);
     251    no_collection_label.setOpaque(true);
     252    Dictionary.registerText(no_collection_label, "Collection.Collection");
     253
     254    JPanel no_collection_loaded_panel = new JPanel();
     255    no_collection_loaded_panel.setBorder(BorderFactory.createLineBorder(Color.black));
     256    no_collection_loaded_panel.setBackground(Color.lightGray);
     257
     258    JLabel no_collection_loaded_label = new JLabel();
     259    no_collection_loaded_label.setHorizontalAlignment(JLabel.CENTER);
     260    no_collection_loaded_label.setVerticalAlignment(JLabel.CENTER);
     261    Dictionary.registerText(no_collection_loaded_label, "Collection.No_Collection_Loaded");
     262
    236263    // Status pane
    237264    control_pane = new JPanel();
     
    240267    inner_pane.setSize(STATUS_SIZE);
    241268
     269    card_pane = new JPanel();
    242270    JPanel file_pane = new JPanel();
    243271    JPanel progress_pane = new JPanel();
     
    260288    workspace_pane.add(workspace_scroll, BorderLayout.CENTER);
    261289    workspace_pane.add(workspace_filter, BorderLayout.SOUTH);
    262 
     290   
    263291    collection_pane.setLayout(new BorderLayout());
    264292    collection_pane.add(collection_label, BorderLayout.NORTH);
    265293
     294    no_collection_loaded_panel.setLayout(new BorderLayout());
     295    no_collection_loaded_panel.add(no_collection_loaded_label, BorderLayout.CENTER);
     296
     297    no_collection_pane.setLayout(new BorderLayout());
     298    no_collection_pane.add(no_collection_label, BorderLayout.NORTH);
     299    no_collection_pane.add(no_collection_loaded_panel, BorderLayout.CENTER);
     300
     301    card_pane.setLayout(card_layout);
     302    card_pane.add(no_collection_pane, NO_COLLECTION_LOADED_CARD);
     303    card_pane.add(collection_pane, COLLECTION_LOADED_CARD);
     304
    266305    tree_pane.add(workspace_pane, JSplitPane.LEFT);
    267     tree_pane.add(collection_pane, JSplitPane.RIGHT);
     306    tree_pane.add(card_pane, JSplitPane.RIGHT);
    268307    tree_pane.setDividerLocation(TREE_SIZE.width - 10);
    269308
     
    344383    {
    345384    if (collection_loaded) {
    346         // Update collection label
    347         Dictionary.registerText(collection_label, "Collection.Collection");
    348         collection_label.setBackground(Configuration.getColor("coloring.collection_heading_background", false));
    349         collection_label.setForeground(Configuration.getColor("coloring.collection_heading_foreground", false));
    350 
    351385        // Update collection tree
    352386        if (refresh_reason == Gatherer.COLLECTION_OPENED) {
     
    354388        }
    355389
    356         // Update collection filter
    357         collection_filter.setBackground(Configuration.getColor("coloring.collection_heading_background", false));
     390        card_layout.show(card_pane, COLLECTION_LOADED_CARD);
    358391    }
    359392    else {
    360         // Update collection label
    361         String[] args = new String[1];
    362         args[0] = Dictionary.get("Collection.No_Collection");
    363         Dictionary.registerText(collection_label, "Collection.Collection", args);
    364         collection_label.setBackground(Color.lightGray);
    365         collection_label.setForeground(Color.black);
    366 
    367393        // Update collection tree
    368394        collection_tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Error")));
    369395
    370         // Update collection filter
    371         collection_filter.setBackground(Color.lightGray);
     396        card_layout.show(card_pane, NO_COLLECTION_LOADED_CARD);
    372397    }
    373398
    374399    // Enable or disable the controls
    375     workspace_tree.setEnabled(true);
    376400    collection_tree.setEnabled(collection_loaded);
    377401    collection_filter.setEnabled(collection_loaded);
Note: See TracChangeset for help on using the changeset viewer.