Changeset 14047
- Timestamp:
- 2007-05-03T09:29:43+12:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/FormatPane.java
r13709 r14047 46 46 import org.greenstone.gatherer.cdm.FormatManager; 47 47 import org.greenstone.gatherer.cdm.Format; 48 import org.greenstone.gatherer.cdm.Format4gs3Manager; 49 import org.greenstone.gatherer.cdm.Format4gs3; 50 import org.greenstone.gatherer.cdm.DOMProxyListEntry; 48 51 import org.greenstone.gatherer.cdm.Control; 49 52 import org.greenstone.gatherer.Configuration; … … 52 55 import org.greenstone.gatherer.shell.GShellListener; 53 56 54 public class FormatPane 55 extends BaseConfigPane 56 57 58 57 public class FormatPane 58 extends BaseConfigPane 59 implements PreviewButtonOwner,GShellListener{ 60 61 59 62 /** The button for viewing the collection. */ 60 private PreviewButton preview_button = null;63 private static PreviewButton preview_button = null; 61 64 private boolean buildCanceled = false; 62 65 63 66 /** The constructor. */ 64 public FormatPane() { 65 super(); 66 if (Gatherer.GS3) { 67 contents = new String []{ "CDM.GUI.General", "CDM.GUI.SearchMetadata", "CDM.GUI.Formats", "CDM.GUI.Translation" }; 68 } else { 69 contents = new String []{ "CDM.GUI.General", "CDM.GUI.SearchMetadata", "CDM.GUI.Formats", "CDM.GUI.Translation", "CDM.GUI.SuperCollection","CDM.GUI.Macros" }; 70 } 71 JPanel side_panel = new JPanel(); 72 side_panel.setLayout(new BorderLayout()); 73 remove(tree_pane); 74 side_panel.add(tree_pane, BorderLayout.CENTER); 75 JPanel preview_pane = new JPanel(); 76 preview_pane.setLayout(new BorderLayout()); 77 preview_pane.setBorder(BorderFactory.createEmptyBorder(5,0,0,0)); 78 79 preview_button = new PreviewButton(Dictionary.get("CreatePane.Preview_Collection"), Dictionary.get("CreatePane.Preview_Collection_Tooltip")); 80 preview_button.setEnabled(true); 81 preview_button.setVariablePreview(true); 82 preview_button.setOwner(this); 83 preview_pane.add(preview_button, BorderLayout.CENTER); 84 85 86 preview_button.addActionListener(new ActionListener() { 87 public void actionPerformed(ActionEvent event) { 88 if (view != null) { 89 view.loseFocus(); 90 } 91 92 if (buildCanceled){ 93 WarningDialog dialog = new WarningDialog("warning.ShowPreviousCollection", Dictionary.get("ShowPreviousCollection.Title"), Dictionary.get("ShowPreviousCollection.Message"), null, false); 94 dialog.display(); 95 dialog.dispose(); 96 } 97 } 98 99 }); 100 side_panel.add(preview_pane, BorderLayout.SOUTH); 101 102 add(side_panel, BorderLayout.WEST); 103 } 104 105 public void gainFocus(){ 106 107 if (Gatherer.c_man.built() && Configuration.library_url != null) { 108 preview_button.setEnabled(true); 109 } 110 else{ 111 preview_button.setEnabled(false); 112 } 113 114 } 115 116 67 public FormatPane () { 68 super (); 69 if (Gatherer.GS3) { 70 contents = new String []{ "CDM.GUI.General", "CDM.GUI.SearchMetadata", "CDM.GUI.Formats", "CDM.GUI.Translation" }; 71 } else { 72 contents = new String []{ "CDM.GUI.General", "CDM.GUI.SearchMetadata", "CDM.GUI.Formats", "CDM.GUI.Translation", "CDM.GUI.SuperCollection","CDM.GUI.Macros" }; 73 } 74 JPanel side_panel = new JPanel (); 75 side_panel.setLayout (new BorderLayout ()); 76 remove (tree_pane); 77 side_panel.add (tree_pane, BorderLayout.CENTER); 78 JPanel preview_pane = new JPanel (); 79 preview_pane.setLayout (new BorderLayout ()); 80 preview_pane.setBorder (BorderFactory.createEmptyBorder (5,0,0,0)); 81 82 preview_button = new PreviewButton (Dictionary.get ("CreatePane.Preview_Collection"), Dictionary.get ("CreatePane.Preview_Collection_Tooltip")); 83 preview_button.setEnabled (true); 84 preview_button.setVariablePreview (true); 85 preview_button.setOwner (this); 86 preview_pane.add (preview_button, BorderLayout.CENTER); 87 88 89 preview_button.addActionListener (new ActionListener () { 90 public void actionPerformed (ActionEvent event) { 91 if (view != null) { 92 view.loseFocus (); 93 } 94 95 if (buildCanceled){ 96 WarningDialog dialog = new WarningDialog ("warning.ShowPreviousCollection", Dictionary.get ("ShowPreviousCollection.Title"), Dictionary.get ("ShowPreviousCollection.Message"), null, false); 97 dialog.display (); 98 dialog.dispose (); 99 } 100 } 101 102 }); 103 side_panel.add (preview_pane, BorderLayout.SOUTH); 104 105 add (side_panel, BorderLayout.WEST); 106 } 107 108 public void gainFocus (){ 109 110 if (Gatherer.c_man.built () && Configuration.library_url != null) { 111 preview_button.setEnabled (true); 112 } 113 else{ 114 preview_button.setEnabled (false); 115 } 116 117 } 118 public static void setPreviewButton (boolean ready_to_preview) { 119 preview_button.setEnabled (ready_to_preview); 120 } 121 117 122 /** All implementation of GShellListener must include this method so the listener can be informed of messages from the GShell. 118 123 * @param event A <strong>GShellEvent</strong> that contains, amoung other things, the message. 119 124 */ 120 public synchronized void message (GShellEvent event) {121 // We don't care. 122 } 123 125 public synchronized void message (GShellEvent event) { 126 // We don't care. 127 } 128 124 129 125 130 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell begins its task. Implementation side-effect, not actually used. 126 131 * @param event A <strong>GShellEvent</strong> that contains details of the initial state of the <strong>GShell</strong> before task comencement. 127 132 */ 128 public synchronized void processBegun (GShellEvent event) {129 133 public synchronized void processBegun (GShellEvent event) { 134 buildCanceled = false; 130 135 } 131 136 … … 133 138 * @param event A <strong>GShellEvent</strong> that contains details of the final state of the <strong>GShell</strong> after task completion. 134 139 */ 135 public synchronized void processComplete (GShellEvent event) {136 if(event.getStatus() == GShell.OK) {137 if(event.getType() == GShell.BUILD) {138 139 140 } 141 142 buildCanceled = true; 143 144 } 145 146 147 148 protected Control getSubControls (String type) {149 if(type.equals("CDM.GUI.General")) {150 return CollectionDesignManager.general_manager.getControls();151 152 if (type.equals("CDM.GUI.SearchMetadata")) {153 return CollectionDesignManager.searchmetadata_manager.getControls();154 155 if(type.equals("CDM.GUI.Formats")) {156 return CollectionDesignManager.format_manager.getControls();157 158 if (type.equals("CDM.GUI.Translation")) {159 return CollectionDesignManager.translation_manager.getControls();160 161 if (type.equals("CDM.GUI.Macros")) {162 return CollectionDesignManager.macros_manager.getControls();163 164 if(type.equals("CDM.GUI.SuperCollection")) {165 return CollectionDesignManager.supercollection_manager.getControls();166 167 168 } 169 140 public synchronized void processComplete (GShellEvent event) { 141 if(event.getStatus () == GShell.OK) { 142 if(event.getType () == GShell.BUILD) { 143 buildCanceled = false; 144 } 145 } 146 else { 147 buildCanceled = true; 148 } 149 } 150 151 152 153 protected Control getSubControls (String type) { 154 if(type.equals ("CDM.GUI.General")) { 155 return CollectionDesignManager.general_manager.getControls (); 156 } 157 if (type.equals ("CDM.GUI.SearchMetadata")) { 158 return CollectionDesignManager.searchmetadata_manager.getControls (); 159 } 160 if(type.equals ("CDM.GUI.Formats")) { 161 return CollectionDesignManager.format_manager.getControls (); 162 } 163 if (type.equals ("CDM.GUI.Translation")) { 164 return CollectionDesignManager.translation_manager.getControls (); 165 } 166 if (type.equals ("CDM.GUI.Macros")) { 167 return CollectionDesignManager.macros_manager.getControls (); 168 } 169 if(type.equals ("CDM.GUI.SuperCollection")) { 170 return CollectionDesignManager.supercollection_manager.getControls (); 171 } 172 return null; 173 } 174 170 175 private int page_type = PreviewButton.HOME_PAGE; 171 176 private String page_params = ""; 172 public int getPageType() { 173 System.err.println("view type = "+view_type); 174 if (view_type.equals("CDM.GUI.General") || view_type.equals("CDM.GUI.Translation")) { 175 page_type = PreviewButton.HOME_PAGE; 176 } else { 177 Format current_format = ((FormatManager.FormatControl)view).getCurrentFormat(); 178 String feature_name = current_format.getFeatureName(); 179 System.err.println("current format = "+feature_name); 180 if (feature_name.equals("")) { 181 // must be modifying VList or HList 182 // what should we do??? 183 page_type = PreviewButton.CLASSIFIER_PAGE; 184 page_params = "CL1"; 185 } 186 if (feature_name.startsWith("CL")) { 187 page_type = PreviewButton.CLASSIFIER_PAGE; 188 page_params = current_format.getFeatureName(); 189 } 190 else if (feature_name.startsWith("Document")) { 191 page_type = PreviewButton.DOCUMENT_PAGE; 192 page_params = "HASH01e4da6100fdbb11b7ef244b"; 193 } 194 else if (feature_name.equals("Search")) { 195 page_type = PreviewButton.SEARCH_PAGE; 196 page_params = "the"; 197 } 198 } 199 return page_type; 200 } 201 202 public String getPageParams() { 203 return page_params; 204 } 205 177 public int getPageType () { 178 System.err.println ("view type = "+view_type); 179 if (view_type.equals ("CDM.GUI.General") || view_type.equals ("CDM.GUI.Translation")) { 180 page_type = PreviewButton.HOME_PAGE; 181 } else { 182 183 if (Gatherer.GS3 == true) { 184 Format4gs3 current_format = ((Format4gs3Manager.FormatControl)view).getCurrentFormat (); 185 String feature_name = current_format.getFeatureName (); 186 187 if (feature_name.equals ("browse")) { 188 page_type = PreviewButton.CLASSIFIER_PAGE; 189 page_params = "CL1"; 190 } else 191 if (feature_name.startsWith ("CL")) { 192 page_type = PreviewButton.CLASSIFIER_PAGE; 193 page_params = current_format.getFeatureName (); 194 } 195 else if (feature_name.startsWith ("display")) { 196 page_type = PreviewButton.DOCUMENT_PAGE; 197 page_params = "HASH01e4da6100fdbb11b7ef244b"; 198 } 199 else if (feature_name.equals ("search")) { 200 page_type = PreviewButton.SEARCH_PAGE; 201 page_params = "the"; 202 } else { // HOME_PAGE 203 } 204 } else { 205 Format current_format = ((FormatManager.FormatControl)view).getCurrentFormat (); 206 String feature_name = current_format.getFeatureName (); 207 System.err.println ("current format = "+feature_name); 208 if (feature_name.equals ("")) { 209 // must be modifying VList or HList 210 // what should we do??? 211 page_type = PreviewButton.CLASSIFIER_PAGE; 212 page_params = "CL1"; 213 } 214 if (feature_name.startsWith ("CL")) { 215 page_type = PreviewButton.CLASSIFIER_PAGE; 216 page_params = current_format.getFeatureName (); 217 } 218 else if (feature_name.startsWith ("Document")) { 219 page_type = PreviewButton.DOCUMENT_PAGE; 220 page_params = "HASH01e4da6100fdbb11b7ef244b"; 221 } 222 else if (feature_name.equals ("Search")) { 223 page_type = PreviewButton.SEARCH_PAGE; 224 page_params = "the"; 225 } 226 } 227 } 228 return page_type; 229 } 230 231 public String getPageParams () { 232 return page_params; 233 } 234 206 235 }
Note:
See TracChangeset
for help on using the changeset viewer.