Mercurial > dive4elements > river
changeset 4628:03ab907b6f5d
Merged.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 03 Dec 2012 17:27:08 +0100 |
parents | d5821c6f0ab0 (current diff) 35dceb726fc4 (diff) |
children | e29f368c09ba |
files | flys-client/src/main/java/de/intevation/flys/client/client/ui/MainMenu.java |
diffstat | 46 files changed, 824 insertions(+), 467 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/make_flys_release/confs/floodmap.xml Mon Dec 03 17:25:49 2012 +0100 +++ b/contrib/make_flys_release/confs/floodmap.xml Mon Dec 03 17:27:08 2012 +0100 @@ -14,12 +14,12 @@ <river name="Saar"> <srid value="31466"/> - <river-wms url="http://czech-republic.intevation.de/cgi-bin/saar-wms"/> + <river-wms url="http://czech-republic.intevation.de/cgi-bin/user-wms" layers="FLYS-Map"/> <background-wms url="http://osm.wheregroup.com/cgi-bin/osm_basic.xml?" layers="OSM_Basic"/> </river> <river name="Mosel"> <srid value="31466"/> - <river-wms url="http://czech-republic.intevation.de/cgi-bin/mosel-wms"/> + <river-wms url="http://czech-republic.intevation.de/cgi-bin/user-wms" layers="FLYS-Map"/> <background-wms url="http://osm.wheregroup.com/cgi-bin/osm_basic.xml?" layers="OSM_Basic"/> </river> <river name="Elbe">
--- a/flys-artifacts/doc/conf/artifacts/gaugedischargecurve.xml Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/doc/conf/artifacts/gaugedischargecurve.xml Mon Dec 03 17:27:08 2012 +0100 @@ -16,6 +16,12 @@ <facet name="at" description="facet.gauge_discharge_curve_export.at"/> </facets> </outputmode> + <outputmode name="computed_dischargecurve_export" description="output.computed_dischargecurve_export" mime-type="text/plain" type="export"> + <facets> + <facet name="csv" description="facet.computed_dischargecurve_export.csv" /> + <facet name="pdf" description="facet.computed_dischargecurve_export.pdf" /> + </facets> + </outputmode> </outputmodes> </state> </states>
--- a/flys-artifacts/doc/conf/artifacts/manualpoints.xml Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/doc/conf/artifacts/manualpoints.xml Mon Dec 03 17:27:08 2012 +0100 @@ -23,6 +23,17 @@ <facet name="fix_longitudinal_section_curve.manualpoints" description="Points provided by user." /> <facet name="fix_derivate_curve.manualpoints" description="Points provided by user." /> <facet name="extreme_wq_curve.manualpoints" description="Points provided by user." /> + <facet name="bedheight_middle.manualpoints" description="Points provided by user." /> + <facet name="sedimentload_ls.manualpoints"/> + <facet name="flow_velocity.manualpoints"/> + <facet name="bedheight_difference.manualpoints" /> + <facet name="sq_relation_a.manualpoints" /> + <facet name="sq_relation_b.manualpoints" /> + <facet name="sq_relation_c.manualpoints" /> + <facet name="sq_relation_d.manualpoints" /> + <facet name="sq_relation_e.manualpoints" /> + <facet name="bed_longitudinal_section.manualpoints" /> + <facet name="sq_relation_f.manualpoints" /> </facets> </outputmode> </outputmodes>
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/doc/conf/artifacts/minfo.xml Mon Dec 03 17:27:08 2012 +0100 @@ -148,6 +148,7 @@ <facet name="flow_velocity.discharge" description="A facet for discharges"/> <facet name="flow_velocity.measurement" description="A facet for measured flow velocities"/> <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> + <facet name="flow_velocity.manualpoints"/> </facets> </outputmode> <outputmode name="flow_velocity_export" description="output.flow_velocity_export" mime-type="text/plain" type="export"> @@ -168,6 +169,7 @@ <facet name="bedheight_middle.single" description="A facet for total channels"/> <facet name="bedheight_middle.epoch" description="A facet for total channels"/> <facet name="longitudinal_section.w" description="Datacage facet"/> + <facet name="bedheight_middle.manualpoints" description="points"/> <facet name="bedheight" description="Datacage facet"/> </facets> </outputmode> @@ -191,6 +193,7 @@ <outputmode name="bed_difference_height_year" description="output.absolute_height" mime-type="image/png" type="chart"> <facets> <facet name="bedheight_difference.height_year" description="A facet for absolute heights"/> + <facet name="bedheight_difference.manualpoints" /> <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> <facet name="fix_sector_average_ls_0" description="Datacage facet"/> <facet name="fix_sector_average_ls_1" description="Datacage facet"/> @@ -203,6 +206,7 @@ <outputmode name="bed_difference_year" description="output.difference_year" mime-type="img/png" type="chart"> <facets> <facet name="bedheight_difference.year" description="A facet for bed height differences"/> + <facet name="bedheight_difference.manualpoints" /> <facet name="bedheight_difference.morph_width" description="A facet for morphologic width"/> <facet name="bedheight_difference.year.height1" description="A facet for raw heights."/> <facet name="bedheight_difference.year.height2" description="A facet for raw heights."/> @@ -218,6 +222,7 @@ <outputmode name="bed_difference_epoch" description="output.difference_epoch" mime-type="img/png" type="chart"> <facets> <facet name="bedheight_difference.epoch" description="A facet for bed height differences"/> + <facet name="bed_difference_epoch.manualpoints" /> <facet name="bedheight_difference.epoch.height1" description="A facet for raw heights."/> <facet name="bedheight_difference.epoch.height2" description="A facet for raw heights."/> <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> @@ -255,6 +260,7 @@ <facet name="sq_a_outlier" description="A facet fo sq outliers"/> <facet name="sq_a_curve" description="A facet for sq curve"/> <facet name="sq_a_outlier_curve" description="A facet for sq outlier curve"/> + <facet name="sq_relation_a.manualpoints" /> <facet name="sq_a_outlier_measurement" description="A facet for sq outlier measurement"/> </facets> </outputmode> @@ -264,6 +270,7 @@ <facet name="sq_b_outlier" description="A facet fo sq outliers"/> <facet name="sq_b_curve" description="A facet for sq curve"/> <facet name="sq_b_outlier_curve" description="A facet for sq outlier curve"/> + <facet name="sq_relation_b.manualpoints" /> <facet name="sq_b_outlier_measurement" description="A facet for sq outlier measurement"/> </facets> </outputmode> @@ -273,6 +280,7 @@ <facet name="sq_c_outlier" description="A facet fo sq outliers"/> <facet name="sq_c_curve" description="A facet for sq curve"/> <facet name="sq_c_outlier_curve" description="A facet for sq outlier curve"/> + <facet name="sq_relation_c.manualpoints" /> <facet name="sq_c_outlier_measurement" description="A facet for sq outlier measurement"/> </facets> </outputmode> @@ -281,6 +289,7 @@ <facet name="sq_d_measurement" description="A facet for sq measurements"/> <facet name="sq_d_outlier" description="A facet fo sq outliers"/> <facet name="sq_d_curve" description="A facet for sq curve"/> + <facet name="sq_relation_d.manualpoints" /> <facet name="sq_d_outlier_curve" description="A facet for sq outlier curve"/> <facet name="sq_d_outlier_measurement" description="A facet for sq outlier measurement"/> </facets> @@ -291,12 +300,14 @@ <facet name="sq_e_outlier" description="A facet fo sq outliers"/> <facet name="sq_e_curve" description="A facet for sq curve"/> <facet name="sq_e_outlier_curve" description="A facet for sq outlier curve"/> + <facet name="sq_relation_e.manualpoints" /> <facet name="sq_e_outlier_measurement" description="A facet for sq outlier measurement"/> </facets> </outputmode> <outputmode name="sq_relation_f" description="output.sq_relation" type="chart"> <facets> <facet name="sq_f_measurement" description="A facet for sq measurements"/> + <facet name="sq_relation_f.manualpoints" /> <facet name="sq_f_outlier" description="A facet fo sq outliers"/> <facet name="sq_f_curve" description="A facet for sq curve"/> <facet name="sq_f_outlier_curve" description="A facet for sq outlier curve"/> @@ -326,7 +337,8 @@ <facet name="bed_longitudinal_section.sediment_density_toplayer"/> <facet name="bed_longitudinal_section.sediment_density_sublayer"/> <facet name="bed_longitudinal_section.bed_diameter_toplayer"/> - <facet name="bed_longitudinal_section.bed_diameter_sublayer"/> + <facet name="bed_longitudinal_section.bed_diameter_sublayer"/> + <facet name="bed_longitudinal_section.manualpoints" /> <facet name="bed_longitudinal_section.bedload_diameter"/> </facets> </outputmode> @@ -425,6 +437,7 @@ <facet name="sedimentload.susp_sand_bed"/> <facet name="sedimentload.susp_sediment"/> <facet name="sedimentload.total_load"/> + <facet name="sedimentload_ls.manualpoints"/> <facet name="sedimentload.total"/> </facets> </outputmode>
--- a/flys-artifacts/doc/conf/default-themes.xml Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/doc/conf/default-themes.xml Mon Dec 03 17:27:08 2012 +0100 @@ -156,7 +156,7 @@ <field name="showpoints" type="boolean" display="Datenpunkte anzeigen" default="false" hidden="true" /> <field name="pointsize" type="int" display="Punktdicke" - default="5" hidden="true" /> + default="5" hidden="true" /> <field name="showlinelabel" type="boolean" display="Beschriftung anzeigen" default="false" hidden="true" /> <field name="labelfontface" type="Font" @@ -186,7 +186,7 @@ <field name="bandwidth" type="double" display="Bandbreite" default="0"/> <field name="fillcolor" type="Color" display="Bandbreitenfarbe" - default="104, 104, 104"/> + default="104, 104, 104"/> <field name="transparency" type="int" default="20" display="Transparenz"/> <field name="linecolor" type="Color" display="Linienfarbe" default="204, 204, 204" /> @@ -1132,6 +1132,14 @@ <inherits> <inherit from="WSPLGENS" /> </inherits> + <fields> + <field name="startcolor" type="Color" + display="Farbverlauf Startfarbe" default="178, 201, 215" /> + <field name="endcolor" type="Color" + display="Farbverlauf Endfarbe" default="2, 27, 42" /> + <field name="numclasses" type="int" display="Anzahl Klassen" + default="6" /> + </fields> </theme> <theme name="RiverAxis"> @@ -1224,7 +1232,7 @@ default="0, 0, 102" /> </fields> </theme> - + <!-- Bed Quality --> <theme name="PorosityTopLayer"> <inherits> @@ -1236,7 +1244,7 @@ default="0, 0, 0" /> </fields> </theme> - + <theme name="PorositySubLayer"> <inherits> <inherit from="HiddenColorLines" /> @@ -1247,7 +1255,7 @@ default="0, 0, 0" /> </fields> </theme> - + <theme name="DensityTopLayer"> <inherits> <inherit from="HiddenColorLines" /> @@ -1258,7 +1266,7 @@ default="#996366" /> </fields> </theme> - + <theme name="DensitySubLayer"> <inherits> <inherit from="HiddenColorLines" /> @@ -1269,7 +1277,7 @@ default="#996366" /> </fields> </theme> - + <theme name="BedDiameterTopLayer"> <inherits> <inherit from="HiddenColorLines" /> @@ -1280,7 +1288,7 @@ default="#FF0000" /> </fields> </theme> - + <theme name="BedDiameterSubLayer"> <inherits> <inherit from="HiddenColorLines" /> @@ -1291,7 +1299,7 @@ default="#FF0000" /> </fields> </theme> - + <theme name="BedLoadDiameter"> <inherits> <inherit from="HiddenColorLines" /> @@ -1762,7 +1770,7 @@ <field name="backgroundcolor" type="Color" default="255, 0, 0" display="Füllfarbe" /> </fields> </theme> - + <theme name="FixingReferencePeriod"> <inherits> <inherit from="Areas"/> @@ -1823,7 +1831,7 @@ display="Beschriftung anzeigen" default="false" hints="h" /> </fields> </theme> - + <theme name="SedimentLoadSuspSand"> <inherits> <inherit from="HiddenColorLines" /> @@ -1874,6 +1882,6 @@ display="Beschriftung anzeigen" default="false" hints="h" /> </fields> </theme> - - + + </themegroup>
--- a/flys-artifacts/doc/conf/meta-data.xml Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/doc/conf/meta-data.xml Mon Dec 03 17:27:08 2012 +0100 @@ -674,6 +674,19 @@ </flowvelocitymeasurement> </dc:macro> + <dc:macro name="longitudinal-section-prototype"> + <dc:call-macro name="basedata_0"/> + <dc:call-macro name="basedata_1_additionals"/> + <dc:comment comment=" FIXATIONS ---------------------------"/> + <dc:call-macro name="basedata_2_fixations"/> + <dc:comment comment=" HOEHENMARKEN ---------------------------"/> + <dc:call-macro name="basedata_4_heightmarks-points"/> + <dc:comment comment=" AMTL LINIEN ---------------------------"/> + <dc:call-macro name="basedata_3_officials"/> + <dc:call-macro name="basedata_5_flood-protections"/> + <dc:call-macro name="annotations_per_type"/> + </dc:macro> + <dc:comment> + River-Node @@ -698,6 +711,9 @@ <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')"> <dc:call-macro name="mainvalues"/> </dc:if> + <dc:if test="dc:contains($artifact-outs, 'duration_curve')"> + <dc:call-macro name="mainvalues"/> + </dc:if> <dc:if test="dc:contains($artifact-outs, 'reference_curve')"> <dc:call-macro name="annotations"/> <dc:call-macro name="mainvalues"/> @@ -734,31 +750,19 @@ <dc:call-macro name="cross_sections"/> <dc:call-macro name="hyks"/> </dc:if> - <dc:if test="dc:contains($artifact-outs, 'discharge_longitudinal_section')"> - <dc:call-macro name="basedata_0"/> - <dc:call-macro name="basedata_1_additionals"/> - <dc:call-macro name="basedata_2_fixations"/> - <dc:call-macro name="basedata_3_officials"/> - <dc:call-macro name="basedata_4_heightmarks-points"/> - <dc:call-macro name="basedata_5_flood-protections"/> - </dc:if> <!--dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')"> <dc:call-macro name="basedata_0_wq"/> <dc:call-macro name="basedata_4_heightmarks-wq"/> </dc:if--> - <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences'))"> - <dc:call-macro name="basedata_0"/> - <dc:call-macro name="basedata_1_additionals"/> - <dc:comment comment=" FIXATIONS ---------------------------"/> - <dc:call-macro name="basedata_2_fixations"/> - <dc:comment comment=" HOEHENMARKEN ---------------------------"/> - <dc:call-macro name="basedata_4_heightmarks-points"/> - <dc:comment comment=" AMTL LINIEN ---------------------------"/> - <dc:call-macro name="basedata_3_officials"/> - <dc:call-macro name="basedata_5_flood-protections"/> - <dc:call-macro name="annotations_per_type"/> + <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')) or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))"> + <dc:call-macro name="longitudinal-section-prototype"/> </dc:if> - + <dc:if test="dc:contains($artifact-outs, 'duration_curve')"> + <dc:call-macro name="mainvalues"/> + <dc:call-macro name="basedata_2_fixations_relative_point"/> + <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/> + <dc:call-macro name="basedata_5_flood-protections_relative_points"/> + </dc:if> <dc:if test="dc:contains($artifact-outs, 'reference_curve')"> <dc:call-macro name="annotations"/> <!--dc:call-macro name="basedata_0"/--> @@ -782,6 +786,11 @@ <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')"> <dc:call-macro name="annotations"/> </dc:if> + <dc:if test="dc:contains($artifact-outs, 'map')"> + <map> + <dc:call-macro name="flood-map-complete"/> + </map> + </dc:if> <dc:if test="dc:contains($artifact-outs, 'flow_velocity')"> <dc:call-macro name="annotations"/> <dc:call-macro name="flow_velocity_measurements"/> @@ -901,20 +910,6 @@ </computed_discharge_curve> </dc:if> - <dc:if test="dc:contains($artifact-outs, 'duration_curve')"> - <dc:choose> - <dc:when test="dc:contains($parameters, 'recommended')"> - <dc:call-macro name="mainvalues"/> - </dc:when> - <dc:otherwise> - <dc:call-macro name="mainvalues"/> - <dc:call-macro name="basedata_2_fixations_relative_point"/> - <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/> - <dc:call-macro name="basedata_5_flood-protections_relative_points"/> - </dc:otherwise> - </dc:choose> - </dc:if> - <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve') and not (dc:contains($parameters, 'recommended'))"> <discharge_table_nn> <discharge_table_gauge> @@ -939,17 +934,6 @@ </discharge_table_nn> </dc:if> - <dc:if test="dc:contains($artifact-outs, 'map')"> - <map> - <dc:choose> - <dc:when test="dc:contains($parameters, 'recommended')"> - </dc:when> - <dc:otherwise> - <dc:call-macro name="flood-map-complete"/> - </dc:otherwise> - </dc:choose> - </map> - </dc:if> <dc:if test="dc:contains($artifact-outs, 'floodmap')"> <floodmap> <dc:choose>
--- a/flys-artifacts/doc/conf/virtual-themes.xml Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/doc/conf/virtual-themes.xml Mon Dec 03 17:27:08 2012 +0100 @@ -162,16 +162,12 @@ <!-- MAP relevant themes --> <theme name="WSPLGENS" type="virtual"> <fields> - <field name="wsplgen_cat1" type="Color" display="Hintergrund" - default="178, 201, 215" /> - <field name="wsplgen_cat2" type="Color" display="Hintergrund" - default="111, 147, 170" /> - <field name="wsplgen_cat3" type="Color" display="Hintergrund" - default="66, 111, 139" /> - <field name="wsplgen_cat4" type="Color" display="Hintergrund" - default="33, 79, 108" /> - <field name="wsplgen_cat5" type="Color" display="Hintergrund" - default="2, 27, 42" /> + <field name="startcolor" type="Color" + display="Farbverlauf Startfarbe" default="178, 201, 215" /> + <field name="endcolor" type="Color" + display="Farbverlauf Endfarbe" default="2, 27, 42" /> + <field name="numclasses" type="int" display="Anzahl Klassen" + default="5" /> </fields> </theme>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java Mon Dec 03 17:27:08 2012 +0100 @@ -51,9 +51,17 @@ "discharge_curve"; public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT = "computed_dischargecurve_at_export"; + public static final String GAUGE_DISCHARGE_CURVE_EXPORT_OUT = + "computed_dischargecurve_export"; + public static final String GAUGE_DISCHARGE_CURVE_CSV_FACET = + "csv"; + public static final String GAUGE_DISCHARGE_CURVE_PDF_FACET = + "pdf"; private Facet atexportfacet; private Facet curvefacet; + private Facet csvfacet; + private Facet pdffacet; /** * Setup initializes the data by extracting the river and gauge from @@ -119,7 +127,7 @@ rivername, gaugename); - List<Facet> fs = new ArrayList<Facet>(2); + List<Facet> fs = new ArrayList<Facet>(4); curvefacet = new GaugeDischargeCurveFacet( GAUGE_DISCHARGE_CURVE_FACET, description); fs.add(curvefacet); @@ -133,6 +141,24 @@ GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET, description); fs.add(atexportfacet); + description = Resources.format(callmeta, + "facet.computed_dischargecurve_export.csv", + "Discharge curve CSV export on gauge", + rivername, + gaugename); + csvfacet = new GaugeDischargeCurveFacet( + GAUGE_DISCHARGE_CURVE_CSV_FACET, description); + fs.add(csvfacet); + + description = Resources.format(callmeta, + "facet.computed_dischargecurve_export.pdf", + "Discharge curve PDF export on gauge", + rivername, + gaugename); + pdffacet = new GaugeDischargeCurveFacet( + GAUGE_DISCHARGE_CURVE_PDF_FACET, description); + fs.add(pdffacet); + addFacets(STATIC_STATE_NAME, fs); super.setup(identifier, factory, context, callmeta, data); @@ -168,6 +194,17 @@ "export"); state.addOutput(output); + fs = new ArrayList<Facet>(2); + fs.add(csvfacet); + fs.add(pdffacet); + output = new DefaultOutput( + GAUGE_DISCHARGE_CURVE_EXPORT_OUT, + "output.computed_dischargecurve_export", + "text/plain", + fs, + "export"); + state.addOutput(output); + state.setUIProvider(UIPROVIDER); setStaticState(state); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java Mon Dec 03 17:27:08 2012 +0100 @@ -63,17 +63,22 @@ if(filterFacets != null) { List<Facet> list = new ArrayList<Facet>(); List<Facet> wlist = filterFacets.get(ChartType.LS); - for (Facet f: wlist) { - if (!f.getName().equals(LONGITUDINAL_Q)) { - DefaultFacet df = new DefaultFacet(f.getIndex(), - "longitudinal_section.q", ""); - list.add(df); + if (wlist == null) { + logger.warn("No matching filterfacets found"); + dumpFilterFacets(); + } else { + for (Facet f: wlist) { + if (!f.getName().equals(LONGITUDINAL_Q)) { + DefaultFacet df = new DefaultFacet(f.getIndex(), + "longitudinal_section.q", ""); + list.add(df); + } } - } - list.addAll(wlist); + list.addAll(wlist); - filterFacets.put("w_differences", list); + filterFacets.put("w_differences", list); + } } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java Mon Dec 03 17:27:08 2012 +0100 @@ -543,6 +543,7 @@ compileStatements(); } + /** Handle <dc:statement> elements. */ protected void compileStatements() { NodeList nodes = template.getElementsByTagNameNS(
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/CompiledStatement.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/CompiledStatement.java Mon Dec 03 17:27:08 2012 +0100 @@ -20,6 +20,7 @@ import org.apache.log4j.Logger; +/** SQL Statement, create PreparedStatement. */ public class CompiledStatement { private static Logger log = Logger.getLogger(CompiledStatement.class);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java Mon Dec 03 17:27:08 2012 +0100 @@ -13,9 +13,12 @@ import org.apache.log4j.Logger; + +/** Resolves functions (e.g. dc:contains) in Datacage/Meta-Data system. */ public class FunctionResolver implements XPathFunctionResolver { + /** Home logger. */ private static Logger log = Logger.getLogger(FunctionResolver.class); public static final String FUNCTION_NAMESPACE_URI = "dc"; @@ -79,12 +82,19 @@ }); } + /** List of functions. */ protected List<Entry> functions; public FunctionResolver() { functions = new ArrayList<Entry>(); } + /** + * Create a new function. + * @param name Name of the function. + * @param arity Number of arguments for function. + * @param function the function itself. + */ public void addFunction(String name, int arity, XPathFunction function) { functions.add(new Entry(name, function, arity)); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/StackFrames.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/StackFrames.java Mon Dec 03 17:27:08 2012 +0100 @@ -13,11 +13,17 @@ import org.apache.log4j.Logger; + +/** + * Maintains stack of 'frames' which are maps from string to object. + * Used for variables in datacage/meta-data system. + */ public class StackFrames implements XPathVariableResolver { private static Logger log = Logger.getLogger(StackFrames.class); + /** The frames (used like a stack). */ protected List<Map<String, Object>> frames; public StackFrames() { @@ -31,14 +37,17 @@ } } + /** Push a new String->Object map. */ public void enter() { frames.add(new HashMap<String, Object>()); } + /** Pop/Remove last String->Object map. */ public void leave() { frames.remove(frames.size()-1); } + /** Put Key/Value in last String->Object map. */ public void put(String key, Object value) { int N = frames.size(); if (N > 0) { @@ -46,6 +55,7 @@ } } + /** Put multiple Key/Values in last String->Object map. */ public void put(String [] keys, Object [] values) { Map<String, Object> top = frames.get(frames.size()-1); for (int i = 0; i < keys.length; ++i) { @@ -53,6 +63,7 @@ } } + /** Check last frame (string->object map) for key. */ public boolean containsKey(String key) { key = key.toUpperCase(); for (int i = frames.size()-1; i >= 0; --i) { @@ -73,6 +84,8 @@ return get(key, null); } + /** result[0] is modified with value when true returned. + * @return false if key not found in any frame. */ public boolean getStore(String key, Object [] result) { key = key.toUpperCase();
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Mon Dec 03 17:27:08 2012 +0100 @@ -124,6 +124,16 @@ FLSC("fix_longitudinal_section_curve"), FDC("fix_derivate_curve"), EWQ("extreme_wq_curve"), + BHM("bedheight_middle"), + BLS("bed_longitudinal_section"), + SLS("sedimentload_ls"), + FV("flow_velocity"), + SQA("sq_relation_a"), + SQB("sq_relation_b"), + SQC("sq_relation_c"), + SQD("sq_relation_d"), + SQE("sq_relation_e"), + SQF("sq_relation_f"), HD("historical_discharge"); private String chartTypeString;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeDischargeCurveFacet.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeDischargeCurveFacet.java Mon Dec 03 17:27:08 2012 +0100 @@ -35,7 +35,10 @@ @Override public Object getData(Artifact art, CallContext context) { + return getWQKms(art, context); + } + protected WQKms getWQKms(Artifact art, CallContext context) { if (!(art instanceof FLYSArtifact)) { log.warn("Invalid artifact type"); return null; @@ -56,7 +59,8 @@ DischargeTables dt = new DischargeTables(river, name); - Map<String, double [][]> map = dt.getValues(100d); + Map<String, double [][]> map = dt.getValues( + DischargeTables.HISTORICAL_SCALE); double [][] values = map.get(name); if (values == null) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java Mon Dec 03 17:27:08 2012 +0100 @@ -104,6 +104,7 @@ return data; } + /** Return the document containing matched stuff from meta-data.xml. */ protected Document doService( String artifactId, String userId,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MiddleBedHeight.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MiddleBedHeight.java Mon Dec 03 17:27:08 2012 +0100 @@ -19,8 +19,10 @@ import de.intevation.flys.artifacts.model.MiddleBedHeightCalculation; +/** State in which Middle Bed Heights are generated. */ public class MiddleBedHeight extends DefaultState implements FacetTypes { + /** Private logger. */ private static final Logger logger = Logger.getLogger(MiddleBedHeight.class);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Mon Dec 03 17:27:08 2012 +0100 @@ -495,6 +495,8 @@ public abstract JFreeChart generateChart(); + /** For every outable (i.e. facets), this function is + * called and handles the data accordingly. */ @Override public abstract void doOut( ArtifactAndFacet bundle, @@ -699,12 +701,14 @@ } + /** Sets the master artifact. */ @Override public void setMasterArtifact(Artifact master) { this.master = master; } + /** Sets the collection. */ @Override public void setCollection(FLYSArtifactCollection collection) { this.collection = collection; @@ -1384,10 +1388,21 @@ } + /** + * Look up \param key in i18n dictionary. + * @param key key for which to find i18nd version. + * @param def default, returned if lookup failed. + * @return value found in i18n dictionary, \param def if no value found. + */ protected String msg(String key, String def) { return Resources.getMsg(context.getMeta(), key, def); } + /** + * Look up \param key in i18n dictionary. + * @param key key for which to find i18nd version. + * @return value found in i18n dictionary, key itself if failed. + */ protected String msg(String key) { return Resources.getMsg(context.getMeta(), key, key); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java Mon Dec 03 17:27:08 2012 +0100 @@ -76,10 +76,17 @@ protected void addData(Object d) { if (d instanceof CalculationResult) { d = ((CalculationResult)d).getData(); - if (d instanceof WQKms []) { - data.addAll(Arrays.asList((WQKms [])d)); - } } + if (d instanceof WQKms[]){ + data.addAll(Arrays.asList((WQKms [])d)); + return; + } + else if (d instanceof WQKms) { + data.add((WQKms)d); + return; + } + logger.warn("Can't add data for csv export. Unkown data type " + + d.getClass().getName()); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java Mon Dec 03 17:27:08 2012 +0100 @@ -142,6 +142,14 @@ attr, visible); } + else if (FacetTypes.IS.MANUALPOINTS(name)) { + doPoints( + bundle.getData(context), + bundle, + attr, + visible, + YAXIS.L.idx); + } } @Override
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java Mon Dec 03 17:27:08 2012 +0100 @@ -123,6 +123,14 @@ else if (IS.SQ_OUTLIER(name)) { doSQOut(artifactAndFacet, attr, visible); } + else if (IS.MANUALPOINTS(name)) { + doPoints( + artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible, + YAXIS.S.idx); + } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Mon Dec 03 17:27:08 2012 +0100 @@ -329,7 +329,7 @@ if (locationStr == null || locationStr.length() == 0) { if (flys instanceof WINFOArtifact) { WINFOArtifact winfo = (WINFOArtifact) flys; - if (winfo.getReferenceStartKm() != null) { + if (winfo.getReferenceStartKm() != null && winfo.getReferenceEndKms() != null) { return new double[] { winfo.getReferenceStartKm().doubleValue(),
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Mon Dec 03 17:27:08 2012 +0100 @@ -1,15 +1,5 @@ package de.intevation.flys.utils; -import java.awt.Color; -import java.awt.Font; - -import javax.xml.xpath.XPathConstants; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.flys.artifacts.model.MapserverStyle; import de.intevation.flys.artifacts.model.MapserverStyle.Clazz; @@ -17,6 +7,12 @@ import de.intevation.flys.artifacts.model.MapserverStyle.Label; import de.intevation.flys.artifacts.model.MapserverStyle.Style; +import java.awt.Color; +import java.awt.Font; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + /** * Utility to deal with themes and their representations. @@ -117,6 +113,15 @@ public final static String XPATH_WSPLGEN_FIELDS = "/theme[@name='WSPLGEN']/field"; + public final static String XPATH_WSPLGEN_STARTCOLOR = + "/theme/field[@name='startcolor']/@default"; + + public final static String XPATH_WSPLGEN_ENDCOLOR = + "/theme/field[@name='endcolor']/@default"; + + public final static String XPATH_WSPLGEN_NUMCLASSES = + "/theme/field[@name='numclasses']/@default"; + /** XPATH to bandwidth field. */ public final static String XPATH_BANDWIDTH = "/theme/field[@name='bandwidth']/@default"; @@ -619,38 +624,39 @@ public static String createWSPLGENStyle(Document theme) { - NodeList categories = (NodeList) XMLUtils.xpath( - theme, - XPATH_WSPLGEN_FIELDS, - XPathConstants.NODESET); - - return createWSPLGENStyle(categories).toString(); - } - - protected static MapserverStyle createWSPLGENStyle(NodeList categories) { MapserverStyle ms = new MapserverStyle(); - for (int i = 0, n = categories.getLength(); i < n; i++) { - Element cat = (Element) categories.item(i); - String color = cat.getAttribute("default"); - String name = cat.getAttribute("name"); - - String expr; + String strStartColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_STARTCOLOR, null); + Color startColor = strStartColor != null ? parseColor(strStartColor) : new Color(178, 201, 215); + String strEndColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_ENDCOLOR, null); + Color endColor = strEndColor != null? parseColor(strEndColor) : new Color(2, 27, 42); + String strNumClasses = XMLUtils.xpathString(theme, XPATH_WSPLGEN_NUMCLASSES, null); + int numClasses = strNumClasses != null ? Integer.parseInt(strNumClasses) : 5; - try { - int length = name.length(); - int idx = Integer.parseInt(name.substring(length-1, length)); + if (numClasses < 5) { + numClasses = 5; + } + else if (numClasses > 20) { + numClasses = 20; + } - expr = createWSPLGENExpression(idx); - } - catch (NumberFormatException nfe) { - logger.warn("Error while parsing WSPLGEN category.", nfe); - continue; - } + float rd = (endColor.getRed() - startColor.getRed()) / (float)numClasses; + float gd = (endColor.getGreen() - startColor.getGreen()) / (float)numClasses; + float bd = (endColor.getBlue() - startColor.getBlue()) / (float)numClasses; - Clazz c = new Clazz(expr); - Style s = new Style(); - s.setColor(color.replace(",", "")); + for (int n = 0; n < numClasses; n++) { + StringBuilder newColor = new StringBuilder(); + newColor.append(startColor.getRed() + Math.round(n * rd)); + newColor.append(' '); + newColor.append(startColor.getGreen() + Math.round(n * gd)); + newColor.append(' '); + newColor.append(startColor.getBlue() + Math.round(n * bd)); + + String expr = createWSPLGENExpression(n + 1, numClasses); + + Clazz c = new Clazz(expr); + Style s = new Style(); + s.setColor(newColor.toString()); s.setSize(5); c.addItem(new Expression("(" + expr + ")")); @@ -659,17 +665,17 @@ ms.addClazz(c); } - return ms; + return ms.toString(); } - protected static String createWSPLGENExpression(int idx) { - if (idx < 5) { + protected static String createWSPLGENExpression(int idx, int maxIdx) { + if (idx < maxIdx) { int lower = idx - 1; return "[DIFF] >= " + lower + " AND [DIFF] < " + idx; } else { - return "[DIFF] >= 4"; + return "[DIFF] >= " + (maxIdx - 1); } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/wsplgen/WSPLGENCallable.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/wsplgen/WSPLGENCallable.java Mon Dec 03 17:27:08 2012 +0100 @@ -1,14 +1,14 @@ package de.intevation.flys.wsplgen; +import de.intevation.artifacts.CallContext; +import de.intevation.flys.artifacts.model.map.WSPLGENJob; + import java.io.File; import java.io.IOException; import java.util.concurrent.Callable; import org.apache.log4j.Logger; -import de.intevation.artifacts.CallContext; -import de.intevation.flys.artifacts.model.map.WSPLGENJob; - /** * A Callable that is used to start and observe an external Process for WSPLGEN. @@ -63,8 +63,6 @@ protected void execute(String[] args, File dir) { logger.info("Start JobExecutor for artifact: " + dir.getName()); - String errorMsg = null; - try { synchronized (this) { process = Runtime.getRuntime().exec(args, null, dir);
--- a/flys-artifacts/src/main/resources/messages.properties Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/resources/messages.properties Mon Dec 03 17:27:08 2012 +0100 @@ -37,7 +37,7 @@ state.fix.preprocess=incorporate in calculation state.fix.vollmer.function=Function state.fix.vollmer.preprocessing = Outliers -state.fix.vollmer.qa = Input for W/Q data +state.fix.vollmer.qs = Input for W/Q data state.minfo.river = River state.minfo.calculation_mode = Calculation Mode
--- a/flys-artifacts/src/main/resources/messages_de.properties Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/resources/messages_de.properties Mon Dec 03 17:27:08 2012 +0100 @@ -37,7 +37,7 @@ state.fix.preprocess=beim Berechnen einbeziehen state.fix.vollmer.function=Funktion state.fix.vollmer.preprocessing = Ausrei\u00DFer -state.fix.vollmer.qa = Eingabe f\u00e4r W/Q Daten +state.fix.vollmer.qs = Eingabe f\u00fcr W/Q Daten state.minfo.river = Gew\u00e4sser state.minfo.calculation_mode = Berechnungsart
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Dec 03 17:27:08 2012 +0100 @@ -37,7 +37,7 @@ state.fix.preprocess=beim Berechnen einbeziehen state.fix.vollmer.function=Funktion state.fix.vollmer.preprocessing = Ausrei\u00DFer -state.fix.vollmer.qa = Eingabe f\u00e4r W/Q Daten +state.fix.vollmer.qs = Eingabe f\u00fcr W/Q Daten state.minfo.river = Gew\u00e4sser state.minfo.calculation_mode = Berechnungsart
--- a/flys-artifacts/src/main/resources/messages_en.properties Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-artifacts/src/main/resources/messages_en.properties Mon Dec 03 17:27:08 2012 +0100 @@ -37,7 +37,7 @@ state.fix.preprocess=incorporate in calculation state.fix.vollmer.function=Function state.fix.vollmer.preprocessing = Outliers -state.fix.vollmer.qa = Input for W/Q data +state.fix.vollmer.qs = Input for W/Q data state.minfo.river = River state.minfo.calculation_mode = Calculation Mode
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Mon Dec 03 17:27:08 2012 +0100 @@ -31,7 +31,6 @@ import de.intevation.flys.client.client.ui.FLYSHeader; import de.intevation.flys.client.client.ui.FLYSView; import de.intevation.flys.client.client.ui.FLYSWorkspace; -import de.intevation.flys.client.client.ui.MainMenu; import de.intevation.flys.client.client.ui.ProjectList; import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; @@ -77,10 +76,7 @@ protected CreateCollectionServiceAsync collectionService = GWT.create(CreateCollectionService.class); - /** The menu bar at the top of the application. */ - protected MainMenu menu; - - /** The content window. It takes the whole space beneath the menu bar. */ + /** The content window. It takes the whole space beneath the header. */ protected FLYSView view; /** The project list that displays the projects of the user. */ @@ -98,6 +94,8 @@ /** This list is used to track the opened projects. */ protected List<String> openProjects; + private FLYSHeader header; + public static String getExceptionString(FLYSConstants msg, Throwable caught) { try { @@ -131,11 +129,10 @@ vertical.setWidth100(); vertical.setHeight100(); - menu = new MainMenu(this); view = new FLYSView(); + header = new FLYSHeader(this); - vertical.addMember(new FLYSHeader()); - vertical.addMember(menu); + vertical.addMember(header); vertical.addMember(view); vertical.draw(); @@ -158,10 +155,10 @@ GWT.log("Found a user. Set '"+ user.getName() + "'"); setCurrentUser(user); - menu.setCurrentUser(user); + header.setCurrentUser(user); projectList = new ProjectList(FLYS.this, user); - workspace = new FLYSWorkspace(); + workspace = new FLYSWorkspace(FLYS.this); view.setProjectList(projectList); view.setFLYSWorkspace(workspace); @@ -521,5 +518,32 @@ flys.closeProject(uuid); } } + + public boolean isProjectListVisible() { + if (this.projectList == null) { + return true; + } + return this.projectList.isVisible(); + } + + public void hideProjectList() { + if (this.projectList != null) { + this.projectList.hide(); + } + } + + public void openProjectList() { + if (this.projectList != null) { + this.projectList.show(); + } + } + + public void hideHeaderProjectButton() { + this.header.hideProjectButton(); + } + + public void shoHeaderProjectButton() { + this.header.showProjectButton(); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Mon Dec 03 17:27:08 2012 +0100 @@ -314,6 +314,8 @@ String bfgLogo(); + String bfgLogoSmall(); + String downloadPNG(); String downloadPDF(); @@ -1098,5 +1100,15 @@ String projectlist_close(); + String startcolor(); + + String endcolor(); + + String numclasses(); + + String welcome(); + + String welcome_open_or_create(); + } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Mon Dec 03 17:27:08 2012 +0100 @@ -87,9 +87,12 @@ period = Period year = Year sedimentload_ls = Sediment Load +welcome = Welcome to Flusshydrologische Software +welcome_open_or_create = Please open a project from the project list or create a # Header images flysLogo = images/flys_logo.gif bfgLogo = images/bfg_logo.gif +bfgLogoSmall = images/bfg_logo_small.png # Images downloadPNG = images/png_export.png @@ -442,6 +445,10 @@ bedheights = Bedheights datacage = Datacage +startcolor = Colorrange start color +endcolor = Colorrange end color +numclasses = Number of classes + # capabilities information panel addwmsInputTitle = Base URL of WMS service addwmsInfoTitle = Information about WMS service
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Mon Dec 03 17:27:08 2012 +0100 @@ -87,10 +87,13 @@ period = Zeitraum year = Jahr sedimentload_ls = Sediment Fracht +welcome = Willkommen bei der Flusshydrologischen Software +welcome_open_or_create = Bitte \u00f6ffnen Sie ein bestehendes Projekt aus der Projektliste oder erstellen Sie ein # Header images flysLogo = images/flys_logo.gif bfgLogo = images/bfg_logo.gif +bfgLogoSmall = images/bfg_logo_small.png # Images downloadPNG = images/png_export.png @@ -443,6 +446,10 @@ bedheights = Sohlh\u00f6hen datacage = Datenkorb +startcolor = Farbverlauf Startfarbe +endcolor = Farbverlauf Endfarbe +numclasses = Anzahl Klassen + # capabilities information panel addwmsInputTitle = Basis URL des WMS Dienstes addwmsInfoTitle = Informationen des WMS Dienstes
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Mon Dec 03 17:27:08 2012 +0100 @@ -87,10 +87,13 @@ period = Period year = Year sedimentload_ls = Sediment Load +welcome = Welcome to Flusshydrologische Software +welcome_open_or_create = Please open a project from the project list or create a # Header images flysLogo = images/flys_logo.gif bfgLogo = images/bfg_logo.gif +bfgLogoSmall = images/bfg_logo_small.png # Images downloadPNG = images/png_export.png @@ -443,6 +446,10 @@ bedheights = Bedheights datacage = Datacage +startcolor = Colorrange start color +endcolor = Colorrange end color +numclasses = Number of classes + # capabilities information panel addwmsInputTitle = Base URL of WMS service addwmsInfoTitle = Information about WMS service
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Dec 03 17:27:08 2012 +0100 @@ -2,7 +2,6 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; - import com.smartgwt.client.types.Encoding; import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.util.SC; @@ -204,6 +203,7 @@ layout.addMember(uploadLabel); layout.addMember(uploadForm); layout.addMember(submit); + layout.addMember(getNextButton()); } form.setValues(initial);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSHeader.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSHeader.java Mon Dec 03 17:27:08 2012 +0100 @@ -1,15 +1,26 @@ package de.intevation.flys.client.client.ui; import com.google.gwt.core.client.GWT; -import com.google.gwt.resources.client.ImageResource; +import com.google.gwt.i18n.client.LocaleInfo; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.types.VerticalAlignment; +import com.smartgwt.client.util.BooleanCallback; +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.layout.HLayout; -import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.events.ClickEvent; +import com.smartgwt.client.widgets.events.ClickHandler; +import de.intevation.flys.client.client.FLYS; import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.services.UserService; +import de.intevation.flys.client.client.services.UserServiceAsync; +import de.intevation.flys.client.shared.model.User; /** @@ -21,19 +32,109 @@ private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); /** The height used for this header.*/ - public static final int HEIGHT = 75; + public static final int HEIGHT = 56; /** The height used for the images.*/ public static final int IMG_HEIGHT = 50; + /** The user that is currently logged in. */ + private User currentUser; - public FLYSHeader() { + /** The label that displays the current logged in user. */ + private Label userText; + + /** The button to log the current user out.*/ + private Button logout; + + /** The button to open the project list.*/ + private Button projectList; + + /** The button to switch between the english and german version.*/ + private Button language; + + /** The button to open an info panel.*/ + private Button info; + + private UserServiceAsync userService = + GWT.create(UserService.class); + + /** An instance to FLYS.*/ + private FLYS flys; + + + public FLYSHeader(FLYS flys) { + this.flys = flys; + + String guest = MESSAGES.user() + " " + MESSAGES.guest(); + + userText = new Label(guest); + projectList = new Button(MESSAGES.manage_projects()); + logout = new Button(MESSAGES.logout()); + language = new Button(MESSAGES.switch_language()); + info = new Button(MESSAGES.info()); + + projectList.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + GWT.log("Clicked 'Open ProjectList' button."); + getFlys().openProjectList(); + } + }); + + logout.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + GWT.log("Clicked 'logout' button."); + userService.logoutCurrentUser(new AsyncCallback<Void>() { + public void onFailure(Throwable caught) { + } + + public void onSuccess(Void result) { + /* Just reload the page. GGInAFilter is goint to redirect + * to the correct login page */ + Window.Location.reload(); + } + }); + + } + }); + + language.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + LocaleInfo info = LocaleInfo.getCurrentLocale(); + final String currentLocale = info.getLocaleName(); + final String newLocale = currentLocale.equals("de") + ? "en" + : "de"; + + SC.confirm(MESSAGES.warning(), MESSAGES.warning_language(), + new BooleanCallback() { + @Override + public void execute(Boolean value) { + if (value) { + switchLanguage(currentLocale, newLocale); + } + } + }); + } + }); + + info.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + GWT.log("Clicked 'info' button."); + GWT.log("IMPLEMENT the 'open info panel' function."); + } + }); init(); } public void init() { + setStyleName("header"); setWidth100(); setHeight(HEIGHT); + setBackgroundColor("#a9c9e6"); setLayoutLeftMargin(5); setLayoutRightMargin(5); @@ -44,45 +145,147 @@ 50, IMG_HEIGHT); - Img bfg = new Img( - baseUrl + MESSAGES.bfgLogo(), - 112, - HEIGHT); + Img bfg = new Img( + baseUrl + MESSAGES.bfgLogoSmall(), + 150, + IMG_HEIGHT); Label fullname = new Label(MESSAGES.fullname()); fullname.setHeight(HEIGHT - IMG_HEIGHT); - fullname.setStyleName ("fontNormalMid"); + fullname.setStyleName("fontBlackMid"); - VLayout left = new VLayout(); + HLayout left = new HLayout(); + left.setDefaultLayoutAlign(VerticalAlignment.CENTER); + left.setMembersMargin(3); left.addMember(flys); left.addMember(fullname); HLayout right = new HLayout(); right.setAlign(Alignment.RIGHT); + right.setDefaultLayoutAlign(Alignment.RIGHT); + right.setDefaultLayoutAlign(VerticalAlignment.CENTER); + right.setMembersMargin(3); + right.setLayoutRightMargin(5); + + projectList.setStyleName("manageProjects"); + userText.setStyleName("fontBlackSmall"); + logout.setStyleName("fontLightSmall"); + language.setStyleName("fontLightSmall"); + info.setStyleName("fontLightSmall"); + + userText.setAlign(Alignment.RIGHT); + userText.setWidth(200); + logout.setWidth(70); + info.setWidth(40); + language.setWidth(70); + + left.addMember(projectList); + if (this.flys.isProjectListVisible()) { + hideProjectButton(); + } + else { + showProjectButton(); + } + + right.addMember(userText); + right.addMember(logout); + right.addMember(language); + right.addMember(info); right.addMember(bfg); addMember(left); addMember(right); } + /** + * Returns the FLYS instance stored in this class. + * + * @return the flys instance. + */ + private FLYS getFlys() { + return flys; + } /** - * This method calculates the wight of an image relative to the given - * height. + * This method triggers the language switch between the <i>currentLocale</i> + * and the <i>newLocale</i>. The switch is done by replacing a "locale=" + * parameter in the url of the application. We could use the GWT UrlBuilder + * class to create a new URL, but - in my eyes - this class is a bit + * inconsistens in its implementation. * - * @param res The ImageResource that points to the image. - * @param height The pre-defined height. - * - * @return the calculated width that should be used for the image. + * @param currentLocale The current locale string (e.g. "en"). + * @param newLocale The new locale string (e.g. "de"). */ - protected int calcWidth(ImageResource res, int height) { - int widthOrig = res.getWidth(); - int heightOrig = res.getHeight(); + private void switchLanguage(String currentLocale, String newLocale) { + String newLocation = Window.Location.getHref(); - double factor = (double)heightOrig / height; - double width = (double)widthOrig / factor; + if (newLocation.endsWith("/")) { + newLocation = newLocation.substring(0, newLocation.length()-1); + } - return (int) width * 10 / 10; + String replace = null; + String replaceWith = null; + + if (newLocation.indexOf("&locale=") >= 0) { + replace = currentLocale.equals("de") + ? "&locale=de" + : "&locale=en"; + + replaceWith = "&locale=" + newLocale; + } + else if (newLocation.indexOf("?locale=") >= 0) { + replace = currentLocale.equals("de") + ? "?locale=de" + : "?locale=en"; + + replaceWith = "?locale=" + newLocale; + } + else { + newLocation += newLocation.indexOf("?") >= 0 + ? "&locale=" + newLocale + : "?locale=" + newLocale; + } + + if (replace != null && replaceWith != null) { + newLocation = newLocation.replace(replace, replaceWith); + } + + Window.open(newLocation, "_self", ""); + } + + /** + * Update the text field that shows the current user. If no user is + * currently logged in, the text will display {@link FLYSConstants.guest()}. + */ + private void updateCurrentUser() { + String name = currentUser != null + ? currentUser.getName() + : MESSAGES.guest(); + + GWT.log("Update the current user: " + name); + + String username = MESSAGES.user() + " " + name; + userText.setContents(username); + } + + /** + * Set the current {@link User} and call {@link updateCurrentUser()} + * afterwards. + * + * @param user the new user. + */ + public void setCurrentUser(User currentUser) { + this.currentUser = currentUser; + + updateCurrentUser(); + } + + public void hideProjectButton() { + this.projectList.hide(); + } + + public void showProjectButton() { + this.projectList.show(); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java Mon Dec 03 17:27:08 2012 +0100 @@ -2,7 +2,20 @@ import com.google.gwt.core.client.GWT; +import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.types.VerticalAlignment; +import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.Img; +import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.events.ClickEvent; +import com.smartgwt.client.widgets.events.ClickHandler; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.LayoutSpacer; +import com.smartgwt.client.widgets.layout.VLayout; + +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.client.FLYSConstants; import java.util.HashMap; import java.util.Map; @@ -25,16 +38,23 @@ /** A map that contains the open CollectionViews. */ protected Map<String, CollectionView> views; + /** The interface that provides the message resources. */ + private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); + + private FLYS flys; /** * The default constructor creates an empty FLYSWorkspace with no * CollectionViews opened. */ - public FLYSWorkspace() { + public FLYSWorkspace(FLYS flys) { + this.flys = flys; views = new HashMap<String, CollectionView>(); setWidth("100%"); setHeight("100%"); + + addBackgroundWorkspace(); } @@ -99,5 +119,61 @@ } return false; } + + private void addBackgroundWorkspace() { + String baseUrl = GWT.getHostPageBaseURL(); + Img bfg = new Img( + baseUrl + MESSAGES.bfgLogo()); + bfg.setWidth(150); + bfg.setHeight(100); + bfg.setLayoutAlign(Alignment.RIGHT); + + HLayout backgroundlayout = new HLayout(); + backgroundlayout.setHeight100(); + backgroundlayout.setWidth100(); + backgroundlayout.setDefaultLayoutAlign(Alignment.CENTER); + backgroundlayout.setDefaultLayoutAlign(VerticalAlignment.CENTER); + + Canvas spacer = new Canvas(); + spacer.setWidth("33%"); + + VLayout infobox = new VLayout(); + infobox.setHeight("*"); + infobox.setWidth("*"); + infobox.setDefaultLayoutAlign(Alignment.CENTER); + + Label welcome = new Label(MESSAGES.welcome()); + welcome.setAlign(Alignment.CENTER); + welcome.setStyleName("fontNormalBig"); + + Label lcreate = new Label(MESSAGES.welcome_open_or_create()); + lcreate.setStyleName("welcomeCreateText"); + lcreate.setWidth100(); + lcreate.setAlign(Alignment.CENTER); + + Button addbutton = new Button(MESSAGES.new_project()); + addbutton.setStyleName("projectsAddButton"); + addbutton.setAlign(Alignment.CENTER); + addbutton.setTitle(MESSAGES.new_project()); + addbutton.setAutoFit(true); + addbutton.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + flys.newProject(); + } + }); + + + infobox.addMember(welcome); + infobox.addMember(lcreate); + infobox.addMember(addbutton); + + backgroundlayout.addMember(spacer); + backgroundlayout.addMember(infobox); + backgroundlayout.addMember(spacer); + + addChild(backgroundlayout); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LinkSelection.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LinkSelection.java Mon Dec 03 17:27:08 2012 +0100 @@ -36,9 +36,6 @@ /** The message class that provides i18n strings.*/ protected FLYSConstants messages = GWT.create(FLYSConstants.class); - /** The combobox.*/ - protected DynamicForm form; - /** The selected river*/ protected Data river; @@ -117,8 +114,6 @@ layout.setAlign(VerticalAlignment.TOP); layout.setHeight(25); - - form = new DynamicForm(); VLayout formLayout = new VLayout(); formLayout.setLayoutLeftMargin(60);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MainMenu.java Mon Dec 03 17:25:49 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -package de.intevation.flys.client.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.i18n.client.LocaleInfo; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.smartgwt.client.types.Alignment; -import com.smartgwt.client.util.BooleanCallback; -import com.smartgwt.client.util.SC; -import com.smartgwt.client.widgets.Button; -import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.events.ClickEvent; -import com.smartgwt.client.widgets.events.ClickHandler; -import com.smartgwt.client.widgets.layout.HLayout; - -import de.intevation.flys.client.client.FLYS; -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.services.UserService; -import de.intevation.flys.client.client.services.UserServiceAsync; -import de.intevation.flys.client.shared.model.User; - - -/** - * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> - */ -public class MainMenu extends HLayout { - - /** The interface that provides i18n messages. */ - private final FLYSConstants messages = GWT.create(FLYSConstants.class); - - /** An instance to FLYS.*/ - protected FLYS flys; - - /** The user that is currently logged in. */ - protected User currentUser; - - /** The label that displays the current logged in user. */ - protected Label userText; - - /** The button to log the current user out.*/ - protected Button logout; - - /** The button to open the project list.*/ - protected Button projectList; - - /** The button to switch between the english and german version.*/ - protected Button language; - - /** The button to open an info panel.*/ - protected Button info; - - protected UserServiceAsync userService = - GWT.create(UserService.class); - - /** - * The default constructor for creating a new MainMenu. - */ - public MainMenu(FLYS flys) { - this.flys = flys; - - String guest = messages.user() + " " + messages.guest(); - - userText = new Label(guest); - projectList = new Button(messages.manage_projects()); - logout = new Button(messages.logout()); - language = new Button(messages.switch_language()); - info = new Button(messages.info()); - - projectList.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - GWT.log("Clicked 'Open ProjectList' button."); - ProjectList list = getFlys().getProjectList(); - if (list.isVisible()) - list.hide(); - else - list.show(); - } - }); - - logout.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - GWT.log("Clicked 'logout' button."); - userService.logoutCurrentUser(new AsyncCallback<Void>() { - public void onFailure(Throwable caught) { - } - - public void onSuccess(Void result) { - /* Just reload the page. GGInAFilter is goint to redirect - * to the correct login page */ - Window.Location.reload(); - } - }); - - } - }); - - language.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - LocaleInfo info = LocaleInfo.getCurrentLocale(); - final String currentLocale = info.getLocaleName(); - final String newLocale = currentLocale.equals("de") - ? "en" - : "de"; - - SC.confirm(messages.warning(), messages.warning_language(), - new BooleanCallback() { - @Override - public void execute(Boolean value) { - if (value) { - switchLanguage(currentLocale, newLocale); - } - } - }); - } - }); - - info.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - GWT.log("Clicked 'info' button."); - GWT.log("IMPLEMENT the 'open info panel' function."); - } - }); - - init(); - } - - - /** - * This method is called by the constructor after creating the necessary - * components. It initializes layout specific stuff like width, height, - * colors and so on and appends the components. - */ - protected void init() { - setStyleName("bgBlueDark"); - setHeight("25px"); - setLayoutMargin(5); - - projectList.setStyleName("fontLightSmall"); - userText.setStyleName("fontLightSmall"); - logout.setStyleName("fontLightSmall"); - language.setStyleName("fontLightSmall"); - info.setStyleName("fontLightSmall"); - - projectList.setWidth("140px"); - - HLayout leftPanel = new HLayout(); - leftPanel.setWidth("80%"); - leftPanel.setMembersMargin(5); - leftPanel.addMember(projectList); - - userText.setAlign(Alignment.RIGHT); - userText.setWidth(200); - logout.setWidth(70); - info.setWidth(40); - language.setWidth(70); - - HLayout rightPanel = new HLayout(); - rightPanel.setAlign(Alignment.RIGHT); - rightPanel.setMembersMargin(3); - rightPanel.setLayoutRightMargin(5); - rightPanel.addMember(userText); - rightPanel.addMember(logout); - rightPanel.addMember(language); - rightPanel.addMember(info); - - addMember(leftPanel); - addMember(rightPanel); - } - - - /** - * Returns the FLYS instance stored in this class. - * - * @return the flys instance. - */ - protected FLYS getFlys() { - return flys; - } - - - /** - * Set the current {@link User} and call {@link updateCurrentUser()} - * afterwards. - * - * @param user the new user. - */ - public void setCurrentUser(User currentUser) { - this.currentUser = currentUser; - - updateCurrentUser(); - } - - - /** - * Update the text field that shows the current user. If no user is - * currently logged in, the text will display {@link FLYSConstants.guest()}. - */ - public void updateCurrentUser() { - String name = currentUser != null - ? currentUser.getName() - : messages.guest(); - - GWT.log("Update the current user: " + name); - - String username = messages.user() + " " + name; - userText.setContents(username); - } - - - /** - * Create a new project by calling FLYS.newProject(). - */ - protected void createNewProject() { - flys.newProject(); - } - - - /** - * This method triggers the language switch between the <i>currentLocale</i> - * and the <i>newLocale</i>. The switch is done by replacing a "locale=" - * parameter in the url of the application. We could use the GWT UrlBuilder - * class to create a new URL, but - in my eyes - this class is a bit - * inconsistens in its implementation. - * - * @param currentLocale The current locale string (e.g. "en"). - * @param newLocale The new locale string (e.g. "de"). - */ - protected void switchLanguage(String currentLocale, String newLocale) { - String newLocation = Window.Location.getHref(); - - if (newLocation.endsWith("/")) { - newLocation = newLocation.substring(0, newLocation.length()-1); - } - - String replace = null; - String replaceWith = null; - - if (newLocation.indexOf("&locale=") >= 0) { - replace = currentLocale.equals("de") - ? "&locale=de" - : "&locale=en"; - - replaceWith = "&locale=" + newLocale; - } - else if (newLocation.indexOf("?locale=") >= 0) { - replace = currentLocale.equals("de") - ? "?locale=de" - : "?locale=en"; - - replaceWith = "?locale=" + newLocale; - } - else { - newLocation += newLocation.indexOf("?") >= 0 - ? "&locale=" + newLocale - : "?locale=" + newLocale; - } - - if (replace != null && replaceWith != null) { - newLocation = newLocation.replace(replace, replaceWith); - } - - Window.open(newLocation, "_self", ""); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java Mon Dec 03 17:27:08 2012 +0100 @@ -49,7 +49,7 @@ moduleSelection = new ModuleSelection(); Canvas form = moduleSelection.create(data); - form.setWidth(250); + form.setWidth(400); form.setLayoutAlign(VerticalAlignment.TOP); // TODO implement event handling in the river map (here? or in LinkSelection)
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java Mon Dec 03 17:27:08 2012 +0100 @@ -884,6 +884,8 @@ } } + + /** Sets content of reportPanel. */ protected void setReportMessage(String msg) { GWT.log("returned from service: " + msg); if (msg == null) {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java Mon Dec 03 17:27:08 2012 +0100 @@ -20,6 +20,8 @@ import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.events.VisibilityChangedEvent; +import com.smartgwt.client.widgets.events.VisibilityChangedHandler; import com.smartgwt.client.widgets.grid.CellFormatter; import com.smartgwt.client.widgets.grid.HoverCustomizer; import com.smartgwt.client.widgets.grid.ListGrid; @@ -90,7 +92,8 @@ */ public class ProjectList extends VLayout -implements CollectionChangeHandler, EditCompleteHandler, FilterHandler +implements CollectionChangeHandler, EditCompleteHandler, FilterHandler, + VisibilityChangedHandler { /** Interval to refresh the user's projects.*/ public static final int UPDATE_INTERVAL = 30000; @@ -191,6 +194,8 @@ grid.addEditCompleteHandler(this); + addVisibilityChangedHandler(this); + updateUserCollections(); } @@ -963,5 +968,16 @@ } ); } + + + @Override + public void onVisibilityChanged(VisibilityChangedEvent event) { + if (event.getIsVisible()) { + this.flys.hideHeaderProjectButton(); + } + else { + this.flys.shoHeaderProjectButton(); + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java Mon Dec 03 17:27:08 2012 +0100 @@ -1,22 +1,28 @@ package de.intevation.flys.client.client.ui; import com.google.gwt.core.client.GWT; - import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.FormItem; +import com.smartgwt.client.widgets.form.fields.LinkItem; import com.smartgwt.client.widgets.form.fields.SelectItem; +import com.smartgwt.client.widgets.form.fields.SpacerItem; +import com.smartgwt.client.widgets.form.fields.events.ClickEvent; +import com.smartgwt.client.widgets.form.fields.events.ClickHandler; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.StepForwardEvent; import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DataList; import de.intevation.flys.client.shared.model.DefaultData; import de.intevation.flys.client.shared.model.DefaultDataItem; +import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; @@ -36,7 +42,9 @@ protected FLYSConstants messages = GWT.create(FLYSConstants.class); /** The combobox.*/ - protected DynamicForm form; + protected DynamicForm form = new DynamicForm(); + + public static final int COMBOBOX_THRESHOLD = 20; /** @@ -52,14 +60,21 @@ public Canvas create(DataList data) { VLayout v = new VLayout(); v.setMembersMargin(10); - - Canvas content = createWidget(data); - Canvas button = getNextButton(); + v.addMember(createWidget(data)); + if(data.size() > COMBOBOX_THRESHOLD) { + v.addMember(getNextButton()); + } + return v; + } - v.addMember(content); - v.addMember(button); - return v; + protected Canvas createWidget(DataList data) { + if (data.size() > COMBOBOX_THRESHOLD) { + return createComboboxWidget(data); + } + else { + return createListWidget(data); + } } @@ -98,15 +113,83 @@ } - /** - * This method creates the content of the widget. - * - * @param data The {@link DataList} object. - * - * @return a combobox. - */ - protected Canvas createWidget(DataList data) { - GWT.log("SelectProvider - create()"); + protected Canvas createListWidget(DataList data) { + VLayout layout = new VLayout(); + layout.setAlign(VerticalAlignment.TOP); + layout.setHeight(25); + layout.setWidth("100%"); + + VLayout formLayout = new VLayout(); + formLayout.setLayoutTopMargin(20); + formLayout.setLayoutLeftMargin(50); + + ClickHandler handler = new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + LinkItem li = (LinkItem)event.getItem(); + String attr = li.getAttribute(li.getName()); + GWT.log("li.getTarget: " + attr + " " + li.getName()); + DataItem item = new DefaultDataItem( + attr, + null, + attr); + + Data d = new DefaultData( + li.getName(), + null, + null, + new DataItem [] { item }); + + Data [] odata = getData(); + Data [] ndata = new Data[odata.length+1]; + System.arraycopy(odata, 0, ndata, 0, odata.length); + ndata[odata.length] = d; + + fireStepForwardEvent(new StepForwardEvent(ndata)); + } + }; + + for (int i = 0, size = data.size(); i < size; i++) { + Data d = data.get(i); + + Label label = new Label(d.getDescription()); + label.setValign(VerticalAlignment.TOP); + label.setHeight(20); + label.setWidth(400); + + LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>(); + ArrayList<FormItem> formItems = new ArrayList<FormItem>(); + + for (DataItem item: d.getItems()) { + initial.put(item.getLabel().replace(' ', '_'), item.getStringValue()); + GWT.log("put: " + item.getLabel().replace(' ', '_') + "=" + item.getStringValue()); + + LinkItem link = new LinkItem(d.getLabel()); + link.setLinkTitle(item.getLabel()); // i18n text of the link + link.setAttribute(d.getLabel(), item.getStringValue()); // e.g. "calculation_mode":"foo" + link.setShowTitle(false); + link.setEndRow(true); + link.setWidth("350px"); + + SpacerItem space = new SpacerItem(); + space.setWidth(15); + formItems.add(space); + formItems.add(link); + + link.addClickHandler(handler); + } + + form.setFields(formItems.toArray(new FormItem[0])); + form.setValues(initial); + + layout.addMember(label); + layout.addMember(form); + } + return layout; + } + + protected Canvas createComboboxWidget(DataList data) { + GWT.log("SelectProvider.createComboboxWidget()"); VLayout layout = new VLayout(); layout.setAlign(VerticalAlignment.TOP); @@ -114,8 +197,6 @@ LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>(); - form = new DynamicForm(); - int size = data.size(); for (int i = 0; i < size; i++) { @@ -142,7 +223,6 @@ defaultSet = true; } - // I was here. Me 2. for (DataItem item: d.getItems()) { if (!defaultSet && first) { initial.put(d.getLabel(), item.getStringValue()); @@ -178,7 +258,7 @@ int i = 0; while (keys.hasNext()) { - String fieldname = (String) keys.next(); + String fieldname = ((String) keys.next()).replace('_', ' '); String selection = (String) values.get(fieldname); DataItem item = new DefaultDataItem(fieldname, null, selection);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java Mon Dec 03 17:27:08 2012 +0100 @@ -410,6 +410,22 @@ f.setValueMap(valueMap); f.setValue(value); } + else if (name.equals("numclasses")) { + LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); + valueMap.put("5", "5"); + valueMap.put("6", "6"); + valueMap.put("7", "7"); + valueMap.put("8", "8"); + valueMap.put("9", "9"); + valueMap.put("10", "10"); + valueMap.put("12", "12"); + valueMap.put("14", "14"); + valueMap.put("16", "16"); + valueMap.put("18", "18"); + valueMap.put("20", "20"); + f.setValueMap(valueMap); + f.setValue(value); + } else if (name.equals("transparency")) { LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); for (int n = 10; n < 100; n += 10) {
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ReportServiceImpl.java Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ReportServiceImpl.java Mon Dec 03 17:27:08 2012 +0100 @@ -77,6 +77,8 @@ return "error processing error report"; } + + /** Returns String containing markup that shows the report message. */ protected static String buildReport(Document document) { NodeList problems = document.getElementsByTagName("problem");
--- a/flys-client/src/main/webapp/FLYS.css Mon Dec 03 17:25:49 2012 +0100 +++ b/flys-client/src/main/webapp/FLYS.css Mon Dec 03 17:27:08 2012 +0100 @@ -77,12 +77,30 @@ color: #a9c9e6; } +.fontBlackMid { + font-family: Arial,Verdana,sans-serif; + font-size: 12pt; + color: #000000; +} + +.fontBlackSmall { + font-family: Arial,Verdana,sans-serif; + font-size: 10pt; + color: #000000; +} + .fontNormalMid { font-family: Arial,Verdana,sans-serif; font-size: 12pt; color: #a9c9e6; } +.fontWhiteMid { + font-family: Arial,Verdana,sans-serif; + font-size: 12pt; + color: #FFFFFF; +} + .fontNormalBig { font-family: Arial,Verdana,sans-serif; font-size: 18pt; @@ -199,4 +217,21 @@ .projectsAddButton { font-weight: bold; vertical-align: middle; -} \ No newline at end of file +} + +.welcomeCreateText { + font-family: Arial,Verdana,sans-serif; + font-size: 11pt; + color: #000000; +} + +.header { + border-bottom: 3px solid #669fd1; +} + +.manageProjects { + font-family: Arial,Verdana,sans-serif; + font-size: 10pt; + color: #a9c9e6; + margin-left: 10px; +}