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 | * <BR><BR>
|
---|
9 | *
|
---|
10 | * Author: John Thompson, Greenstone Digital Library, University of Waikato
|
---|
11 | *
|
---|
12 | * <BR><BR>
|
---|
13 | *
|
---|
14 | * Copyright (C) 1999 New Zealand Digital Library Project
|
---|
15 | *
|
---|
16 | * <BR><BR>
|
---|
17 | *
|
---|
18 | * This program is free software; you can redistribute it and/or modify
|
---|
19 | * it under the terms of the GNU General Public License as published by
|
---|
20 | * the Free Software Foundation; either version 2 of the License, or
|
---|
21 | * (at your option) any later version.
|
---|
22 | *
|
---|
23 | * <BR><BR>
|
---|
24 | *
|
---|
25 | * This program is distributed in the hope that it will be useful,
|
---|
26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
28 | * GNU General Public License for more details.
|
---|
29 | *
|
---|
30 | * <BR><BR>
|
---|
31 | *
|
---|
32 | * You should have received a copy of the GNU General Public License
|
---|
33 | * along with this program; if not, write to the Free Software
|
---|
34 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
35 | *########################################################################
|
---|
36 | */
|
---|
37 | package org.greenstone.gatherer.gui;
|
---|
38 |
|
---|
39 | import java.awt.*;
|
---|
40 | import java.awt.event.*;
|
---|
41 | import javax.swing.*;
|
---|
42 |
|
---|
43 | import org.greenstone.gatherer.Dictionary;
|
---|
44 | import org.greenstone.gatherer.Gatherer;
|
---|
45 | import org.greenstone.gatherer.LocalLibraryServer;
|
---|
46 | import org.greenstone.gatherer.cdm.CollectionDesignManager;
|
---|
47 | import org.greenstone.gatherer.cdm.FormatManager;
|
---|
48 | import org.greenstone.gatherer.cdm.Format;
|
---|
49 | import org.greenstone.gatherer.cdm.Control;
|
---|
50 |
|
---|
51 | public class FormatPane
|
---|
52 | extends BaseConfigPane
|
---|
53 | implements PreviewButtonOwner {
|
---|
54 |
|
---|
55 |
|
---|
56 | /** The button for viewing the collection. */
|
---|
57 | private PreviewButton preview_button = null;
|
---|
58 |
|
---|
59 | /** The constructor. */
|
---|
60 | public FormatPane() {
|
---|
61 | super();
|
---|
62 | contents = new String []{ "CDM.GUI.General", "CDM.GUI.SearchMetadata", "CDM.GUI.Formats", "CDM.GUI.Translation", "CDM.GUI.SuperCollection","CDM.GUI.Macros" };
|
---|
63 |
|
---|
64 | JPanel side_panel = new JPanel();
|
---|
65 | side_panel.setLayout(new BorderLayout());
|
---|
66 | remove(tree_pane);
|
---|
67 | side_panel.add(tree_pane, BorderLayout.CENTER);
|
---|
68 | preview_button = new PreviewButton();
|
---|
69 | preview_button.setEnabled(true);
|
---|
70 | preview_button.setVariablePreview(true);
|
---|
71 | preview_button.setOwner(this);
|
---|
72 |
|
---|
73 | Dictionary.registerBoth(preview_button, "CreatePane.Preview_Collection", "CreatePane.Preview_Collection_Tooltip");
|
---|
74 |
|
---|
75 | side_panel.add(preview_button, BorderLayout.SOUTH);
|
---|
76 |
|
---|
77 | add(side_panel, BorderLayout.WEST);
|
---|
78 | }
|
---|
79 |
|
---|
80 | protected Control getSubControls(String type) {
|
---|
81 | if(type.equals("CDM.GUI.General")) {
|
---|
82 | return CollectionDesignManager.general_manager.getControls();
|
---|
83 | }
|
---|
84 | if (type.equals("CDM.GUI.SearchMetadata")) {
|
---|
85 | return CollectionDesignManager.searchmetadata_manager.getControls();
|
---|
86 | }
|
---|
87 | if(type.equals("CDM.GUI.Formats")) {
|
---|
88 | return CollectionDesignManager.format_manager.getControls();
|
---|
89 | }
|
---|
90 | if (type.equals("CDM.GUI.Translation")) {
|
---|
91 | return CollectionDesignManager.translation_manager.getControls();
|
---|
92 | }
|
---|
93 | if (type.equals("CDM.GUI.Macros")) {
|
---|
94 | return CollectionDesignManager.macros_manager.getControls();
|
---|
95 | }
|
---|
96 | if(type.equals("CDM.GUI.SuperCollection")) {
|
---|
97 | return CollectionDesignManager.supercollection_manager.getControls();
|
---|
98 | }
|
---|
99 | return null;
|
---|
100 | }
|
---|
101 |
|
---|
102 | private int page_type = PreviewButton.HOME_PAGE;
|
---|
103 | private String page_params = "";
|
---|
104 | public int getPageType() {
|
---|
105 | System.err.println("view type = "+view_type);
|
---|
106 | if (view_type.equals("CDM.GUI.General") || view_type.equals("CDM.GUI.Translation")) {
|
---|
107 | page_type = PreviewButton.HOME_PAGE;
|
---|
108 | } else {
|
---|
109 | Format current_format = ((FormatManager.FormatControl)view).getCurrentFormat();
|
---|
110 | String feature_name = current_format.getFeatureName();
|
---|
111 | System.err.println("current format = "+feature_name);
|
---|
112 | if (feature_name.equals("")) {
|
---|
113 | // must be modifying VList or HList
|
---|
114 | // what should we do???
|
---|
115 | page_type = PreviewButton.CLASSIFIER_PAGE;
|
---|
116 | page_params = "CL1";
|
---|
117 | }
|
---|
118 | if (feature_name.startsWith("CL")) {
|
---|
119 | page_type = PreviewButton.CLASSIFIER_PAGE;
|
---|
120 | page_params = current_format.getFeatureName();
|
---|
121 | }
|
---|
122 | else if (feature_name.startsWith("Document")) {
|
---|
123 | page_type = PreviewButton.DOCUMENT_PAGE;
|
---|
124 | page_params = "HASH01e4da6100fdbb11b7ef244b";
|
---|
125 | }
|
---|
126 | else if (feature_name.equals("Search")) {
|
---|
127 | page_type = PreviewButton.SEARCH_PAGE;
|
---|
128 | page_params = "the";
|
---|
129 | }
|
---|
130 | }
|
---|
131 | return page_type;
|
---|
132 | }
|
---|
133 |
|
---|
134 | public String getPageParams() {
|
---|
135 | return page_params;
|
---|
136 | }
|
---|
137 |
|
---|
138 | }
|
---|