|
From: <bma...@us...> - 2011-06-06 16:32:43
|
Revision: 6274
http://fudaa.svn.sourceforge.net/fudaa/?rev=6274&view=rev
Author: bmarchan
Date: 2011-06-06 16:32:37 +0000 (Mon, 06 Jun 2011)
Log Message:
-----------
Chgt de signature methode : public void CtuluDialogPanel.cancel() => public boolean CtuluDialogPanel.cancel()
Modified Paths:
--------------
trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialog.java
trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialogPanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java
trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exec/FudaaExecManagerPanel.java
trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exetools/FudaaLaunchExeToolAction.java
trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exetools/FudaaOutputPanel.java
trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/impl/FudaaInternalFramePanel.java
trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/impl/FudaaPanelTask.java
Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialog.java
===================================================================
--- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialog.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialog.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -72,6 +72,7 @@
public static final int ZERO_OPTION = -1;
CtuluDialogPanel dial_;
+ private BuPanel pnAction_;
int option_;
@@ -264,62 +265,63 @@
_princ.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
_princ.add(dial_, BuBorderLayout.CENTER);
- BuPanel pnAction = new BuPanel();
- pnAction.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 0));
- pnAction.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- JButton r = null;
- switch (option_) {
- case ZERO_OPTION:
- break;
- case OK_CANCEL_APPLY_OPTION:
- r = construireOk();
- pnAction.add(r);
- pnAction.add(construireApply());
- pnAction.add(construireCancel());
- break;
- case OK_CANCEL_OPTION:
- r = construireOk();
- pnAction.add(r);
- pnAction.add(construireCancel());
- break;
- case OK_OPTION:
- r = construireOk();
- pnAction.add(r);
- break;
- case OK_APPLY_OPTION:
- r = construireOk();
- pnAction.add(construireApply());
- pnAction.add(r);
-
- break;
- case CANCEL_OPTION:
- r = construireCancel();
- pnAction.add(r);
- break;
- case APPLY_CANCEL_OPTION:
- r = construireApply();
- pnAction.add(r);
- pnAction.add(construireCancel());
- break;
- case QUIT_OPTION:
- r = construireQuit();
- pnAction.add(r);
- break;
- default:
- }
+ pnAction_ = new BuPanel();
+ pnAction_.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 0));
+ pnAction_.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+// JButton r = null;
+// switch (option_) {
+// case ZERO_OPTION:
+// break;
+// case OK_CANCEL_APPLY_OPTION:
+// r = construireOk();
+// pnAction_.add(r);
+// pnAction_.add(construireApply());
+// pnAction_.add(construireCancel());
+// break;
+// case OK_CANCEL_OPTION:
+// r = construireOk();
+// pnAction_.add(r);
+// pnAction_.add(construireCancel());
+// break;
+// case OK_OPTION:
+// r = construireOk();
+// pnAction_.add(r);
+// break;
+// case OK_APPLY_OPTION:
+// r = construireOk();
+// pnAction_.add(construireApply());
+// pnAction_.add(r);
+//
+// break;
+// case CANCEL_OPTION:
+// r = construireCancel();
+// pnAction_.add(r);
+// break;
+// case APPLY_CANCEL_OPTION:
+// r = construireApply();
+// pnAction_.add(r);
+// pnAction_.add(construireCancel());
+// break;
+// case QUIT_OPTION:
+// r = construireQuit();
+// pnAction_.add(r);
+// break;
+// default:
+// }
+ JButton r=rebuildButtons();
+
+ BuPanel pnSouth=new BuPanel();
+ pnSouth.setLayout(new BuBorderLayout(0, 0));
+ pnSouth.add(pnAction_, BuBorderLayout.EAST);
+ _princ.add(pnSouth, BuBorderLayout.SOUTH);
+
if (dial_.getHelpText() != null) {
final JButton b = new BuToolButton(BuResource.BU.getToolIcon("aide"));
b.setToolTipText(BuResource.BU.getString("aide"));
b.setActionCommand("HELP");
b.addActionListener(this);
- final BuPanel south = new BuPanel();
- south.setLayout(new BuBorderLayout(0, 0));
- south.add(b, BuBorderLayout.WEST);
- south.add(pnAction, BuBorderLayout.EAST);
- pnAction = south;
+ pnSouth.add(b, BuBorderLayout.WEST);
}
- _princ.add(pnAction, BuBorderLayout.SOUTH);
- _princ.doLayout();
return r;
}
@@ -392,10 +394,11 @@
public void cancel() {
response_ = JOptionPane.CANCEL_OPTION;
- dial_.cancel();
+ if (dial_.cancel()) {
// B.M. L'appel a setVisible(false) empeche de r\xE9afficher le panel au travers d'un autre CtuluDialog.
// dial_.setVisible(false);
- dispose();
+ dispose();
+ }
}
/**
@@ -431,5 +434,57 @@
*/
public void setOption(final int _option) {
option_ = _option;
+ if (pnAction_!=null) {
+ rebuildButtons();
+ }
}
+
+ /**
+ * Reconstruit les boutons en cas de modification des options par exemple.
+ */
+ public JButton rebuildButtons() {
+ pnAction_.removeAll();
+ JButton r = null;
+ switch (option_) {
+ case ZERO_OPTION:
+ break;
+ case OK_CANCEL_APPLY_OPTION:
+ r = construireOk();
+ pnAction_.add(r);
+ pnAction_.add(construireApply());
+ pnAction_.add(construireCancel());
+ break;
+ case OK_CANCEL_OPTION:
+ r = construireOk();
+ pnAction_.add(r);
+ pnAction_.add(construireCancel());
+ break;
+ case OK_OPTION:
+ r = construireOk();
+ pnAction_.add(r);
+ break;
+ case OK_APPLY_OPTION:
+ r = construireOk();
+ pnAction_.add(construireApply());
+ pnAction_.add(r);
+
+ break;
+ case CANCEL_OPTION:
+ r = construireCancel();
+ pnAction_.add(r);
+ break;
+ case APPLY_CANCEL_OPTION:
+ r = construireApply();
+ pnAction_.add(r);
+ pnAction_.add(construireCancel());
+ break;
+ case QUIT_OPTION:
+ r = construireQuit();
+ pnAction_.add(r);
+ break;
+ default:
+ }
+ pnAction_.doLayout();
+ return r;
+ }
}
\ No newline at end of file
Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialogPanel.java
===================================================================
--- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialogPanel.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialogPanel.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -499,7 +499,12 @@
*/
public void apply() {}
- public void cancel() {}
+ /**
+ * @return true : La boite de dialogue peut \xEAtre ferm\xE9e. False : Elle reste ouverte.
+ */
+ public boolean cancel() {
+ return true;
+ }
public void cancelErrorText() {
if (lbError_.isVisible()) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -191,9 +191,9 @@
}
@Override
- public void cancel() {
+ public boolean cancel() {
graphe_.removeModelListener(modelListener);
- super.cancel();
+ return super.cancel();
}
@Override
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -396,13 +396,13 @@
}
@Override
- public void cancel() {
- super.cancel();
+ public boolean cancel() {
// D\xE9active le model
if (modelData_!=null) {
modelData_.setSource(null, -1);
((CtuluCommandComposite)modelData_.getUndoRedoContainer()).undo();
}
+ return super.cancel();
}
public final CtuluCommandContainer getCmd() {
Modified: trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exec/FudaaExecManagerPanel.java
===================================================================
--- trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exec/FudaaExecManagerPanel.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exec/FudaaExecManagerPanel.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -240,7 +240,8 @@
/**
* @see org.fudaa.ctulu.gui.CtuluDialogPanel#cancel()
*/
- public void cancel() {
+ public boolean cancel() {
mng_.getExecMng().reloadFromPref();
+ return true;
}
}
Modified: trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exetools/FudaaLaunchExeToolAction.java
===================================================================
--- trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exetools/FudaaLaunchExeToolAction.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exetools/FudaaLaunchExeToolAction.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -58,7 +58,7 @@
if (params.size()!=0) {
FudaaSetParamPanel pn=new FudaaSetParamPanel(impl_);
pn.setParams(params);
- if (!pn.afficheModaleOk(impl_.getParentComponent(),FudaaLib.getS("Saisissez les param\xE8tres d'ex\xE9cution"))) return;
+ if (!pn.afficheModaleOk(impl_.getParentComponent(),FudaaLib.getS("Param\xE8tres d'ex\xE9cution de {0}",tool_.name))) return;
}
@@ -66,7 +66,7 @@
final CtuluDialog di=pnOut.createDialog(impl_.getParentComponent());
di.setOption(CtuluDialog.CANCEL_OPTION);
di.setDefaultCloseOperation(CtuluDialog.DO_NOTHING_ON_CLOSE);
- di.setTitle(FudaaLib.getS("Progression..."));
+ di.setTitle(FudaaLib.getS("Progression de {0}...",tool_.name));
CtuluTaskOperationAbstract th=new CtuluTaskOperationAbstract("Execution") {
Process proc;
@@ -102,22 +102,10 @@
process.setOutStream(new PrintStream(pnOut.getOutputStream()));
process.setErrStream(new PrintStream(pnOut.getOutputStream()));
process.exec();
-
- if (isStopRequested()) return;
}
finally {
di.setOption(CtuluDialog.OK_OPTION);
- di.dispose();
- di.afficheDialogModal();
}
-
- // Dans le cas ou il y a eu interruption de la part de l'utilisateur, on s'arrete.
- if (isStopRequested()) return;
-
- // Traitement \xE9ventuel des param\xE8tres apr\xE8s lancement.
- for (FudaaExeTool.ParamI param : tool_.getParams()) {
- param.postLaunch(pnOut);
- }
}
public ProgressionInterface getStateReceiver() {
@@ -132,6 +120,7 @@
public void requestStop() {
super.requestStop();
proc.destroy();
+ pnOut.appendDetailln("La tache a \xE9t\xE9 interrompue");
}
@@ -140,5 +129,15 @@
pnOut.setTask(th);
th.start();
di.afficheDialogModal();
+
+ // Dans le cas ou il y a eu interruption de la part de l'utilisateur, on s'arrete.
+ if (th.isStopRequested()) {
+ return;
+ }
+
+ // Traitement \xE9ventuel des param\xE8tres apr\xE8s lancement.
+ for (FudaaExeTool.ParamI param : tool_.getParams()) {
+ param.postLaunch(pnOut);
+ }
}
}
Modified: trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exetools/FudaaOutputPanel.java
===================================================================
--- trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exetools/FudaaOutputPanel.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/exetools/FudaaOutputPanel.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -18,7 +18,6 @@
import java.awt.Dimension;
import java.awt.Font;
import java.io.OutputStream;
-import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.fudaa.ctulu.CtuluTaskOperationAbstract;
@@ -48,8 +47,9 @@
taTrace_=new JTextArea();
taTrace_.setFont(new Font("Courier",Font.PLAIN,taTrace_.getFont().getSize()));
JScrollPane pnTrace=new JScrollPane(taTrace_);
- pnTrace.setPreferredSize(new Dimension(400,200));
+ pnTrace.setPreferredSize(new Dimension(800,400));
add(pnTrace,BorderLayout.CENTER);
+ setHelpText("Utilisez 'Annuler' pour arreter la progression");
outs_=new OutputStream() {
@Override
@@ -64,9 +64,10 @@
}
@Override
- public void cancel() {
+ public boolean cancel() {
if (task_!=null && task_.isAlive())
task_.requestStop();
+ return false;
}
@Override
Modified: trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/impl/FudaaInternalFramePanel.java
===================================================================
--- trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/impl/FudaaInternalFramePanel.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/impl/FudaaInternalFramePanel.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -256,10 +256,6 @@
}
- public void cancel() {
- // System.out.println("on ferme ...");
- }
-
public void valueChanged(final ListSelectionEvent _e) {
if (_e.getValueIsAdjusting()) {
return;
Modified: trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/impl/FudaaPanelTask.java
===================================================================
--- trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/impl/FudaaPanelTask.java 2011-06-06 14:17:54 UTC (rev 6273)
+++ trunk/framework/fudaa-common/src/main/java/org/fudaa/fudaa/commun/impl/FudaaPanelTask.java 2011-06-06 16:32:37 UTC (rev 6274)
@@ -89,8 +89,9 @@
}
@Override
- public void cancel() {
+ public boolean cancel() {
cancelPanel();
+ return true;
}
};
panel_.setLayout(new BuVerticalLayout(2, true, true));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|