Author: kmorin Date: 2014-07-18 12:22:20 +0200 (Fri, 18 Jul 2014) New Revision: 424 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/424 Log: affichage du message de l'utilisateur qui n'a aucun droit seulement au d?\195?\169marrage Removed: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/StartAction.java Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.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/RunFaxToMail.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java 2014-07-18 10:17:20 UTC (rev 423) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java 2014-07-18 10:22:20 UTC (rev 424) @@ -25,7 +25,6 @@ import com.franciaflex.faxtomail.FaxToMailConfiguration; import com.franciaflex.faxtomail.ui.swing.content.MainUI; import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; -import com.franciaflex.faxtomail.ui.swing.actions.StartAction; import com.franciaflex.faxtomail.ui.swing.util.FaxToMailExceptionHandler; import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; @@ -120,11 +119,6 @@ mainUI.setVisible(true); } }); - - // launch start action (use the tutti-start-action file) - StartAction uiAction = context.getActionFactory().createLogicAction( - mainUI.getHandler(), StartAction.class); - context.getActionEngine().runAction(uiAction); } public static void closeFaxToMail(MainUIHandler handler, Integer exitCode) { Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/StartAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/StartAction.java 2014-07-18 10:17:20 UTC (rev 423) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/StartAction.java 2014-07-18 10:22:20 UTC (rev 424) @@ -1,112 +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.content.MainUIHandler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import static org.nuiton.i18n.I18n.t; - -/** - * Start action (when the start action file is present when - * starting application). - * - * @author kmorin - morin@codelutin.com - */ -public class StartAction extends AbstractMainUIFaxToMailAction { - - /** Logger. */ - private static final Log log = LogFactory.getLog(StartAction.class); - - protected AbstractMainUIFaxToMailAction delegateAction; - - public StartAction(MainUIHandler handler) { - super(handler, true); - setActionDescription(t("faxtomail.action.start.tip")); - } - - @Override - public boolean prepareAction() throws Exception { - -// File actionfile = getConfig().getStartActionFile(); - boolean doAction = false;//actionfile.exists(); - - if (doAction) { - - try { - // get action to execute -// String content = FaxToMailIOUtil.readContent(actionfile, _("faxtomail.error.read.startActionFile", actionfile)); -// content = content.trim(); - -// if (InstallDbAction.class.getName().equals(content)) { -// -// // install db -// delegateAction = TuttiActionHelper.createLogicAction(getHandler(), InstallDbAction.class); -// -// if (log.isInfoEnabled()) { -// log.info("Found install db action"); -// } -// } else if (content.startsWith(ImportDbAction.class.getName())) { -// -// // import db -// ImportDbAction action = TuttiActionHelper.createLogicAction(getHandler(), ImportDbAction.class); -// File importFile = new File(content.substring(ImportDbAction.class.getName().length() + 1)); -// action.setImportFile(importFile); -// delegateAction = action; -// if (log.isInfoEnabled()) { -// log.info("Found import db action (with file " + importFile + ")"); -// } -// } else { - doAction = false; -// } - - } finally { - - // delete start action file -// FaxToMailIOUtil.deleteFile( -// actionfile, -// _("faxtomail.error.delete.startActionFile", actionfile)); - } - } - - - if (doAction) { - setActionDescription(delegateAction.getActionDescription()); - doAction = delegateAction.prepareAction(); - } - return doAction; - } - - @Override - public void doAction() throws Exception { - - getActionEngine().runInternalAction(delegateAction); - } - - @Override - protected void releaseAction() { - delegateAction = null; - super.releaseAction(); - } -} 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-07-18 10:17:20 UTC (rev 423) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-07-18 10:22:20 UTC (rev 424) @@ -38,6 +38,7 @@ import jaxx.runtime.swing.JAXXWidgetUtil; import jaxx.runtime.swing.session.SwingSession; import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.i18n.I18n; @@ -161,6 +162,13 @@ ui.getStatus().addWidget(bar, 0); getContext().setScreen(FaxToMailScreen.LIST); + + // affichage d'un message si l'utilisateur n'a aucun droit + DemandeListUI demandeListUI = (DemandeListUI) getCurrentBody(); + if (CollectionUtils.isEmpty(demandeListUI.getModel().getFolders())) { + JOptionPane.showMessageDialog(demandeListUI, t("faxtomail.demandeList.noRigthsFound"), + t("faxtomail.demandeList.title"), JOptionPane.ERROR_MESSAGE); + } } @Override 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-07-18 10:17:20 UTC (rev 423) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-07-18 10:22:20 UTC (rev 424) @@ -325,12 +325,6 @@ ui.getNavigationTree().setSelectionPath(new TreePath(node.getPath())); } - - // affichage d'un message si l'utilisateur n'a aucun droit - if (CollectionUtils.isEmpty(model.getFolders())) { - JOptionPane.showMessageDialog(ui, t("faxtomail.demandeList.noRigthsFound"), - t("faxtomail.demandeList.title"), JOptionPane.ERROR_MESSAGE); - } } public void goToNextPage() {