# HG changeset patch # User Felix Wolfsteller # Date 1320232917 0 # Node ID f6a190f6aaff2bebb4959f316fd280f4e4e3806b # Parent 36de4e32631c85925b89ecfbf35fc75edc9f53f2 Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves. flys-artifacts/trunk@3138 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 36de4e32631c -r f6a190f6aaff flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Nov 02 11:15:00 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Nov 02 11:21:57 2011 +0000 @@ -1,10 +1,25 @@ 2011-11-02 Felix Wolfsteller - Added newish Facet Types (main values in discharge out). - - * src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java: + 1) Give Artifacts information about the out when they have to decide + whether a given facet is initially in/active by adding parameter + to getInitialFacetActivity(+outputName). + 2) Generate separate Set of MainValueFacets for discharge curves. + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java, + src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java, + src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java, + src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java, + src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: + (getInitialFacetActivity): Adjusted, new parameter outputName. Added MAINVALUES_{Q,W} definition. + * src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java, + src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java: + Accept name in constructor. + + * src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java: + Create second pair of MainValuesFacets, give distinguishable names. + 2011-11-02 Felix Wolfsteller Added compatibility of (computed)discharge-curve diagrams with diff -r 36de4e32631c -r f6a190f6aaff flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Wed Nov 02 11:15:00 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Wed Nov 02 11:21:57 2011 +0000 @@ -1045,13 +1045,18 @@ * selection in Client ThemeList GUI). This will be checked one time * when the facet enters a collections describe document. * - * @param facetName name of the facet. - * @param index index of the facet. + * @param facetName name of the facet. + * @param outputName name of the output. + * @param index index of the facet. * * @return 1 if wished to be initally active, 0 if not. FLYSArtifact * defaults to "1". */ - public int getInitialFacetActivity(String facetName, int index) { + public int getInitialFacetActivity( + String outputName, + String facetName, + int index) + { return 1; } } diff -r 36de4e32631c -r f6a190f6aaff flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Wed Nov 02 11:15:00 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Wed Nov 02 11:21:57 2011 +0000 @@ -21,6 +21,7 @@ import de.intevation.flys.model.River; import de.intevation.flys.artifacts.model.Calculation; +import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.MainValuesQFacet; import de.intevation.flys.artifacts.model.MainValuesWFacet; import de.intevation.flys.artifacts.model.NamedDouble; @@ -40,6 +41,7 @@ */ public class MainValuesArtifact extends StaticFLYSArtifact +implements FacetTypes { /** The logger for this class. */ private static Logger logger = Logger.getLogger(MainValuesArtifact.class); @@ -76,18 +78,36 @@ logger.debug("MainValuesArtifact.setup"); state = new StaticState(STATIC_STATE_NAME); - Facet qfacet = new MainValuesQFacet(Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q")); - Facet wfacet = new MainValuesWFacet(Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.w", - "facet.discharge_curves.mainvalues.w")); + Facet qfacet1 = new MainValuesQFacet( + COMPUTED_DISCHARGE_MAINVALUES_Q, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.q", + "facet.discharge_curves.mainvalues.q")); + Facet qfacet2 = new MainValuesQFacet( + MAINVALUES_Q, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.q", + "facet.discharge_curves.mainvalues.q")); + Facet wfacet1 = new MainValuesWFacet( + COMPUTED_DISCHARGE_MAINVALUES_W, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.w", + "facet.discharge_curves.mainvalues.w")); + Facet wfacet2 = new MainValuesWFacet( + MAINVALUES_W, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.w", + "facet.discharge_curves.mainvalues.w")); List fs = new ArrayList(); - fs.add(qfacet); - fs.add(wfacet); + fs.add(qfacet1); + fs.add(qfacet2); + fs.add(wfacet1); + fs.add(wfacet2); facets.put(state.getID(), fs); spawnState(); @@ -262,4 +282,36 @@ } return filteredList; } + + + /** + * Determines Facets initial disposition regarding activity (think of + * selection in Client ThemeList GUI). This will be checked one time + * when the facet enters a collections describe document. + * + * @param facetName name of the facet. + * @param index index of the facet. + * @return 0 if not active + */ + @Override + public int getInitialFacetActivity( + String outputName, + String facetName, + int index) + { + logger.debug("MainValuesArtifact.active?: " + + outputName + + "/" + + facetName); + + if (outputName.equals("computed_discharge_curve")) { + logger.debug("active? no: " + outputName + "/" + facetName); + return 0; + } + else { + logger.debug("active? yes: " + outputName + "/" + facetName); + return 1; + } + } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 36de4e32631c -r f6a190f6aaff flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java Wed Nov 02 11:15:00 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java Wed Nov 02 11:21:57 2011 +0000 @@ -139,9 +139,15 @@ /** * Called via setup. + * + * @param artifact The master-artifact. */ @Override - protected void initialize(Artifact artifact, Object context, CallMeta meta) { + protected void initialize( + Artifact artifact, + Object context, + CallMeta meta) + { logger.debug("StaticWKmsArtifact.initialize"); WINFOArtifact winfo = (WINFOArtifact) artifact; // TODO: The river is of no interest, so far. @@ -190,10 +196,9 @@ */ @Override protected State getState(Object context, String stateID) { - if (state != null) - return state; - else - return spawnState(); + return (state != null) + ? state + : spawnState(); } @@ -221,9 +226,13 @@ * * @return Always 0. Static Data will enter plots inactive. */ - public int getInitialFacetActivity(String facetName, int index) { + @Override + public int getInitialFacetActivity( + String outputName, + String facetName, + int index) + { return 0; } - } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 36de4e32631c -r f6a190f6aaff flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Wed Nov 02 11:15:00 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Wed Nov 02 11:21:57 2011 +0000 @@ -31,6 +31,7 @@ import de.intevation.flys.artifacts.model.CalculationResult; import de.intevation.flys.artifacts.model.CrossSectionFactory; import de.intevation.flys.artifacts.model.DischargeTables; +import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.MainValuesFactory; import de.intevation.flys.artifacts.model.Segment; import de.intevation.flys.artifacts.model.WQKms; @@ -72,7 +73,10 @@ * * @author Ingo Weinzierl */ -public class WINFOArtifact extends FLYSArtifact { +public class WINFOArtifact +extends FLYSArtifact +implements FacetTypes +{ /** The logger for this class. */ private static Logger logger = Logger.getLogger(WINFOArtifact.class); @@ -1302,10 +1306,26 @@ * * @param facetName name of the facet. * @param index index of the facet. + * @return 0 if not active */ - public int getInitialFacetActivity(String facetName, int index) { - return (facetName.startsWith("longitudinal_section") - && facetName.endsWith("q")) + @Override + public int getInitialFacetActivity(String outputName, String facetName, int index) { + String [] inactives = new String[] { + LONGITUDINAL_Q + }; + + logger.debug("WINFOArtifact.active?: " + + outputName + + "/" + + facetName); + + if ((facetName.equals(COMPUTED_DISCHARGE_MAINVALUES_Q) || + facetName.equals(COMPUTED_DISCHARGE_MAINVALUES_W) + && outputName.equals("computed_discharge_curve"))) + { + return 0; + } + return Arrays.asList(inactives).contains(facetName) ? 0 : 1; } diff -r 36de4e32631c -r f6a190f6aaff flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java Wed Nov 02 11:15:00 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java Wed Nov 02 11:21:57 2011 +0000 @@ -106,7 +106,11 @@ * @return Always 0 to have Facets initial predisposition to "inactive". */ @Override - public int getInitialFacetActivity(String facetName, int index) { + public int getInitialFacetActivity( + String outputName, + String facetName, + int index) + { return 0; } } diff -r 36de4e32631c -r f6a190f6aaff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java Wed Nov 02 11:15:00 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java Wed Nov 02 11:21:57 2011 +0000 @@ -23,9 +23,9 @@ implements FacetTypes { /** Trivial Constructor. */ - public MainValuesQFacet(String description) { + public MainValuesQFacet(String name, String description) { this.description = description; - name = COMPUTED_DISCHARGE_MAINVALUES_Q; + this.name = name; index = 0; } @@ -50,7 +50,6 @@ q.getName(), (float) q.getValue(), StickyAxisAnnotation.SimpleAxis.X_AXIS)); - } return new FLYSAnnotation(description, xy); @@ -63,8 +62,9 @@ */ @Override public MainValuesQFacet deepCopy() { - MainValuesQFacet copy = new MainValuesQFacet(description); + MainValuesQFacet copy = new MainValuesQFacet(this.name, description); copy.set(this); return copy; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 36de4e32631c -r f6a190f6aaff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java Wed Nov 02 11:15:00 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java Wed Nov 02 11:21:57 2011 +0000 @@ -23,9 +23,9 @@ implements FacetTypes { /** Trivial Constructor. */ - public MainValuesWFacet(String description) { + public MainValuesWFacet(String name, String description) { this.description = description; - name = COMPUTED_DISCHARGE_MAINVALUES_W; + this.name = name; index = 0; } @@ -63,9 +63,9 @@ */ @Override public MainValuesWFacet deepCopy() { - MainValuesWFacet copy = new MainValuesWFacet(description); + MainValuesWFacet copy = new MainValuesWFacet(this.name, description); copy.set(this); return copy; } } - +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :