Revision: 4527 http://sourceforge.net/p/jump-pilot/code/4527 Author: ma15569 Date: 2015-07-06 09:45:34 +0000 (Mon, 06 Jul 2015) Log Message: ----------- correct bug when Largest scale>Smallest scale
Modified Paths: -------------- core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/ChangeRasterImagePropertiesPlugIn.java core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/panel/RasterScaleStylePanel.java Modified: core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/ChangeRasterImagePropertiesPlugIn.java =================================================================== --- core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/ChangeRasterImagePropertiesPlugIn.java 2015-07-06 09:26:25 UTC (rev 4526) +++ core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/ChangeRasterImagePropertiesPlugIn.java 2015-07-06 09:45:34 UTC (rev 4527) @@ -10,6 +10,7 @@ import javax.swing.ImageIcon; import javax.swing.JComponent; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; @@ -33,10 +34,11 @@ import com.vividsolutions.jump.workbench.ui.style.StylePanel; /** - * @version $Rev: 4221 $ Dic 23 2014 [Giuseppe Aruta] - Transformed in a - * MultiImputDialog. Add Added Raster Transparency, ScaleStyle and - * ColorEditor Panels - * @version $Rev: 4425 $ July 3 2015 [Giuseppe Aruta] - Renamed plugin name to "Change Style" + * @version Dic 23 2014 [Giuseppe Aruta] - Transformed in a MultiImputDialog. + * Add Added Raster Transparency, ScaleStyle and ColorEditor Panels + * @version Jul 03 2015 [Giuseppe Aruta] - Renamed plugin name to "Change Style" + * @version Jul 06 2015 [Giuseppe Aruta] - correct bug when Largest scale + * >Smallest scale */ @SuppressWarnings("deprecation") public class ChangeRasterImagePropertiesPlugIn extends AbstractPlugIn { @@ -114,23 +116,44 @@ .put(LAST_TAB_KEY, ((StylePanel) tabbedPane.getSelectedComponent()) .getTitle()); - + dialog.addEnableChecks(rasterScalepanel.getTitle(), + Arrays.asList(new EnableCheck() { + public String check(JComponent component) { + return rasterScalepanel.validateInput(); + } + })); dialog.addOKCancelApplyPanelActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (dialog.wasApplyPressed()) { - if (rLayer.getNumBands() == 1) { + if (rasterScalepanel.LSCale().doubleValue() > rasterScalepanel + .SSCale().doubleValue()) { + + JOptionPane.showMessageDialog( + null, + I18N.get("ui.style.ScaleStylePanel.units-pixel-at-smallest-scale-must-be-larger-than-units-pixel-at-largest-scale"), + "Jump", JOptionPane.ERROR_MESSAGE); + + } else { rasterScalepanel.updateStyles(); rasstyle.updateStyles(); + + } + + if (rLayer.getNumBands() == 1) { + rascolorpanel.updateStyles(); } else { - rasterScalepanel.updateStyles(); - rasstyle.updateStyles(); - // rascolorpanel.updateStyles(); + } + } } }); + // Add to prevent error message and OJ to freeze if Large scale>Small + // scale + // Now the only way to close this dialog is using cancel button + dialog.setDefaultCloseOperation(dialog.DO_NOTHING_ON_CLOSE); dialog.pack(); GUIUtil.centreOnWindow(dialog); dialog.setVisible(true); Modified: core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/panel/RasterScaleStylePanel.java =================================================================== --- core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/panel/RasterScaleStylePanel.java 2015-07-06 09:26:25 UTC (rev 4526) +++ core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/panel/RasterScaleStylePanel.java 2015-07-06 09:45:34 UTC (rev 4527) @@ -26,11 +26,12 @@ import com.vividsolutions.jump.workbench.ui.style.StylePanel; /** - * @version $Rev: 4221 $ Dic 23 2014 Giuseppe Aruta Panel that allows to set - * Scale display of a Sextante Raster Layer Panel Refractor from - * AdbToolBox version ver 1.0 2014_02_10 + * @version Dic 23 2014 Giuseppe Aruta Panel that allows to set Scale display of + * a Sextante Raster Layer Panel Refractor from AdbToolBox version ver + * 1.0 2014_02_10 + * @version Jul 06 2015 Giuseppe Aruta correct bug when Largest scale >Smallest + * scale * - * */ public class RasterScaleStylePanel extends JPanel implements StylePanel { @@ -304,6 +305,14 @@ return null; } + public Double LSCale() { + return getLargestScale(); + } + + public Double SSCale() { + return getSmallestScale(); + } + private Double getLargestScale() { return largestScaleTextField.getText().trim().length() > 0 ? new Double( largestScaleTextField.getDouble() * this.scaleFactor) : null; ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel