branch feature/6944 updated (f971ce3 -> ad5649f)
This is an automated email from the git hooks/post-receive script. New change to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git from f971ce3 move scale in map and add compass new ad5649f fix code, hide actions buttons, tab name The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit ad5649fd98f9f880bcda95459e10cd7d44c79fa0 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 18:05:42 2015 +0200 fix code, hide actions buttons, tab name Summary of changes: .../ui/content/open/impl/seine/TripSeineUI.css | 4 +- .../open/impl/seine/TripSeineUIHandler.java | 59 ++++++++++++++-------- .../observe/ui/util/tripMap/ObserveMapPane.java | 11 ++-- .../fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx | 6 +-- .../observe/ui/util/tripMap/TripMapUIHandler.java | 49 ++++++++---------- 5 files changed, 69 insertions(+), 60 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit ad5649fd98f9f880bcda95459e10cd7d44c79fa0 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 18:05:42 2015 +0200 fix code, hide actions buttons, tab name --- .../ui/content/open/impl/seine/TripSeineUI.css | 4 +- .../open/impl/seine/TripSeineUIHandler.java | 59 ++++++++++++++-------- .../observe/ui/util/tripMap/ObserveMapPane.java | 11 ++-- .../fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx | 6 +-- .../observe/ui/util/tripMap/TripMapUIHandler.java | 49 ++++++++---------- 5 files changed, 69 insertions(+), 60 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css index b1772ef..7d1fa16 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css @@ -31,11 +31,11 @@ NumberEditor { } #generalTab { - title:"observe.tripSeine.tab.general"; + title: {t("observe.tripSeine.tab.general")}; } #mapTab { - title:"observe.tripSeine.tab.map"; + title: {t("observe.tripSeine.tab.map")}; } #model { diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index ad8d6c7..fb467d8 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -45,6 +45,7 @@ import org.nuiton.topia.persistence.util.TopiaEntityBinder; import org.nuiton.util.DateUtil; import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.util.Date; @@ -96,6 +97,44 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } @Override + public void initUI() throws Exception { + super.initUI(); + + TripSeineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + ObserveConfig config = ui.getContextValue(ObserveConfig.class); + + tripMap.getHandler().setConfig(config); + + getUi().getTripSeineTabPane().addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource(); + TripSeineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + if (tripSeineTabPane.getSelectedComponent() == tripMap) { + ui.getActions().setVisible(false); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + TripSeineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + + tripMap.getHandler().doOpenMap(ui.getDataSource(), ui.getDataService(), getSelectedId()); + } + }); + + } else { + ui.getActions().setVisible(true); + } + } + }); + + } + + @Override public void openUI() throws Exception { super.openUI(); @@ -139,26 +178,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } } - - TripSeineUI ui = getUi(); - TripMapUI tripMap = ui.getTripMap(); - ObserveConfig config = ui.getContextValue(ObserveConfig.class); - - tripMap.getHandler().setConfig(config); - - getUi().getTripSeineTabPane().addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource(); - TripSeineUI ui = getUi(); - TripMapUI tripMap = ui.getTripMap(); - if (tripSeineTabPane.getSelectedComponent() == tripMap) { - tripMap.getHandler().doOpenMap(ui.getDataSource(), ui.getDataService(), tripId); - } - } - }); - - finalizeOpenUI(mode, create); } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java index 62578c4..a0f8718 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java @@ -15,6 +15,7 @@ import java.awt.Point; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; +import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; /** @@ -168,10 +169,10 @@ public class ObserveMapPane extends JMapPane { } protected enum CardinalPoint { - NORTH(-1, 0, 0, -1, t("observe.map.north")), - SOUTH( 1, 0, 0, 1, t("observe.map.south")), - WEST ( 0, -1, 1, 0, t("observe.map.west")), - EST ( 0, 1, -1, 0, t("observe.map.east")); + NORTH(-1, 0, 0, -1, n("observe.map.north")), + SOUTH( 1, 0, 0, 1, n("observe.map.south")), + WEST ( 0, -1, 1, 0, n("observe.map.west")), + EST ( 0, 1, -1, 0, n("observe.map.east")); protected int matrix00; protected int matrix01; @@ -214,7 +215,7 @@ public class ObserveMapPane extends JMapPane { } public String getLabel() { - return label; + return t(label); } } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx index 73ddb67..8038dfb 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx @@ -2,12 +2,8 @@ layout="{new BorderLayout()}"> <import> - fr.ird.observe.DataService - fr.ird.observe.db.DataSource - fr.ird.observe.ObserveConfig - fr.ird.observe.ObserveContext - fr.ird.observe.ui.util.tripMap.ObserveMapPane + static org.nuiton.i18n.I18n.n </import> <TripMapUIHandler id='handler' initializer='TripMapUIHandler.newHandler(this)'/> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index 7fa37d0..8eb175a 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -11,6 +11,7 @@ import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.MultiPoint; import fr.ird.observe.DataService; import fr.ird.observe.ObserveConfig; +import fr.ird.observe.ObserveTechnicalException; import fr.ird.observe.db.DataSource; import fr.ird.observe.db.DataSourceException; import fr.ird.observe.entities.constants.seine.SchoolType; @@ -79,9 +80,7 @@ public class TripMapUIHandler { protected TripMapUI view; private ObserveConfig config; - protected MapContent mapContent; protected ReferencedEnvelope tripArea; - protected List<TripMapPoint> tripMapPoints; protected boolean rendererRunning; @@ -113,35 +112,33 @@ public class TripMapUIHandler { public void doOpenMap(DataSource dataSource, DataService dataService, String tripId) { - getTipMapPoints(dataSource, dataService, tripId); + List<TripMapPoint> tripMapPoints; + try { + tripMapPoints = dataService.loadTripMapActivityPoints(dataSource, tripId); + } catch (DataSourceException e) { + throw new ObserveTechnicalException("Unable to load trip map activity points", e); + } + + JMapPane mapPane = view.getMap(); + MapContent mapContent = buildMapContent(tripMapPoints); + mapPane.setMapContent(mapContent); + zoomIt(); + } + + public void zoomIt() { JMapPane mapPane = view.getMap(); - mapPane.setMapContent(getMapContent()); mapPane.setDisplayArea(tripArea); } - protected List<TripMapPoint> getTipMapPoints(DataSource dataSource, DataService dataService, String tripId) { - if (tripMapPoints == null) { + protected MapContent buildMapContent(List<TripMapPoint> tripMapPoints) { - try { - tripMapPoints = dataService.loadTripMapActivityPoints(dataSource, tripId); - } catch (DataSourceException e) { - if (log.isErrorEnabled()) { - log.error("error in loadTripMapActivityPoints", e); - } - } - } - return tripMapPoints; - - } + MapContent mapContent = new MapContent(); - public MapContent getMapContent() { - if (/*mapContent == null &&*/ tripMapPoints != null) { + if (tripMapPoints != null) { try { - mapContent = new MapContent(); - StyledLayerDescriptor styledLayerDescriptor = importStyledLayerDescriptor(); for (File layerFile : config.getMapLayerFiles()) { @@ -269,9 +266,7 @@ public class TripMapUIHandler { } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("error in getMapContent", e); - } + throw new ObserveTechnicalException("Unable to build content map", e); } } @@ -339,12 +334,12 @@ public class TripMapUIHandler { } - protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName) throws Exception { + protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName) { Style style = findStyle(styledLayerDescriptor, layerName, styleName, null); if (style == null) { - throw new Exception(String.format("No style found for layer name '%s' and style name '%s'", layerName, styleName)); + throw new ObserveTechnicalException(String.format("No style found for layer name '%s' and style name '%s'", layerName, styleName)); } return style; @@ -506,6 +501,4 @@ public class TripMapUIHandler { } } - - } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
participants (1)
-
codelutin.com scm