r1007 - in trunk: coser-business/src/main/java/fr/ifremer/coser/bean coser-ui/src/main/java/fr/ifremer/coser/ui coser-ui/src/main/java/fr/ifremer/coser/ui/freize coser-ui/src/main/resources/i18n
Author: echatellier Date: 2012-07-16 15:46:24 +0200 (Mon, 16 Jul 2012) New Revision: 1007 Url: http://forge.codelutin.com/repositories/revision/coser/1007 Log: #1328: Premiere version de la frise Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/Freize.jaxx trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeHandler.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeModel.java Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/AbstractDataContainer.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/AbstractDataContainer.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/AbstractDataContainer.java 2012-07-16 13:44:46 UTC (rev 1006) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/AbstractDataContainer.java 2012-07-16 13:46:24 UTC (rev 1007) @@ -154,22 +154,22 @@ public void setHistoryCommands(List<Command> historyCommand) { this.historyCommands = historyCommand; - getPropertyChangeSupport().firePropertyChange("historyCommands", null, historyCommands); + getPropertyChangeSupport().firePropertyChange(PROPERTY_HISTORY_COMMANDS, null, historyCommands); } public void addHistoryCommand(Command historyCommand) { historyCommands.add(historyCommand); - getPropertyChangeSupport().firePropertyChange("historyCommands", null, historyCommands); + getPropertyChangeSupport().firePropertyChange(PROPERTY_HISTORY_COMMANDS, null, historyCommands); } public void removeHistoryCommand(Command historyCommand) { historyCommands.remove(historyCommand); - getPropertyChangeSupport().firePropertyChange("historyCommands", null, historyCommands); + getPropertyChangeSupport().firePropertyChange(PROPERTY_HISTORY_COMMANDS, null, historyCommands); } public void clearHistoryCommands() { historyCommands.clear(); - getPropertyChangeSupport().firePropertyChange("historyCommands", null, historyCommands); + getPropertyChangeSupport().firePropertyChange(PROPERTY_HISTORY_COMMANDS, null, historyCommands); } /** Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx 2012-07-16 13:44:46 UTC (rev 1006) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx 2012-07-16 13:46:24 UTC (rev 1007) @@ -32,6 +32,7 @@ <CoserFrameHandler id="handler" constructorParams="this" /> <fr.ifremer.coser.bean.Project id="project" javaBean="null" /> + <fr.ifremer.coser.bean.Selection id="selection" javaBean="null" /> <JMenuBar> @@ -82,5 +83,7 @@ <HomeView handler="{getHandler()}" /> </JPanel> - <StatusMessagePanel constraints='BorderLayout.SOUTH' /> + <fr.ifremer.coser.ui.freize.Freize id="freize" constraints='BorderLayout.SOUTH' /> + <fr.ifremer.coser.ui.freize.FreizeModel initializer="freize.getModel()" project="{getProject()}" + selection="{getSelection()}" /> </JFrame> Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2012-07-16 13:44:46 UTC (rev 1006) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2012-07-16 13:46:24 UTC (rev 1007) @@ -477,8 +477,9 @@ setWaitCursor(view); try { + view.setSelection(selection); // for freize view.setContextValue(selection); - + view.getParentContainer(CoserFrame.class).getHandler().showSelectionView(selection, selectedTab); SelectionView selectionView = new SelectionView(view); selectionView.setSelection(selection); Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/Freize.jaxx =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/Freize.jaxx (rev 0) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/Freize.jaxx 2012-07-16 13:46:24 UTC (rev 1007) @@ -0,0 +1,105 @@ +<!-- + #%L + Coser :: UI + + $Id$ + $HeadURL$ + %% + Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> +<JPanel layout="{new GridLayout(0, 4)}" + border="{BorderFactory.createLineBorder(Color.BLACK)}"> + + <import> + java.awt.Color + javax.swing.BorderFactory + fr.ifremer.coser.ui.CoserFrame + </import> + + <FreizeModel id="model" javaBean="new FreizeModel()" /> + <FreizeHandler id="handler" constructorParams="this" model="{getModel()}" /> + + <Table id="step0Panel" border="{BorderFactory.createEtchedBorder()}"> + <row> + <cell weightx="1"> + <JLabel text="coser.ui.freize.projectstep" font-weight="bold" /> + </cell> + <cell rows="2"> + <JLabel id="step0Icon" icon="button_ok.png" /> + </cell> + </row> + <row> + <cell> + <JButton text='coser.ui.freize.projectaction' + onActionPerformed="getParentContainer(CoserFrame.class).getHandler().showProjectCreationView()"/> + </cell> + </row> + </Table> + + <Table id="step1Panel" border="{BorderFactory.createEtchedBorder()}" decorator="boxed"> + <row> + <cell weightx="1"> + <JLabel text="coser.ui.freize.controlstep" enabled="{model.isStep1Enabled()}" /> + </cell> + <cell rows="2"> + <JLabel id="step1Icon" icon="stock_lock.png" enabled="{model.isStep1Enabled()}" /> + </cell> + </row> + <row> + <cell> + <JButton text='coser.ui.freize.controlaction' enabled="{model.isStep1Enabled()}" + onActionPerformed="getParentContainer(CoserFrame.class).getHandler().showControlView()"/> + </cell> + </row> + </Table> + + <Table id="step2Panel" border="{BorderFactory.createEtchedBorder()}" decorator="boxed"> + <row> + <cell weightx="1"> + <JLabel text="coser.ui.freize.selectionstep" enabled="{model.isStep2Enabled()}" /> + </cell> + <cell rows="2"> + <JLabel id="step2Icon" icon="agt_action_fail.png" enabled="{model.isStep2Enabled()}" /> + </cell> + </row> + <row> + <cell> + <JButton text='coser.ui.freize.selectionaction' enabled="{model.isStep2Enabled()}" + onActionPerformed="getParentContainer(CoserFrame.class).getHandler().showSelectionView(model.getSelection(), 0)"/> + </cell> + </row> + </Table> + + <Table id="step3Panel" border="{BorderFactory.createEtchedBorder()}" decorator="boxed"> + <row> + <cell weightx="1"> + <JLabel text="coser.ui.freize.resultstep" enabled="{model.isStep3Enabled()}" /> + </cell> + <cell rows="2"> + <JLabel id="step3Icon" icon="agt_action_fail.png" enabled="{model.isStep3Enabled()}" /> + </cell> + </row> + <row> + <cell> + <JButton text='coser.ui.freize.resultaction' enabled="{model.isStep3Enabled()}" + onActionPerformed="getParentContainer(CoserFrame.class).getHandler().showSelectionView(model.getSelection(), 2)"/> + </cell> + </row> + </Table> + +</JPanel> Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeHandler.java (rev 0) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeHandler.java 2012-07-16 13:46:24 UTC (rev 1007) @@ -0,0 +1,138 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +package fr.ifremer.coser.ui.freize; + +import java.awt.Color; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import javax.swing.Icon; +import javax.swing.ImageIcon; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.coser.bean.Project; +import fr.ifremer.coser.bean.Selection; + + +/** + * Panel affichant l'état d'avancement du dans la definition sous forme de frise. + * + * @author echatellier + */ +public class FreizeHandler implements PropertyChangeListener { + + private static final Log log = LogFactory.getLog(FreizeHandler.class); + + protected static final Icon OK_ICON = new ImageIcon(FreizeHandler.class.getResource("/icons/button_ok.png")); + protected static final Icon LOCKED_ICON = new ImageIcon(FreizeHandler.class.getResource("/icons/stock_lock.png")); + protected static final Icon BAD_ICON = new ImageIcon(FreizeHandler.class.getResource("/icons/agt_action_fail.png")); + protected static final Color COMPLETE_COLOR = Color.GREEN; + protected static final Color PENDING_COLOR = Color.YELLOW; + protected static final Color DISABLED_COLOR = null; + + protected FreizeModel model; + + protected Freize view; + + public FreizeHandler(Freize view) { + this.view = view; + } + + public void setModel(FreizeModel model) { + if (this.model != null) { + this.model.removePropertyChangeListener(this); + } + this.model = model; + if (this.model != null) { + this.model.addPropertyChangeListener(this); + } + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + String propertyName = evt.getPropertyName(); + + if (log.isDebugEnabled()) { + log.debug("Update freize : " + propertyName); + } + + if (FreizeModel.PROPERTY_PROJECT.equals(propertyName)) { + updateUi(); + } else if (FreizeModel.PROPERTY_SELECTION.equals(propertyName)) { + updateUi(); + } else if (FreizeModel.PROPERTY_R_SUFI_RESULT.equals(propertyName)) { + updateUi(); + } + } + + /** + * Met à jour le visuel de la frise. + */ + protected void updateUi() { + + // init with default values + model.setStep1Enabled(false); + model.setStep2Enabled(false); + model.setStep3Enabled(false); + + view.getStep0Panel().setBackground(DISABLED_COLOR); + view.getStep1Panel().setBackground(DISABLED_COLOR); + view.getStep2Panel().setBackground(DISABLED_COLOR); + view.getStep0Icon().setIcon(BAD_ICON); + view.getStep1Icon().setIcon(BAD_ICON); + view.getStep2Icon().setIcon(BAD_ICON); + + Project project = model.getProject(); + if (project != null) { + view.getStep0Icon().setIcon(OK_ICON); + view.getStep0Panel().setBackground(COMPLETE_COLOR); + model.setStep1Enabled(true); + + if (project.getControl().isValidated()) { + view.getStep1Panel().setBackground(COMPLETE_COLOR); + model.setStep2Enabled(true); + if (!project.getSelections().isEmpty()) { + view.getStep1Icon().setIcon(LOCKED_ICON); + } else { + view.getStep1Icon().setIcon(OK_ICON); + } + + Selection selection = model.getSelection(); + if (selection != null && selection.isValidated()) { + view.getStep2Icon().setIcon(OK_ICON); + view.getStep2Panel().setBackground(COMPLETE_COLOR); + model.setStep3Enabled(true); + } else { + view.getStep2Panel().setBackground(PENDING_COLOR); + } + } else { + view.getStep1Panel().setBackground(PENDING_COLOR); + } + } else { + view.getStep0Panel().setBackground(PENDING_COLOR); + view.getStep0Icon().setIcon(BAD_ICON); + } + } +} Property changes on: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeModel.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeModel.java (rev 0) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeModel.java 2012-07-16 13:46:24 UTC (rev 1007) @@ -0,0 +1,122 @@ +package fr.ifremer.coser.ui.freize; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +import fr.ifremer.coser.bean.Project; +import fr.ifremer.coser.bean.RSufiResult; +import fr.ifremer.coser.bean.Selection; + +public class FreizeModel { + + public static final String PROPERTY_PROJECT = "project"; + public static final String PROPERTY_SELECTION = "selection"; + public static final String PROPERTY_R_SUFI_RESULT = "rSufiResult"; + public static final String PROPERTY_STEP0_ENABLED = "step0Enabled"; + public static final String PROPERTY_STEP1_ENABLED = "step1Enabled"; + public static final String PROPERTY_STEP2_ENABLED = "step2Enabled"; + public static final String PROPERTY_STEP3_ENABLED = "step3Enabled"; + + protected Project project; + protected Selection selection; + protected RSufiResult rSufiResult; + + protected boolean step0Enabled; + protected boolean step1Enabled; + protected boolean step2Enabled; + protected boolean step3Enabled; + + protected transient PropertyChangeSupport pcs; + + public FreizeModel() { + pcs = new PropertyChangeSupport(this); + } + + public Project getProject() { + return project; + } + + public void setProject(Project project) { + Project oldValue = this.project; + this.project = project; + pcs.firePropertyChange(PROPERTY_PROJECT, oldValue, project); + } + + public Selection getSelection() { + return selection; + } + + public void setSelection(Selection selection) { + Selection oldValue = this.selection; + this.selection = selection; + pcs.firePropertyChange(PROPERTY_SELECTION, oldValue, selection); + } + + public RSufiResult getrSufiResult() { + return rSufiResult; + } + + public void setrSufiResult(RSufiResult rSufiResult) { + RSufiResult oldValue = this.rSufiResult; + this.rSufiResult = rSufiResult; + pcs.firePropertyChange(PROPERTY_R_SUFI_RESULT, oldValue, rSufiResult); + } + + public boolean isStep0Enabled() { + return step0Enabled; + } + + public void setStep0Enabled(boolean step0Enabled) { + boolean oldValue = this.step0Enabled; + this.step0Enabled = step0Enabled; + pcs.firePropertyChange(PROPERTY_STEP0_ENABLED, oldValue, step0Enabled); + } + + public boolean isStep1Enabled() { + return step1Enabled; + } + + public void setStep1Enabled(boolean step1Enabled) { + boolean oldValue = this.step1Enabled; + this.step1Enabled = step1Enabled; + pcs.firePropertyChange(PROPERTY_STEP1_ENABLED, oldValue, step1Enabled); + } + + public boolean isStep2Enabled() { + return step2Enabled; + } + + public void setStep2Enabled(boolean step2Enabled) { + boolean oldValue = this.step2Enabled; + this.step2Enabled = step2Enabled; + pcs.firePropertyChange(PROPERTY_STEP2_ENABLED, oldValue, step2Enabled); + } + + public boolean isStep3Enabled() { + return step3Enabled; + } + + public void setStep3Enabled(boolean step3Enabled) { + boolean oldValue = this.step3Enabled; + this.step3Enabled = step3Enabled; + pcs.firePropertyChange(PROPERTY_STEP3_ENABLED, oldValue, step3Enabled); + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + pcs.addPropertyChangeListener(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + pcs.removePropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String propertyName, + PropertyChangeListener listener) { + pcs.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(String propertyName, + PropertyChangeListener listener) { + pcs.removePropertyChangeListener(propertyName, listener); + } +} Property changes on: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/freize/FreizeModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties =================================================================== --- trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2012-07-16 13:44:46 UTC (rev 1006) +++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2012-07-16 13:46:24 UTC (rev 1007) @@ -60,6 +60,14 @@ coser.ui.error.htmlmessage=An error occurred \: %s coser.ui.error.reportSendTo=A report has been sent to %s coser.ui.error.title=Global application error +coser.ui.freize.controlaction= +coser.ui.freize.controlstep= +coser.ui.freize.projectaction= +coser.ui.freize.projectstep= +coser.ui.freize.resultaction= +coser.ui.freize.resultstep= +coser.ui.freize.selectionaction= +coser.ui.freize.selectionstep= coser.ui.graph.compareNumberCatchLength=Comparison Catch/Length coser.ui.graph.compareNumberCatchLengthTip=Display catch and length number comparison graphs (data are generated only during error check) coser.ui.graph.lengthStructure=Length structure Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties =================================================================== --- trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2012-07-16 13:44:46 UTC (rev 1006) +++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2012-07-16 13:46:24 UTC (rev 1007) @@ -60,6 +60,14 @@ coser.ui.error.htmlmessage=Une erreur s'est produite \: %s coser.ui.error.reportSendTo=Un rapport a été envoyé à %s coser.ui.error.title=Erreur globale +coser.ui.freize.controlaction=Contrôle +coser.ui.freize.controlstep=2/4 \: Contrôle +coser.ui.freize.projectaction=Créer +coser.ui.freize.projectstep=1/4 \: Création +coser.ui.freize.resultaction=Ajouter un résultat +coser.ui.freize.resultstep=4/4 \: Résultats +coser.ui.freize.selectionaction=Sélection +coser.ui.freize.selectionstep=3/4 \: Sélection coser.ui.graph.compareNumberCatchLength=Comparaison Captures/Tailles coser.ui.graph.compareNumberCatchLengthTip=Affiche les graphiques de comparaison des nombres entre les captures et les tailles (Les données sont générées uniquement lors de la vérification des erreurs) coser.ui.graph.lengthStructure=Structures en taille
participants (1)
-
echatellier@users.forge.codelutin.com