Author: kmorin Date: 2014-02-12 18:16:05 +0100 (Wed, 12 Feb 2014) New Revision: 9 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/9 Log: continue swing ui Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeTableModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/FolderTreeNode.java trunk/faxtomail-ui-swing/src/main/resources/log4j.properties Removed: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/LabelAware.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Label.java Modified: trunk/faxtomail-persistence/pom.xml trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java trunk/faxtomail-ui-swing/pom.xml 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/RunFaxToMail.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx 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/DemandeListUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java Modified: trunk/faxtomail-persistence/pom.xml =================================================================== --- trunk/faxtomail-persistence/pom.xml 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-persistence/pom.xml 2014-02-12 17:16:05 UTC (rev 9) @@ -150,6 +150,7 @@ <defaultPackage>com.franciaflex.faxtomail.persistence.entities</defaultPackage> <fullPackagePath>com.franciaflex.faxtomail.persistence.entities</fullPackagePath> <templates> + org.nuiton.eugene.java.JavaInterfaceTransformer, org.nuiton.topia.templates.TopiaMetaTransformer </templates> </configuration> Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java 2014-02-12 17:16:05 UTC (rev 9) @@ -134,19 +134,19 @@ FaxToMailConfigurationOption.BASEDIR.getKey(), faxToMailBasedir.getAbsolutePath()); - if (log.isInfoEnabled()) { - StringBuilder builder = new StringBuilder(); - List<FaxToMailConfigurationOption> options = - Lists.newArrayList(FaxToMailConfigurationOption.values()); - for (FaxToMailConfigurationOption option : options) { - String key = option.getKey(); - Object value = applicationConfig.getOption(option); - builder.append(String.format("\n%1$-40s = %2$s", - key, - value)); - } - log.info("faxtomail: " + builder.toString()); - } +// if (log.isInfoEnabled()) { +// StringBuilder builder = new StringBuilder(); +// List<FaxToMailConfigurationOption> options = +// Lists.newArrayList(FaxToMailConfigurationOption.values()); +// for (FaxToMailConfigurationOption option : options) { +// String key = option.getKey(); +// Object value = applicationConfig.getOption(option); +// builder.append(String.format("\n%1$-40s = %2$s", +// key, +// value)); +// } +// log.info("faxtomail: " + builder.toString()); +// } } public void prepareDirectories() { Deleted: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/LabelAware.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/LabelAware.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/LabelAware.java 2014-02-12 17:16:05 UTC (rev 9) @@ -1,14 +0,0 @@ -package com.franciaflex.faxtomail; - -import java.io.Serializable; - -/** - * A contract to decorate some objects - * (not known at this level but with a label property to display them). - * - * @author tchemit <chemit@codelutin.com> - * @since 0.3 - */ -public interface LabelAware extends Serializable { - String getLabel(); -} Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo =================================================================== (Binary files differ) Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-02-12 17:16:05 UTC (rev 9) @@ -24,11 +24,14 @@ * #L% */ -import com.franciaflex.faxtomail.LabelAware; +import com.franciaflex.faxtomail.persistence.entities.HasLabel; +import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; import org.nuiton.decorator.DecoratorProvider; import java.io.File; +import java.text.DateFormat; +import java.util.Date; import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; @@ -41,22 +44,6 @@ */ public class DecoratorService extends FaxToMailServiceSupport { - public static final String CARACTERISTIC_WITH_UNIT = "withUnit"; - - public static final String CARACTERISTIC_PARAMETER_ONLY_WITH_UNIT = "parameterOnlyWithUnit"; - - public static final String CARACTERISTIC_PARAMETER_ONLY = "parameterOnly"; - - public static final String FROM_PROTOCOL = "fromProtocol"; - - public static final String GEAR_WITH_RANK_ORDER = "gearWithrankOrder"; - - public static final String BY_NAME = "byName"; - - public static final String ONLY_NAME = "onlyName"; - - public static final String FILE_NAME_COMPATIBLE = "fileNameCompatible"; - public static final String SEPARATOR = "#"; /** Delegate decorator provider. */ @@ -102,7 +89,18 @@ return bean == null ? "" : String.valueOf(bean); } }); - registerMultiJXPathDecorator(LabelAware.class, "${label}$s", SEPARATOR, " - "); + registerDecorator(new Decorator<Date>(Date.class) { + private static final long serialVersionUID = 1L; + + @Override + public String toString(Object bean) { + if (bean == null) { + return ""; + } + return DateFormat.getDateTimeInstance().format(bean); + } + }); + registerMultiJXPathDecorator(HasLabel.class, "${label}$s", SEPARATOR, " - "); } }; } Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java 2014-02-12 17:16:05 UTC (rev 9) @@ -40,6 +40,12 @@ return company; } + public Company getCompanyByName(String name) { + CompanyTopiaDao dao = getPersistenceContext().getCompanyDao(); + Company company = dao.forNameEquals(name).findAny(); + return company; + } + public Company saveCompany(Company company, Collection<MailFolder> mailFolders, Map<MailFilter, String> mailFilters) { Preconditions.checkNotNull(company); Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-02-12 17:16:05 UTC (rev 9) @@ -0,0 +1,22 @@ +package com.franciaflex.faxtomail.services.service; + +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since x.x + */ +public class EmailService extends FaxToMailServiceSupport { + + public List<Email> getEmailForFolder(MailFolder folder) { + EmailTopiaDao dao = getPersistenceContext().getEmailDao(); + return new ArrayList<>(dao.forMailFolderEquals(folder).findAll()); + } +} Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-02-12 17:16:05 UTC (rev 9) @@ -28,16 +28,34 @@ import com.franciaflex.faxtomail.persistence.entities.Company; import com.franciaflex.faxtomail.persistence.entities.CompanyTopiaDao; import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.DemandStatus; +import com.franciaflex.faxtomail.persistence.entities.DemandStatusTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.DemandType; +import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Priority; +import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Range; +import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; +import com.google.common.collect.Lists; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.application.ApplicationTechnicalException; import java.io.File; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Random; public class InitFaxToMailService extends FaxToMailServiceSupport { @@ -100,27 +118,136 @@ } protected void initSampleData() { + log.debug("init Sample Data"); - // companies - CompanyTopiaDao companyTopiaDao = getPersistenceContext().getCompanyDao(); - ConfigurationTopiaDao configurationTopiaDao = getPersistenceContext().getConfigurationDao(); + DemandTypeTopiaDao demandTypeDao = getPersistenceContext().getDemandTypeDao(); + long count = demandTypeDao.count(); - long count = companyTopiaDao.count(); + if (count == 0) { + List<DemandType> types = Lists.newArrayList( + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande"), + demandTypeDao.create(DemandType.PROPERTY_LABEL, "SAV") + ); - log.debug("sample data: " + count); - if (count == 0) { - log.debug("add sample data"); - companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create()); + DemandStatusTopiaDao demandStatusDao = getPersistenceContext().getDemandStatusDao(); + List<DemandStatus> statuses = Lists.newArrayList( + demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "Non traîtée"), + demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "En cours"), + demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "Validée") + ); + + PriorityTopiaDao priorityDao = getPersistenceContext().getPriorityDao(); + List<Priority> priorities = Lists.newArrayList( + priorityDao.create(Priority.PROPERTY_LABEL, "Basse"), + priorityDao.create(Priority.PROPERTY_LABEL, "Normale"), + priorityDao.create(Priority.PROPERTY_LABEL, "Haute"), + priorityDao.create(Priority.PROPERTY_LABEL, "Urgente") + ); + + RangeTopiaDao rangeDao = getPersistenceContext().getRangeDao(); + List<Range> ranges = Lists.newArrayList( + rangeDao.create(Range.PROPERTY_LABEL, "Menuiserie"), + rangeDao.create(Range.PROPERTY_LABEL, "Volets roulants"), + rangeDao.create(Range.PROPERTY_LABEL, "Accessoires") + ); + + MailFolderTopiaDao folderDao = getPersistenceContext().getMailFolderDao(); + List<MailFolder> folders = new ArrayList<>(); + + Random random = new Random(); + EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); + + MailFolder cyril = folderDao.create(MailFolder.PROPERTY_NAME, "Cyril"); + int r = random.nextInt(10) + 5; + for (int i = 0 ; i < r ; i++) { + emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", + Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), + Email.PROPERTY_RECEPTION_DATE, new Date(), + Email.PROPERTY_MAIL_FOLDER, cyril, + Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), + Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), + Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), + Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size())))); + } + + MailFolder claire = folderDao.create(MailFolder.PROPERTY_NAME, "Claire"); + r = random.nextInt(10) + 5; + for (int i = 0 ; i < r ; i++) { + emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", + Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), + Email.PROPERTY_RECEPTION_DATE, new Date(), + Email.PROPERTY_MAIL_FOLDER, claire, + Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), + Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), + Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), + Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size())))); + } + + MailFolder agathe = folderDao.create(MailFolder.PROPERTY_NAME, "Agathe"); + r = random.nextInt(10) + 5; + for (int i = 0 ; i < r ; i++) { + emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", + Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), + Email.PROPERTY_RECEPTION_DATE, new Date(), + Email.PROPERTY_MAIL_FOLDER, agathe, + Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), + Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), + Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), + Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size())))); + } + + folders.add(folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle", + MailFolder.PROPERTY_CHILDREN, Lists.newArrayList(cyril, claire, agathe))); + + MailFolder marc = folderDao.create(MailFolder.PROPERTY_NAME, "Marc"); + r = random.nextInt(10) + 5; + for (int i = 0 ; i < r ; i++) { + emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", + Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), + Email.PROPERTY_RECEPTION_DATE, new Date(), + Email.PROPERTY_MAIL_FOLDER, marc, + Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), + Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), + Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), + Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size())))); + } + + MailFolder frederic = folderDao.create(MailFolder.PROPERTY_NAME, "Frédéric"); + r = random.nextInt(10) + 5; + for (int i = 0 ; i < r ; i++) { + emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", + Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), + Email.PROPERTY_RECEPTION_DATE, new Date(), + Email.PROPERTY_MAIL_FOLDER, frederic, + Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), + Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), + Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), + Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size())))); + } + + MailFolder jeanne = folderDao.create(MailFolder.PROPERTY_NAME, "Jeanne"); + r = random.nextInt(10) + 5; + for (int i = 0 ; i < r ; i++) { + emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", + Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), + Email.PROPERTY_RECEPTION_DATE, new Date(), + Email.PROPERTY_MAIL_FOLDER, jeanne, + Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), + Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), + Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), + Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size())))); + } + folders.add(folderDao.create(MailFolder.PROPERTY_NAME, "SAV", + MailFolder.PROPERTY_CHILDREN, Lists.newArrayList(marc, frederic, jeanne))); + + // companies + CompanyTopiaDao companyTopiaDao = getPersistenceContext().getCompanyDao(); + ConfigurationTopiaDao configurationTopiaDao = getPersistenceContext().getConfigurationDao(); + companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create(), Company.PROPERTY_MAIL_FOLDER, folders); companyTopiaDao.create(Company.PROPERTY_NAME, "Faber", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create()); companyTopiaDao.create(Company.PROPERTY_NAME, "France Fermeture", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create()); - getPersistenceContext().commit(); - log.debug("sample data " + companyTopiaDao.count()); - } - - FaxToMailUserGroupTopiaDao userGroupDao = getPersistenceContext().getFaxToMailUserGroupDao(); - count = userGroupDao.count(); - if (count == 0) { + FaxToMailUserGroupTopiaDao userGroupDao = getPersistenceContext().getFaxToMailUserGroupDao(); userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Chargés de clientèle"); userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Commerciaux"); userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "SAV"); @@ -128,19 +255,6 @@ getPersistenceContext().commit(); } - - FaxToMailUserTopiaDao userDao = getPersistenceContext().getFaxToMailUserDao(); - count = userDao.count(); - if (count == 0) { - userDao.create(FaxToMailUser.PROPERTY_NAME, "Marc Lefebvre", FaxToMailUser.PROPERTY_LOGIN, "mlefebvre"); - userDao.create(FaxToMailUser.PROPERTY_NAME, "Cyril Baillet", FaxToMailUser.PROPERTY_LOGIN, "cbaillet"); - userDao.create(FaxToMailUser.PROPERTY_NAME, "Frédéric Viala", FaxToMailUser.PROPERTY_LOGIN, "fviala"); - userDao.create(FaxToMailUser.PROPERTY_NAME, "Claire Marquis", FaxToMailUser.PROPERTY_LOGIN, "cmarquis"); - userDao.create(FaxToMailUser.PROPERTY_NAME, "Agathe Borde", FaxToMailUser.PROPERTY_LOGIN, "aborde"); - userDao.create(FaxToMailUser.PROPERTY_NAME, "Jeanne Bourgoin", FaxToMailUser.PROPERTY_LOGIN, "jbourgoin"); - - getPersistenceContext().commit(); - } } } Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-02-12 17:16:05 UTC (rev 9) @@ -20,6 +20,11 @@ private static final Log log = LogFactory.getLog(MailFolderService.class); + public List<MailFolder> getAllMailFolders() { + MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); + return new ArrayList<MailFolder>(dao.findAll()); + } + public List<MailFolder> getMailFolders(Collection<String> ids) { MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); return new ArrayList<MailFolder>(dao.forTopiaIdIn(ids).findAll()); Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-02-12 17:16:05 UTC (rev 9) @@ -0,0 +1,41 @@ +package com.franciaflex.faxtomail.services.service; + +import com.franciaflex.faxtomail.persistence.entities.DemandStatus; +import com.franciaflex.faxtomail.persistence.entities.DemandStatusTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.DemandType; +import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Priority; +import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Range; +import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; +import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since x.x + */ +public class ReferentielService extends FaxToMailServiceSupport { + + public List<DemandStatus> getAllDemandStatus() { + DemandStatusTopiaDao dao = getPersistenceContext().getDemandStatusDao(); + return new ArrayList<>(dao.findAll()); + } + + public List<DemandType> getAllDemandType() { + DemandTypeTopiaDao dao = getPersistenceContext().getDemandTypeDao(); + return new ArrayList<>(dao.findAll()); + } + + public List<Priority> getAllPriority() { + PriorityTopiaDao dao = getPersistenceContext().getPriorityDao(); + return new ArrayList<>(dao.findAll()); + } + + public List<Range> getAllRange() { + RangeTopiaDao dao = getPersistenceContext().getRangeDao(); + return new ArrayList<>(dao.findAll()); + } +} Modified: trunk/faxtomail-ui-swing/pom.xml =================================================================== --- trunk/faxtomail-ui-swing/pom.xml 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/pom.xml 2014-02-12 17:16:05 UTC (rev 9) @@ -63,13 +63,25 @@ <dependencies> + <dependency> <groupId>${project.groupId}</groupId> + <artifactId>faxtomail-persistence</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>faxtomail-service</artifactId> <version>${project.version}</version> </dependency> <dependency> + <groupId>org.nuiton.topia</groupId> + <artifactId>topia-persistence</artifactId> + </dependency> + + <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> </dependency> @@ -210,6 +222,13 @@ <artifactId>junit</artifactId> </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>runtime</scope> + </dependency> + + </dependencies> <build> 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-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-02-12 17:16:05 UTC (rev 9) @@ -1,9 +1,18 @@ package com.franciaflex.faxtomail.ui.swing; import com.franciaflex.faxtomail.FaxToMailConfiguration; +import com.franciaflex.faxtomail.persistence.entities.Company; +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; import com.franciaflex.faxtomail.services.DecoratorService; import com.franciaflex.faxtomail.services.FaxToMailServiceContext; import com.franciaflex.faxtomail.persistence.RessourceClassLoader; +import com.franciaflex.faxtomail.services.service.CompanyService; +import com.franciaflex.faxtomail.services.service.EmailService; +import com.franciaflex.faxtomail.services.service.InitFaxToMailService; +import com.franciaflex.faxtomail.services.service.MailFolderService; +import com.franciaflex.faxtomail.services.service.ReferentielService; import com.franciaflex.faxtomail.ui.swing.content.MainUI; import com.franciaflex.faxtomail.ui.swing.util.UIMessageNotifier; import com.google.common.base.Preconditions; @@ -170,6 +179,10 @@ private final ApplicationActionEngine faxToMailActionEngine; + protected Company currentCompany; + + protected Email currentEmail; + public static FaxToMailUIContext newContext(FaxToMailConfiguration config) { Preconditions.checkNotNull(config); Preconditions.checkState(applicationContext == null, @@ -200,8 +213,16 @@ this.config = config; this.resourceLoader = new RessourceClassLoader(Thread.currentThread().getContextClassLoader()); this.serviceContext = new FaxToMailServiceContext(); + FaxToMailTopiaApplicationContext topiaApplicationContext = new FaxToMailTopiaApplicationContext(config.getTopiaProperties()); + FaxToMailTopiaPersistenceContext persistenceContext = topiaApplicationContext.newPersistenceContext(); + serviceContext.setPersistenceContext(persistenceContext); serviceContext.setApplicationConfig(config); + InitFaxToMailService initExtranetService = + serviceContext.newService(InitFaxToMailService.class); + + initExtranetService.init(); + Map<Class, State> additionalStates = Maps.newHashMap(); additionalStates.put(BeanFilterableComboBox.class, new BeanFilterableComboBoxState()); additionalStates.put(BeanDoubleList.class, new BeanDoubleListState()); @@ -380,6 +401,10 @@ // helpDirectory)); // } // + + Company franciaflex = getCompanyService().getCompanyByName("Franciaflex"); + setCurrentCompany(franciaflex); + // //--------------------------------------------------------------------// // // init action UI // //--------------------------------------------------------------------// @@ -447,6 +472,22 @@ return serviceContext.newService(DecoratorService.class); } + public MailFolderService getMailFolderService() { + return serviceContext.newService(MailFolderService.class); + } + + public CompanyService getCompanyService() { + return serviceContext.newService(CompanyService.class); + } + + public EmailService getEmailService() { + return serviceContext.newService(EmailService.class); + } + + public ReferentielService getReferentielService() { + return serviceContext.newService(ReferentielService.class); + } + //------------------------------------------------------------------------// //-- DataContext methods --// //------------------------------------------------------------------------// @@ -592,4 +633,19 @@ firePropertyChange(PROPERTY_LOCALE, null, locale); } + public Company getCurrentCompany() { + return currentCompany; + } + + public void setCurrentCompany(Company currentCompany) { + this.currentCompany = currentCompany; + } + + public Email getCurrentEmail() { + return currentEmail; + } + + public void setCurrentEmail(Email currentEmail) { + this.currentEmail = currentEmail; + } } 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-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java 2014-02-12 17:16:05 UTC (rev 9) @@ -35,7 +35,7 @@ // Create configuration FaxToMailConfiguration config = - new FaxToMailConfiguration("faxtomail.config", args); + new FaxToMailConfiguration("faxtomail.properties", args); // Create application context FaxToMailUIContext context = FaxToMailUIContext.newContext(config); Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css 2014-02-12 17:16:05 UTC (rev 9) @@ -1,68 +1,33 @@ -BeanFilterableComboBox { - showReset: true; - bean: {model}; +#navigationTree { + font-size: "11"; + rootVisible: false; + showsRootHandles: true; } -JXDatePicker { - _selectOnFocus: {true}; +#dataTable { + editable: false; + autoCreateRowSorter: true; } -JTextField { - _selectOnFocus: {true}; +#printMenu { + actionIcon: print; + text: "faxtomail.demandeList.action.print"; + toolTipText: "faxtomail.demandeList.action.print.tip"; + i18nMnemonic: "faxtomail.demandeList.action.print.mnemonic"; } -.between2ndPartLabel { - text: "faxtomail.search.between2ndPart.label"; +#replyMenu { + actionIcon: reply; + text: "faxtomail.demandeList.action.reply"; + toolTipText: "faxtomail.demandeList.action.reply.tip"; + i18nMnemonic: "faxtomail.demandeList.action.reply.mnemonic"; + enabled: {model.isReplyEnabled()}; } -#modifiedByLabel { - text: "faxtomail.search.modifiedBy.label"; -} - -#modifiedBetweenLabel { - text: "faxtomail.search.modifiedBetween.label"; -} - -#receivedBetweenLabel { - text: "faxtomail.search.receivedBetween.label"; -} - -#printedBetweenLabel { - text: "faxtomail.search.printedBetween.label"; -} - -#objectLabel { - text: "faxtomail.search.object.label"; -} - -#statusLabel { - text: "faxtomail.search.status.label"; -} - -#senderLabel { - text: "faxtomail.search.sender.label"; -} - -#docTypeLabel { - text: "faxtomail.search.docType.label"; -} - -#clientAccountLabel { - text: "faxtomail.search.clientAccount.label"; -} - -#refLabel { - text: "faxtomail.search.ref.label"; -} - -#commentLabel { - text: "faxtomail.search.comment.label"; -} - -#chantierLabel { - text: "faxtomail.search.chantier.label"; -} - -#searchButton { - text: "faxtomail.search.button.label" +#addAttachmentMenu { + actionIcon: attachment; + text: "faxtomail.demandeList.action.attachment"; + toolTipText: "faxtomail.demandeList.action.attachment.tip"; + i18nMnemonic: "faxtomail.demandeList.action.attachment.mnemonic"; + enabled: {model.isAddAttachmentEnabled()}; } \ No newline at end of file Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx 2014-02-12 17:16:05 UTC (rev 9) @@ -5,7 +5,6 @@ com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - com.franciaflex.faxtomail.ui.swing.util.Label jaxx.runtime.swing.editor.bean.BeanFilterableComboBox @@ -23,18 +22,31 @@ <DemandeListUIModel id='model' initializer='getContextValue(DemandeListUIModel.class)'/> + <!-- + Au dessus du tableau, mettre les totaux des quantités PF et SAV. Mettre à jour en fonction des éléments affichés (suivant le filtre) + Liste des éléments globale (de tous les dossiers accessibles). + --> + + <JPopupMenu id='tablePopup'> + <JMenuItem id='printMenu' + onActionPerformed='handler.print()'/> + <JMenuItem id='replyMenu' + onActionPerformed='handler.reply()'/> + <JMenuItem id='addAttachmentMenu' + onActionPerformed='handler.addAttachment()'/> + </JPopupMenu> + <JSplitPane constraints='BorderLayout.CENTER'> <JScrollPane> - <JTree id="navigationTree" - font-size='11' - rootVisible='false' - showsRootHandles='false'/> + <JTree id="navigationTree"/> </JScrollPane> <JPanel layout='{new BorderLayout()}'> - <JLabel id="selectedFolder" text="1 - Volets roulants" constraints='BorderLayout.NORTH'/> + <JLabel id="selectedFolder" constraints='BorderLayout.NORTH'/> <JScrollPane constraints='BorderLayout.CENTER'> - <JXTable id='dataTable' autoCreateRowSorter='true'/> + <JXTable id='dataTable' + onMouseClicked='handler.autoSelectRowInTable(event, tablePopup)' + onKeyPressed='handler.openRowMenu(event, tablePopup)'/> </JScrollPane> </JPanel> </JSplitPane> 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-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-02-12 17:16:05 UTC (rev 9) @@ -24,24 +24,38 @@ * #L% */ +import com.franciaflex.faxtomail.persistence.entities.Company; +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; import com.franciaflex.faxtomail.ui.swing.util.CloseableUI; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; +import jaxx.runtime.swing.JAXXWidgetUtil; import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.table.DefaultTableColumnModelExt; +import org.jdesktop.swingx.table.TableColumnModelExt; +import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; import javax.swing.*; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeModel; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; import static org.nuiton.i18n.I18n.t; @@ -75,58 +89,124 @@ */ // private final PersistenceService persistenceService; + @Override + public void beforeInit(DemandeListUI ui) { + super.beforeInit(ui); + + DemandeListUIModel model = new DemandeListUIModel(); + Company franciaflex = getContext().getCurrentCompany(); + Collection<MailFolder> folders = franciaflex.getMailFolder(); + model.setFolders(new ArrayList<MailFolder>(folders)); + + model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_SELECTED_FOLDER, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + DemandeListUIModel model = (DemandeListUIModel) evt.getSource(); + MailFolder folder = (MailFolder) evt.getNewValue(); + List<Email> emails = getContext().getEmailService().getEmailForFolder(folder); + model.setEmails(emails); + } + }); + + this.ui.setContextValue(model); + } + @Override public void afterInit(DemandeListUI ui) { initUI(ui); + // init tree DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); + for (MailFolder folder : getModel().getFolders()) { + createFolderTree(root, folder); + } - DefaultMutableTreeNode commandes = new DefaultMutableTreeNode("Commandes"); - commandes.add(new DefaultMutableTreeNode("FME - 1 - Volets roulants")); - commandes.add(new DefaultMutableTreeNode("FME - 1 - Volets roulants")); + TreeModel treeModel = new DefaultTreeModel(root); + JTree navigationTree = ui.getNavigationTree(); + navigationTree.setModel(treeModel); - DefaultMutableTreeNode devis = new DefaultMutableTreeNode("Devis"); - devis.add(new DefaultMutableTreeNode("FME - 1 - Volets roulants")); - devis.add(new DefaultMutableTreeNode("FME - 1 - Volets roulants")); + // use the folder icon for the leaf + DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); + Icon folderIcon = renderer.getDefaultClosedIcon(); + renderer.setLeafIcon(folderIcon); + navigationTree.setCellRenderer(renderer); - root.add(commandes); - root.add(devis); + JAXXWidgetUtil.expandTree(navigationTree); + navigationTree.addTreeSelectionListener(new TreeSelectionListener() { + @Override + public void valueChanged(TreeSelectionEvent e) { + FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent(); + MailFolder folder = folderNode.getMailFolder(); + getModel().setSelectedFolder(folder); + } + }); - TreeModel treeModel = new DefaultTreeModel(root); - ui.getNavigationTree().setModel(treeModel); + // init table + TableColumnModelExt columnModel = new DefaultTableColumnModelExt(); + Company franciaflex = getContext().getCurrentCompany(); + String columns = franciaflex.getConfiguration().getTableColumns(); + if (columns == null) { + columns = StringUtils.join(new String[] { + Email.PROPERTY_OBJECT, Email.PROPERTY_RECEPTION_DATE, Email.PROPERTY_SENDER_EMAIL_ADDRESS + }, ','); + } + String[] columnNames = columns.split(","); + for (String columnName : columnNames) { + addColumnToModel(columnModel, + null, + Email.PROPERTY_RECEPTION_DATE.equals(columnName) ? newTableCellRender(Date.class): null, + DemandeTableModel.COLUMN_IDENTIFIERS.get(columnName)) + .setSortable(true); + } + final AbstractApplicationTableModel tableModel = new DemandeTableModel(columnModel); + JXTable table = ui.getDataTable(); + table.setModel(tableModel); + table.setColumnModel(columnModel); + table.getTableHeader().setReorderingAllowed(false); - String[][] data = new String[][] { - { "Sté 1", "Utilisateur 1", "Objet 1", "10/01/14 12:12" }, - { "Sté 2", "Utilisateur 2", "Objet 2", "13/01/14 12:12" }, - { "Sté 3", "Utilisateur 3", "Objet 3", "14/01/14 12:12" } - }; - String[] columns = new String[] { - "De", - "Nom TCC", - "Objet", - "Reçu le" - }; - TableModel tableModel = new DefaultTableModel(data, columns); - ui.getDataTable().setModel(tableModel); - ui.getDataTable().setEditable(false); - - ui.getDataTable().addMouseListener(new MouseAdapter() { + table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JXTable table = (JXTable) evt.getSource(); if (evt.getClickCount() == 2) { + int rowIndex = table.getSelectedRow(); + Email selectedEmail = (Email) tableModel.getEntry(rowIndex); + getContext().setCurrentEmail(selectedEmail); getContext().getActionEngine().runAction(new ShowDemandeAction(getContext().getMainUI().getHandler())); } } }); -// initBeanFilterableComboBox(ui.getModifiedByComboBox(), createLabelList("Utilisateur A", "Utilisateur B", "Utilisateur C"), null); -// initBeanFilterableComboBox(ui.getStatusComboBox(), createLabelList("Nouveau", "En cours", "Archivé"), null); -// initBeanFilterableComboBox(ui.getDocTypeComboBox(), createLabelList("Commande", "SAV"), null); + getModel().addPropertyChangeListener(DemandeListUIModel.PROPERTY_EMAILS, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + List<Email> emails = (List<Email>) evt.getNewValue(); + tableModel.setRows(emails); + } + }); + getModel().addPropertyChangeListener(DemandeListUIModel.PROPERTY_SELECTED_FOLDER, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + MailFolder folder = (MailFolder) evt.getNewValue(); + String name = folder != null ? folder.getName() : null; + getUI().getSelectedFolder().setText(name); + } + }); + } + protected void createFolderTree(DefaultMutableTreeNode parent, MailFolder folder) { + DefaultMutableTreeNode node = new FolderTreeNode(folder); + parent.add(node); + if (folder.isChildrenNotEmpty()) { + for (MailFolder child : folder.getChildren()) { + createFolderTree(node, child); + } + } + } + @Override protected JComponent getComponentToFocus() { return getUI().getNavigationTree(); @@ -158,4 +238,25 @@ public SwingValidator<DemandeListUIModel> getValidator() { return null; } + + @Override + protected void beforeOpenPopup(int rowIndex, int columnIndex) { + super.beforeOpenPopup(rowIndex, columnIndex); + + int selectedRowCount = getUI().getDataTable().getSelectedRowCount(); + getModel().setAddAttachmentEnabled(selectedRowCount == 1); + getModel().setReplyEnabled(selectedRowCount == 1); + } + + public void print() { + log.debug("print"); + } + + public void reply() { + log.debug("reply"); + } + + public void addAttachment() { + log.debug("addAttachment"); + } } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java 2014-02-12 17:16:05 UTC (rev 9) @@ -1,9 +1,74 @@ package com.franciaflex.faxtomail.ui.swing.content.demande; +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import org.jdesktop.beans.AbstractSerializableBean; + +import java.util.List; + /** * @author kmorin <kmorin@codelutin.com> * @since x.x */ -public class DemandeListUIModel { +public class DemandeListUIModel extends AbstractSerializableBean { + public static final String PROPERTY_FOLDERS = "folders"; + public static final String PROPERTY_EMAILS = "emails"; + public static final String PROPERTY_SELECTED_FOLDER = "selectedFolder"; + + protected List<MailFolder> folders; + + protected List<Email> emails; + + protected MailFolder selectedFolder; + + protected boolean replyEnabled; + + protected boolean addAttachmentEnabled; + + public List<MailFolder> getFolders() { + return folders; + } + + public void setFolders(List<MailFolder> folders) { + Object oldValue = getFolders(); + this.folders = folders; + firePropertyChange(PROPERTY_FOLDERS, oldValue, folders); + } + + public List<Email> getEmails() { + return emails; + } + + public void setEmails(List<Email> emails) { + Object oldValue = getEmails(); + this.emails = emails; + firePropertyChange(PROPERTY_EMAILS, oldValue, emails); + } + + public MailFolder getSelectedFolder() { + return selectedFolder; + } + + public void setSelectedFolder(MailFolder selectedFolder) { + Object oldValue = getSelectedFolder(); + this.selectedFolder = selectedFolder; + firePropertyChange(PROPERTY_SELECTED_FOLDER, oldValue, selectedFolder); + } + + public boolean isReplyEnabled() { + return replyEnabled; + } + + public void setReplyEnabled(boolean replyEnabled) { + this.replyEnabled = replyEnabled; + } + + public boolean isAddAttachmentEnabled() { + return addAttachmentEnabled; + } + + public void setAddAttachmentEnabled(boolean addAttachmentEnabled) { + this.addAttachmentEnabled = addAttachmentEnabled; + } } Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeTableModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeTableModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeTableModel.java 2014-02-12 17:16:05 UTC (rev 9) @@ -0,0 +1,129 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.EmailImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.table.TableColumnModelExt; +import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; +import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; + +import javax.swing.table.AbstractTableModel; +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.nuiton.i18n.I18n.n; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since x.x + */ +public class DemandeTableModel extends AbstractApplicationTableModel<Email> { + + private static final Log log = + LogFactory.getLog(DemandeTableModel.class); + + public static final Map<String, ColumnIdentifier<Email>> COLUMN_IDENTIFIERS = new HashMap<String, ColumnIdentifier<Email>>() {{ + put(Email.PROPERTY_SENDER_EMAIL_ADDRESS, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_SENDER_EMAIL_ADDRESS, + n("faxtomail.demandeList.table.header.senderEmail"), + n("faxtomail.demandeList.table.header.senderEmail"))); + + put(Email.PROPERTY_OBJECT, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_OBJECT, + n("faxtomail.demandeList.table.header.object"), + n("faxtomail.demandeList.table.header.object"))); + + put(Email.PROPERTY_RECEPTION_DATE, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_RECEPTION_DATE, + n("faxtomail.demandeList.table.header.receptionDate"), + n("faxtomail.demandeList.table.header.receptionDate"))); + + put(Email.PROPERTY_CLIENT, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_CLIENT, + n("faxtomail.demandeList.table.header.client"), + n("faxtomail.demandeList.table.header.client"))); + + put(Email.PROPERTY_COMMAND_NB, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_COMMAND_NB, + n("faxtomail.demandeList.table.header.commandNb"), + n("faxtomail.demandeList.table.header.commandNb"))); + + put(Email.PROPERTY_DEMAND_STATUS, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_DEMAND_STATUS, + n("faxtomail.demandeList.table.header.status"), + n("faxtomail.demandeList.table.header.status"))); + + put(Email.PROPERTY_DEMAND_TYPE, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_DEMAND_TYPE, + n("faxtomail.demandeList.table.header.type"), + n("faxtomail.demandeList.table.header.type"))); + + put(Email.PROPERTY_EDI_CODE_NUMBER, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_EDI_CODE_NUMBER, + n("faxtomail.demandeList.table.header.ediCodeNumber"), + n("faxtomail.demandeList.table.header.ediCodeNumber"))); + + put(Email.PROPERTY_ETAT_ATTENTE, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_ETAT_ATTENTE, + n("faxtomail.demandeList.table.header.waitingState"), + n("faxtomail.demandeList.table.header.waitingState"))); + + put(Email.PROPERTY_FAX_TO_MAIL_USER, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_FAX_TO_MAIL_USER, + n("faxtomail.demandeList.table.header.user"), + n("faxtomail.demandeList.table.header.user"))); + + put(Email.PROPERTY_MAIL_FOLDER, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_MAIL_FOLDER, + n("faxtomail.demandeList.table.header.folder"), + n("faxtomail.demandeList.table.header.folder"))); + + put(Email.PROPERTY_PRIORITY, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_PRIORITY, + n("faxtomail.demandeList.table.header.priority"), + n("faxtomail.demandeList.table.header.priority"))); + + put(Email.PROPERTY_PROJECT_REFERENCE, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_PROJECT_REFERENCE, + n("faxtomail.demandeList.table.header.projectReference"), + n("faxtomail.demandeList.table.header.projectReference"))); + + put(Email.PROPERTY_RANGE, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_RANGE, + n("faxtomail.demandeList.table.header.range"), + n("faxtomail.demandeList.table.header.range"))); + + put(Email.PROPERTY_SAV_NUMBER, + ColumnIdentifier.<Email>newReadOnlyId( + Email.PROPERTY_SAV_NUMBER, + n("faxtomail.demandeList.table.header.savNumber"), + n("faxtomail.demandeList.table.header.savNumber"))); + + }}; + + protected DemandeTableModel(TableColumnModelExt columnModel) { + super(columnModel, false, false); + } + + @Override + public Email createNewRow() { + return new EmailImpl(); + } +} Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-02-12 17:16:05 UTC (rev 9) @@ -15,38 +15,104 @@ text: "faxtomail.demande.object.label"; } -#receivedLabel { - text: "faxtomail.demande.received.label"; +#objectField { + text: {model.getObject()}; } -#tccLabel { - text: "faxtomail.demande.tcc.label"; +#receivedDateLabel { + text: "faxtomail.demande.receivedDate.label"; } -#docTypeLabel { - text: "faxtomail.demande.docType.label"; +#receivedDateField { + text: {getDateFormat().format(model.getReceptionDate())}; + editable: false; } -#statusLabel { - text: "faxtomail.demande.status.label"; +#senderLabel { + text: "faxtomail.demande.sender.label"; } -#priorityLabel { - text: "faxtomail.demande.priority.label"; +#senderField { + text: {model.getSenderEmailAddress()}; + editable: false; } #clientLabel { text: "faxtomail.demande.client.label"; } +#docTypeLabel { + text: "faxtomail.demande.docType.label"; +} + +#docTypeComboBox { + property: demandType; + selectedItem: {model.getDemandType()}; +} + #demandeNumberLabel { text: "faxtomail.demande.demandeNumber.label"; } -#refLabel { - text: "faxtomail.demande.ref.label"; +#demandeNumberField { + text: {model.getCommandNb()}; } +#ediCodeNumberLabel { + text: "faxtomail.demande.ediCodeNumber.label"; +} + +#ediCodeNumberField { + text: {model.getEdiCodeNumber()}; + editable: false; +} + +#priorityLabel { + text: "faxtomail.demande.priority.label"; +} + +#priorityComboBox { + property: priority; + selectedItem: {model.getPriority()}; +} + +#statusLabel { + text: "faxtomail.demande.status.label"; +} + +#statusComboBox { + property: demandStatus; + selectedItem: {model.getDemandStatus()}; +} + +#etatAttenteLabel { + text: "faxtomail.demande.etatAttente.label"; +} + +#projectReferenceLabel { + text: "faxtomail.demande.projectReference.label"; +} + +#projectReferenceField { + text: {model.getProjectReference()}; +} + +#savNumberLabel { + text: "faxtomail.demande.savNumber.label"; +} + +#savNumberField { + text: {model.getSavNumber()}; +} + +#finishedProductsLabel { + text: "faxtomail.demande.finishedProducts.label"; +} + +//#finishedProductsField { +// +//} + #gammeLabel { text: "faxtomail.demande.gamme.label"; } @@ -74,4 +140,4 @@ #archiveButton { text: "faxtomail.demande.archive.button.label"; -} \ No newline at end of file +} Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-02-12 17:16:05 UTC (rev 9) @@ -5,8 +5,13 @@ com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - com.franciaflex.faxtomail.ui.swing.util.Label + com.franciaflex.faxtomail.persistence.entities.Email + com.franciaflex.faxtomail.persistence.entities.DemandType + com.franciaflex.faxtomail.persistence.entities.DemandStatus + com.franciaflex.faxtomail.persistence.entities.Range + com.franciaflex.faxtomail.persistence.entities.Priority + jaxx.runtime.swing.editor.bean.BeanFilterableComboBox org.jdesktop.swingx.JXDatePicker @@ -25,7 +30,7 @@ ]]></script> <DemandeUIModel id='model' - initializer='getContextValue(DemandeUIModel.class)'/> + initializer='getContextValue(DemandeUIModel.class)'/> <String id='patternLayout' javaBean='"dd/MM/yyyy HH:mm:ss"'/> @@ -37,106 +42,139 @@ <JPanel layout='{new GridLayout(0,1)}'> <Table fill='both'> + <row> - <cell anchor='west'> - <JLabel id='objectLabel'/> + <cell anchor='east'> + <JLabel id='receivedDateLabel'/> </cell> - <cell weightx='1' columns="3"> - <JTextField id='objectField'/> + <cell weightx='1'> + <JTextField id='receivedDateField'/> </cell> - </row> - <row> - <cell anchor='west'> - <JLabel id='receivedLabel'/> + <cell anchor='east'> + <JLabel id='senderLabel'/> </cell> <cell weightx='1'> - <JAXXDatePicker id='receivedDatePicker' - date='{date}' - patternLayout='{patternLayout}'/> + <JTextField id='senderField'/> </cell> - <cell> - <JLabel id='tccLabel'/> + + <cell anchor='east'> + <JLabel id='clientLabel'/> </cell> <cell weightx='1'> - <JTextField id='tccField'/> + <JTextField id='clientField'/><!-- TODO list of clients --> </cell> </row> <row> - <cell anchor='west' columns='4'> - <JLabel text="Dernière modification par Utilisateur 1 le 14/01/2014 à 08:42"/> + <cell anchor='east'> + <JLabel id='objectLabel'/> </cell> + <cell weightx='1' columns="5"> + <JTextField id='objectField' + onKeyReleased='handler.setText(event, "object")'/> + </cell> </row> - </Table> - <Table> <row> - <cell anchor='west'> + <cell anchor='east'> <JLabel id='docTypeLabel'/> </cell> <cell weightx='1'> <BeanFilterableComboBox id='docTypeComboBox' constructorParams='this' - genericType="Label"/> + genericType="DemandType"/> </cell> - <cell anchor='west'> + + <cell anchor='east'> + <JLabel id='demandeNumberLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='demandeNumberField' + onKeyReleased='handler.setText(event, "commandNb")'/> + </cell> + + <cell anchor='east'> + <JLabel id='ediCodeNumberLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='ediCodeNumberField'/> + </cell> + </row> + + <row> + <cell anchor='east'> + <JLabel id='priorityLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='priorityComboBox' + constructorParams='this' + genericType="Priority"/> + </cell> + + <cell anchor='east'> <JLabel id='statusLabel'/> </cell> <cell weightx='1'> <BeanFilterableComboBox id='statusComboBox' constructorParams='this' - genericType="Label"/> + genericType="DemandStatus"/> </cell> - <cell anchor='west'> - <JLabel id='priorityLabel'/> + + <cell anchor='east'> + <JLabel id='etatAttenteLabel'/> </cell> <cell weightx='1'> - <BeanFilterableComboBox id='priorityComboBox' + <BeanFilterableComboBox id='etatAttenteComboBox' constructorParams='this' - genericType="Label"/> + genericType="DemandStatus"/> </cell> </row> <row> - <cell anchor='west'> - <JLabel id='clientLabel'/> + <cell anchor='east'> + <JLabel id='projectReferenceLabel'/> </cell> <cell weightx='1'> - <JTextField id='clientField'/> + <JTextField id='projectReferenceField'/> </cell> - <cell anchor='west'> - <JLabel id='demandeNumberLabel'/> + + <cell anchor='east'> + <JLabel id='savNumberLabel'/> </cell> <cell weightx='1'> - <JTextField id='demandeNumberField'/> + <JTextField id='savNumberField'/> </cell> - <cell anchor='west'> - <JLabel id='refLabel'/> + + <cell anchor='east'> + <JLabel id='finishedProductsLabel'/> </cell> <cell weightx='1'> - <JTextField id='refField'/> + <JTextField id='finishedProductsField'/> </cell> </row> <row> - <cell anchor='west'> + <cell anchor='east'> <JLabel id='gammeLabel'/> </cell> - <cell weightx='1'> + <cell weightx='1' columns='6'> <BeanFilterableComboBox id='gammeComboBox' constructorParams='this' - genericType="Label"/> + genericType="Range"/> </cell> - <cell anchor='west'> + </row> + + <row> + <cell anchor='east'> <JLabel id='messageLabel'/> </cell> - <cell weightx='3' columns='3'> + <cell weightx='1' columns='5'> <JScrollPane id='commentPane'> <JTextArea id='messageField'/> </JScrollPane> </cell> - </row> + </row> </Table> @@ -158,15 +196,6 @@ <JButton text="Ajouter"/> </JPanel> - <JPanel id="faxInfoPanel" - border='{BorderFactory.createTitledBorder("Informations fax")}' - layout='{new GridLayout(0,1)}'> - <JLabel text="Télécopie reçue le 10/01/2014 à 13:37"/> - <JLabel text="Origine : 02 34 56 78 90"/> - <JLabel text="Nombre de pages : 1, durée : 13 secondes, vitesse : 31200"/> - <JLabel text="Numéro SDA : 6374"/> - </JPanel> - </JPanel> </JScrollPane> Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-02-12 17:16:05 UTC (rev 9) @@ -24,6 +24,10 @@ * #L% */ +import com.franciaflex.faxtomail.persistence.entities.Company; +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.services.service.ReferentielService; import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; import com.franciaflex.faxtomail.ui.swing.util.CloseableUI; @@ -34,6 +38,12 @@ import javax.swing.*; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + import static org.nuiton.i18n.I18n.t; /** @@ -66,17 +76,31 @@ */ // private final PersistenceService persistenceService; + @Override + public void beforeInit(DemandeUI ui) { + super.beforeInit(ui); + + DemandeUIModel model = new DemandeUIModel(); + model.fromBean(getContext().getCurrentEmail()); + log.debug(model.getDemandStatus()); + + this.ui.setContextValue(model); + } + @Override public void afterInit(DemandeUI ui) { initUI(ui); - initBeanFilterableComboBox(ui.getDocTypeComboBox(), createLabelList("Commande", "SAV"), null); - initBeanFilterableComboBox(ui.getStatusComboBox(), createLabelList("Non traité", "En cours", "Clos"), null); - initBeanFilterableComboBox(ui.getPriorityComboBox(), createLabelList("Basse", "Normale", "Haute", "Urgente"), null); - initBeanFilterableComboBox(ui.getGammeComboBox(), createLabelList("FFE"), null); + DemandeUIModel model = getModel(); + ReferentielService referentielService = getContext().getReferentielService(); + initBeanFilterableComboBox(ui.getDocTypeComboBox(), referentielService.getAllDemandType(), model.getDemandType()); + initBeanFilterableComboBox(ui.getStatusComboBox(), referentielService.getAllDemandStatus(), model.getDemandStatus()); + initBeanFilterableComboBox(ui.getPriorityComboBox(), referentielService.getAllPriority(), model.getPriority()); + initBeanFilterableComboBox(ui.getGammeComboBox(), referentielService.getAllRange(), null); + } @Override Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-02-12 17:16:05 UTC (rev 9) @@ -1,9 +1,190 @@ package com.franciaflex.faxtomail.ui.swing.content.demande; +import com.franciaflex.faxtomail.persistence.entities.Client; +import com.franciaflex.faxtomail.persistence.entities.DemandStatus; +import com.franciaflex.faxtomail.persistence.entities.DemandType; +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.EmailImpl; +import com.franciaflex.faxtomail.persistence.entities.EtatAttente; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; +import com.franciaflex.faxtomail.persistence.entities.Priority; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; + +import java.util.Date; + /** * @author kmorin <kmorin@codelutin.com> * @since x.x */ -public class DemandeUIModel { +public class DemandeUIModel extends AbstractFaxToMailBeanUIModel<Email, DemandeUIModel> { + protected final Email editObject = new EmailImpl(); + + protected static Binder<DemandeUIModel, Email> toBeanBinder = + BinderFactory.newBinder(DemandeUIModel.class, + Email.class); + + protected static Binder<Email, DemandeUIModel> fromBeanBinder = + BinderFactory.newBinder(Email.class, DemandeUIModel.class); + + public DemandeUIModel() { + super(fromBeanBinder, toBeanBinder); + } + + public void setSavNumber(String savNumber) { + Object oldValue = getSavNumber(); + editObject.setSavNumber(savNumber); + firePropertyChanged(Email.PROPERTY_SAV_NUMBER, oldValue, savNumber); + } + + public String getSavNumber() { + return editObject.getSavNumber(); + } + + public void setSenderEmailAddress(String senderEmailAddress) { + Object oldValue = getSenderEmailAddress(); + editObject.setSenderEmailAddress(senderEmailAddress); + firePropertyChanged(Email.PROPERTY_SENDER_EMAIL_ADDRESS, oldValue, senderEmailAddress); + } + + public String getSenderEmailAddress() { + return editObject.getSenderEmailAddress(); + } + + public void setSenderFaxNumber(String senderFaxNumber) { + Object oldValue = getSenderFaxNumber(); + editObject.setSenderFaxNumber(senderFaxNumber); + firePropertyChanged(Email.PROPERTY_SENDER_FAX_NUMBER, oldValue, senderFaxNumber); + } + + public String getSenderFaxNumber() { + return editObject.getSenderFaxNumber(); + } + + public void setReceptionEmailAddress(String receptionEmailAddress) { + Object oldValue = getReceptionEmailAddress(); + editObject.setReceptionEmailAddress(receptionEmailAddress); + firePropertyChanged(Email.PROPERTY_RECEPTION_EMAIL_ADDRESS, oldValue, receptionEmailAddress); + } + + public String getReceptionEmailAddress() { + return editObject.getReceptionEmailAddress(); + } + + public void setObject(String object) { + Object oldValue = getObject(); + editObject.setObject(object); + firePropertyChanged(Email.PROPERTY_OBJECT, oldValue, object); + } + + public String getObject() { + return editObject.getObject(); + } + + public void setClient(Client client) { + Object oldValue = getClient(); + editObject.setClient(client); + firePropertyChanged(Email.PROPERTY_CLIENT, oldValue, client); + } + + public Client getClient() { + return editObject.getClient(); + } + + public void setEtatAttente(EtatAttente etatAttente) { + Object oldValue = getEtatAttente(); + editObject.setEtatAttente(etatAttente); + firePropertyChanged(Email.PROPERTY_ETAT_ATTENTE, oldValue, etatAttente); + } + + public EtatAttente getEtatAttente() { + return editObject.getEtatAttente(); + } + + public void setFaxToMailUser(FaxToMailUser faxToMailUser) { + Object oldValue = getFaxToMailUser(); + editObject.setFaxToMailUser(faxToMailUser); + firePropertyChanged(Email.PROPERTY_FAX_TO_MAIL_USER, oldValue, faxToMailUser); + } + + public FaxToMailUser getFaxToMailUser() { + return editObject.getFaxToMailUser(); + } + + public Priority getPriority() { + return editObject.getPriority(); + } + + public void setPriority(Priority priority) { + Object oldValue = getPriority(); + editObject.setPriority(priority); + firePropertyChanged(Email.PROPERTY_PRIORITY, oldValue, priority); + } + + public DemandType getDemandType() { + return editObject.getDemandType(); + } + + public void setDemandType(DemandType demandType) { + Object oldValue = getDemandType(); + editObject.setDemandType(demandType); + firePropertyChanged(Email.PROPERTY_DEMAND_TYPE, oldValue, demandType); + } + + public DemandStatus getDemandStatus() { + return editObject.getDemandStatus(); + } + + public void setDemandStatus(DemandStatus demandStatus) { + Object oldValue = getDemandStatus(); + editObject.setDemandStatus(demandStatus); + firePropertyChanged(Email.PROPERTY_DEMAND_STATUS, oldValue, demandStatus); + } + + public void setReceptionDate(Date receptionDate) { + Object oldValue = getReceptionDate(); + editObject.setReceptionDate(receptionDate); + firePropertyChanged(Email.PROPERTY_RECEPTION_DATE, oldValue, receptionDate); + } + + public Date getReceptionDate() { + return editObject.getReceptionDate(); + } + + public void setEdiCodeNumber(String ediCodeNumber) { + Object oldValue = getEdiCodeNumber(); + editObject.setEdiCodeNumber(ediCodeNumber); + firePropertyChanged(Email.PROPERTY_EDI_CODE_NUMBER, oldValue, ediCodeNumber); + } + + public String getEdiCodeNumber() { + return editObject.getEdiCodeNumber(); + } + + public void setCommandNb(String commandNb) { + Object oldValue = getCommandNb(); + editObject.setCommandNb(commandNb); + firePropertyChanged(Email.PROPERTY_COMMAND_NB, oldValue, commandNb); + } + + public String getCommandNb() { + return editObject.getCommandNb(); + } + + public void setProjectReference(String projectReference) { + Object oldValue = getProjectReference(); + editObject.setProjectReference(projectReference); + firePropertyChanged(Email.PROPERTY_PROJECT_REFERENCE, oldValue, projectReference); + } + + public String getProjectReference() { + return editObject.getProjectReference(); + } + + @Override + protected Email newEntity() { + return new EmailImpl(); + } } Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/FolderTreeNode.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/FolderTreeNode.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/FolderTreeNode.java 2014-02-12 17:16:05 UTC (rev 9) @@ -0,0 +1,26 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +import com.franciaflex.faxtomail.persistence.entities.MailFolder; + +import javax.swing.tree.DefaultMutableTreeNode; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since x.x + */ +public class FolderTreeNode extends DefaultMutableTreeNode { + + public FolderTreeNode(MailFolder folder) { + super(folder); + } + + public MailFolder getMailFolder() { + return (MailFolder) userObject; + } + + @Override + public String toString() { + MailFolder folder = (MailFolder) userObject; + return folder.getName(); + } +} Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-02-12 17:16:05 UTC (rev 9) @@ -5,8 +5,9 @@ com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - com.franciaflex.faxtomail.ui.swing.util.Label + com.franciaflex.faxtomail.persistence.entities.HasLabel + jaxx.runtime.swing.editor.bean.BeanFilterableComboBox org.jdesktop.swingx.JXDatePicker @@ -34,7 +35,7 @@ <cell weightx='1'> <BeanFilterableComboBox id='modifiedByComboBox' constructorParams='this' - genericType="Label"/> + genericType="HasLabel"/> </cell> <cell> </cell> @@ -107,7 +108,7 @@ <cell weightx='1'> <BeanFilterableComboBox id='statusComboBox' constructorParams='this' - genericType="Label"/> + genericType="HasLabel"/> </cell> <cell> </cell> @@ -135,7 +136,7 @@ <cell weightx='1'> <BeanFilterableComboBox id='docTypeComboBox' constructorParams='this' - genericType="Label"/> + genericType="HasLabel"/> </cell> <cell> </cell> Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-02-12 17:16:05 UTC (rev 9) @@ -1,13 +1,12 @@ package com.franciaflex.faxtomail.ui.swing.util; import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.LabelAware; +import com.franciaflex.faxtomail.persistence.entities.HasLabel; import com.franciaflex.faxtomail.services.DecoratorService; import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; import com.franciaflex.faxtomail.ui.swing.content.MainUI; import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -18,6 +17,7 @@ import java.awt.Component; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -81,8 +81,8 @@ Decorator decorator = decoratorService.getDecoratorByType(type, name); if (decorator == null) { - if (LabelAware.class.isAssignableFrom(type)) { - decorator = getDecorator(LabelAware.class, null); + if (HasLabel.class.isAssignableFrom(type)) { + decorator = getDecorator(HasLabel.class, null); } } Preconditions.checkNotNull(decorator); @@ -188,10 +188,15 @@ ui.getHandler().onCloseUI(); } - protected List<Label> createLabelList(String... labels) { - List<Label> labelList = Lists.newArrayList(); - for (String label : labels) { - labelList.add(new Label(label)); + protected List<HasLabel> createLabelList(String... labels) { + List<HasLabel> labelList = new ArrayList<HasLabel>(); + for (final String label : labels) { + labelList.add(new HasLabel() { + @Override + public String getLabel() { + return label; + } + }); } return labelList; } Deleted: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Label.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Label.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Label.java 2014-02-12 17:16:05 UTC (rev 9) @@ -1,21 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -import com.franciaflex.faxtomail.LabelAware; - -/** - * @author kmorin <kmorin@codelutin.com> - * @since x.x - */ -public class Label implements LabelAware { - - String label; - - public Label(String label) { - this.label = label; - } - - @Override - public String getLabel() { - return label; - } -} Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-02-12 17:16:05 UTC (rev 9) @@ -66,18 +66,49 @@ faxtomail.demande.client.label= faxtomail.demande.demandeNumber.label= faxtomail.demande.docType.label= +faxtomail.demande.ediCodeNumber.label= +faxtomail.demande.etatAttente.label= +faxtomail.demande.finishedProducts.label= faxtomail.demande.gamme.label= faxtomail.demande.message.label= faxtomail.demande.object.label= faxtomail.demande.print.button.label= faxtomail.demande.priority.label= +faxtomail.demande.projectReference.label= faxtomail.demande.received.label= +faxtomail.demande.receivedDate.label= faxtomail.demande.ref.label= +faxtomail.demande.savNumber.label= faxtomail.demande.save.button.label= +faxtomail.demande.sender.label= faxtomail.demande.status.label= faxtomail.demande.tcc.label= faxtomail.demande.title= faxtomail.demande.transmit.button.label= +faxtomail.demandeList.action.attachment= +faxtomail.demandeList.action.attachment.mnemonic= +faxtomail.demandeList.action.attachment.tip= +faxtomail.demandeList.action.print= +faxtomail.demandeList.action.print.mnemonic= +faxtomail.demandeList.action.print.tip= +faxtomail.demandeList.action.reply= +faxtomail.demandeList.action.reply.mnemonic= +faxtomail.demandeList.action.reply.tip= +faxtomail.demandeList.table.header.client= +faxtomail.demandeList.table.header.commandNb= +faxtomail.demandeList.table.header.ediCodeNumber= +faxtomail.demandeList.table.header.folder= +faxtomail.demandeList.table.header.object= +faxtomail.demandeList.table.header.priority= +faxtomail.demandeList.table.header.projectReference= +faxtomail.demandeList.table.header.range= +faxtomail.demandeList.table.header.receptionDate= +faxtomail.demandeList.table.header.savNumber= +faxtomail.demandeList.table.header.senderEmail= +faxtomail.demandeList.table.header.status= +faxtomail.demandeList.table.header.type= +faxtomail.demandeList.table.header.user= +faxtomail.demandeList.table.header.waitingState= faxtomail.demandeList.title= faxtomail.error.delete.startActionFile= faxtomail.error.errorpane.htmlmessage= Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-02-12 17:16:05 UTC (rev 9) @@ -62,20 +62,48 @@ faxtomail.demande.archive.button.label=Archiver faxtomail.demande.back.button.label=Retour faxtomail.demande.client.label=Client -faxtomail.demande.demandeNumber.label=N° Devis/Commande +faxtomail.demande.demandeNumber.label=N° Devis/Cde faxtomail.demande.docType.label=Type +faxtomail.demande.ediCodeNumber.label=Retour EDI +faxtomail.demande.etatAttente.label=État attente +faxtomail.demande.finishedProducts.label=Produits finis faxtomail.demande.gamme.label=Gamme faxtomail.demande.message.label=Message faxtomail.demande.object.label=Objet faxtomail.demande.print.button.label=Imprimer faxtomail.demande.priority.label=Priorité -faxtomail.demande.received.label=Reçu le -faxtomail.demande.ref.label=Rèf +faxtomail.demande.projectReference.label=Référence travaux +faxtomail.demande.receivedDate.label=Reçu le +faxtomail.demande.savNumber.label=SAV faxtomail.demande.save.button.label=Enregistrer +faxtomail.demande.sender.label=Émetteur faxtomail.demande.status.label=Statut -faxtomail.demande.tcc.label=Tcc par faxtomail.demande.title=Demande faxtomail.demande.transmit.button.label=Transmettre +faxtomail.demandeList.action.attachment=Ajouter une pièce-jointe +faxtomail.demandeList.action.attachment.mnemonic=A +faxtomail.demandeList.action.attachment.tip=Ajouter une pièce-jointe +faxtomail.demandeList.action.print=Imprimer +faxtomail.demandeList.action.print.mnemonic=I +faxtomail.demandeList.action.print.tip=Imprimer +faxtomail.demandeList.action.reply=Répondre +faxtomail.demandeList.action.reply.mnemonic=R +faxtomail.demandeList.action.reply.tip=Répondre +faxtomail.demandeList.table.header.client=Client +faxtomail.demandeList.table.header.commandNb=Numéro de commande +faxtomail.demandeList.table.header.ediCodeNumber=Code EDI +faxtomail.demandeList.table.header.folder=Dossier +faxtomail.demandeList.table.header.object=Objet +faxtomail.demandeList.table.header.priority=Priorité +faxtomail.demandeList.table.header.projectReference=Référence travaux +faxtomail.demandeList.table.header.range=Gamme +faxtomail.demandeList.table.header.receptionDate=Date de réception +faxtomail.demandeList.table.header.savNumber=Numéro SAV +faxtomail.demandeList.table.header.senderEmail=Email de l'émetteur +faxtomail.demandeList.table.header.status=Statut +faxtomail.demandeList.table.header.type=Type +faxtomail.demandeList.table.header.user=Pris pas +faxtomail.demandeList.table.header.waitingState=État attente faxtomail.demandeList.title=Gestion des fax faxtomail.error.delete.startActionFile= faxtomail.error.errorpane.htmlmessage= @@ -129,17 +157,5 @@ swing.error.desktop.browse.not.supported= swing.error.desktop.mail.not.supported= swing.error.desktop.not.supported= -tutti.action.create.error= -tutti.db.deleteCache.error= -tutti.editCruise.askCancelEditBeforeLeaving.cancelSaveCruise= -tutti.editCruise.askSaveBeforeLeaving.saveCruise= tutti.editCruise.title.create.cruise= tutti.editCruise.title.edit.cruise= -tutti.error.ui.business.error= -tutti.help.mkDir.error= -tutti.main.title.noSelectedCruise= -tutti.main.title.noSelectedProgram= -tutti.main.title.noSelectedProtocol= -tutti.main.title.selectedCruise= -tutti.main.title.selectedProgram= -tutti.main.title.selectedProtocol= Copied: trunk/faxtomail-ui-swing/src/main/resources/log4j.properties (from rev 7, trunk/faxtomail-ui-web/src/main/resources/log4j.properties) =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/log4j.properties (rev 0) +++ trunk/faxtomail-ui-swing/src/main/resources/log4j.properties 2014-02-12 17:16:05 UTC (rev 9) @@ -0,0 +1,15 @@ +log4j.rootCategory=WARN, console + +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %M %m%n + +# global level +log4j.logger.com.franciaflex.faxtomail=TRACE + +### persistence level +# log4j.logger.org.nuiton.topia=TRACE +# log4j.logger.com.franciaflex.faxtomail.persistence=TRACE + +### services level +# log4j.logger.com.franciaflex.faxtomail.services=TRACE Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-02-11 10:12:54 UTC (rev 8) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-02-12 17:16:05 UTC (rev 9) @@ -150,11 +150,21 @@ public Map<String, String> getEmailFields() { Map<String, String> result = new HashMap<>(); - result.put(Email.PROPERTY_EMAIL_ADDRESS, "Adresse email"); + result.put(Email.PROPERTY_SENDER_EMAIL_ADDRESS, "Adresse email"); result.put(Email.PROPERTY_RECEPTION_DATE, "Date de réception"); result.put(Email.PROPERTY_EDI_CODE_NUMBER, "Code EDI"); result.put(Email.PROPERTY_COMMAND_NB, "Numéro de commande"); - result.put(Email.PROPERTY_PROJECT_REFERENCE, "Référence travaux"); + result.put(Email.PROPERTY_OBJECT, "Objet"); + result.put(Email.PROPERTY_PROJECT_REFERENCE, "Référence travaux"); + result.put(Email.PROPERTY_PRIORITY, "Priorité"); + result.put(Email.PROPERTY_SAV_NUMBER, "Numéro SAV"); + result.put(Email.PROPERTY_RANGE, "Gamme"); + result.put(Email.PROPERTY_MAIL_FOLDER, "Dossier"); + result.put(Email.PROPERTY_CLIENT, "Client"); + result.put(Email.PROPERTY_DEMAND_STATUS, "Statut"); + result.put(Email.PROPERTY_DEMAND_TYPE, "Type"); + result.put(Email.PROPERTY_FAX_TO_MAIL_USER, "Pris par"); + result.put(Email.PROPERTY_ETAT_ATTENTE, "État attente"); return result; }