source: gli/trunk/src/org/greenstone/gatherer/cdm/SubcollectionIndexManager.java@ 18412

Last change on this file since 18412 was 18412, checked in by kjdon, 15 years ago

more modifications for RTL GLI, thanks to Amin Hedjazi

  • Property svn:keywords set to Author Date Id Revision
File size: 23.5 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * Author: John Thompson, Greenstone Digital Library, University of Waikato
9 *
10 * Copyright (C) 1999 New Zealand Digital Library Project
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *########################################################################
26 */
27package org.greenstone.gatherer.cdm;
28
29import java.awt.*;
30import java.awt.event.*;
31import java.util.*;
32import javax.swing.*;
33import javax.swing.event.*;
34import org.greenstone.gatherer.DebugStream;
35import org.greenstone.gatherer.Dictionary;
36import org.greenstone.gatherer.Gatherer;
37import org.greenstone.gatherer.gui.GLIButton;
38import org.greenstone.gatherer.util.CheckList;
39import org.greenstone.gatherer.util.JarTools;
40import org.greenstone.gatherer.util.StaticStrings;
41import org.w3c.dom.*;
42
43
44/** This class maintains a list of indexes partitions for the purpose of defining subcollections.
45 * @author John Thompson, Greenstone Digital Library, University of Waikato
46 * @version 2.4
47 */
48public class SubcollectionIndexManager
49extends DOMProxyListModel
50{
51 static final private Dimension FIELD_SIZE = new Dimension(200, 30);
52
53 private Control controls;
54 private DOMProxyListModel model;
55 private SubcollectionIndex default_index;
56
57
58 /** Constructor. */
59 public SubcollectionIndexManager(Element subindexes)
60 {
61 super(subindexes, StaticStrings.INDEX_ELEMENT, new SubcollectionIndex());
62 DebugStream.println("SubcollectionIndexManager: " + getSize() + " subcollection indexes parsed.");
63 this.model = this;
64
65 // Parse and retrieve the default index
66 NodeList default_index_elements = CollectionConfiguration.getElementsByTagName(StaticStrings.SUBCOLLECTION_DEFAULT_INDEX_ELEMENT);
67 if (default_index_elements.getLength() > 0) {
68 default_index = new SubcollectionIndex((Element) default_index_elements.item(0));
69 }
70 }
71
72
73 /** Method to add a subindex.
74 * @param subindex a SubcollectionIndex
75 * @see org.greenstone.gatherer.Gatherer
76 * @see org.greenstone.gatherer.collection.CollectionManager
77 */
78 private void addSubcollectionIndex(SubcollectionIndex subcollection_index)
79 {
80 if (!contains(subcollection_index)) {
81 // add a pseudo metadata
82 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + subcollection_index.getID());
83 metadatum.setValue(subcollection_index.getID());
84 CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum);
85 add(getSize(), subcollection_index);
86 }
87 }
88
89
90 public void destroy()
91 {
92 if (controls != null) {
93 controls.destroy();
94 controls = null;
95 }
96 default_index = null;
97 model = null;
98 }
99
100
101 public Control getControls()
102 {
103 if (controls == null) {
104 controls = new SubcollectionIndexControls();
105 }
106 return controls;
107 }
108
109
110 /** Method to get all of the subindexes set.
111 * @return an ArrayList containing all the defined indexes
112 */
113 public ArrayList getSubcollectionIndexes()
114 {
115 return children();
116 }
117
118 /** Called when the detail mode has changed which in turn may cause several design elements to be available/hidden
119 * @param mode the new mode as an int
120 */
121 public void modeChanged(int mode) {
122
123 }
124
125 private int moveSubcollectionIndex(SubcollectionIndex subcollection_index, boolean move_up)
126 {
127 // Determine the current position of the subcollection index
128 int position = indexOf(subcollection_index);
129 int new_position;
130
131 // Attempt to move the subcollection index up
132 if (move_up) {
133 // Check it's not already at the top
134 if (position == 0) {
135 return position;
136 }
137
138 // This automatically removes the index first, as an Element can only exist once in a particular document
139 new_position = position - 1;
140 addBefore(subcollection_index, (SubcollectionIndex) getElementAt(new_position));
141 }
142
143 // Attempt to move the subcollection index down
144 else {
145 // Check it's not already at the bottom
146 if (position == (getSize()) - 1) {
147 return position;
148 }
149
150 // This automatically removes the index first, as an Element can only exist once in a particular document
151 new_position = position + 1;
152 addAfter(subcollection_index, (SubcollectionIndex) getElementAt(new_position));
153 }
154
155 return new_position;
156 }
157
158
159 /** Method to remove a certain subcollection index. */
160 private void removeSubcollectionIndex(SubcollectionIndex subcollection_index)
161 {
162 if (subcollection_index != null) {
163 // Remove any current metadata from this index
164 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + subcollection_index.getID());
165
166 // Check if the index removed happens to be the default index
167 if (default_index != null && default_index.equals(subcollection_index)) {
168 setDefault(null);
169 }
170
171 // Remove the index
172 remove(subcollection_index);
173 }
174 }
175
176
177 /** Method to remove all of the subindexes that contain a certain subcollection.
178 * @param subcollection the Subcollection that has been removed
179 * @see org.greenstone.gatherer.cdm.Subcollection
180 * @see org.greenstone.gatherer.cdm.SubcollectionIndex
181 */
182 public void removeSubcollectionIndexes(Subcollection subcollection)
183 {
184 String subcollection_name = subcollection.getName();
185 int size = getSize();
186 for(int i = size - 1; i >= 0; i--) {
187 SubcollectionIndex subcollection_index = (SubcollectionIndex) getElementAt(i);
188 if (subcollection_index.getSources().contains(subcollection_name)) {
189 removeSubcollectionIndex(subcollection_index);
190 }
191 }
192 }
193
194 private void replaceSubcollectionIndex(SubcollectionIndex old_subcollection, SubcollectionIndex new_subcollection) {
195 // Remove old collection meta
196 CollectionDesignManager.collectionmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + old_subcollection.getID());
197 // Add new one
198 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + new_subcollection.getID());
199 metadatum.setValue(new_subcollection.getID());
200 CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum);
201 if(default_index != null && default_index.equals(old_subcollection)) {
202 setDefault(new_subcollection);
203 }
204
205 // get the position of the old one
206 int position = indexOf(old_subcollection);
207 remove(old_subcollection);
208 add(position, new_subcollection);
209 }
210
211 /** Method to set the default subcollection index.
212 * @param index The <strong>SubcollectionIndex</strong> to use as the default index.
213 * @see org.greenstone.gatherer.Gatherer
214 * @see org.greenstone.gatherer.collection.CollectionManager
215 * @see org.greenstone.gatherer.cdm.SubcollectionIndex
216 */
217 private void setDefault(SubcollectionIndex subcollection_index)
218 {
219 if (subcollection_index != null) {
220 if (default_index == null) {
221 // Create the default index element, and place immediately after indexes element.
222 Element default_index_element = root.getOwnerDocument().createElement(StaticStrings.SUBCOLLECTION_DEFAULT_INDEX_ELEMENT);
223 default_index = new SubcollectionIndex(default_index_element);
224 Node target_node = CollectionConfiguration.findInsertionPoint(default_index_element);
225 if (target_node != null) {
226 root.getOwnerDocument().getDocumentElement().insertBefore(default_index_element, target_node);
227 }
228 else {
229 root.getOwnerDocument().getDocumentElement().appendChild(default_index_element);
230 }
231 }
232 default_index.setAssigned(true);
233 default_index.setSources(subcollection_index.getSources());
234 }
235 else {
236 if (default_index != null) {
237 default_index.setAssigned(false);
238 }
239 }
240 }
241
242
243 /** This class creates a set of controls for editing the indexes. */
244 private class SubcollectionIndexControls
245 extends JPanel
246 implements Control
247 {
248 private CheckList source_list;
249 private JButton add_button;
250 private JButton move_down_button;
251 private JButton move_up_button;
252 private JButton remove_button;
253 private JButton replace_button;
254 private JButton select_all_button;
255 private JButton select_none_button;
256 private JButton set_default_button;
257 private JList subcollection_index_list;
258 private JTextField subcollection_index_name_textfield;
259
260
261 /** Constructor.
262 */
263 public SubcollectionIndexControls()
264 {
265 super();
266 this.setComponentOrientation(Dictionary.getOrientation());
267 ArrayList sources = new ArrayList();
268 ListModel source_model = CollectionDesignManager.subcollection_manager;
269 for (int i = 0; i < source_model.getSize(); i++) {
270 sources.add(source_model.getElementAt(i));
271 }
272
273 // Creation
274 JPanel assigned_indexes_pane = new JPanel();
275 assigned_indexes_pane.setComponentOrientation(Dictionary.getOrientation());
276 JLabel index_label = new JLabel(Dictionary.get("CDM.SubcollectionIndexManager.Subindexes"));
277 index_label.setComponentOrientation(Dictionary.getOrientation());
278 subcollection_index_list = new JList(model);
279 subcollection_index_list.setCellRenderer(new SubcollectionIndexListCellRenderer());
280 subcollection_index_list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
281 subcollection_index_list.setVisibleRowCount(2);
282 subcollection_index_list.setComponentOrientation(Dictionary.getOrientation());
283
284 JPanel movement_pane = new JPanel();
285 movement_pane.setComponentOrientation(Dictionary.getOrientation());
286 move_up_button = new GLIButton(Dictionary.get("CDM.Move.Move_Up"), JarTools.getImage("arrow-up.gif"), Dictionary.get("CDM.Move.Move_Up_Tooltip"));
287 move_up_button.setEnabled(false);
288
289 move_down_button = new GLIButton(Dictionary.get("CDM.Move.Move_Down"), JarTools.getImage("arrow-down.gif"), Dictionary.get("CDM.Move.Move_Down_Tooltip"));
290 move_down_button.setEnabled(false);
291
292 set_default_button = new GLIButton(Dictionary.get("CDM.SubcollectionIndexManager.Set_Default_Subindex"), Dictionary.get("CDM.SubcollectionIndexManager.Set_Default_Subindex_Tooltip"));
293 set_default_button.setEnabled(false);
294
295 JPanel index_pane = new JPanel();
296 index_pane.setComponentOrientation(Dictionary.getOrientation());
297 JPanel details_pane = new JPanel();
298 details_pane.setComponentOrientation(Dictionary.getOrientation());
299 JPanel labels_pane = new JPanel();
300 labels_pane.setComponentOrientation(Dictionary.getOrientation());
301
302 select_all_button = new GLIButton(Dictionary.get("CDM.IndexManager.Select_All"), Dictionary.get("CDM.IndexManager.Select_All_Tooltip"));
303 select_none_button = new GLIButton(Dictionary.get("CDM.IndexManager.Select_None"), Dictionary.get("CDM.IndexManager.Select_None_Tooltip"));
304
305
306 JPanel boxes_pane = new JPanel();
307 boxes_pane.setComponentOrientation(Dictionary.getOrientation());
308 JPanel content_pane = new JPanel();
309 content_pane.setComponentOrientation(Dictionary.getOrientation());
310
311 JLabel source_label = new JLabel(Dictionary.get("CDM.SubcollectionIndexManager.Source"));
312 source_label.setComponentOrientation(Dictionary.getOrientation());
313
314 source_list = new CheckList(false);
315 source_list.setListData(sources);
316 source_list.setToolTipText(Dictionary.get("CDM.SubcollectionIndexManager.Source_Tooltip"));
317
318 select_all_button.setEnabled(isSelectAllEnabled());
319 select_none_button.setEnabled(isSelectAllEnabled());
320
321 JPanel button_pane = new JPanel();
322 button_pane.setComponentOrientation(Dictionary.getOrientation());
323
324 add_button = new GLIButton(Dictionary.get("CDM.SubcollectionIndexManager.Add_Subindex"), Dictionary.get("CDM.SubcollectionIndexManager.Add_Subindex_Tooltip"));
325 add_button.setEnabled(false);
326
327 remove_button = new GLIButton(Dictionary.get("CDM.SubcollectionIndexManager.Remove_Subindex"), Dictionary.get("CDM.SubcollectionIndexManager.Remove_Subindex_Tooltip"));
328 remove_button.setEnabled(false);
329
330 replace_button = new GLIButton(Dictionary.get("CDM.SubcollectionIndexManager.Replace_Subindex"), Dictionary.get("CDM.SubcollectionIndexManager.Replace_Subindex_Tooltip"));
331 replace_button.setEnabled(false);
332
333
334 // Listeners
335 add_button.addActionListener(new AddListener());
336 add_button.addActionListener(CollectionDesignManager.buildcol_change_listener);
337 move_down_button.addActionListener(new MoveListener(false));
338 move_down_button.addActionListener(CollectionDesignManager.buildcol_change_listener);
339 move_up_button.addActionListener(new MoveListener(true));
340 move_up_button.addActionListener(CollectionDesignManager.buildcol_change_listener);
341 remove_button.addActionListener(new RemoveListener());
342 remove_button.addActionListener(CollectionDesignManager.buildcol_change_listener);
343 replace_button.addActionListener(new ReplaceListener());
344 replace_button.addActionListener(CollectionDesignManager.buildcol_change_listener);
345 select_all_button.addActionListener(new SelectAllListener());
346 select_all_button.addActionListener(CollectionDesignManager.buildcol_change_listener);
347 select_none_button.addActionListener(new SelectNoneListener());
348 select_none_button.addActionListener(CollectionDesignManager.buildcol_change_listener);
349 set_default_button.addActionListener(new SetDefaultListener());
350 set_default_button.addActionListener(CollectionDesignManager.buildcol_change_listener);
351 subcollection_index_list.addListSelectionListener(new AssignedListListener());
352 source_list.addListSelectionListener(new SourceListListener());
353
354
355 // Layout
356 movement_pane.setBorder(BorderFactory.createEmptyBorder(0,2,0,0));
357 movement_pane.setLayout(new GridLayout(3,1));
358 movement_pane.add(move_up_button);
359 movement_pane.add(move_down_button);
360 movement_pane.add(set_default_button);
361
362 assigned_indexes_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
363 assigned_indexes_pane.setLayout(new BorderLayout());
364 assigned_indexes_pane.add(index_label, BorderLayout.NORTH);
365 assigned_indexes_pane.add(new JScrollPane(subcollection_index_list), BorderLayout.CENTER);
366 assigned_indexes_pane.add(movement_pane, BorderLayout.LINE_END);
367
368 labels_pane.setLayout(new BorderLayout());
369 labels_pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5));
370
371 // add the select all and select none buttons to the label panel
372 GridBagLayout gridbag = new GridBagLayout();
373 GridBagConstraints c = new GridBagConstraints();
374 labels_pane.setLayout(gridbag);
375
376 c.fill = GridBagConstraints.BOTH;
377 c.weightx = 1.0;
378 c.weighty = 1.0;
379 c.gridx = 0;
380 c.gridy = 0;
381
382 gridbag.setConstraints(source_label, c);
383 labels_pane.add(source_label);
384
385 c.fill = GridBagConstraints.HORIZONTAL;
386 c.weighty = 0.0;
387 c.gridy = 1;
388
389 gridbag.setConstraints(select_all_button, c);
390 labels_pane.add(select_all_button);
391
392 c.gridy = 2;
393 gridbag.setConstraints(select_none_button, c);
394 labels_pane.add(select_none_button);
395
396
397 boxes_pane.setLayout(new BorderLayout());
398 boxes_pane.add(new JScrollPane(source_list), BorderLayout.CENTER);
399
400 details_pane.setLayout(new BorderLayout());
401 details_pane.add(labels_pane, BorderLayout.LINE_START);
402 details_pane.add(boxes_pane, BorderLayout.CENTER);
403
404 button_pane.setLayout(new GridLayout(1,3));
405 button_pane.add(add_button);
406 button_pane.add(replace_button);
407 button_pane.add(remove_button);
408
409 index_pane.setLayout(new BorderLayout());
410 index_pane.add(details_pane, BorderLayout.CENTER);
411 index_pane.add(button_pane, BorderLayout.SOUTH);
412
413 content_pane.setLayout(new BorderLayout());
414 content_pane.add(assigned_indexes_pane, BorderLayout.NORTH);
415 content_pane.add(index_pane, BorderLayout.CENTER);
416
417 setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
418 setLayout(new BorderLayout());
419 add(content_pane, BorderLayout.CENTER);
420 }
421
422
423 public void destroy()
424 {
425 }
426
427
428 public void gainFocus()
429 {
430 // Reload the source list
431 ArrayList sources = new ArrayList();
432 ListModel source_model = CollectionDesignManager.subcollection_manager;
433 for (int i = 0; i < source_model.getSize(); i++) {
434 sources.add(source_model.getElementAt(i));
435 }
436 source_list.setListData(sources);
437
438 // Refresh the subcollection index list
439 subcollection_index_list.updateUI();
440
441 clearControls();
442
443 }
444
445
446 public void loseFocus() {
447 }
448
449 private void clearControls() {
450 subcollection_index_list.clearSelection();
451 source_list.clearTicked();
452 add_button.setEnabled(false);
453 remove_button.setEnabled(false);
454 replace_button.setEnabled(false);
455 set_default_button.setEnabled(false);
456 move_down_button.setEnabled(false);
457 move_up_button.setEnabled(false);
458 select_all_button.setEnabled(isSelectAllEnabled());
459 select_none_button.setEnabled(isSelectAllEnabled());
460 }
461
462 private boolean isSelectAllEnabled(){
463 return source_list.getModel().getSize() > 0 ? true : false;
464 }
465
466 private void updateControlsWithSelectedIndex()
467 {
468 SubcollectionIndex selected_index = (SubcollectionIndex) subcollection_index_list.getSelectedValue();
469 if (selected_index == null) {
470 source_list.clearTicked();
471 return;
472 }
473
474 // Display the selected subcollection index's sources
475 source_list.clearTicked();
476 source_list.setTickedObjects(selected_index.getSources().toArray());
477 }
478
479
480 private void validateButtons() {
481
482 boolean add_enabled = false;
483 boolean replace_enabled = false;
484
485 // Can't add a new index if no sources are selected
486 if (!source_list.isNothingTicked()) {
487 ArrayList sources = source_list.getTicked();
488 SubcollectionIndex subcollection_index = new SubcollectionIndex(sources.toArray());
489
490 // Subcollection index already exists: can't add, but can replace if the name has changed
491 if (!model.contains(subcollection_index)) {
492 add_enabled = true;
493 if (!subcollection_index_list.isSelectionEmpty()) {
494 replace_enabled = true;
495 }
496 }
497 }
498
499 select_all_button.setEnabled(isSelectAllEnabled());
500 select_none_button.setEnabled(isSelectAllEnabled());
501
502 // We should now know the add_button state
503 add_button.setEnabled(add_enabled);
504 replace_button.setEnabled(replace_enabled);
505 }
506
507
508 private class AddListener
509 implements ActionListener {
510
511 public void actionPerformed(ActionEvent event)
512 {
513 if (!source_list.isNothingTicked()) {
514 ArrayList sources = source_list.getTicked();
515 SubcollectionIndex subcollection_index = new SubcollectionIndex(sources.toArray());
516 addSubcollectionIndex(subcollection_index);
517 clearControls();
518 }
519 }
520 }
521
522
523 private class MoveListener
524 implements ActionListener
525 {
526 private boolean move_up;
527
528 public MoveListener(boolean move_up)
529 {
530 this.move_up = move_up;
531 }
532
533 public void actionPerformed(ActionEvent event)
534 {
535 // Retrieve the selected subcollection index
536 SubcollectionIndex subcollection_index = (SubcollectionIndex) subcollection_index_list.getSelectedValue();
537 if (subcollection_index != null) {
538 int new_position = moveSubcollectionIndex(subcollection_index, move_up);
539 // Ensure the subcollection index that moved is still selected
540 subcollection_index_list.setSelectedIndex(new_position);
541 }
542 }
543 }
544
545 private class RemoveListener
546 implements ActionListener
547 {
548 public void actionPerformed(ActionEvent event) {
549
550 SubcollectionIndex delete_me = (SubcollectionIndex) subcollection_index_list.getSelectedValue();
551 if (delete_me != null) {
552 removeSubcollectionIndex(delete_me);
553 }
554 }
555 }
556
557
558 private class ReplaceListener
559 implements ActionListener {
560
561 public void actionPerformed(ActionEvent event) {
562
563 if (subcollection_index_list.isSelectionEmpty()|| source_list.isNothingTicked()) {
564 // This should never happen, but just in case...
565 replace_button.setEnabled(false);
566 return;
567 }
568 SubcollectionIndex old_index = (SubcollectionIndex) subcollection_index_list.getSelectedValue();
569 ArrayList sources = source_list.getTicked();
570 SubcollectionIndex new_index = new SubcollectionIndex(sources.toArray());
571 replaceSubcollectionIndex(old_index, new_index);
572 }
573 }
574
575
576 private class SetDefaultListener
577 implements ActionListener {
578
579 public void actionPerformed(ActionEvent event)
580 {
581 SubcollectionIndex subcollection_index = (SubcollectionIndex) subcollection_index_list.getSelectedValue();
582 if (subcollection_index != null) {
583 setDefault(subcollection_index);
584 // This should cause a repaint of just the desired row
585 subcollection_index_list.setSelectedValue(subcollection_index, true);
586 }
587 set_default_button.setEnabled(false);
588 }
589 }
590
591
592 private class SourceListListener
593 implements ListSelectionListener {
594
595 public void valueChanged(ListSelectionEvent event) {
596 if (event.getValueIsAdjusting()) {
597 return;
598 }
599 validateButtons();
600 }
601 }
602
603 private class SelectAllListener
604 implements ActionListener {
605
606 public void actionPerformed(ActionEvent event){
607 if(select_all_button.isEnabled()){
608 source_list.setAllTicked();
609 validateButtons();
610 }
611 }
612 }
613
614 private class SelectNoneListener
615 implements ActionListener {
616
617 public void actionPerformed(ActionEvent event){
618 if(select_none_button.isEnabled()){
619 source_list.clearTicked();
620 validateButtons();
621 }
622 }
623 }
624
625
626 /** Listens for selections within the assigned subcollection indexes list */
627 private class AssignedListListener
628 implements ListSelectionListener {
629
630 public void valueChanged(ListSelectionEvent event) {
631
632 if (event.getValueIsAdjusting()) {
633 return;
634 }
635
636 if (subcollection_index_list.isSelectionEmpty()) {
637 clearControls();
638 return;
639 }
640
641 int i = subcollection_index_list.getSelectedIndex();
642 int size = subcollection_index_list.getModel().getSize();
643
644 select_all_button.setEnabled(isSelectAllEnabled());
645 select_none_button.setEnabled(isSelectAllEnabled());
646
647 // Enable the buttons appropriately
648 remove_button.setEnabled(true);
649 replace_button.setEnabled(false);
650 add_button.setEnabled(false);
651 SubcollectionIndex selected_index = (SubcollectionIndex) subcollection_index_list.getSelectedValue();
652 set_default_button.setEnabled(default_index == null || !default_index.equals(selected_index));
653 if (i > 0) {
654 move_up_button.setEnabled(true);
655 }
656 else {
657 move_up_button.setEnabled(false);
658 }
659 if (i < size-1){
660 move_down_button.setEnabled(true);
661 }
662 else {
663 move_down_button.setEnabled(false);
664 }
665
666 // Need to fill in the rest of the bits
667 updateControlsWithSelectedIndex();
668 }
669 }
670
671
672 private class SubcollectionIndexListCellRenderer
673 extends DefaultListCellRenderer
674 {
675 /** Return a component that has been configured to display the specified value. */
676 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
677 JLabel component = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
678 if (default_index != null && default_index.equals(value)) {
679 component.setText(component.getText() + " " + Dictionary.get("CDM.SubcollectionIndexManager.Default_Partition_Indicator"));
680 }
681 return component;
682 }
683 }
684 }
685}
Note: See TracBrowser for help on using the repository browser.