|
From: <bma...@us...> - 2015-01-27 15:43:22
|
Revision: 8999
http://sourceforge.net/p/fudaa/svn/8999
Author: bmarchan
Date: 2015-01-27 15:43:20 +0000 (Tue, 27 Jan 2015)
Log Message:
-----------
Ajout de la m?\195?\169thode CtuluListEditorPanel.setAllEnabled()
Modified Paths:
--------------
trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluListEditorPanel.java
Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluListEditorPanel.java
===================================================================
--- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluListEditorPanel.java 2015-01-27 15:38:02 UTC (rev 8998)
+++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluListEditorPanel.java 2015-01-27 15:43:20 UTC (rev 8999)
@@ -48,6 +48,8 @@
protected JButton btCopy_;
boolean doubleClickEdit_;
+ /** Pour rendre le panneau enable ou non */
+ private boolean allEnabled_=true;
public CtuluListEditorPanel(final CtuluListEditorModel _m) {
this(_m, true, true, true, true, true);
@@ -449,6 +451,15 @@
popupMenu(_evt);
}
}
+
+ /**
+ * Rend actif ou inactif tous les sous composants.
+ * @param _b True : Le composant est actif.
+ */
+ public void setAllEnabled(boolean _b) {
+ allEnabled_=_b;
+ updateActionsState();
+ }
void popupMenu(final MouseEvent _evt) {
buildPopupMenu().show((JComponent) _evt.getSource(), _evt.getX(), _evt.getY());
@@ -456,28 +467,30 @@
protected void updateActionsState() {
if (btAjouter_ != null) {
- btAjouter_.setEnabled(model_.canAdd());
+ btAjouter_.setEnabled(model_.canAdd() && allEnabled_);
}
if (btInserer_ != null) {
- btInserer_.setEnabled((model_.canAdd()) && (table_.getSelectedRowCount() == 1));
+ btInserer_.setEnabled((model_.canAdd()) && (table_.getSelectedRowCount() == 1) && allEnabled_);
}
if (btSupprimer_ != null) {
- btSupprimer_.setEnabled((model_.canRemove()) && (table_.getSelectedRowCount() != 0));
+ btSupprimer_.setEnabled((model_.canRemove()) && (table_.getSelectedRowCount() != 0) && allEnabled_);
}
if (btModifier_ != null) {
- btModifier_.setEnabled(table_.getSelectedRowCount() == 1);
+ btModifier_.setEnabled(table_.getSelectedRowCount() == 1 && allEnabled_);
}
if (btCopy_ != null) {
- btCopy_.setEnabled(table_.getSelectedRowCount() == 1);
+ btCopy_.setEnabled(table_.getSelectedRowCount() == 1 && allEnabled_);
}
if (btMonter_ != null) {
final boolean isOnlyOne = table_.getRowCount() > 1 && table_.getSelectedRowCount() >= 1
- && table_.getSelectedRow() >= 0;
- btMonter_.setEnabled(isOnlyOne && table_.getSelectionModel().getMinSelectionIndex() > 0);
+ && table_.getSelectedRow() >= 0 && allEnabled_;
+ btMonter_.setEnabled(isOnlyOne && table_.getSelectionModel().getMinSelectionIndex() > 0 && allEnabled_);
btDescendre_
- .setEnabled(isOnlyOne && table_.getSelectionModel().getMaxSelectionIndex() < table_.getRowCount() - 1);
+ .setEnabled(isOnlyOne && table_.getSelectionModel().getMaxSelectionIndex() < table_.getRowCount() - 1 && allEnabled_);
}
+
+ table_.setEnabled(allEnabled_);
}
public void setDoubleClickEdit(final boolean _b) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bma...@us...> - 2017-01-09 19:45:49
|
Revision: 9503
http://sourceforge.net/p/fudaa/svn/9503
Author: bmarchan
Date: 2017-01-09 19:45:47 +0000 (Mon, 09 Jan 2017)
Log Message:
-----------
Custom panneau de liste
Modified Paths:
--------------
trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluListEditorPanel.java
Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluListEditorPanel.java
===================================================================
--- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluListEditorPanel.java 2017-01-09 19:45:02 UTC (rev 9502)
+++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluListEditorPanel.java 2017-01-09 19:45:47 UTC (rev 9503)
@@ -122,43 +122,43 @@
buildMonterButton();
}
if (action) {
- final BuPanel pnBt = new BuPanel();
- pnBt.setName("pnBt");
- pnBt.setLayout(new BuVerticalLayout(5, true, false));
+ pnBt_=new BuPanel();
+ pnBt_.setName("pnBt");
+ pnBt_.setLayout(new BuVerticalLayout(5, true, false));
boolean sep = false;
if (btAjouter_ != null) {
sep = true;
- addBtAdd(pnBt);
+ addBtAdd(pnBt_);
}
if (btInserer_ != null) {
sep = true;
- pnBt.add(btInserer_);
+ pnBt_.add(btInserer_);
}
if (btSupprimer_ != null) {
sep = true;
- pnBt.add(btSupprimer_);
+ pnBt_.add(btSupprimer_);
}
if (btCopy_ != null) {
sep = true;
- pnBt.add(btCopy_);
+ pnBt_.add(btCopy_);
}
if (btMonter_ != null) {
sep = true;
- pnBt.add(btMonter_);
+ pnBt_.add(btMonter_);
}
if (btDescendre_ != null) {
sep = true;
- pnBt.add(btDescendre_);
+ pnBt_.add(btDescendre_);
}
if (btModifier_ != null) {
if (sep) {
- pnBt.add(new BuSeparator());
+ pnBt_.add(new BuSeparator());
}
- pnBt.add(btModifier_);
+ pnBt_.add(btModifier_);
}
table_.addMouseListener(this);
updateActionsState();
- add(pnBt, BuBorderLayout.EAST);
+ add(pnBt_, BuBorderLayout.EAST);
}
}
@@ -167,6 +167,14 @@
_pn.add(btAjouter_);
}
}
+
+ /**
+ * Pour ajouter un bouton au panneau liste.
+ * @param _bt Le bouton.
+ */
+ public void addButton(AbstractButton _bt) {
+ pnBt_.add(_bt);
+ }
public void initCellRendererEditor() {
final TableColumnModel colModel = table_.getColumnModel();
@@ -271,6 +279,8 @@
JButton btDescendre_;
+ protected BuPanel pnBt_;
+
protected void buildMonterButton() {
btMonter_ = buildButton(CtuluResource.CTULU.getIcon("monter"), CtuluLib.getS("Monter"), "MONTER", CtuluLib
.getS("Monter l'objet s\xE9lecionn\xE9"), 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|