Author: kmorin Date: 2014-06-26 22:36:55 +0200 (Thu, 26 Jun 2014) New Revision: 272 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/272 Log: - cloture propre de l'appli swing - prise en compte des dossiers affect?\195?\169s ?\195?\160 l'utilisateur Removed: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx 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 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java 2014-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java 2014-06-26 20:36:55 UTC (rev 272) @@ -1,63 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Franciaflex - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.RunFaxToMail; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; - -import static org.nuiton.i18n.I18n.t; - -/** - * To close FaxToMail Application. - * - * @author tchemit <chemit@codelutin.com> - * @since 1.1 - */ -public class CloseApplicationAction extends AbstractChangeScreenAction { - - protected int exitCode = RunFaxToMail.NORMAL_EXIT_CODE; - - public CloseApplicationAction(MainUIHandler handler) { - super(handler, false, null); - setSkipCheckCurrentScreen(true); - setActionDescription(t("faxtomail.action.exit.tip")); - } - - public void setExitCode(int exitCode) { - this.exitCode = exitCode; - } - - @Override - public void doAction() throws Exception { - - super.doAction(); - - RunFaxToMail.closeFaxToMail(getHandler(), exitCode); - } - - @Override - public void releaseAction() { - exitCode = RunFaxToMail.NORMAL_EXIT_CODE; - super.releaseAction(); - } -} Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css 2014-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css 2014-06-26 20:36:55 UTC (rev 272) @@ -29,8 +29,7 @@ #mainFrame { title: "faxtomail.main.title.applicationName"; - defaultCloseOperation: {JFrame.EXIT_ON_CLOSE}; - //iconImage:{SwingUtil.createImageIcon("allegro_32.png").getImage()}; + defaultCloseOperation: {JFrame.DO_NOTHING_ON_CLOSE}; } #menuFile { @@ -59,7 +58,6 @@ actionIcon: exit; text: "faxtomail.main.action.exit"; toolTipText: "faxtomail.main.action.exit.tip"; - _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.CloseApplicationAction.class}; _help: {"faxtomail.main.menu.action.exit.help"}; } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx 2014-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx 2014-06-26 20:36:55 UTC (rev 272) @@ -52,7 +52,7 @@ <JMenuItem id='menuFileRecherche'/> <JMenuItem id='menuFileConfiguration'/> <JSeparator/> - <JMenuItem id='menuFileExit'/> + <JMenuItem id='menuFileExit' onActionPerformed="this.dispose()"/> </JMenu> <!--<JMenu id='menuHelp'>--> 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-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-06-26 20:36:55 UTC (rev 272) @@ -46,6 +46,8 @@ import javax.swing.*; import java.awt.Cursor; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListenerProxy; @@ -131,6 +133,15 @@ initUI(ui); + getUI().addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + if (quitCurrentScreen()) { + RunFaxToMail.closeFaxToMail(MainUIHandler.this, RunFaxToMail.NORMAL_EXIT_CODE); + } + } + }); + // installation layer de blocage en mode busy // SwingUtil.setLayerUI(ui.getBody(), ui.getBusyBlockLayerUI()); // 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-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-26 20:36:55 UTC (rev 272) @@ -249,7 +249,7 @@ // init tree Map<MailFolder, DefaultMutableTreeNode> nodesByFolder = - FaxToMailUIUtil.initFolderTree(getContext(), ui.getNavigationTree(), model.getFolders()); + FaxToMailUIUtil.initFolderTree(getContext(), ui.getNavigationTree(), model.getFolders(), true); ui.getNavigationTree().addTreeSelectionListener(new TreeSelectionListener() { @Override Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-06-26 20:36:55 UTC (rev 272) @@ -74,7 +74,7 @@ JTree navigationTree = ui.getNavigationTree(); Map<MailFolder, DefaultMutableTreeNode> nodesByFolder = - FaxToMailUIUtil.initFolderTree(getContext(), navigationTree, folders); + FaxToMailUIUtil.initFolderTree(getContext(), navigationTree, folders, false); MailFolder currentFolder = getModel().getMailFolder(); for (MailFolder folder : nodesByFolder.keySet()) { Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-26 20:36:55 UTC (rev 272) @@ -62,6 +62,8 @@ import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXUtil; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.Predicate; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -101,9 +103,10 @@ setApplicationContext(ui, parentUI.getHandler().getContext()); } - public static Map<MailFolder, DefaultMutableTreeNode> initFolderTree(FaxToMailUIContext context, + public static Map<MailFolder, DefaultMutableTreeNode> initFolderTree(final FaxToMailUIContext context, JTree navigationTree, - Collection<MailFolder> folders) { + Collection<MailFolder> folders, + final boolean colorNotAffectedFolders) { DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); List<MailFolder> foldersToExpand = context.getExpandedFolders(); @@ -118,7 +121,8 @@ FolderTreeNode parentNode = (FolderTreeNode) nodesByFolder.get(parent); if (parentNode == null) { parentNode = new FolderTreeNode(parent); - parentNode.setCanSelect(false); + parentNode.setCanRead(false); + parentNode.setCanSelect(true); nodesByFolder.put(parent, parentNode); } @@ -142,6 +146,23 @@ FolderTreeNode node = (FolderTreeNode) value; setEnabled(node.isCanSelect()); + Font font = component.getFont(); + if (node.isCanRead()) { + font = font.deriveFont(Font.PLAIN); + } else { + font = font.deriveFont(Font.ITALIC); + } + component.setFont(font); + + Color foreground; + if (!colorNotAffectedFolders + || context.getCurrentUser().containsAffectedFolders(node.getMailFolder())) { + foreground = Color.BLACK; + } else { + foreground = Color.LIGHT_GRAY; + } + component.setForeground(foreground); + return component; } }; @@ -170,11 +191,18 @@ FolderTreeNode node = new FolderTreeNode(folder); node.setCanSelect(true); + node.setCanRead(true); result.put(folder, node); parent.add(node); if (folder.isChildrenNotEmpty()) { List<MailFolder> children = new ArrayList<MailFolder>(folder.getChildren()); + CollectionUtils.filter(children, new Predicate<MailFolder>() { + @Override + public boolean evaluate(MailFolder object) { + return !object.isArchiveFolder(); + } + }); Collections.sort(children, new Comparator<MailFolder>() { @Override public int compare(MailFolder o1, MailFolder o2) { Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java 2014-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java 2014-06-26 20:36:55 UTC (rev 272) @@ -33,6 +33,7 @@ public class FolderTreeNode extends DefaultMutableTreeNode { protected boolean canSelect; + protected boolean canRead; public FolderTreeNode(MailFolder folder) { super(folder); @@ -50,6 +51,14 @@ this.canSelect = canSelect; } + public boolean isCanRead() { + return canRead; + } + + public void setCanRead(boolean canRead) { + this.canRead = canRead; + } + @Override public String toString() { MailFolder folder = (MailFolder) userObject; Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-26 18:53:55 UTC (rev 271) +++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-26 20:36:55 UTC (rev 272) @@ -888,7 +888,7 @@ <tr> <th>Filtre</th> <th>Dossier</th> - <th>Priorité au chargé de clientelle</th> + <th>Priorité au dossier de la règle</th> <th/> </tr> </thead> @@ -896,7 +896,7 @@ <tr ng-repeat="mailFilter in rootFolderMailFilters[mailFolder.topiaId]"> <td>{{mailFilter.expression}}</td> <td>{{mailFilter.mailFolder.$fullPath}}</td> - <td>{{mailFilter.clientResponsiblePriority ? 'Oui' : 'Non'}}</td> + <td>{{mailFilter.clientResponsiblePriority ? 'Non' : 'Oui'}}</td> <td><a class="btn btn-danger btn-xs" ng-click="removeFilter(mailFolder, mailFilter)"> <span class="glyphicon glyphicon-remove"></span> </a></td> @@ -914,14 +914,14 @@ <select class="form-control" ng-model="newFilter.mailFolder" ng-options="mailFolder.$fullPath for mailFolder in flatMailFolders[mailFolder.topiaId]"></select> </div> <div class="form-group"> - <label for="clientResponsiblePriorityField">Utiliser le chargé de clientelle en priorité : </label> + <label for="clientResponsiblePriorityField">Utiliser le dossier de la règle en priorité : </label> <label class="radio-inline"> <input type="radio" - ng-model="newFilter.clientResponsiblePriority" ng-value="true"> oui + ng-model="newFilter.clientResponsiblePriority" ng-value="false"> oui </label> <label class="radio-inline"> <input type="radio" - ng-model="newFilter.clientResponsiblePriority" ng-value="false"> non + ng-model="newFilter.clientResponsiblePriority" ng-value="true"> non </label> </div> </div>