Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/ModulePanel.java |
---|
14,6 → 14,7 |
package org.openconcerto.erp.modules; |
import org.openconcerto.erp.modules.ModuleManager.ModuleAction; |
import org.openconcerto.erp.modules.ModuleManager.ModuleState; |
import org.openconcerto.erp.modules.ModuleManager.NoChoicePredicate; |
import org.openconcerto.erp.modules.ModuleTableModel.Columns; |
import org.openconcerto.erp.modules.ModuleTableModel.ModuleRow; |
65,12 → 66,12 |
private final ModuleTableModel tm; |
ModulePanel(final ModuleFrame moduleFrame, final boolean onlyInstall) { |
ModulePanel(final ModuleManager mngr, final boolean onlyInstall) { |
this.setOpaque(false); |
this.setLayout(new GridBagLayout()); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
this.tm = new ModuleTableModel(); |
this.tm = new ModuleTableModel(mngr); |
final JTable t = new JTable(this.tm) { |
// only force JTable size above its minimal size (i.e. otherwise use its preferred size |
// and display scroll bars accordingly). Without this, some columns can be invisible |
197,7 → 198,7 |
return; |
} |
final ModuleManager mngr = ModuleManager.getInstance(); |
final ModuleManager mngr = getModuleManager(); |
final boolean forceUninstall = (evt.getModifiers() & ActionEvent.CTRL_MASK) != 0 && mngr.currentUserIsAdmin(); |
try { |
final Set<ModuleReference> ids = new HashSet<ModuleReference>(); |
226,6 → 227,9 |
final JDialog dialog = AvailableModulesPanel.displayDialog(ModulePanel.this, "Calcul des dépendences"); |
new SwingWorker<ModulesStateChange, Object>() { |
protected ModulesStateChange doInBackground() throws Exception { |
// MAYBE find other solutions (e.g. instead of removing all modules |
// depending on ids, find other modules that can fulfill their |
// dependencies) |
return mngr.getUninstallSolution(ids, true, forceUninstall); |
} |
258,7 → 262,7 |
return; |
} |
AvailableModulesPanel.applySolution(mngr, ModulePanel.this, solution, onlyInstall); |
AvailableModulesPanel.applySolution(mngr, ModulePanel.this, solution, ModuleState.NOT_CREATED); |
} catch (Exception e) { |
ExceptionHandler.handle(ModulePanel.this, "Impossible de désinstaller les modules", e); |
} |
289,6 → 293,10 |
this.setTransferHandler(AvailableModulesPanel.createTransferHandler(this)); |
} |
public final ModuleManager getModuleManager() { |
return this.tm.getModuleManager(); |
} |
public final void reload() { |
try { |
this.tm.reload(); |
320,7 → 328,7 |
@Override |
public void actionPerformed(ActionEvent evt) { |
final ModuleManager mngr = ModuleManager.getInstance(); |
final ModuleManager mngr = getModuleManager(); |
final String dialogTitle = this.start ? "Démarrage de modules" : "Arrêt de modules"; |
final Collection<ModuleRow> checkedRows = getSelection(); |
if (checkedRows.isEmpty()) { |