Revision: 5770 http://sourceforge.net/p/jump-pilot/code/5770 Author: michaudm Date: 2018-04-18 11:56:17 +0000 (Wed, 18 Apr 2018) Log Message: ----------- improve WritableDataStoreLayer wizard (user interaction)
Modified Paths: -------------- core/trunk/ChangeLog core/trunk/src/com/vividsolutions/jump/workbench/ui/wizard/WizardPanel.java core/trunk/src/com/vividsolutions/jump/workbench/ui/wizard/WizardPanelV2.java core/trunk/src/org/openjump/core/ui/plugin/datastore/AddDataStoreLayerWizardPanel.java core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerPanel.java core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizard.java core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizardPanel.java Modified: core/trunk/ChangeLog =================================================================== --- core/trunk/ChangeLog 2018-04-17 19:31:45 UTC (rev 5769) +++ core/trunk/ChangeLog 2018-04-18 11:56:17 UTC (rev 5770) @@ -5,6 +5,9 @@ * Changes.txt updated until here ********************************************** +2018-04-18 mmichaud <m.michael.mich...@orange.fr> + * improve WritableDataStoreLayer wizard (user interaction) + 2018-04-12 mmichaud <m.michael.mich...@orange.fr> * Fix #473 : shapefile driver no more limited to 4G files * Fix #471 : small bug in PostGIS (new) driver UI Modified: core/trunk/src/com/vividsolutions/jump/workbench/ui/wizard/WizardPanel.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/workbench/ui/wizard/WizardPanel.java 2018-04-17 19:31:45 UTC (rev 5769) +++ core/trunk/src/com/vividsolutions/jump/workbench/ui/wizard/WizardPanel.java 2018-04-18 11:56:17 UTC (rev 5770) @@ -41,12 +41,12 @@ /** * Called when the user presses Next on this panel's previous panel */ - public void enteredFromLeft(Map dataMap); + void enteredFromLeft(Map dataMap); /** * Called when the user presses Next on this panel */ - public void exitingToRight() throws Exception; + void exitingToRight() throws Exception; /** * Tip: Delegate to an InputChangedFirer. @@ -54,20 +54,20 @@ * WizardDialog, which needs to know when to update the enabled state of * the buttons. */ - public void add(InputChangedListener listener); + void add(InputChangedListener listener); - public void remove(InputChangedListener listener); + void remove(InputChangedListener listener); - public String getTitle(); + String getTitle(); - public String getID(); + String getID(); - public String getInstructions(); + String getInstructions(); - public boolean isInputValid(); + boolean isInputValid(); /** * @return null to turn the Next button into a Finish button */ - public String getNextID(); + String getNextID(); } Modified: core/trunk/src/com/vividsolutions/jump/workbench/ui/wizard/WizardPanelV2.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/workbench/ui/wizard/WizardPanelV2.java 2018-04-17 19:31:45 UTC (rev 5769) +++ core/trunk/src/com/vividsolutions/jump/workbench/ui/wizard/WizardPanelV2.java 2018-04-18 11:56:17 UTC (rev 5770) @@ -1,6 +1,5 @@ package com.vividsolutions.jump.workbench.ui.wizard; -import java.util.Map; /** * adds missing method definitions in older interface @@ -11,5 +10,5 @@ * Called in WizardDialog when the user presses Previous on this panel's * next panel to (re)initialize this panel, see e.g. {@link org.openjump.core.ui.plugin.file.open.SelectFilesPanel} */ - public void enteredFromRight() throws Exception; + void enteredFromRight() throws Exception; } Modified: core/trunk/src/org/openjump/core/ui/plugin/datastore/AddDataStoreLayerWizardPanel.java =================================================================== --- core/trunk/src/org/openjump/core/ui/plugin/datastore/AddDataStoreLayerWizardPanel.java 2018-04-17 19:31:45 UTC (rev 5769) +++ core/trunk/src/org/openjump/core/ui/plugin/datastore/AddDataStoreLayerWizardPanel.java 2018-04-18 11:56:17 UTC (rev 5770) @@ -12,6 +12,7 @@ import com.vividsolutions.jump.workbench.ui.wizard.AbstractWizardPanel; public class AddDataStoreLayerWizardPanel extends AbstractWizardPanel { + private static final String KEY = AddDataStoreLayerWizardPanel.class.getName(); private static final String TITLE = I18N.get(KEY); @@ -46,7 +47,7 @@ /** * @return the dataStorePanel */ - AddDatastoreLayerPanel getDataStorePanel() { + public AddDatastoreLayerPanel getDataStorePanel() { return dataStorePanel; } Modified: core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerPanel.java =================================================================== --- core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerPanel.java 2018-04-17 19:31:45 UTC (rev 5769) +++ core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerPanel.java 2018-04-18 11:56:17 UTC (rev 5770) @@ -15,6 +15,7 @@ import com.vividsolutions.jump.workbench.ui.plugin.datastore.ConnectionPanel; import com.vividsolutions.jump.workbench.ui.plugin.datastore.PasswordPrompter; import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager; +import com.vividsolutions.jump.workbench.ui.wizard.WizardPanel; import javax.swing.*; import javax.swing.event.PopupMenuEvent; @@ -41,7 +42,6 @@ private JComboBox<PrimaryKeyColumn> identifierAttributeComboBox = null; private JTextField maxFeaturesTextField = null; private JTextArea whereTextArea = null; - //private JCheckBox cachingCheckBox = null; private JCheckBox limitedToViewCheckBox = null; private JCheckBox manageConflictsCheckBox = null; @@ -51,6 +51,13 @@ getConnectionComboBox().addActionListener(new ActionListener() { public void actionPerformed( ActionEvent e ) { getDatasetComboBox().setSelectedItem( null ); + Component c = AddWritableDataStoreLayerPanel.this; + while ((c = c.getParent()) != null) { + if (c instanceof WizardPanel) { + ((AddWritableDataStoreLayerWizardPanel) c).selectionChanged(); + break; + } + } } }); } @@ -69,7 +76,7 @@ return description; } - public boolean execute(PlugInContext context) throws Exception { + public boolean execute(PlugInContext context) { return true; } @@ -134,14 +141,6 @@ return whereTextArea.getText().trim(); } - //public boolean isCaching() { - // return getCachingCheckBox().isSelected(); - //} - - //public void setCaching( boolean caching ) { - // getCachingCheckBox().setSelected( caching ); - //} - public boolean isLimitedToView() { return getLimitedToViewCheckBox().isSelected(); } @@ -159,8 +158,9 @@ } public String validateInput() { - if ( super.validateInput() != null ) { - return super.validateInput(); + String validation = super.validateInput(); + if ( validation != null ) { + return validation; } if (((String) LangUtil.ifNull(getDatasetName(), "")).length() == 0) { return I18N.get(KEY + ".missing-dataset-name"); @@ -202,6 +202,13 @@ if ( identifierAttributeComboBox.getItemCount() > 0 ) { identifierAttributeComboBox.setSelectedIndex( 0 ); } + Component c = AddWritableDataStoreLayerPanel.this; + while ((c = c.getParent()) != null) { + if (c instanceof WizardPanel) { + ((AddWritableDataStoreLayerWizardPanel) c).selectionChanged(); + break; + } + } } } ); // Populate the dataset combobox only if the user pushes the @@ -494,6 +501,7 @@ addRow("Where", sp, null, true ); addRow(null, getLimitedToViewCheckBox(), null, false ); addRow(null, getManageConflictsCheckBox(), null, true ); + } /** Modified: core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizard.java =================================================================== --- core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizard.java 2018-04-17 19:31:45 UTC (rev 5769) +++ core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizard.java 2018-04-18 11:56:17 UTC (rev 5770) @@ -110,7 +110,6 @@ } else throw new Exception(dataStorePanel.validateInput()); } catch (Exception e) { - monitor.report(e); throw e; } } Modified: core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizardPanel.java =================================================================== --- core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizardPanel.java 2018-04-17 19:31:45 UTC (rev 5769) +++ core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizardPanel.java 2018-04-18 11:56:17 UTC (rev 5770) @@ -2,17 +2,18 @@ import com.vividsolutions.jump.I18N; import com.vividsolutions.jump.workbench.WorkbenchContext; -import com.vividsolutions.jump.workbench.ui.InputChangedListener; -import com.vividsolutions.jump.workbench.ui.wizard.WizardPanel; +import com.vividsolutions.jump.workbench.ui.wizard.AbstractWizardPanel; import javax.swing.*; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.Map; /** * WizardPanel to connect to a read/write datastore. */ -public class AddWritableDataStoreLayerWizardPanel extends JPanel implements WizardPanel { +public class AddWritableDataStoreLayerWizardPanel extends AbstractWizardPanel { private static final String KEY = AddWritableDataStoreLayerWizardPanel.class.getName(); @@ -23,14 +24,18 @@ private AddWritableDataStoreLayerPanel dataStorePanel; public AddWritableDataStoreLayerWizardPanel(WorkbenchContext context) { - super(new BorderLayout()); + super(KEY, TITLE, INSTRUCTIONS); + setLayout(new BorderLayout()); dataStorePanel = new AddWritableDataStoreLayerPanel(context); + dataStorePanel.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + selectionChanged(); + } + }); add(new JScrollPane(dataStorePanel), BorderLayout.CENTER); } - public void add(InputChangedListener listener) { - } - public void enteredFromLeft(Map dataMap) { dataStorePanel.populateConnectionComboBox(); } @@ -38,33 +43,21 @@ public void exitingToRight() throws Exception { } - public String getID() { - return KEY; + /** + * expose the input listeners fire for the wrapped panel to use + */ + public void selectionChanged(){ + fireInputChanged(); } - public String getInstructions() { - return INSTRUCTIONS; - } - - public String getNextID() { - return null; - } - - public String getTitle() { - return TITLE; - } - public boolean isInputValid() { - return true; + return dataStorePanel.validateInput() == null; } - public void remove(InputChangedListener listener) { - } - /** * @return the dataStorePanel */ - AddWritableDataStoreLayerPanel getDataStorePanel() { + public AddWritableDataStoreLayerPanel getDataStorePanel() { return dataStorePanel; } } ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel