|
From: <de...@us...> - 2012-07-20 09:50:34
|
Revision: 7522
http://fudaa.svn.sourceforge.net/fudaa/?rev=7522&view=rev
Author: deniger
Date: 2012-07-20 09:50:24 +0000 (Fri, 20 Jul 2012)
Log Message:
-----------
ajout m?\195?\169thode utilitaires
Modified Paths:
--------------
trunk/soft/fudaa-crue/ui-branding/src/main/resources/org/fudaa/fudaa/crue/branding/loi-dcspEditorWsmode.xml
trunk/soft/fudaa-crue/ui-branding/src/main/resources/org/fudaa/fudaa/crue/branding/loi-dlhyEditorWsmode.xml
trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/LoiCourbeModel.java
trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/LoiUiController.java
trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/DLHYTopComponent.java
trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/DcspEditorLoiTopComponent.java
Modified: trunk/soft/fudaa-crue/ui-branding/src/main/resources/org/fudaa/fudaa/crue/branding/loi-dcspEditorWsmode.xml
===================================================================
--- trunk/soft/fudaa-crue/ui-branding/src/main/resources/org/fudaa/fudaa/crue/branding/loi-dcspEditorWsmode.xml 2012-07-20 08:15:40 UTC (rev 7521)
+++ trunk/soft/fudaa-crue/ui-branding/src/main/resources/org/fudaa/fudaa/crue/branding/loi-dcspEditorWsmode.xml 2012-07-20 09:50:24 UTC (rev 7522)
@@ -3,7 +3,7 @@
<name unique="loi-dcspEditor"/>
<kind type="view"/>
<state type="separated"/>
- <bounds x="250" y="50" width="650" height="850" />
+ <bounds x="250" y="50" width="850" height="850" />
<frame state="0"/>
<empty-behavior permanent="false"/>
</mode>
Modified: trunk/soft/fudaa-crue/ui-branding/src/main/resources/org/fudaa/fudaa/crue/branding/loi-dlhyEditorWsmode.xml
===================================================================
--- trunk/soft/fudaa-crue/ui-branding/src/main/resources/org/fudaa/fudaa/crue/branding/loi-dlhyEditorWsmode.xml 2012-07-20 08:15:40 UTC (rev 7521)
+++ trunk/soft/fudaa-crue/ui-branding/src/main/resources/org/fudaa/fudaa/crue/branding/loi-dlhyEditorWsmode.xml 2012-07-20 09:50:24 UTC (rev 7522)
@@ -3,7 +3,7 @@
<name unique="loi-dlhyEditor"/>
<kind type="view"/>
<state type="separated"/>
- <bounds x="250" y="50" width="650" height="850" />
+ <bounds x="250" y="50" width="850" height="850" />
<frame state="0"/>
<empty-behavior permanent="false"/>
</mode>
Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/LoiCourbeModel.java
===================================================================
--- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/LoiCourbeModel.java 2012-07-20 08:15:40 UTC (rev 7521)
+++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/LoiCourbeModel.java 2012-07-20 09:50:24 UTC (rev 7522)
@@ -212,7 +212,7 @@
}
if (!xrangeComputed) {
xMax = getX(0);
- xMin = yMax;
+ xMin = xMax;
for (int i = getNbValues() - 1; i > 0; i--) {
final double d = getX(i);
if (d > xMax) {
Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/LoiUiController.java
===================================================================
--- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/LoiUiController.java 2012-07-20 08:15:40 UTC (rev 7521)
+++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/LoiUiController.java 2012-07-20 09:50:24 UTC (rev 7522)
@@ -1,6 +1,7 @@
package org.fudaa.fudaa.crue.loi;
import java.awt.Color;
+import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.Observable;
import java.util.Observer;
@@ -41,6 +42,14 @@
return infoController;
}
+ protected void configureTablePanel() {
+ tableGraphePanel.getTable().setModel(new LoiTableModel(tableGraphePanel));
+ tableGraphePanel.getTable().getColumnModel().getColumn(1).setPreferredWidth(120);
+ tableGraphePanel.getTable().getColumnModel().getColumn(2).setPreferredWidth(120);
+ tableGraphePanel.getTable().setPreferredSize(new Dimension(400, 600));
+ tableGraphePanel.setPreferredSize(new Dimension(300, 600));
+ }
+
EGGrapheSimpleModel getEGGrapheSimpleModel() {
return (EGGrapheSimpleModel) getGraphe().getModel();
}
@@ -69,7 +78,7 @@
panel = new EGFillePanel(graphe);
grapheModel.setSelectedComponent(courbe);
tableGraphePanel = new EGTableGraphePanel(true);
- tableGraphePanel.getTable().setModel(new LoiTableModel(tableGraphePanel));
+ configureTablePanel();
panel.majSelectionListener(tableGraphePanel);
tableGraphePanel.setGraphe(graphe);
@@ -130,6 +139,7 @@
@Override
public void update(Observable o, Object arg) {
tableGraphePanel.courbeContentChanged(courbe, false);
+ getGraphe().setXRangeIsModified();
getGraphe().fullRepaint();
}
});
Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/DLHYTopComponent.java
===================================================================
--- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/DLHYTopComponent.java 2012-07-20 08:15:40 UTC (rev 7521)
+++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/DLHYTopComponent.java 2012-07-20 09:50:24 UTC (rev 7522)
@@ -7,6 +7,7 @@
import com.memoire.bu.BuGridLayout;
import com.memoire.bu.BuResource;
import java.awt.BorderLayout;
+import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
@@ -49,38 +50,41 @@
@TopComponent.Description(preferredID = DLHYTopComponent.TOPCOMPONENT_ID, persistenceType = TopComponent.PERSISTENCE_ALWAYS)
@TopComponent.Registration(mode = DLHYTopComponent.MODE, openAtStartup = false)
public final class DLHYTopComponent extends AbstractModellingTopComponent implements ItemListener {
-
+
public static final String MODE = "loi-dlhyEditor"; //NOI18N
public static final String TOPCOMPONENT_ID = "DLHYTopComponent"; //NOI18N
LoiUiController loiUiController;
JTextField txtCommentaire;
JTextField txtNom;
JLabel lbNomValidation;
-
+
public DLHYTopComponent() {
initComponents();
setName(NbBundle.getMessage(DLHYTopComponent.class, "CTL_" + TOPCOMPONENT_ID));
setToolTipText(NbBundle.getMessage(DLHYTopComponent.class, "HINT_" + TOPCOMPONENT_ID));
loiUiController = new LoiUiController();
- add(loiUiController.getPanel());
add(loiUiController.getToolbar(), BorderLayout.NORTH);
- add(loiUiController.getTableGraphePanel(), BorderLayout.EAST);
-
+ loiUiController.getPanel().setPreferredSize(new Dimension(550, 350));
+ JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, loiUiController.getPanel(), loiUiController.getTableGraphePanel());
+ splitPane.setDividerLocation(550);
+ splitPane.setContinuousLayout(true);
+ add(splitPane);
+
JPanel nomComment = new JPanel(new BuGridLayout(3, 10, 10));
nomComment.add(new JLabel(NbBundle.getMessage(DLHYTopComponent.class, "Nom.DisplayName")));
final DocumentListener documentListener = super.createDocumentListener();
DocumentListener nameChanged = new DocumentListener() {
-
+
@Override
public void insertUpdate(DocumentEvent e) {
titleChanged();
}
-
+
@Override
public void removeUpdate(DocumentEvent e) {
titleChanged();
}
-
+
@Override
public void changedUpdate(DocumentEvent e) {
titleChanged();
@@ -123,11 +127,11 @@
Action delete;
Action duplicate;
Action create;
-
+
protected EMHScenario getScenario() {
return modellingScenarioModificationService.getModellingScenarioService().getScenarioLoaded();
}
-
+
protected void titleChanged() {
lbNomValidation.setText(StringUtils.EMPTY);
lbNomValidation.setIcon(null);
@@ -143,34 +147,34 @@
lbNomValidation.setIcon(LogIconTranslationProvider.getIcon(CtuluLogLevel.SEVERE));
}
}
-
+
protected String validateNom() {
String nom = txtNom.getText();
String error = ValidationPatternHelper.isNameValidei18nMessage(nom, currentLoi.getType());
return error;
}
-
+
private void createActions() {
delete = new EbliActionSimple(NbBundle.getMessage(DLHYTopComponent.class, "Delete.DisplayName"), BuResource.BU.getIcon("enlever"), "DELETE") {
-
+
@Override
public void actionPerformed(ActionEvent _e) {
delete();
}
};
delete.putValue(Action.SHORT_DESCRIPTION, NbBundle.getMessage(DLHYTopComponent.class, "Delete.Description"));
-
+
duplicate = new EbliActionSimple(NbBundle.getMessage(DLHYTopComponent.class, "Duplicate.DisplayName"), BuResource.BU.getIcon("dupliquer"), "DUPLICATE") {
-
+
@Override
public void actionPerformed(ActionEvent _e) {
duplicate();
}
};
duplicate.putValue(Action.SHORT_DESCRIPTION, NbBundle.getMessage(DLHYTopComponent.class, "Duplicate.Description"));
-
+
create = new EbliActionSimple(NbBundle.getMessage(DLHYTopComponent.class, "Create.DisplayName"), BuResource.BU.getIcon("creer"), "CREATE") {
-
+
@Override
public void actionPerformed(ActionEvent _e) {
create();
@@ -178,7 +182,7 @@
};
create.putValue(Action.SHORT_DESCRIPTION, NbBundle.getMessage(DLHYTopComponent.class, "Create.Description"));
}
-
+
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
@@ -186,7 +190,7 @@
updateWithLoi();
}
}
-
+
@Override
public void setEditable(boolean b) {
editable = b;
@@ -197,12 +201,17 @@
duplicate.setEnabled(b);
create.setEnabled(b);
}
-
+
@Override
public void cancelModification() {
+ if (isNewLoi) {
+ isNewLoi = false;
+ currentLoi = (Loi) cbLois.getSelectedItem();
+ }
scenarioReloaded();
+ setModified(false);
}
-
+
@Override
protected void scenarioLoaded() {
Loi oldLoi = getCurrentLoi();
@@ -217,9 +226,9 @@
cbLois.setSelectedIndex(idx);
}
isNewLoi = false;
-
+
}
-
+
protected void updateWithLoi() {
Loi loi = getCurrentLoi();
txtCommentaire.setText(StringUtils.EMPTY);
@@ -232,7 +241,7 @@
}
loiUiController.setLoi(loi, getCcm());
loiUiController.getLoiModel().addObserver(new Observer() {
-
+
@Override
public void update(Observable o, Object arg) {
setModified(true);
@@ -241,12 +250,12 @@
loiUiController.setEditable(editable);
setModified(false);
}
-
+
@Override
protected void scenarioReloaded() {
scenarioLoaded();
}
-
+
@Override
protected void scenarioUnloaded() {
loiUiController.setLoi(null, null);
@@ -254,10 +263,10 @@
JComboBox cbLois;
Loi currentLoi;
boolean isNewLoi;
-
+
Loi getCurrentLoi() {
return currentLoi;
-
+
}
// protected boolean canModify(String action) {
@@ -287,7 +296,7 @@
cbLois.setEnabled(!modified);
}
boolean editable;
-
+
void delete() {
boolean used = currentLoi.getUsed();
if (used) {
@@ -304,13 +313,13 @@
DonLoiHYConteneur loiConteneur = getScenario().getLoiConteneur();
if (!isNewLoi) {
//TODO faire la recherche dans la boite
- int idx = Math.max(0, loiConteneur.getLois().indexOf(currentLoi) - 1);
+ DefaultComboBoxModel model = (DefaultComboBoxModel) cbLois.getModel();
+ int idx = Math.max(0, model.getIndexOf(model) - 1);
loiConteneur.removeLois(currentLoi);
currentLoi = null;
if (idx < loiConteneur.getLois().size()) {
currentLoi = loiConteneur.getLois().get(idx);
}
-
modellingScenarioModificationService.setScenarioModified(new ScenarioModificationEvent(EnumModification.DLHY));
} else {
//on sélectionne la loi disponible dans la combobox.
@@ -321,11 +330,12 @@
setModified(false);
}
}
-
+
void create() {
List<EnumTypeLoi> loisType = new ArrayList<EnumTypeLoi>(getCcm().getConfLoi().keySet());
loisType.remove(EnumTypeLoi.LoiZFK);
loisType.remove(EnumTypeLoi.LoiZFN);
+ loisType.remove(EnumTypeLoi.LoiPtProfil);
Collections.sort(loisType, ObjetNommeByIdComparator.INSTANCE);
JComboBox cb = new JComboBox(loisType.toArray(new EnumTypeLoi[loisType.size()]));
cb.setRenderer(new ObjetWithIdCellRenderer());
@@ -333,7 +343,7 @@
JPanel pn = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
pn.add(new JLabel(NbBundle.getMessage(DLHYTopComponent.class, "CreateLoi.TypeLabel")));
pn.add(cb);
- if (DialogHelper.showQuestion((String) create.getValue(Action.NAME), pn) && cb.getSelectedItem() != null) {
+ if (DialogHelper.showQuestionOkCancel((String) create.getValue(Action.NAME), pn) && cb.getSelectedItem() != null) {
EnumTypeLoi typeLoi = (EnumTypeLoi) cb.getSelectedItem();
isNewLoi = true;
currentLoi = LoiFactory.createLoi(typeLoi, getCcm());
@@ -342,7 +352,7 @@
setModified(true);
}
}
-
+
void duplicate() {
if (currentLoi == null) {
return;
@@ -353,7 +363,7 @@
updateWithLoi();
setModified(true);
}
-
+
@Override
public void valideModification() {
if (currentLoi == null) {
@@ -391,12 +401,12 @@
if (valideLoi.isNotEmpty()) {
LogsDisplayer.displayError(valideLoi, getName());
}
-
+
}
/**
- * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
+ * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
+ * content of this method is always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@@ -412,12 +422,12 @@
// p.setProperty("version", "1.0");
// TODO store your settings
}
-
+
void readProperties(java.util.Properties p) {
// String version = p.getProperty("version");
// TODO read your settings according to their version
}
-
+
void selectLoi(Loi loiToActivate) {
if (isModified()) {
return;
Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/DcspEditorLoiTopComponent.java
===================================================================
--- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/DcspEditorLoiTopComponent.java 2012-07-20 08:15:40 UTC (rev 7521)
+++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/DcspEditorLoiTopComponent.java 2012-07-20 09:50:24 UTC (rev 7522)
@@ -11,6 +11,7 @@
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.JSplitPane;
import javax.swing.JTextField;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
@@ -47,9 +48,11 @@
setName(NbBundle.getMessage(DcspEditorLoiTopComponent.class, "CTL_" + TOPCOMPONENT_ID));
setToolTipText(NbBundle.getMessage(DcspEditorLoiTopComponent.class, "HINT_" + TOPCOMPONENT_ID));
loiUiController = new LoiUiController();
- add(loiUiController.getPanel());
add(loiUiController.getToolbar(), BorderLayout.NORTH);
- add(loiUiController.getTableGraphePanel(), BorderLayout.EAST);
+ JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, loiUiController.getPanel(), loiUiController.getTableGraphePanel());
+ splitPane.setDividerLocation(550);
+ splitPane.setContinuousLayout(true);
+ add(splitPane);
JPanel nomComment = new JPanel(new BuGridLayout(2, 10, 10));
nomComment.add(new JLabel(NbBundle.getMessage(DcspEditorLoiTopComponent.class, "Description.DisplayName")));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|