Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
February 2010
- 5 participants
- 39 discussions
r2862 - in trunk/pollen-business/src/main/java/org/chorem/pollen/business: services utils
by jruchaud@users.chorem.org 09 Feb '10
by jruchaud@users.chorem.org 09 Feb '10
09 Feb '10
Author: jruchaud
Date: 2010-02-09 16:31:45 +0100 (Tue, 09 Feb 2010)
New Revision: 2862
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java
Log:
#116 Rollback des transactions pour toutes les exceptions pas seulement la TopiaException
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -25,7 +25,6 @@
import org.chorem.pollen.business.persistence.UserAccountDAO;
import org.chorem.pollen.business.utils.ContextUtil;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Implémentation du service d'authentification.
@@ -68,7 +67,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -98,7 +97,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -71,7 +71,7 @@
}
return topiaId;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return "";
} finally {
@@ -101,7 +101,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
}
@@ -131,7 +131,7 @@
}
return resu;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -157,7 +157,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -189,7 +189,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -224,7 +224,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -262,7 +262,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -29,7 +29,6 @@
import org.chorem.pollen.business.persistence.PollenModelDAOHelper;
import org.chorem.pollen.business.utils.ContextUtil;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Implémentation du service de gestion des commentaires.
@@ -75,7 +74,7 @@
}
return topiaId;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return "";
} finally {
@@ -104,7 +103,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
}
@@ -131,7 +130,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -157,7 +156,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -189,7 +188,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -227,7 +226,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -36,7 +36,6 @@
import org.chorem.pollen.business.persistence.VotingListDAO;
import org.chorem.pollen.business.utils.ContextUtil;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Implémentation du service de gestion des listes.
@@ -96,7 +95,7 @@
}
return topiaId;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return "";
} finally {
@@ -141,7 +140,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
}
@@ -168,7 +167,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -194,7 +193,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -228,7 +227,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -260,7 +259,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -300,7 +299,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -339,7 +338,7 @@
}
return topiaId;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return "";
} finally {
@@ -376,7 +375,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
}
@@ -422,7 +421,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -448,7 +447,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -484,7 +483,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -518,7 +517,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -550,7 +549,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -585,7 +584,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -625,7 +624,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -32,7 +32,6 @@
import org.chorem.pollen.business.persistence.UserAccountDAO;
import org.chorem.pollen.business.utils.ContextUtil;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Implémentation du service de gestion des comptes.
@@ -79,7 +78,7 @@
log.debug("Entity created: " + topiaId);
}
return topiaId;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -117,7 +116,7 @@
}
return pollAccountEntity;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -152,7 +151,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
}
@@ -176,7 +175,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -211,7 +210,7 @@
}
return resu;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -245,7 +244,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -279,7 +278,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -313,7 +312,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -354,7 +353,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -39,7 +39,6 @@
import org.chorem.pollen.business.persistence.VotingList;
import org.chorem.pollen.business.utils.ContextUtil;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Implémentation du service de gestion des sondages.
@@ -127,7 +126,7 @@
}
return topiaId;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return "";
} finally {
@@ -160,7 +159,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -186,7 +185,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -218,7 +217,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -250,7 +249,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -281,7 +280,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -316,7 +315,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -354,7 +353,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -407,7 +406,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -449,7 +448,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -487,7 +486,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -520,7 +519,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -29,7 +29,6 @@
import org.chorem.pollen.business.persistence.PreventRuleDAO;
import org.chorem.pollen.business.utils.ContextUtil;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Gestion des règles de notification.
@@ -72,7 +71,7 @@
}
return topiaId;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return "";
} finally {
@@ -104,7 +103,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
}
@@ -137,7 +136,7 @@
}
return resu;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -165,7 +164,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -199,7 +198,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -240,7 +239,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -43,7 +43,6 @@
import org.chorem.pollen.votecounting.services.ServiceVoteCounting;
import org.chorem.pollen.votecounting.services.ServiceVoteCountingImpl;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Implémentation du service de gestion des résultats.
@@ -172,7 +171,7 @@
resultListDTO.setVoteCountingResultDTO(result);
return resultListDTO;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -251,7 +250,7 @@
}
return filename;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -28,7 +28,6 @@
import org.chorem.pollen.business.persistence.UserAccountDAO;
import org.chorem.pollen.business.utils.ContextUtil;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Implémentation du service de gestion des utilisateurs.
@@ -73,7 +72,7 @@
}
return topiaId;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -99,7 +98,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -124,7 +123,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -156,7 +155,7 @@
}
return result;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -194,7 +193,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
@@ -223,7 +222,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -250,7 +249,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -274,7 +273,7 @@
log.debug("Entity exists for the login " + login + ": "
+ userExists);
}
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return true;
} finally {
@@ -299,7 +298,7 @@
log.debug("Entity exists for the email " + email + ": "
+ userExists);
}
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return true;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -32,7 +32,6 @@
import org.chorem.pollen.business.persistence.VoteDAO;
import org.chorem.pollen.business.utils.ContextUtil;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
* Implémentation du service de gestion des votes.
@@ -142,7 +141,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -167,7 +166,7 @@
}
return true;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return false;
} finally {
@@ -206,7 +205,7 @@
}
return results;
- } catch (TopiaException e) {
+ } catch (Exception e) {
ContextUtil.doCatch(e, transaction);
return null;
} finally {
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java 2010-02-09 14:30:00 UTC (rev 2861)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java 2010-02-09 15:31:45 UTC (rev 2862)
@@ -289,7 +289,7 @@
}
}
- public static void doCatch(TopiaException e, TopiaContext transaction) {
+ public static void doCatch(Exception e, TopiaContext transaction) {
doCatch(e, transaction, "Échec lors du déroulement de la transaction");
}
1
0
r2861 - in trunk/pollen-business/src/main/java/org/chorem/pollen/business: services utils
by jruchaud@users.chorem.org 09 Feb '10
by jruchaud@users.chorem.org 09 Feb '10
09 Feb '10
Author: jruchaud
Date: 2010-02-09 15:30:00 +0100 (Tue, 09 Feb 2010)
New Revision: 2861
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java
Log:
#116 Fermeture de la transaction dans le bloc finally
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -60,7 +60,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -72,6 +71,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -90,7 +91,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -101,6 +101,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -65,7 +65,6 @@
topiaId = choiceEntity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -75,20 +74,22 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return "";
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@Override
public List<Choice> createChoices(List<ChoiceDTO> choices, String pollId,
- TopiaContext trans) {
+ TopiaContext transaction) {
if (choices.isEmpty() || pollId.length() == 0) {
return null;
}
List<Choice> result = null;
try {
- choiceDAO = PollenModelDAOHelper.getChoiceDAO(trans);
- converter.setTransaction(trans);
+ choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction);
+ converter.setTransaction(transaction);
result = new ArrayList<Choice>();
for (ChoiceDTO choice : choices) {
@@ -101,7 +102,7 @@
return result;
} catch (TopiaException e) {
- ContextUtil.doCatch(e, trans);
+ ContextUtil.doCatch(e, transaction);
return null;
}
}
@@ -124,7 +125,6 @@
transaction.commitTransaction();
resu = true;
}
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + choiceDTO.getId());
@@ -134,6 +134,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -149,7 +151,6 @@
choiceDAO.delete(choiceEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + choiceId);
@@ -159,6 +160,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -179,7 +182,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -190,6 +192,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -213,7 +217,6 @@
results = converter.createChoiceDTOs(choiceEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -224,6 +227,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -250,7 +255,6 @@
results = converter.createChoiceDTOs(choiceEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -261,6 +265,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceCommentImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -69,7 +69,6 @@
topiaId = commentEntity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -79,20 +78,22 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return "";
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@Override
public List<Comment> createComments(List<CommentDTO> comments,
- String pollId, TopiaContext trans) {
+ String pollId, TopiaContext transaction) {
if (comments.isEmpty() || pollId.length() == 0) {
return null;
}
List<Comment> result = null;
try {
- commentDAO = PollenModelDAOHelper.getCommentDAO(trans);
- converter.setTransaction(trans);
+ commentDAO = PollenModelDAOHelper.getCommentDAO(transaction);
+ converter.setTransaction(transaction);
result = new ArrayList<Comment>();
for (CommentDTO comment : comments) {
@@ -104,7 +105,7 @@
return result;
} catch (TopiaException e) {
- ContextUtil.doCatch(e, trans);
+ ContextUtil.doCatch(e, transaction);
return null;
}
}
@@ -124,7 +125,6 @@
commentDAO.update(commentEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + comment.getId());
@@ -134,6 +134,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -149,7 +151,6 @@
commentDAO.delete(commentEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + commentId);
@@ -159,6 +160,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -179,7 +182,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -190,6 +192,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -216,7 +220,6 @@
results = converter.createCommentDTOs(commentEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -227,6 +230,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -90,7 +90,6 @@
topiaId = votingListEntity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -100,21 +99,23 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return "";
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@Override
public List<VotingList> createVotingLists(List<VotingListDTO> votingLists,
- String pollId, TopiaContext trans) {
+ String pollId, TopiaContext transaction) {
if (votingLists.isEmpty() || pollId.length() == 0) {
return null;
}
List<VotingList> result = null;
try {
- votingListDAO = PollenModelDAOHelper.getVotingListDAO(trans);
+ votingListDAO = PollenModelDAOHelper.getVotingListDAO(transaction);
- votingListConverter.setTransaction(trans);
+ votingListConverter.setTransaction(transaction);
result = new ArrayList<VotingList>();
for (VotingListDTO votingList : votingLists) {
@@ -141,7 +142,7 @@
return result;
} catch (TopiaException e) {
- ContextUtil.doCatch(e, trans);
+ ContextUtil.doCatch(e, transaction);
return null;
}
}
@@ -161,7 +162,6 @@
votingListDAO.update(entity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + votingList.getId());
@@ -171,6 +171,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -186,7 +188,6 @@
votingListDAO.delete(entity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + votingListId);
@@ -196,6 +197,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -218,7 +221,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -229,6 +231,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -249,7 +253,6 @@
.createVotingListDTOs(votingListEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -260,6 +263,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -288,7 +293,6 @@
.createVotingListDTOs(votingListEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -299,6 +303,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -327,7 +333,6 @@
topiaId = entity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -337,20 +342,22 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return "";
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@Override
public boolean createPersonLists(List<PersonListDTO> personLists,
- String userId, TopiaContext trans) {
+ String userId, TopiaContext transaction) {
if (personLists.isEmpty() || userId.length() == 0) {
return false;
}
try {
- personListDAO = PollenModelDAOHelper.getPersonListDAO(trans);
+ personListDAO = PollenModelDAOHelper.getPersonListDAO(transaction);
- personListConverter.setTransaction(trans);
+ personListConverter.setTransaction(transaction);
for (PersonListDTO personList : personLists) {
PersonList entity = personListDAO.create();
@@ -361,7 +368,7 @@
account.setPersonListId(entity.getTopiaId());
}
entity.setPollAccount(spa.createPollAccounts(personList
- .getPollAccountDTOs(), trans));
+ .getPollAccountDTOs(), transaction));
personList.setUserId(userId);
personListConverter
@@ -370,7 +377,7 @@
return true;
} catch (TopiaException e) {
- ContextUtil.doCatch(e, trans);
+ ContextUtil.doCatch(e, transaction);
return false;
}
}
@@ -409,7 +416,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + personList.getId());
@@ -419,6 +425,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -434,7 +442,6 @@
personListDAO.delete(entity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + personListId);
@@ -444,6 +451,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -468,7 +477,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug(personListEntities.size()
@@ -479,6 +487,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -501,7 +511,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -512,6 +521,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -532,7 +543,6 @@
.createPersonListDTOs(personListEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -543,6 +553,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -566,7 +578,6 @@
.createPersonListDTOs(personListEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -577,6 +588,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -605,7 +618,6 @@
.createPersonListDTOs(personListEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -616,6 +628,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -74,7 +74,6 @@
topiaId = pollAccountEntity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -83,6 +82,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -110,7 +111,6 @@
topiaId = pollAccountEntity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -120,21 +120,23 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@Override
public List<PollAccount> createPollAccounts(
- List<PollAccountDTO> pollAccounts, TopiaContext trans) {
+ List<PollAccountDTO> pollAccounts, TopiaContext transaction) {
if (pollAccounts.isEmpty()) {
return null;
}
List<PollAccount> result = null;
try {
- pollAccountDAO = PollenModelDAOHelper.getPollAccountDAO(trans);
+ pollAccountDAO = PollenModelDAOHelper.getPollAccountDAO(transaction);
- converter.setTransaction(trans);
+ converter.setTransaction(transaction);
result = new ArrayList<PollAccount>();
for (PollAccountDTO pollAccount : pollAccounts) {
@@ -151,7 +153,7 @@
return result;
} catch (TopiaException e) {
- ContextUtil.doCatch(e, trans);
+ ContextUtil.doCatch(e, transaction);
return null;
}
}
@@ -168,7 +170,6 @@
.findByTopiaId(pollAccountId);
pollAccountDAO.delete(pollAccountEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + pollAccountId);
@@ -178,6 +179,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -203,8 +206,6 @@
resu = true;
}
- transaction.closeContext();
-
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + pollAccountDTO.getId());
}
@@ -213,6 +214,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -235,7 +238,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -246,6 +248,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -268,7 +272,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -279,6 +282,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -301,7 +306,6 @@
results = converter.createPollAccountDTOs(pollAccountEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -312,6 +316,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -341,7 +347,6 @@
results = converter.createPollAccountDTOs(pollAccountEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -352,6 +357,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -118,7 +118,6 @@
.getPreventRuleDTOs(), topiaId, transaction));
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("creator after creation: " + pollEntity.getCreator());
@@ -131,6 +130,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return "";
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -153,7 +154,6 @@
pollDAO.update(pollEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + pollDTO.getId());
@@ -163,6 +163,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -178,7 +180,6 @@
pollDAO.delete(pollEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + pollId);
@@ -188,6 +189,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -208,7 +211,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -219,6 +221,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -239,7 +243,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -250,6 +253,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -269,7 +274,6 @@
results = converter.createPollDTOs(pollEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -280,6 +284,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -303,7 +309,6 @@
results = converter.createPollDTOs(pollEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -314,6 +319,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -340,7 +347,6 @@
.createPollDTOs(new ArrayList<Poll>(pollEntities));
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -351,6 +357,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -392,7 +400,6 @@
.createPollDTOs(new ArrayList<Poll>(pollEntities));
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -403,6 +410,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -433,7 +442,6 @@
results = converter.createPollDTOs(pollEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -444,6 +452,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -470,7 +480,6 @@
results = converter.createPollDTOs(pollEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -481,6 +490,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -503,7 +514,6 @@
pollEntity.update();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + pollId);
@@ -513,6 +523,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -66,7 +66,6 @@
topiaId = preventRuleEntity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -76,21 +75,23 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return "";
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@Override
public List<PreventRule> createPreventRules(
- List<PreventRuleDTO> preventRules, String pollId, TopiaContext trans) {
+ List<PreventRuleDTO> preventRules, String pollId, TopiaContext transaction) {
if (preventRules.isEmpty() || pollId.length() == 0) {
return null;
}
List<PreventRule> result = null;
try {
- preventRuleDAO = PollenModelDAOHelper.getPreventRuleDAO(trans);
+ preventRuleDAO = PollenModelDAOHelper.getPreventRuleDAO(transaction);
- converter.setTransaction(trans);
+ converter.setTransaction(transaction);
result = new ArrayList<PreventRule>();
for (PreventRuleDTO preventRule : preventRules) {
@@ -104,7 +105,7 @@
return result;
} catch (TopiaException e) {
- ContextUtil.doCatch(e, trans);
+ ContextUtil.doCatch(e, transaction);
return null;
}
}
@@ -130,7 +131,6 @@
transaction.commitTransaction();
resu = true;
}
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + preventRuleDTO.getId());
@@ -140,6 +140,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -157,7 +159,6 @@
preventRuleDAO.delete(preventRuleEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + preventRuleId);
@@ -167,6 +168,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -189,7 +192,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -200,6 +202,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -229,7 +233,6 @@
results = converter.createPreventRuleDTOs(preventRuleEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -240,6 +243,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -132,7 +132,6 @@
// Conversion et trie des résultats
List<ResultDTO> list = converter.createResultDTOs(ePoll);
- transaction.closeContext();
VoteCountingType voteCountingType = EnumController
.getVoteCountingType(ePoll);
@@ -176,6 +175,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -234,7 +235,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
// Transformation du sondage
PollExportDTO pollExport = new PollExportDTO();
@@ -254,6 +254,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -67,7 +67,6 @@
topiaId = userEntity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -77,6 +76,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -92,7 +93,6 @@
userDAO.delete(userEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + userEntity.getTopiaId());
@@ -102,6 +102,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -116,7 +118,6 @@
UserAccount userEntity = userDAO.findByTopiaId(user.getId());
userDAO.delete(userEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + userEntity.getTopiaId());
@@ -126,6 +127,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -146,7 +149,6 @@
}
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity found: "
@@ -157,6 +159,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -183,7 +187,6 @@
results = converter.createUserDTOs(userEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -194,6 +197,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -212,7 +217,6 @@
userDAO.update(userEntity);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + user.getId());
@@ -222,8 +226,9 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
-
}
@Override
@@ -239,7 +244,6 @@
userEntity.setPassword(newPassword);
userEntity.update();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + user.getId());
@@ -249,6 +253,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -264,8 +270,6 @@
userExists = false;
}
- transaction.closeContext();
-
if (log.isDebugEnabled()) {
log.debug("Entity exists for the login " + login + ": "
+ userExists);
@@ -273,6 +277,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return true;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
return userExists;
}
@@ -289,8 +295,6 @@
userExists = false;
}
- transaction.closeContext();
-
if (log.isDebugEnabled()) {
log.debug("Entity exists for the email " + email + ": "
+ userExists);
@@ -298,6 +302,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return true;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
return userExists;
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -109,7 +109,6 @@
topiaId = voteEntity.getTopiaId();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity created: " + topiaId);
@@ -119,6 +118,8 @@
} catch (Exception eee) {
ContextUtil.doCatch(eee, transaction, "Problem when creating vote with pollAccount");
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -135,7 +136,6 @@
voteEntity.update();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity updated: " + voteDTO.getId());
@@ -145,6 +145,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -159,7 +161,6 @@
voteEntity.delete();
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + voteId);
@@ -169,6 +170,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return false;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
@@ -196,7 +199,6 @@
results = converter.createVoteDTOs(voteEntities);
transaction.commitTransaction();
- transaction.closeContext();
if (log.isDebugEnabled()) {
log.debug("Entities found: "
@@ -207,6 +209,8 @@
} catch (TopiaException e) {
ContextUtil.doCatch(e, transaction);
return null;
+ } finally {
+ ContextUtil.doFinally(transaction);
}
}
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java 2010-02-09 13:53:44 UTC (rev 2860)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java 2010-02-09 14:30:00 UTC (rev 2861)
@@ -314,15 +314,22 @@
if (log.isErrorEnabled()) {
log.error("Échec lors du rollback de la transaction", ex);
}
- } finally {
- try {
- transaction.closeContext();
- } catch (TopiaException ex) {
- if (log.isErrorEnabled()) {
- log.error(
- "Échec lors de la fermeture de la transaction",
- ex);
- }
+ }
+ }
+ }
+
+ /**
+ * Méthode exécutée dans tous les cas pour libérer la transaction.
+ *
+ * @param transaction transaction en cours
+ */
+ public static void doFinally(TopiaContext transaction) {
+ if (transaction != null) {
+ try {
+ transaction.closeContext();
+ } catch (TopiaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Échec lors de la fermeture de la transaction", ex);
}
}
}
1
0
Author: jruchaud
Date: 2010-02-09 14:53:44 +0100 (Tue, 09 Feb 2010)
New Revision: 2860
Modified:
trunk/pollen-ui/pom.xml
Log:
Supression configuration de netbeans
Modified: trunk/pollen-ui/pom.xml
===================================================================
--- trunk/pollen-ui/pom.xml 2010-02-09 13:50:24 UTC (rev 2859)
+++ trunk/pollen-ui/pom.xml 2010-02-09 13:53:44 UTC (rev 2860)
@@ -97,7 +97,6 @@
<properties>
<redmine.releaseFiles>target/${project.build.finalName}.war</redmine.releaseFiles>
- <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>
<reporting>
1
0
09 Feb '10
Author: jruchaud
Date: 2010-02-09 14:50:24 +0100 (Tue, 09 Feb 2010)
New Revision: 2859
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java
trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java
trunk/pollen-ui/
trunk/pollen-ui/pom.xml
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java
trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java
trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java
Log:
#110 Suppression du contenu m?\195?\169tier dans les DTO
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -25,6 +25,7 @@
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.business.persistence.PollDAO;
import org.chorem.pollen.business.persistence.PollenModelDAOHelper;
+import org.chorem.pollen.votecounting.business.NumberMethod;
import org.nuiton.topia.TopiaException;
/**
@@ -64,7 +65,10 @@
public ChoiceDTO createChoiceDTO(Choice eChoice) {
ChoiceDTO choiceDTO = new ChoiceDTO();
choiceDTO.setId(eChoice.getTopiaId());
- choiceDTO.setName(eChoice.getName());
+ String eChoiceName = eChoice.getName();
+ choiceDTO.setName(eChoiceName);
+ choiceDTO.setHidden(eChoiceName != null
+ && eChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX));
choiceDTO.setDescription(eChoice.getDescription());
choiceDTO.setValidate(eChoice.getValidate());
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -27,6 +27,7 @@
import org.chorem.pollen.business.persistence.PollenModelDAOHelper;
import org.chorem.pollen.business.persistence.Result;
import org.chorem.pollen.business.persistence.ResultDAO;
+import org.chorem.pollen.votecounting.business.NumberMethod;
import org.chorem.pollen.votecounting.dto.ChoiceDTO;
import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO;
import org.nuiton.topia.TopiaContext;
@@ -87,7 +88,10 @@
ResultDTO dto = new ResultDTO();
dto.setId(res.getTopiaId());
dto.setPollId(ePoll.getPollId());
- dto.setName(res.getName());
+ String resName = res.getName();
+ dto.setName(resName);
+ dto.setHidden(resName != null &&
+ resName.startsWith(NumberMethod.HIDDEN_PREFIX));
dto.setValue(res.getResultValue());
dto.setByGroup(res.getByGroup());
dto.setChoiceType(EnumController.getChoiceType(ePoll));
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -26,6 +26,7 @@
import org.chorem.pollen.business.persistence.VotingList;
import org.chorem.pollen.business.services.ServicePollAccount;
import org.chorem.pollen.business.services.ServicePollAccountImpl;
+import org.chorem.pollen.votecounting.business.NumberMethod;
import org.chorem.pollen.votecounting.dto.CommentDTO;
import org.chorem.pollen.votecounting.dto.PollChoiceDTO;
import org.chorem.pollen.votecounting.dto.PollDTO;
@@ -99,7 +100,10 @@
private static PollChoiceDTO createPollChoiceDTO(Choice choice) {
PollChoiceDTO choiceDTO = new PollChoiceDTO(choice.getTopiaId());
- choiceDTO.setName(choice.getName());
+ String choiceName = choice.getName();
+ choiceDTO.setName(choiceName);
+ choiceDTO.setHidden(choiceName != null &&
+ choiceName.startsWith(NumberMethod.HIDDEN_PREFIX));
choiceDTO.setDescription(choice.getDescription());
return choiceDTO;
}
@@ -203,7 +207,10 @@
private static org.chorem.pollen.business.dto.ChoiceDTO createPollChoiceDTO(
PollChoiceDTO pollChoiceDTO) {
org.chorem.pollen.business.dto.ChoiceDTO bChoiceDTO = new org.chorem.pollen.business.dto.ChoiceDTO();
- bChoiceDTO.setName(pollChoiceDTO.getName());
+ String pollChoiceName = pollChoiceDTO.getName();
+ bChoiceDTO.setName(pollChoiceName);
+ bChoiceDTO.setHidden(pollChoiceName != null
+ && pollChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX));
bChoiceDTO.setDescription(pollChoiceDTO.getDescription());
return bChoiceDTO;
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -29,8 +29,6 @@
*/
public class ChoiceDTO implements Serializable {
- public static final String HIDDEN_PREFIX = PollChoiceDTO.HIDDEN_PREFIX;
-
private static final long serialVersionUID = 1L;
private String id = "";
@@ -47,6 +45,8 @@
private String pollId = "";
+ private boolean hidden = false;
+
public ChoiceDTO() {
}
@@ -118,11 +118,10 @@
}
public boolean isHidden() {
- if (name != null) {
- return name.startsWith(HIDDEN_PREFIX);
- }
-
- return false;
+ return hidden;
}
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
}
\ No newline at end of file
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -44,6 +44,8 @@
private boolean byGroup = false;
+ private boolean hidden = false;
+
public ResultDTO() {
}
@@ -118,10 +120,10 @@
}
public boolean isHidden() {
- if (name != null) {
- return name.startsWith(ChoiceDTO.HIDDEN_PREFIX);
- }
-
- return false;
+ return hidden;
}
+
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
}
\ No newline at end of file
Property changes on: trunk/pollen-ui
___________________________________________________________________
Modified: svn:ignore
- target
.classpath
.project
.settings
*.ipr
*.iws
*.iml
.pollen
+ target
.classpath
.project
.settings
*.ipr
*.iws
*.iml
.pollen
profiles.xml
Modified: trunk/pollen-ui/pom.xml
===================================================================
--- trunk/pollen-ui/pom.xml 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-ui/pom.xml 2010-02-09 13:50:24 UTC (rev 2859)
@@ -97,6 +97,7 @@
<properties>
<redmine.releaseFiles>target/${project.build.finalName}.war</redmine.releaseFiles>
+ <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>
<reporting>
@@ -116,7 +117,7 @@
<build>
<!-- call result war : pollen-xxx.war -->
<finalName>pollen-${project.version}</finalName>
-
+
<!-- Add main class into war to make it executable -->
<plugins>
<plugin>
@@ -135,7 +136,7 @@
<includes>
<include>**/war/Winstone*</include>
</includes>
- </overlay>
+ </overlay>
<overlay>
<groupId>org.jvnet.hudson.winstone</groupId>
<artifactId>winstone</artifactId>
@@ -178,3 +179,4 @@
</repository>
</repositories>
</project>
+
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -56,6 +56,7 @@
import org.chorem.pollen.ui.components.ImageContextLink;
import org.chorem.pollen.ui.data.Lien;
import org.chorem.pollen.ui.services.Configuration;
+import org.chorem.pollen.votecounting.business.NumberMethod;
import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO;
import org.slf4j.Logger;
@@ -399,7 +400,8 @@
if (result.isHidden()) {
String name = result.getName();
int indexOf = name.indexOf('#');
- String choice = name.substring(ChoiceDTO.HIDDEN_PREFIX.length(), indexOf);
+ String choice = name.substring(
+ NumberMethod.HIDDEN_PREFIX.length(), indexOf);
List<String> votes = choicesResults.get(choice);
if (votes == null) {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -79,6 +79,7 @@
import org.chorem.pollen.ui.services.Configuration;
import org.chorem.pollen.ui.utils.FeedUtil;
import org.chorem.pollen.ui.utils.ImageUtil;
+import org.chorem.pollen.votecounting.business.NumberMethod;
import org.slf4j.Logger;
/**
@@ -344,8 +345,9 @@
// creates a new hidden choice
ChoiceDTO hiddenChoice = new ChoiceDTO();
- hiddenChoice.setName(ChoiceDTO.HIDDEN_PREFIX +
+ hiddenChoice.setName(NumberMethod.HIDDEN_PREFIX +
choice.getName() + "#" + votingId);
+ hiddenChoice.setHidden(true);
hiddenChoice.setValue(choice.getValue());
hiddenChoice.setPollId(choice.getPollId());
hiddenChoice.setVoteId(choice.getVoteId());
Modified: trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java
===================================================================
--- trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -11,7 +11,10 @@
* @since 1.2.2
*/
public class NumberMethod implements Method {
-
+
+ /** Permet de rajouter des choix cachés */
+ public static final String HIDDEN_PREFIX = "HIDDEN_";
+
@Override
public void executeCounting(List<Choice> choices, boolean byGroup) {
Modified: trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java
===================================================================
--- trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -22,24 +22,26 @@
* @version $Id$
*/
public class PollChoiceDTO {
- public static final String HIDDEN_PREFIX = "HIDDEN_";
-
private String idChoice;
private String name;
private String description;
+ private boolean hidden;
+
public PollChoiceDTO(String idChoice) {
this.idChoice = idChoice;
this.name = "";
this.description = "";
+ this.hidden = false;
}
public PollChoiceDTO(int idChoice) {
this.idChoice = String.valueOf(idChoice);
this.name = "";
this.description = "";
+ this.hidden = false;
}
public String getIdChoice() {
@@ -67,10 +69,10 @@
}
public boolean isHidden() {
- if (name != null) {
- return name.startsWith(HIDDEN_PREFIX);
- }
-
- return false;
+ return hidden;
}
+
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
}
\ No newline at end of file
Modified: trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java
===================================================================
--- trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java 2010-02-04 12:48:09 UTC (rev 2858)
+++ trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java 2010-02-09 13:50:24 UTC (rev 2859)
@@ -27,6 +27,7 @@
import org.chorem.pollen.common.ChoiceType;
import org.chorem.pollen.common.PollType;
import org.chorem.pollen.common.VoteCountingType;
+import org.chorem.pollen.votecounting.business.NumberMethod;
import org.chorem.pollen.votecounting.dto.ChoiceDTO;
import org.chorem.pollen.votecounting.dto.CommentDTO;
import org.chorem.pollen.votecounting.dto.PollChoiceDTO;
@@ -529,7 +530,12 @@
Element pollChoiceElm = (Element) i.next();
PollChoiceDTO pollChoice = new PollChoiceDTO(pollChoiceElm
.getAttributeValue("idChoice"));
- pollChoice.setName(pollChoiceElm.getChild("name").getValue());
+
+ String pollChoiceName = pollChoiceElm.getChild("name").getValue();
+ pollChoice.setName(pollChoiceName);
+ pollChoice.setHidden(pollChoiceName != null
+ && pollChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX));
+
pollChoice.setDescription(pollChoiceElm.getChild("description")
.getValue());
1
0
Author: echatellier
Date: 2010-02-04 13:48:09 +0100 (Thu, 04 Feb 2010)
New Revision: 2858
Modified:
trunk/pollen-ui/src/main/webapp/js/lightbox.js
Log:
Fix Image x of x (remove s)
Modified: trunk/pollen-ui/src/main/webapp/js/lightbox.js
===================================================================
--- trunk/pollen-ui/src/main/webapp/js/lightbox.js 2010-02-02 09:33:50 UTC (rev 2857)
+++ trunk/pollen-ui/src/main/webapp/js/lightbox.js 2010-02-04 12:48:09 UTC (rev 2858)
@@ -74,7 +74,7 @@
// When grouping images this is used to write: Image # of #.
// Change it for non-english localization
- labelImage: "Images",
+ labelImage: "Image",
labelOf: "of"
}, window.LightboxOptions || {});
1
0
Author: echatellier
Date: 2010-02-02 10:33:50 +0100 (Tue, 02 Feb 2010)
New Revision: 2857
Modified:
trunk/pollen-ui/src/main/webapp/js/lightbox.js
Log:
Fix overlay width
Modified: trunk/pollen-ui/src/main/webapp/js/lightbox.js
===================================================================
--- trunk/pollen-ui/src/main/webapp/js/lightbox.js 2010-02-01 17:46:41 UTC (rev 2856)
+++ trunk/pollen-ui/src/main/webapp/js/lightbox.js 2010-02-02 09:33:50 UTC (rev 2857)
@@ -221,7 +221,10 @@
// stretch overlay to fill page and fade in
var arrayPageSize = this.getPageSize();
- $('overlay').setStyle({height: arrayPageSize[1] + 'px' });
+
+ // EC-20100202 : fix width size
+ //$('overlay').setStyle({height: arrayPageSize[1] + 'px' });
+ $('overlay').setStyle({height: arrayPageSize[0] + 'px', width: arrayPageSize[0] + 'px'});
new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
@@ -311,7 +314,9 @@
IsResized = false;
}
}
- this.overlay.setStyle({ height: arrayPageSize[1] + 'px' });
+ // EC-20100202 : fix width size
+ //this.overlay.setStyle({height: arrayPageSize[1] + 'px' });
+ this.overlay.setStyle({width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px'});
this.lightboxImage.setStyle({ height: imgHeight + 'px', width: imgWidth + 'px'});
if (recall == true) {
@@ -541,11 +546,11 @@
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
- pageWidth = xScroll;
+ pageWidth = windowWidth;
} else {
- pageWidth = windowWidth;
+ pageWidth = xScroll;
}
-
+
return [pageWidth,pageHeight,windowWidth,windowHeight];
}
}
1
0
r2856 - in trunk/pollen-ui/src/main: java/org/chorem/pollen/ui/components java/org/chorem/pollen/ui/pages/poll resources/org/chorem/pollen/ui/components webapp/css webapp/img webapp/img/lightbox webapp/js webapp/poll
by echatellier@users.chorem.org 01 Feb '10
by echatellier@users.chorem.org 01 Feb '10
01 Feb '10
Author: echatellier
Date: 2010-02-01 18:46:41 +0100 (Mon, 01 Feb 2010)
New Revision: 2856
Added:
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/ImageContextLink.java
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Image.tml
trunk/pollen-ui/src/main/webapp/css/lightbox.css
trunk/pollen-ui/src/main/webapp/img/lightbox/
trunk/pollen-ui/src/main/webapp/img/lightbox/closelabel.gif
trunk/pollen-ui/src/main/webapp/img/lightbox/loading.gif
trunk/pollen-ui/src/main/webapp/img/lightbox/nextlabel.gif
trunk/pollen-ui/src/main/webapp/img/lightbox/prevlabel.gif
trunk/pollen-ui/src/main/webapp/js/lightbox.js
Removed:
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/ImageContextLink.java
Modified:
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Image.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ImageDisplay.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
trunk/pollen-ui/src/main/webapp/poll/ImageDisplay.tml
trunk/pollen-ui/src/main/webapp/poll/Results.tml
trunk/pollen-ui/src/main/webapp/poll/VoteForPoll.tml
Log:
Fix #103 : Pr?\195?\169visualisation des images (based on lightbox scripts)
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Image.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Image.java 2010-02-01 14:30:01 UTC (rev 2855)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Image.java 2010-02-01 17:46:41 UTC (rev 2856)
@@ -27,13 +27,10 @@
import org.apache.commons.lang.StringUtils;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
-import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.StreamResponse;
import org.apache.tapestry5.annotations.Parameter;
-import org.apache.tapestry5.dom.Element;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Response;
-import org.chorem.pollen.ui.base.ContextLink;
import org.slf4j.Logger;
/**
@@ -52,55 +49,88 @@
* @author rannou
* @version $Id$
*/
-public class Image {
+public class Image extends ImageContextLink {
/** Chemin de l'image */
@Parameter(required = true)
- private String _src;
+ private String src;
- @Parameter(required = true)
- private ContextLink _context;
-
/** Texte alternatif */
@Parameter
- private String _alt;
+ private String alt;
/** Largeur de l'image */
@Parameter
- private int _width;
+ private int width;
/** Hauteur de l'image */
@Parameter
- private int _height;
+ private int height;
@Inject
private Logger logger;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
- void beginRender(MarkupWriter writer) {
- Link link = _resources.createEventLink("imageLink", _src, _width,
- _height);
- Element img = writer.element("img", "src", link, "alt", _alt);
+ /**
+ * @return the src
+ */
+ public String getSrc() {
+ return src;
+ }
- _resources.renderInformalParameters(writer);
+ /**
+ * @return the alt
+ */
+ public String getAlt() {
+ return alt;
}
- void afterRender(MarkupWriter writer) {
- writer.end();
+ /**
+ * @return the width
+ */
+ public int getWidth() {
+ return width;
}
+ /**
+ * @return the height
+ */
+ public int getHeight() {
+ return height;
+ }
+
+ /**
+ * Create a link to call "thumbLink" event.
+ *
+ * @return event link
+ */
+ public Link getThumbLink() {
+ return resources.createEventLink("imageLink", src, width,
+ height, true);
+ }
+
+ /**
+ * Create a link to call "imageLink" event.
+ *
+ * @return event link
+ */
+ public Link getImageLink() {
+ return resources.createEventLink("imageLink", src, width,
+ height, false);
+ }
+
/** Affichage de l'image */
public StreamResponse onImageLink(final String src, final int width,
- final int height) {
+ final int height, boolean thumb) {
// security : src containing .. are filtered, to not access to full system
if (StringUtils.isEmpty(src) || src.contains("..")) {
return null;
}
- File file = _context.getFile(src);
+ File file = getFile(src, thumb);
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
@@ -132,7 +162,7 @@
return stream;
}
- public void prepareResponse(Response arg0) {
+ public void prepareResponse(Response response) {
}
}
Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/ImageContextLink.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/ImageContextLink.java 2010-02-01 14:30:01 UTC (rev 2855)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/ImageContextLink.java 2010-02-01 17:46:41 UTC (rev 2856)
@@ -1,68 +0,0 @@
-
-package org.chorem.pollen.ui.components;
-
-import java.io.File;
-import org.apache.tapestry5.annotations.Parameter;
-import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.ui.base.ContextLink;
-import org.chorem.pollen.ui.services.Configuration;
-
-/**
- * ImageContextLink
- *
- * Created: 4 nov. 2009
- *
- * @author fdesbois
- * @version $Revision$
- *
- * Mise a jour: $Date$
- * par : $Author$
- */
-public class ImageContextLink implements ContextLink {
-
- public static final String THUMB_PREFIX = "thumb_";
-
- @Inject
- private Configuration config;
-
- /**
- * Directory for files getting or saving from this context
- * (ie. subdirectory where images are uploaded, main directory is defined by contextPath)
- */
- @Parameter
- private String dir;
-
- /**
- * true for thumbnails images prefixed by {@link Configuration.IMG_DIR}
- */
- @Parameter
- private boolean thumb;
-
- @Override
- public String getContextPath() {
- return config.getProperty(Configuration.IMG_DIR);
- }
-
- @Override
- public File getFile(String filename) {
- if (thumb) {
- filename = THUMB_PREFIX + filename;
- }
- return new File(getImageDir(), filename);
- }
-
- /**
- * Get the directory where are uploaded the images from the context.
- * @return a File corresponding to the image directory
- */
- public File getImageDir() {
- File result = null;
- if (dir != null && !dir.isEmpty()) {
- result = new File(getContextPath(), dir);
- } else {
- result = new File(getContextPath());
- }
- return result;
- }
-
-}
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/ImageContextLink.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/ImageContextLink.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/ImageContextLink.java 2010-02-01 17:46:41 UTC (rev 2856)
@@ -0,0 +1,87 @@
+/* *##% Pollen
+ * Copyright (C) 2009 CodeLutin
+ *
+ * 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/>. ##%*/
+
+package org.chorem.pollen.ui.components;
+
+import java.io.File;
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.ui.base.ContextLink;
+import org.chorem.pollen.ui.services.Configuration;
+
+/**
+ * ImageContextLink
+ *
+ * Created: 4 nov. 2009
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class ImageContextLink implements ContextLink {
+
+ public static final String THUMB_PREFIX = "thumb_";
+
+ @Inject
+ private Configuration config;
+
+ /**
+ * Directory for files getting or saving from this context
+ * (ie. subdirectory where images are uploaded, main directory is defined by contextPath)
+ */
+ @Parameter
+ private String dir;
+
+ /**
+ * true for thumbnails images prefixed by {@link Configuration.IMG_DIR}
+ */
+ @Parameter
+ private boolean thumb;
+
+ @Override
+ public String getContextPath() {
+ return config.getProperty(Configuration.IMG_DIR);
+ }
+
+ @Override
+ public File getFile(String filename) {
+ return getFile(filename, thumb);
+ }
+
+ public File getFile(String filename, boolean thumb) {
+ if (thumb) {
+ filename = THUMB_PREFIX + filename;
+ }
+ return new File(getImageDir(), filename);
+ }
+
+ /**
+ * Get the directory where are uploaded the images from the context.
+ * @return a File corresponding to the image directory
+ */
+ public File getImageDir() {
+ File result = null;
+ if (dir != null && !dir.isEmpty()) {
+ result = new File(getContextPath(), dir);
+ } else {
+ result = new File(getContextPath());
+ }
+ return result;
+ }
+
+}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ImageDisplay.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ImageDisplay.java 2010-02-01 14:30:01 UTC (rev 2855)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ImageDisplay.java 2010-02-01 17:46:41 UTC (rev 2856)
@@ -36,6 +36,8 @@
*
* @author rannou
* @version $Id$
+ *
+ * @deprecated not used anymore (displayed by ligthbox now)
*/
public class ImageDisplay {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-02-01 14:30:01 UTC (rev 2855)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-02-01 17:46:41 UTC (rev 2856)
@@ -30,6 +30,7 @@
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.Component;
+import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary;
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.InjectPage;
@@ -64,7 +65,8 @@
* @author rannou
* @version $Id$
*/
-@IncludeStylesheet("context:css/results.css")
+@IncludeStylesheet({"context:css/results.css", "context:css/lightbox.css"})
+@IncludeJavaScriptLibrary({"${tapestry.scriptaculous}/builder.js","context:js/lightbox.js"})
public class Results {
@Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
@Property
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-02-01 14:30:01 UTC (rev 2855)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-02-01 17:46:41 UTC (rev 2856)
@@ -30,9 +30,9 @@
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ValidationException;
import org.apache.tapestry5.annotations.Component;
+import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary;
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.InjectComponent;
-import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
@@ -88,7 +88,8 @@
* @author rannou
* @version $Id$
*/
-@IncludeStylesheet("context:css/vote.css")
+@IncludeStylesheet({"context:css/vote.css", "context:css/lightbox.css"})
+@IncludeJavaScriptLibrary({"${tapestry.scriptaculous}/builder.js","context:js/lightbox.js"})
public class VoteForPoll {
@Inject
@@ -188,8 +189,8 @@
@Retain
private BeanModel voteModel;
- @InjectPage
- private ImageDisplay imageDisplay;
+ /*@InjectPage
+ private ImageDisplay imageDisplay;*/
@InjectComponent
private Zone pollZone;
@@ -843,6 +844,7 @@
newImageChoice.setName(newImageChoice.getImg().getFileName()
.replace(' ', '_'));
poll.getChoiceDTOs().add(newImageChoice);
+ //File imgFile = getImgContext().getImageDir(); // dir set in getImgContext()
File imgFile = getImgContext().getImageDir(); // dir set in getImgContext()
ImageUtil.saveImage(newImageChoice, imgFile);
choiceName = newImageChoice.getName();
@@ -1019,20 +1021,20 @@
}
/** Action réalisée lorsqu'on clique sur l'image */
- Object onDisplayImage(String choiceId) {
+ /*Object onDisplayImage(String choiceId) {
imageDisplay.setPoll(poll);
imageDisplay.setChoiceId(choiceId);
imageDisplay.setPageStyle("Vote");
return imageDisplay;
- }
+ }*/
/** Affichage de "" plutôt que 0 pour le Condorcet */
- String onToClientFromCondorcetInput() {
+ /*String onToClientFromCondorcetInput() {
if (choiceOfVote.getValue() == 0) {
return "";
}
return null;
- }
+ }*/
/** Récupération d'un entier plutôt que "" pour le Condorcet */
/*Object onParseClientFromCondorcetInput(String input) {
Added: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Image.tml
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Image.tml (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Image.tml 2010-02-01 17:46:41 UTC (rev 2856)
@@ -0,0 +1,3 @@
+<a xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" rel="lightbox[pollChoiceImages]" href="${imageLink}" title="${alt}">
+ <img src="${thumbLink}" alt="${alt}" />
+</a>
\ No newline at end of file
Added: trunk/pollen-ui/src/main/webapp/css/lightbox.css
===================================================================
--- trunk/pollen-ui/src/main/webapp/css/lightbox.css (rev 0)
+++ trunk/pollen-ui/src/main/webapp/css/lightbox.css 2010-02-01 17:46:41 UTC (rev 2856)
@@ -0,0 +1,27 @@
+#lightbox{ position: absolute; left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0;}
+#lightbox img{ width: auto; height: auto;}
+#lightbox a img{ border: none; }
+
+#outerImageContainer{ position: relative; background-color: #fff; width: 250px; height: 250px; margin: 0 auto; }
+#imageContainer{ padding: 10px; }
+
+#loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; line-height: 0; }
+#hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
+#imageContainer>#hoverNav{ left: 0;}
+#hoverNav a{ outline: none;}
+
+#prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
+#prevLink { left: 0; float: left;}
+#nextLink { right: 0; float: right;}
+#prevLink:hover, #prevLink:visited:hover { background: url(../img/lightbox/prevlabel.gif) left 15% no-repeat; }
+#nextLink:hover, #nextLink:visited:hover { background: url(../img/lightbox/nextlabel.gif) right 15% no-repeat; }
+
+#imageDataContainer{ font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100% ; }
+
+#imageData{ padding:0 10px; color: #666; }
+#imageData #imageDetails{ width: 70%; float: left; text-align: left; }
+#imageData #caption{ font-weight: bold; }
+#imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; }
+#imageData #bottomNavClose{ width: 66px; float: right; padding-bottom: 0.7em; outline: none;}
+
+#overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }
Property changes on: trunk/pollen-ui/src/main/webapp/css/lightbox.css
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/pollen-ui/src/main/webapp/img/lightbox/closelabel.gif
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-ui/src/main/webapp/img/lightbox/closelabel.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/pollen-ui/src/main/webapp/img/lightbox/loading.gif
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-ui/src/main/webapp/img/lightbox/loading.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/pollen-ui/src/main/webapp/img/lightbox/nextlabel.gif
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-ui/src/main/webapp/img/lightbox/nextlabel.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/pollen-ui/src/main/webapp/img/lightbox/prevlabel.gif
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-ui/src/main/webapp/img/lightbox/prevlabel.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/pollen-ui/src/main/webapp/js/lightbox.js
===================================================================
--- trunk/pollen-ui/src/main/webapp/js/lightbox.js (rev 0)
+++ trunk/pollen-ui/src/main/webapp/js/lightbox.js 2010-02-01 17:46:41 UTC (rev 2856)
@@ -0,0 +1,554 @@
+
+
+// -----------------------------------------------------------------------------------
+//
+// Lightbox v2.04
+// by Lokesh Dhakar - http://www.lokeshdhakar.com
+// Last Modification: 2/9/08
+//
+// For more information, visit:
+// http://lokeshdhakar.com/projects/lightbox2/
+//
+// Modification by Fabian Lange - blog.hma-info.de
+// - Integration of automatic resize from Michael R. Bagnall - elusivemind.net & Sebastien Grosjean - ZenCocoon.com
+// - do not display caption of previous image if new image has none
+// - moved opera hack to resolve disortion in FireFox
+// - readded window sizes to getPageSize()
+//
+// Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
+// - Free for use in both personal and commercial projects
+// - Attribution requires leaving author name, author link, and the license info intact.
+//
+// Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
+// Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
+//
+// -----------------------------------------------------------------------------------
+/*
+
+ Table of Contents
+ -----------------
+ Configuration
+
+ Lightbox Class Declaration
+ - initialize()
+ - updateImageList()
+ - start()
+ - changeImage()
+ - adjustImageSize()
+ - resizeImageContainer()
+ - showImage()
+ - updateDetails()
+ - updateNav()
+ - enableKeyboardNav()
+ - disableKeyboardNav()
+ - keyboardAction()
+ - preloadNeighborImages()
+ - getPageSize()
+ - end()
+
+ Function Calls
+ - document.observe()
+
+*/
+// -----------------------------------------------------------------------------------
+
+//
+// Configurationl
+//
+
+var IsResized = false;
+
+LightboxOptions = Object.extend({
+ fileLoadingImage: '../../img/lightbox/loading.gif',
+ fileBottomNavCloseImage: '../../img/lightbox/closelabel.gif',
+
+ overlayOpacity: 0.7, // controls transparency of shadow overlay
+
+ animate: true, // toggles resizing animations
+ resizeSpeed: 9, // controls the speed of the image resizing animations (1=slowest and 10=fastest)
+
+ borderSize: 10, //if you adjust the padding in the CSS, you will need to update this variable
+
+ featBrowser: true, // set it to true or false to choose to auto-adjust the maximum size to the browser
+ breathingSize: 50, // control the minimum space around the image box
+
+ // When grouping images this is used to write: Image # of #.
+ // Change it for non-english localization
+ labelImage: "Images",
+ labelOf: "of"
+}, window.LightboxOptions || {});
+
+// -----------------------------------------------------------------------------------
+
+var Lightbox = Class.create();
+
+Lightbox.prototype = {
+ imageArray: [],
+ activeImage: undefined,
+
+ // initialize()
+ // Constructor runs on completion of the DOM loading. Calls updateImageList and then
+ // the function inserts html at the bottom of the page which is used to display the shadow
+ // overlay and the image container.
+ //
+ initialize: function() {
+
+ this.updateImageList();
+
+ this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
+
+ if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
+ if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1;
+
+ this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
+ this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration
+
+ // When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
+ // If animations are turned off, it will be hidden as to prevent a flicker of a
+ // white 250 by 250 box.
+ var size = (LightboxOptions.animate ? 250 : 1) + 'px';
+
+
+ // Code inserts html at the bottom of the page that looks similar to this:
+ //
+ // <div id="overlay"></div>
+ // <div id="lightbox">
+ // <div id="outerImageContainer">
+ // <div id="imageContainer">
+ // <img id="lightboxImage">
+ // <div style="" id="hoverNav">
+ // <a href="#" id="prevLink"></a>
+ // <a href="#" id="nextLink"></a>
+ // </div>
+ // <div id="loading">
+ // <a href="#" id="loadingLink">
+ // <img src="images/loading.gif">
+ // </a>
+ // </div>
+ // </div>
+ // </div>
+ // <div id="imageDataContainer">
+ // <div id="imageData">
+ // <div id="imageDetails">
+ // <span id="caption"></span>
+ // <span id="numberDisplay"></span>
+ // </div>
+ // <div id="bottomNav">
+ // <a href="#" id="bottomNavClose">
+ // <img src="images/close.gif">
+ // </a>
+ // </div>
+ // </div>
+ // </div>
+ // </div>
+
+
+ var objBody = $$('body')[0];
+
+ objBody.appendChild(Builder.node('div',{id:'overlay'}));
+ objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
+ Builder.node('div',{id:'outerImageContainer'},
+ Builder.node('div',{id:'imageContainer'}, [
+ Builder.node('img',{id:'lightboxImage'}),
+ Builder.node('div',{id:'hoverNav'}, [
+ Builder.node('a',{id:'prevLink', href: '#' }),
+ Builder.node('a',{id:'nextLink', href: '#' })
+ ]),
+ Builder.node('div',{id:'loading'},
+ Builder.node('a',{id:'loadingLink', href: '#' },
+ Builder.node('img', {src: LightboxOptions.fileLoadingImage})
+ )
+ )
+ ])
+ ),
+ Builder.node('div', {id:'imageDataContainer'},
+ Builder.node('div',{id:'imageData'}, [
+ Builder.node('div',{id:'imageDetails'}, [
+ Builder.node('span',{id:'caption'}),
+ Builder.node('span',{id:'numberDisplay'})
+ ]),
+ Builder.node('div',{id:'bottomNav'},
+ Builder.node('a',{id:'bottomNavClose', href: '#' },
+ Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
+ )
+ )
+ ])
+ )
+ ]));
+
+
+ $('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
+ $('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
+ $('outerImageContainer').setStyle({ width: size, height: size });
+ $('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
+ $('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
+ $('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
+ $('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
+
+ var th = this;
+ (function(){
+ var ids =
+ 'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' +
+ 'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';
+ $w(ids).each(function(id){ th[id] = $(id); });
+ }).defer();
+ },
+
+ //
+ // updateImageList()
+ // Loops through anchor tags looking for 'lightbox' references and applies onclick
+ // events to appropriate links. You can rerun after dynamically adding images w/ajax.
+ //
+ updateImageList: function() {
+ this.updateImageList = Prototype.emptyFunction;
+
+ document.observe('click', (function(event){
+ var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
+ if (target) {
+ event.stop();
+ this.start(target);
+ }
+ }).bind(this));
+ },
+
+ //
+ // start()
+ // Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
+ //
+ start: function(imageLink) {
+
+ $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
+
+ // stretch overlay to fill page and fade in
+ var arrayPageSize = this.getPageSize();
+ $('overlay').setStyle({height: arrayPageSize[1] + 'px' });
+
+ new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
+
+ this.imageArray = [];
+ var imageNum = 0;
+
+ if ((imageLink.rel == 'lightbox')){
+ // if image is NOT part of a set, add single image to imageArray
+ this.imageArray.push([imageLink.href, imageLink.title]);
+ } else {
+ // if image is part of a set..
+ this.imageArray =
+ $$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
+ collect(function(anchor){ return [anchor.href, anchor.title]; }).
+ uniq();
+
+ while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
+ }
+
+ // calculate top and left offset for the lightbox
+ var arrayPageScroll = document.viewport.getScrollOffsets();
+ var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
+ var lightboxLeft = arrayPageScroll[0];
+ this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
+ if (LightboxOptions.featBrowser == true) { Event.observe(window, 'resize', (function(e) {this.adjustImageSize(true); }).bind(this)); }
+ this.changeImage(imageNum);
+ },
+
+ //
+ // changeImage()
+ // Hide most elements and preload image in preparation for resizing image container.
+ //
+ changeImage: function(imageNum) {
+
+ this.activeImage = imageNum; // update global var
+
+ // hide elements during transition
+ if (LightboxOptions.animate) this.loading.show();
+ this.lightboxImage.hide();
+ this.hoverNav.hide();
+ this.prevLink.hide();
+ this.nextLink.hide();
+ this.imageDataContainer.hide();
+ this.numberDisplay.hide();
+
+ var imgPreloader = new Image();
+
+ // once image is preloaded, resize image container
+ imgPreloader.onload = (function(){
+ this.lightboxImage.src = this.imageArray[this.activeImage][0];
+ this.imageArray[this.activeImage][2] = imgPreloader.width;
+ this.imageArray[this.activeImage][3] = imgPreloader.height;
+ this.adjustImageSize(false);
+ }).bind(this);
+ imgPreloader.src = this.imageArray[this.activeImage][0];
+ },
+
+ //
+ // adjustImageSize()
+ // adjust image size if option featBrowser is set to true
+ //
+ adjustImageSize: function( recall ) {
+ // get image size
+ imgWidth = this.imageArray[this.activeImage][2];
+ imgHeight = this.imageArray[this.activeImage][3];
+ var arrayPageSize = this.getPageSize();
+ // adjust image size if featBrowser option is set to true
+ if (LightboxOptions.featBrowser == true) {
+ // calculate proportions
+ var imageProportion = imgWidth / imgHeight;
+ var winProportion = arrayPageSize[2] / arrayPageSize[3];
+
+ if (imageProportion > winProportion) {
+ // calculate max width base on page width
+ var maxWidth = arrayPageSize[2] - (LightboxOptions.borderSize * 4) - (LightboxOptions.breathingSize * 2);
+ var maxHeight = Math.round(maxWidth / imageProportion);
+ } else {
+ // calculate maw height base on page height
+ var maxHeight = arrayPageSize[3] - (LightboxOptions.borderSize * 5) - (arrayPageSize[3] / 15) - LightboxOptions.breathingSize;
+ var maxWidth = Math.round(maxHeight * imageProportion);
+ }
+ if (imgWidth > maxWidth || imgHeight > maxHeight) {
+ IsResized = true;
+ imgWidth = maxWidth;
+ imgHeight = maxHeight;
+ } else {
+ IsResized = false;
+ }
+ }
+ this.overlay.setStyle({ height: arrayPageSize[1] + 'px' });
+ this.lightboxImage.setStyle({ height: imgHeight + 'px', width: imgWidth + 'px'});
+
+ if (recall == true) {
+ this.outerImageContainer.setStyle({height: (imgHeight + (LightboxOptions.borderSize * 2)) + 'px', width: (imgWidth + (LightboxOptions.borderSize * 2)) + 'px'});
+ this.imageDataContainer.setStyle({ width: (imgWidth + (LightboxOptions.borderSize * 2)) + 'px' });
+ } else {
+ this.resizeImageContainer(imgWidth, imgHeight);
+ }
+ },
+
+ //
+ // resizeImageContainer()
+ //
+ resizeImageContainer: function(imgWidth, imgHeight) {
+
+ // get current width and height
+ var widthCurrent = this.outerImageContainer.getWidth();
+ var heightCurrent = this.outerImageContainer.getHeight();
+
+ // get new width and height
+ var widthNew = (imgWidth + LightboxOptions.borderSize * 2);
+ var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
+
+ // scalars based on change from old to new
+ var xScale = (widthNew / widthCurrent) * 100;
+ var yScale = (heightNew / heightCurrent) * 100;
+
+ // calculate size difference between new and old image, and resize if necessary
+ var wDiff = widthCurrent - widthNew;
+ var hDiff = heightCurrent - heightNew;
+
+ if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'});
+ if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration});
+
+ // if new and old image are same size and no scaling transition is necessary,
+ // do a quick pause to prevent image flicker.
+ var timeout = 0;
+ if ((hDiff == 0) && (wDiff == 0)){
+ timeout = 100;
+ if (Prototype.Browser.IE) timeout = 250;
+ }
+
+ (function(){
+ this.prevLink.setStyle({ height: imgHeight + 'px' });
+ this.nextLink.setStyle({ height: imgHeight + 'px' });
+ this.imageDataContainer.setStyle({ width: widthNew + 'px' });
+
+ this.showImage();
+ }).bind(this).delay(timeout / 1000);
+ },
+
+ //
+ // showImage()
+ // Display image and begin preloading neighbors.
+ //
+ showImage: function(){
+ this.loading.hide();
+ new Effect.Appear(this.lightboxImage, {
+ duration: this.resizeDuration,
+ queue: 'end',
+ afterFinish: (function(){ this.updateDetails(); }).bind(this)
+ });
+ this.preloadNeighborImages();
+ },
+
+ //
+ // updateDetails()
+ // Display caption, image number, and bottom nav.
+ //
+ updateDetails: function() {
+ this.caption.update(this.imageArray[this.activeImage][1] ? this.imageArray[this.activeImage][1] : "").show();
+
+ // if image is part of set display 'Image x of x'
+ if (this.imageArray.length > 1){
+ if(IsResized) {
+ this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length + ' <a href="' + this.imageArray[this.activeImage][0] + '" rel="nofollow">Original Size</a>').show();
+ } else {
+ this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length).show();
+ }
+ }
+ //opera 9 hack moved here
+ this.imageDataContainer.setStyle({opacity: .0001});
+ this.imageDataContainer.show();
+ new Effect.Parallel(
+ [
+ new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }),
+ new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration })
+ ],
+ {
+ duration: this.resizeDuration,
+ afterFinish: (function() {
+ this.updateNav();
+ }).bind(this)
+ }
+ );
+ },
+
+ //
+ // updateNav()
+ // Display appropriate previous and next hover navigation.
+ //
+ updateNav: function() {
+
+ this.hoverNav.show();
+
+ // if not first image in set, display prev image button
+ if (this.activeImage > 0) this.prevLink.show();
+
+ // if not last image in set, display next image button
+ if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
+
+ this.enableKeyboardNav();
+ },
+
+ //
+ // enableKeyboardNav()
+ //
+ enableKeyboardNav: function() {
+ document.observe('keydown', this.keyboardAction);
+ },
+
+ //
+ // disableKeyboardNav()
+ //
+ disableKeyboardNav: function() {
+ document.stopObserving('keydown', this.keyboardAction);
+ },
+
+ //
+ // keyboardAction()
+ //
+ keyboardAction: function(event) {
+ var keycode = event.keyCode;
+
+ var escapeKey;
+ if (event.DOM_VK_ESCAPE) { // mozilla
+ escapeKey = event.DOM_VK_ESCAPE;
+ } else { // ie
+ escapeKey = 27;
+ }
+
+ var key = String.fromCharCode(keycode).toLowerCase();
+
+ if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
+ this.end();
+ } else if ((key == 'p') || (keycode == 37)){ // display previous image
+ if (this.activeImage != 0){
+ this.disableKeyboardNav();
+ this.changeImage(this.activeImage - 1);
+ }
+ } else if ((key == 'n') || (keycode == 39)){ // display next image
+ if (this.activeImage != (this.imageArray.length - 1)){
+ this.disableKeyboardNav();
+ this.changeImage(this.activeImage + 1);
+ }
+ }
+ },
+
+ //
+ // preloadNeighborImages()
+ // Preload previous and next images.
+ //
+ preloadNeighborImages: function(){
+ var preloadNextImage, preloadPrevImage;
+ if (this.imageArray.length > this.activeImage + 1){
+ preloadNextImage = new Image();
+ preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
+ }
+ if (this.activeImage > 0){
+ preloadPrevImage = new Image();
+ preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
+ }
+
+ },
+
+ //
+ // end()
+ //
+ end: function() {
+ this.disableKeyboardNav();
+ this.lightbox.hide();
+ new Effect.Fade(this.overlay, { duration: this.overlayDuration });
+ $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
+ },
+
+ //
+ // getPageSize()
+ //
+ getPageSize: function() {
+
+ var xScroll, yScroll;
+
+ if (window.innerHeight && window.scrollMaxY) {
+ xScroll = window.innerWidth + window.scrollMaxX;
+ yScroll = window.innerHeight + window.scrollMaxY;
+ } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
+ xScroll = document.body.scrollWidth;
+ yScroll = document.body.scrollHeight;
+ } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
+ xScroll = document.body.offsetWidth;
+ yScroll = document.body.offsetHeight;
+ }
+
+ var windowWidth, windowHeight;
+
+ if (self.innerHeight) { // all except Explorer
+ if(document.documentElement.clientWidth){
+ windowWidth = document.documentElement.clientWidth;
+ } else {
+ windowWidth = self.innerWidth;
+ }
+ windowHeight = self.innerHeight;
+ } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
+ windowWidth = document.documentElement.clientWidth;
+ windowHeight = document.documentElement.clientHeight;
+ } else if (document.body) { // other Explorers
+ windowWidth = document.body.clientWidth;
+ windowHeight = document.body.clientHeight;
+ }
+
+ // for small pages with total height less then height of the viewport
+ if(yScroll < windowHeight){
+ pageHeight = windowHeight;
+ } else {
+ pageHeight = yScroll;
+ }
+
+ // for small pages with total width less then width of the viewport
+ if(xScroll < windowWidth){
+ pageWidth = xScroll;
+ } else {
+ pageWidth = windowWidth;
+ }
+
+ return [pageWidth,pageHeight,windowWidth,windowHeight];
+ }
+}
+
+document.observe('dom:loaded', function () { new Lightbox(); });
+
Property changes on: trunk/pollen-ui/src/main/webapp/js/lightbox.js
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/pollen-ui/src/main/webapp/poll/ImageDisplay.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/poll/ImageDisplay.tml 2010-02-01 14:30:01 UTC (rev 2855)
+++ trunk/pollen-ui/src/main/webapp/poll/ImageDisplay.tml 2010-02-01 17:46:41 UTC (rev 2856)
@@ -1,4 +1,4 @@
-
+<!-- Not used anymore, images are displayed by lightbox -->
<t:border t:address="address" t:pageLogo="${pageStyle}"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
Modified: trunk/pollen-ui/src/main/webapp/poll/Results.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/poll/Results.tml 2010-02-01 14:30:01 UTC (rev 2855)
+++ trunk/pollen-ui/src/main/webapp/poll/Results.tml 2010-02-01 17:46:41 UTC (rev 2856)
@@ -47,9 +47,10 @@
<t:if test="imageType">
<t:ImageContextLink t:id="imgContext" t:thumb="true" t:dir="poll.pollId" />
<span t:type="ck/Tooltip" value="${result.name}" effect="appear">
- <t:eventlink event="displayImage" context="${result.name}">
+ <!-- <t:eventlink event="displayImage" context="${result.name}">
<t:image src="${result.name}" alt="${result.name}" t:context="imgContext" />
- </t:eventlink>
+ </t:eventlink> -->
+ <t:image src="${result.name}" t:imageid="result.id" alt="${result.name}" t:dir="poll.pollId"/>
</span>
</t:if>
<br/>
Modified: trunk/pollen-ui/src/main/webapp/poll/VoteForPoll.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/poll/VoteForPoll.tml 2010-02-01 14:30:01 UTC (rev 2855)
+++ trunk/pollen-ui/src/main/webapp/poll/VoteForPoll.tml 2010-02-01 17:46:41 UTC (rev 2856)
@@ -98,22 +98,24 @@
</t:loop>
</t:if>
<t:if test="imageType">
- <t:ImageContextLink t:id="imgContext" t:thumb="true" t:dir="poll.pollId"/>
+
<t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true">
<t:if test="!isChoiceHidden()">
<t:unless test="isDescNull()">
<th class="desc">
<span t:type="ck/Tooltip" title="${message:description}" value="${choiceOfPoll.description}" effect="blind">
- <t:eventlink event="displayImage" context="${choiceOfPoll.id}">
+ <!-- <t:eventlink event="displayImage" context="${choiceOfPoll.id}">
<t:image src="${choiceOfPoll.name}" alt="${choiceOfPoll.name}" t:context="imgContext"/>
- </t:eventlink>
+ </t:eventlink> -->
+ <t:image t:src="choiceOfPoll.name" alt="choiceOfPoll.description" t:dir="poll.pollId"/>
</span>
</th>
<p:else>
<th>
- <t:eventlink event="displayImage" context="${choiceOfPoll.id}">
+ <!--<t:eventlink event="displayImage" context="${choiceOfPoll.id}">
<t:image src="${choiceOfPoll.name}" alt="${choiceOfPoll.name}" t:context="imgContext"/>
- </t:eventlink>
+ </t:eventlink> -->
+ <t:image t:src="choiceOfPoll.name" alt="choiceOfPoll.name" t:dir="poll.pollId"/>
</th>
</p:else>
</t:unless>
@@ -255,7 +257,7 @@
<!-- Ajout de choix -->
-
+ <t:ImageContextLink t:id="imgContext" t:thumb="true" t:dir="poll.pollId"/>
<t:if test="${pollChoiceRunning}">
<h4>${message:addChoice}</h4>
<div id="choiceFormDiv">
1
0
Author: echatellier
Date: 2010-02-01 15:30:01 +0100 (Mon, 01 Feb 2010)
New Revision: 2855
Removed:
trunk/pollen-ui/nbactions.xml
Log:
Remove netbeans files.
Deleted: trunk/pollen-ui/nbactions.xml
===================================================================
--- trunk/pollen-ui/nbactions.xml 2010-02-01 14:19:30 UTC (rev 2854)
+++ trunk/pollen-ui/nbactions.xml 2010-02-01 14:30:01 UTC (rev 2855)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<actions>
- <action>
- <actionName>CUSTOM-tomcat embedded</actionName>
- <displayName>tomcat embedded</displayName>
- <goals>
- <goal>tomcat:run</goal>
- </goals>
- </action>
- <action>
- <actionName>CUSTOM-clean & run tomcat embedded</actionName>
- <displayName>clean & run tomcat embedded</displayName>
- <goals>
- <goal>clean</goal>
- <goal>install</goal>
- <goal>tomcat:run</goal>
- </goals>
- </action>
- </actions>
1
0
Author: echatellier
Date: 2010-02-01 15:19:30 +0100 (Mon, 01 Feb 2010)
New Revision: 2854
Modified:
trunk/pollen-ui/pom.xml
trunk/pom.xml
Log:
Update h2 (#112) and jetty (#113)
Modified: trunk/pollen-ui/pom.xml
===================================================================
--- trunk/pollen-ui/pom.xml 2010-01-28 14:01:57 UTC (rev 2853)
+++ trunk/pollen-ui/pom.xml 2010-02-01 14:19:30 UTC (rev 2854)
@@ -146,11 +146,11 @@
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
+ <artifactId>jetty-maven-plugin</artifactId>
<configuration>
<connectors>
- <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
- <port>8080</port>
+ <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+ <port>8888</port>
</connector>
</connectors>
</configuration>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-28 14:01:57 UTC (rev 2853)
+++ trunk/pom.xml 2010-02-01 14:19:30 UTC (rev 2854)
@@ -124,7 +124,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.2.126</version>
+ <version>1.2.128</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
@@ -325,9 +325,8 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <version>6.1.22</version>
- <!--<version>6.1.19</version>-->
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>7.0.1.v20091125</version>
</plugin>
</plugins>
1
0