r618 - in trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing: . actions content content/demande
Author: kmorin Date: 2014-09-10 15:30:37 +0200 (Wed, 10 Sep 2014) New Revision: 618 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/618 Log: fixes #5772 Impossible de selectionner un noeud de l'arbre Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-09-10 10:04:17 UTC (rev 617) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-09-10 13:30:37 UTC (rev 618) @@ -111,7 +111,7 @@ public static final String PROPERTY_HIDE_BODY = "hideBody"; - private static final String PROPERTY_ACTION_IN_PROGRESS = "actionInProgress"; + public static final String PROPERTY_ACTION_IN_PROGRESS = "actionInProgress"; /** * Application context (only one for all the application). Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java 2014-09-10 10:04:17 UTC (rev 617) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java 2014-09-10 13:30:37 UTC (rev 618) @@ -74,8 +74,6 @@ public boolean prepareAction() throws Exception { boolean result = super.prepareAction(); - setTopBarButtonEnabled(false); - result &= skipCheckCurrentScreen || getHandler().quitCurrentScreen(); return result; } @@ -102,17 +100,4 @@ context.setScreen(screen); } - @Override - public void releaseAction() { - super.releaseAction(); - setTopBarButtonEnabled(true); - } - - protected void setTopBarButtonEnabled(boolean enabled) { - MainUI ui = getUI(); - ui.getSearchButton().setEnabled(enabled); - ui.getDemandListButton().setEnabled(enabled); - ui.getExitButton().setEnabled(enabled); - } - } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-09-10 10:04:17 UTC (rev 617) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-09-10 13:30:37 UTC (rev 618) @@ -159,6 +159,17 @@ // SwingUtil.getLayer(ui.getBody()).setUI(new BetaLayerUI()); + getContext().addPropertyChangeListener(FaxToMailUIContext.PROPERTY_ACTION_IN_PROGRESS, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + boolean inProgress = (boolean) evt.getNewValue(); + MainUI ui = getUI(); + ui.getSearchButton().setEnabled(!inProgress); + ui.getDemandListButton().setEnabled(!inProgress); + ui.getExitButton().setEnabled(!inProgress); + } + }); + changeTitle(); JToolBar bar = ui.getBottomBar(); Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-09-10 10:04:17 UTC (rev 617) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-09-10 13:30:37 UTC (rev 618) @@ -56,6 +56,7 @@ import com.franciaflex.faxtomail.persistence.entities.Configuration; import com.franciaflex.faxtomail.persistence.entities.MailAction; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; import com.franciaflex.faxtomail.ui.swing.actions.OpenMailFolderChooserFromListAction; import jaxx.runtime.JAXXUtil; import jaxx.runtime.validator.swing.SwingValidator; @@ -268,12 +269,19 @@ final Map<MailFolder, FolderTreeNode> nodesByFolder = FaxToMailUIUtil.initFolderTree(getContext(), navigationTree, model.getFolders(), true); + getContext().addPropertyChangeListener(FaxToMailUIContext.PROPERTY_ACTION_IN_PROGRESS, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + boolean inProgress = (boolean) evt.getNewValue(); + navigationTree.setEnabled(!inProgress); + } + }); + navigationTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent(); if (folderNode.isCanSelect()) { - navigationTree.setEnabled(false); MailFolder folder = folderNode.getMailFolder(); getModel().setSelectedFolder(folder); @@ -294,31 +302,8 @@ model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_SELECTED_FOLDER, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - - // a new transaction has been opened by getContext().createNewTransaction(); - // 10 line upper - - // reset pagination when folder change - getModel().resetPaginationParameter(); - MailFolder folder = (MailFolder) evt.getNewValue(); - - FolderTreeNode folderNode = nodesByFolder.get(folder); - boolean readable = folderNode.isCanRead(); - - while (folder.getAllowCreateDemandIntoFolder() == null - && folder.getParent() != null) { - folder = folder.getParent(); - } - - DemandeListUIModel model = getModel(); - model.setComputeQuantitiesByRangeEnabled(readable); - model.setNewDemandEnabled(readable && folder != null && Boolean.TRUE.equals(folder.getAllowCreateDemandIntoFolder())); - - LoadFolderEmailsAction loadFolderEmailsAction = - getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this, - LoadFolderEmailsAction.class); - getContext().getActionEngine().runAction(loadFolderEmailsAction); + loadFolderDemands(folder, nodesByFolder); } }); @@ -348,6 +333,37 @@ } } + protected void loadFolderDemands(MailFolder folder, Map<MailFolder, FolderTreeNode> nodesByFolder) { + // a new transaction has been opened by getContext().createNewTransaction(); + // 10 line upper + + // reset pagination when folder change + getModel().resetPaginationParameter(); + + FolderTreeNode folderNode = nodesByFolder.get(folder); + boolean readable = folderNode.isCanRead(); + + while (folder.getAllowCreateDemandIntoFolder() == null + && folder.getParent() != null) { + folder = folder.getParent(); + } + + DemandeListUIModel model = getModel(); + model.setComputeQuantitiesByRangeEnabled(readable); + model.setNewDemandEnabled(readable && folder != null && Boolean.TRUE.equals(folder.getAllowCreateDemandIntoFolder())); + + FaxToMailUIContext context = getContext(); + LoadFolderEmailsAction loadFolderEmailsAction = + context.getActionFactory().createLogicAction(this, + LoadFolderEmailsAction.class); + + if (context.isActionInProgress(null)) { + context.getActionEngine().runInternalAction(loadFolderEmailsAction); + } else { + context.getActionEngine().runAction(loadFolderEmailsAction); + } + } + public void goToNextPage() { getModel().setPaginationParameter(getModel().getPaginationResult().getNextPage()); runListAction();
participants (1)
-
kmorin@users.forge.codelutin.com