Best regards
and thanks... KEN
From: [email protected]
To: [email protected]; [email protected]
Subject: RE: formState="NONE" is it safe to use with persistent properties ?
Date: Fri, 30 Jan 2015 14:20:24 -0500
Thanks Thiago,
I kept the formState="NONE" for the <select> properties.
I put formState="ITERATION" for the image loop which marks up editable images.
The issue persists... on the <select> controls... try it yourself and see
http://psinh.ddns.net:9011/psi/home
set tableColumns to 5 that works
set tableColumns to 4 fails (<select> punches back to 5 and gallery stays same)
???
I am not sure what to think or do.
I will post the two four modules HOME.JAVA and GALLERY.JAVA to your email
Best regards
and thanks... KEN
> To: [email protected]; [email protected]
> Subject: Re: formState="NONE" is it safe to use with persistent properties ?
> Date: Fri, 30 Jan 2015 12:06:44 -0200
> From: [email protected]
>
> Sorry, I hit the Send key by mistake . . .
>
> On Fri, 30 Jan 2015 10:20:30 -0200, nhhockeyplayer nashua
> <[email protected]> wrote:
>
> > Folks,
> >
> > I got a Home Page with a Gallery component sitting on top.
> >
> > I am operating three loops
> >
> > 1. loop to render pagination links
>
> This one should have formState="NONE", as there's nothing to be edited
> here.
>
> > 2. nested loop to render collection looping columns and rows
>
> This one shouldn't, as there's stuff to be edited inside them.
>
> This is the same problem you've reported before. We need to know the part
> of the template that contains the loop plus the Java code related to it.
> It's very probably a problem of of not using formState, which default to
> VALUEs, which uses ValueEncoder to store the looped values. If you use
> VALUES and hasn't provided a ValueEncoder for the type of the objects
> being iterated. Tapestry will serialize the object. That's very probably
> the cause of your problem. Use formState="ITERATION" of provide a
> ValueEncoder that only uses the iterated object id.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
package org.tynamo.psi.psi.components;
import java.util.ArrayList;
import java.util.Collection;
import javax.servlet.ServletContext;
import org.apache.tapestry5.Asset;
import org.apache.tapestry5.Block;
import org.apache.tapestry5.ClientElement;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.InjectContainer;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Path;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.corelib.components.EventLink;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.ApplicationGlobals;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
import org.hibernate.criterion.DetachedCriteria;
import org.slf4j.Logger;
import org.tynamo.blob.BlobManager;
import org.tynamo.descriptor.TynamoPropertyDescriptor;
import org.tynamo.hibernate.services.HibernatePersistenceService;
import org.tynamo.psi.common.util.TynamoUTIL;
import org.tynamo.psi.psi.model.Person;
import org.tynamo.psi.psi.model.Player;
import org.tynamo.psi.psi.model.UploadableMedia;
import org.tynamo.psi.psi.pages.Home;
import org.tynamo.services.DescriptorService;
import org.tynamo.services.PersistenceService;
/**
* This guy (tapestry/prototype/json/script oriented widget) renders a gallery.
*
*
* CAUTION: This component is sanctioned by heaven. The following agreement is
* binding upon use
*
* AGREEMENT: Usage of this component is limited to academic and clean business.
* Under no circumstances is this component to be used for gender business or to
* render criminal/obscene & lude material. Should you decide to violate the
* terms of this agreement and abuse the use of this component, you will be held
* accountable, at your feet, right where you stand. You were warned.
*
* Script is facilitated to operate/persist auto-paging variables.
*
* @author kenneth.colassi
[email protected]
*
*/
public class Gallery
{
@Inject
private Logger logger;
@Inject
private Request _request;
@InjectPage("Home")
private Home homePage;
@Inject
private DescriptorService descriptorService;
@Inject
private PersistenceService persistenceService;
@Inject
private HibernatePersistenceService hibernatePersistenceService;
@Inject
private BlobManager blobManager;
@Property
@Inject
private Block collectionContent;
@Property
@Inject
private Block autoPagingContent;
@Inject
@Property
@Path("classpath:META-INF/assets/psi/images/startpage.jpg")
private Asset startPageImage;
@Inject
@Property
@Path("classpath:META-INF/assets/psi/images/nextpage.jpg")
private Asset nextPageImage;
@Inject
@Property
@Path("classpath:META-INF/assets/psi/images/prevpage.jpg")
private Asset prevPageImage;
@Inject
@Property
@Path("classpath:META-INF/assets/psi/images/endpage.jpg")
private Asset endPageImage;
@Parameter
@Property
private Asset topLeftText;
@Parameter
@Property
private Asset topRightText;
@Parameter
@Property
private Asset bottomLeftText;
@Parameter
@Property
private Asset bottomRightText;
@Parameter
@Property
private Asset centerText;
/**
* Property Selection Support
*/
@Property
@Parameter(required = true, cache=true)
private Class collectionType;
@Property
@Persist
private Integer itemsPerPage;
@Property
@Persist
private Integer tableColumns;
@Property
@Persist
private int cursor;
/**
* Collection Iterator support
*/
@Parameter(required = false)
private int startRow;
@Parameter(required = false)
private Person currentObject;
public Person getCurrentObject()
{
return currentObject;
}
public void setCurrentObject(Person currentObject)
{
this.currentObject = currentObject;
}
@Property
@Parameter(required = false)
private int index;
@Property
@Parameter(required = false)
private int pageIndex;
@Property
@Parameter(required = false)
private Object currentPage;
@Persist
@Property
private Collection collection;
public Collection loadCollection(Class collectionClass)
{ // happens at setuprender
DetachedCriteria criteria =
DetachedCriteria.forClass(collectionClass);
// criteria.add(Restrictions.eq("id", 1));
return
hibernatePersistenceService.getInstances(collectionClass, criteria);
}
//@Inject
//@Path("classpath:META-INF/assets/psi/mixins/Gallery.js")
//private Asset galleryScript;
//@Inject
//@Path("classpath:META-INF/assets/psi/mixins/TransparentTextImage.js")
//private Asset transparentTextImageScript;
//@Inject
//@Path("${tapestry.scriptaculous}/dragdrop.js")
//private Asset dragDropLibrary;
@Environmental
private JavaScriptSupport javaScriptSupport;
/**
* The element we attach ourselves to
*/
@InjectContainer
private ClientElement clientElement;
// Render Phase annotations available at this time are:
// @SetupRender
// @BeginRender
// @BeforeRenderTemplate
// @RenderTemplate
// @BeforeRenderBody
// @RenderBody
// @AfterRenderBody
// @AfterRenderTemplate
// @AfterRender
// @CleanupRender
@SetupRender
public void setupRender()
{
try
{
//javaScriptSupport.importJavaScriptLibrary(galleryScript);
//javaScriptSupport.importJavaScriptLibrary(transparentTextImageScript);
//javaScriptSupport.importJavaScriptLibrary(dragDropLibrary);
//collection = loadCollection(collectionType);
//collection = loadCollection(UploadableMedia.class);
collection = loadCollection(Player.class);
if ( itemsPerPage == null ) itemsPerPage = new
Integer(250);
if ( tableColumns == null ) tableColumns = new
Integer(6);
} catch (Exception e)
{
logger.error("error loading data on collection
gallery");
}
}
@Property(write = false)
private Class beanType;
@Property
private Object bean;
public Object[] getEditPageContext()
{ // <t:pagelink on each image at core loop
return new Object[]
{ collectionType, currentObject.getId() };
}
public Link getPhotoLink()
{
TynamoPropertyDescriptor propertyDescriptor =
TynamoUTIL.findPropertyDescriptor(descriptorService, Player.class, "photo");
Player currentObject = (Player) getCurrentObject();
String contentType = currentObject.getPhoto().getContentType();
String fileName = currentObject.getPhoto().getFileName();
String filePath = currentObject.getPhoto().getFilePath();
return
blobManager.createBlobLink(TynamoUTIL.findPropertyDescriptor(descriptorService,
Player.class, "photo"), currentObject);
}
public String getFilename()
{
TynamoPropertyDescriptor propertyDescriptor =
TynamoUTIL.findPropertyDescriptor(descriptorService, Player.class, "photo");
Player currentObject = (Player) getCurrentObject();
String contentType = currentObject.getPhoto().getContentType();
String fileName = currentObject.getPhoto().getFileName();
String filePath = currentObject.getPhoto().getFilePath();
return filePath;
}
@InjectComponent
private Zone itemsPerPageSelectZone;
public Object onValueChangedFromItemsPerPageSelect(int value)
{
itemsPerPage = value;
logger.debug("In onValueChangedItemsPerPageSelect : ");
if (itemsPerPage < tableColumns)
{
tableColumns = itemsPerPage;
} else
{
/**
* Use case, items is larger than columns, need to back
cursor off
* if in endzone
*/
int i = cursor + itemsPerPage;
if (i > (collection.size() -
Math.min(collection.size(), itemsPerPage + tableColumns))) {
while (i > (collection.size() -
Math.min(collection.size(), itemsPerPage + tableColumns)))
{
i--;
}
cursor = (i);
}
}
return homePage;
}
@InjectComponent
private Zone tableColumnsSelectZone;
public Object onValueChangedFromTableColumnsSelect(int value)
{
tableColumns = value;
logger.debug("In tableColumnsChangeListener : ");
onValueChangedFromItemsPerPageSelect(itemsPerPage);
return homePage;
}
@Component(parameters =
{ "event=firstPage" })
private EventLink firstPage;
public Object onFirstPage()
{
logger.info("In onFirstPage : ");
cursor = 0;
return homePage;
}
@Component(parameters =
{ "event=prevPage" })
private EventLink prevPage;
public Object onPrevPage()
{
logger.info("In onPrevPage : ");
/**
* Use Cases:
*
* Check for setting to - and set to 0
*
* else , set back a page
*/
cursor = (cursor - Math.min(itemsPerPage, collection == null ?
0 : collection.size()) < 0 ? 0 : cursor
- Math.min(itemsPerPage, collection == null ? 0 :
collection.size()));
return homePage;
}
public Object onIndividualPage(int pageNum)
{
logger.info("In onPage : ");
cursor = ((pageNum-1) * itemsPerPage);
return homePage;
}
public Object onNextPage()
{
logger.info("In onNextPage : ");
/**
* If we're already in the endzone, set it to last batch,
*
* If our next action places us into the endzone, set it to
last batch
*
* else just increment by a new page
*/
cursor = (cursor > (collection == null ? 0 : collection.size()
- Math.min(itemsPerPage, collection == null ? 0 : collection.size())) ?
(collection == null ? 0 : collection.size() - Math
.min(itemsPerPage, collection == null ? 0 :
collection.size()))
: ((cursor + Math.min(itemsPerPage, collection == null
? 0 : collection.size())) > (collection == null ? 0 : collection.size() -
Math.min(itemsPerPage,
collection == null ? 0 :
collection.size())) ? collection.size() - Math.min(itemsPerPage, collection ==
null ? 0 : collection.size()) : cursor
+ Math.min(itemsPerPage, collection == null ? 0
: collection.size())));
return homePage;
}
public Object onLastPage()
{
logger.info("In onLastPage : ");
int minimum = Math.min(itemsPerPage, collection == null ? 0 :
collection.size());
cursor = (collection == null ? 0 : collection.size() - minimum);
return homePage;
}
@Property
@Parameter
private Collection numPages;
/**
* We use @Persist obviously but during render we get divide by zeros
*
* we need to keep checks for render phase. our properties dont get
loaded
* til after.
*
* @return
*/
public Collection getPages()
{
numPages = new ArrayList();
if (itemsPerPage != 0)
for (int i = 1; i < (collection == null ? 0 :
collection.size() / itemsPerPage - 1); i++)
numPages.add(new Integer(i));
return numPages;
}
public String getImageComponentId()
{
return "Image_" + new Integer(index).toString();
}
public String getTransparentTextImageComponentId()
{
return "ImageWidget_" + new Integer(index).toString();
}
/**
* Returns the smaller of two int values
*/
public int min(int tableColumns, Integer itemsPerPage)
{
return Math.min(tableColumns, itemsPerPage);
}
public Class getUploadableMediaClass()
{
return UploadableMedia.class;
}
public Class getPersonClass()
{
return Person.class;
}
public Class getPlayerClass()
{
return Player.class;
}
public int getFromValue()
{
return cursor + 1;
}
public int getToValue()
{
return Math.min(cursor + itemsPerPage, collection == null ? 0 :
collection.size() );
}
public int getCount()
{
return collection == null ? 0 : collection.size();
}
public int getPageValue()
{
return pageIndex + 2;
}
public int getIndexValue()
{
return pageIndex + 1;
}
public int getIndividualPageIndex()
{
return pageIndex + 2;
}
public boolean isOKToRenderItem()
{
boolean okToRenderItem = false;
if (index >= cursor && index < (cursor + Math.min(collection ==
null ? 0 : collection.size(), itemsPerPage)))
okToRenderItem = true;
return okToRenderItem;
}
public boolean isAtNewRow()
{
// check if still in render phase,. we need this for @Persist
divide by
// zero checks
if (itemsPerPage == 0 || tableColumns == 0)
return false;
// ok single column case, always return true
if (tableColumns == 1)
return true;
// are we at beginning?
if ((index - cursor) == 0)
return false;
return (((index + 1) - cursor) % min(tableColumns,
itemsPerPage) == 0);
}
public String getNewTableRow()
{
return "</tr><tr>";
}
public String getEndTableRow()
{
return "</tr>";
}
public String getStartRow()
{
return "<tr>";
}
public String getTitle() {
String filePath = currentObject.getPhoto().getFilePath();
String fileName = currentObject.getPhoto().getFileName();
String fileExtension =
currentObject.getPhoto().getFileExtension();
return filePath + "/" + fileName + "/" + fileExtension;
}
}package org.tynamo.psi.psi.pages;
import java.util.Collection;
import java.util.Date;
import org.apache.tapestry5.Block;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.alerts.AlertManager;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.CleanupRender;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.hibernate.annotations.CommitAfter;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.ApplicationStateManager;
import org.apache.tapestry5.services.ExceptionReporter;
import org.apache.tapestry5.services.Request;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.tynamo.blob.BlobManager;
import org.tynamo.descriptor.TynamoPropertyDescriptor;
import org.tynamo.hibernate.services.HibernatePersistenceService;
import org.tynamo.psi.common.util.TynamoUTIL;
import org.tynamo.psi.psi.components.Gallery;
import org.tynamo.psi.psi.model.AdminLayout;
import org.tynamo.psi.psi.model.Coach;
import org.tynamo.psi.psi.model.HitCounter;
import org.tynamo.psi.psi.model.ICurrentUser;
import org.tynamo.psi.psi.model.Person;
import org.tynamo.psi.psi.model.PhotoGroup;
import org.tynamo.psi.psi.model.PhotoGroupPhoto;
import org.tynamo.psi.psi.model.Player;
import org.tynamo.psi.psi.model.UploadableMedia;
import org.tynamo.psi.psi.services.javascript.CustomJavaScriptStack;
import org.tynamo.routing.annotations.Route;
import org.tynamo.security.services.SecurityService;
import org.tynamo.services.DescriptorService;
import org.tynamo.services.PersistenceService;
/**
* components have parameters, pages have properties
*
* @author Kenneth.William.Colassi [email protected]
*/
/*
* To declaratively secure your pages, you can use the following annotations:
*
* Shiro annotations, for securing operations
*
* @RequiresPermissions
*
* @RequiresRoles
*
* @RequiresUser
*
* @RequiresGuest
*
* @RequiresAuthentication
*
* For example, to restrict access to users with roles "admin" only, you would
* add a following annotation to a page class:
*
* @RequiresRoles("admin") public class AdminPage { }
*
* The names of following components should give you a pretty good hint of their
* purpose, can you guess what all of them do?
*
* Authenticated NotAuthenticated User Guest HasAnyRoles HasPermission HasRole
* LacksPermission LacksRole LoginForm LoginLink
*/
//@RequiresAuthentication
//@RequiresUser
// @RequiresGuest
// @RequiresRoles("anon,admin,manager,standard")
// @RequiresPermissions("create, read, update, delete")
@Import(
stack = {
CustomJavaScriptStack.STACK_ID
},
stylesheet = {
"classpath:org/tynamo/themes/tapestryskin/theme.css"
},
library = {
"classpath:META-INF/assets/psi/mixins/ngscripts/partialmodal.js"
}
)
@Route("/")
public class Home implements ExceptionReporter {
@Inject
private Logger logger;
private Throwable exception;
@Override
public void reportException(Throwable exception) {
this.exception = exception;
}
public Throwable getException() {
return exception;
}
public String getMessage() {
if (exception != null) {
return exception.getMessage() + " Try login.";
} else {
return "";
}
}
@SuppressWarnings("unused")
@SessionState(create = false)
@Property
private ICurrentUser currentUser;
@Persist
@Property
private Class collectiontype;
/**
* Component
*/
@Property
private int startRow;
@Property
private Object currentObject;
@Property
private int index;
@Persist
@Property
private int pageIndex;
@Property
private Object currentPage;
@Property
private Collection collection;
private AdminLayout adminLayout;
private HitCounter hitCounter;
@Component(id="Gallery")
private Gallery gallery;
public Class getUploadableMediaClass() {
return UploadableMedia.class;
}
public Class getPhotoGroupPhotoClass() {
return PhotoGroupPhoto.class;
}
public Class getPersonClass() {
return Person.class;
}
public Class getCoachClass() {
return Coach.class;
}
public Class getPlayerClass() {
return Player.class;
}
@Inject
private ApplicationStateManager applicationStateManager;
@Inject
private SecurityService securityService;
public Object onActivate() {
if (currentUser == null) {
if (securityService.getSubject().isAuthenticated()
&&
applicationStateManager.exists(Person.class)) {
currentUser =
applicationStateManager.get(Person.class);
currentUser.merge(securityService.getSubject().getPrincipal());
}
}
return null;
}
@SetupRender
public void setupRender() {
collectiontype = Player.class;
// LOAD from db (find it and load it)
if (findAdminLayout() != null)
applicationStateManager.set(AdminLayout.class,
findAdminLayout());
if (findHitCounter() != null)
applicationStateManager.set(HitCounter.class,
findHitCounter());
if (applicationStateManager.exists(HitCounter.class))
hitCounter =
applicationStateManager.get(HitCounter.class);
/**
* restore gallery metrics
if (gallery.getItemsPerPage() == null) {
if (securityService.getSubject().isAuthenticated())
gallery.itemsPerPage =
getAdminLayout().getItemsPerPage();
else
gallery.itemsPerPage = 5;
}
if (gallery.getTableColumns() == null) {
if (securityService.getSubject().isAuthenticated())
gallery.tableColumns =
getAdminLayout().getTableColumns();
else
gallery.tableColumns = 5;
}
*/
activePhotoGroup = getAdminLayout().getActivePhotoGroup();
String photoGroupTitle = "Photo Group Photos";
if ( activePhotoGroup != null ) {
// transfer
//TODO photoGroupCollection = new
HashSet<PhotoGroup>(activePhotoGroup.getPhotoGroupPhotos().size());
//TODO
photoGroupCollection.addAll(activePhotoGroup.getPhotoGroupPhotos());
photoGroupTitle = activePhotoGroup.getName();
}
photoGroupCollection =
loadPhotoGroupCollection(photoGroupClass);
}
@BeginRender
public void beginRender() {
if (currentUser == null) {
if (securityService.getSubject().isAuthenticated()
&&
applicationStateManager.exists(Person.class)) {
currentUser =
applicationStateManager.get(Person.class);
currentUser.merge(securityService.getSubject().getPrincipal());
}
}
}
@Log
@CommitAfter
@AfterRender
public void afterRender() {
AdminLayout adminLayout;
//if (securityService.getSubject().isAuthenticated())
if (applicationStateManager.exists(AdminLayout.class)) {
adminLayout =
applicationStateManager.get(AdminLayout.class);
//adminLayout.setItemsPerPage(gallery.itemsPerPage);
//adminLayout.setTableColumns(gallery.tableColumns);
if (! securityService.isGuest() )
persistenceService.save(adminLayout);
}
}
@CleanupRender
void cleanup() {
// retrieve and store gallery metrics
if (applicationStateManager.exists(AdminLayout.class)) {
adminLayout =
applicationStateManager.get(AdminLayout.class);
if (! securityService.isGuest() )
persistenceService.save(adminLayout);
}
}
public Date getCurrentTime() {
return new Date();
}
@Inject
private PersistenceService persistenceService;
public AdminLayout getAdminLayout() {
if (applicationStateManager.exists(AdminLayout.class)) {
adminLayout =
applicationStateManager.get(AdminLayout.class);
}
return adminLayout;
}
public HitCounter getHitCounter() {
if (applicationStateManager.exists(HitCounter.class))
hitCounter =
applicationStateManager.get(HitCounter.class);
return hitCounter;
}
/*
@InjectComponent
private Zone friendResults;
@Property
private List<User> friends;
@Property
private User friend;
@RequiresPermissions("facebook")
Block onActionFromListFriends() {
OauthAccessToken accessToken = securityService.getSubject()
.getPrincipals().oneByType(FacebookAccessToken.class);
// could check for expiration
FacebookClient facebookClient = new DefaultFacebookClient(
accessToken.toString());
friends = facebookClient.fetchConnection("me/friends",
User.class)
.getData();
return friendResults.getBody();
}
@Inject
private TwitterFactory twitterFactory;
@Inject
@Symbol(TwitterRealm.TWITTER_CLIENTID)
private String oauthClientId;
@Inject
@Symbol(TwitterRealm.TWITTER_CLIENTSECRET)
private String oauthClientSecret;
@InjectComponent
private Zone tweetResults;
@Property
private List<Status> tweets;
@Property
private Status tweet;
@RequiresPermissions("twitter")
Block onActionFromListTweets() throws TwitterException {
OauthAccessToken accessToken = securityService.getSubject()
.getPrincipals().oneByType(TwitterAccessToken.class);
Twitter twitter = twitterFactory.getInstance();
twitter.setOAuthConsumer(oauthClientId, oauthClientSecret);
twitter.setOAuthAccessToken((AccessToken)
accessToken.getCredentials());
tweets = twitter.getHomeTimeline();
return tweetResults.getBody();
}
*/
@Property
private Link headerBlobLink;
@Property
private Link logoBlobLink;
@Property
private Link backgroundBlobLink;
@Property
private Link splashBlobLink;
@Inject
private Request request;
/*
@InjectPage("Login")
private org.tynamo.psi.psi.pages.Login loginPage;
Object onActionFromTynamoLogoutLink() {
// Need to call this explicitly to invoke onlogout handlers (for
// remember me etc.)
SecurityUtils.getSubject().logout();
try
{
// the session is already invalidated, but need to
cause an
// exception since tapestry doesn't know about it
// and you'll get a container exception message instead
without
// this. Unfortunately, there's no way of
// configuring Shiro to not invalidate sessions right
now. See
// DefaultSecurityManager.logout()
// There's a similar issues in Tapestry - Howard has
fixed, but no
// in T5.2.x releases yet
//request.getSession(false).invalidate();
//applicationStateManager.set(Person.class, null);
} catch (Exception e)
{
}
return loginPage;
}
*/
/**
* http://tapestry5-jquery.com/components/docscarouselpage
* http://access.aol.com/aegis/#goto_carousel
* http://stackoverflow.com/questions
* /6864788/how-to-set-delay-in-jcarousel-between-scoll
* http://stackoverflow.com/questions/9808592/jcarousel-width-issue
*
* @return
*/
public JSONObject getPhotoGroupParams() {
JSONObject retour = new JSONObject();
/*
* vertical: false,
* rtl: false,
* start: 1,
* offset: 1,
* size: null,
* scroll: 3,
* visible: null,
* animation: 'normal',
* easing: 'swing',
* auto: 0,
* wrap: null,
*/
retour.put("vertical", false); // sideways scroll
//retour.put("rtl", true); //
//retour.put("start", 1);
//retour.put("offset", 1);
//retour.put("size", 6); // num items in carousel
retour.put("scroll", 1); // num items to scroll at a time
retour.put("visible", 1); // num items visible in carousel
retour.put("animation", "slow"); // good, not fast
retour.put("easing", "swing"); // good, not fast
retour.put("auto", 1); // auto-scroll interval delay in seconds
retour.put("wrap", "last"); // circular, last
retour.put("animate", true);
retour.put("itemFallbackDimension", 500);
return retour;
}
/**
* PhotoGroup Photo Loop
*/
@Property
private int photoGroupIndex;
@Property
private Class photoGroupClass = PhotoGroupPhoto.class;
@Property
private PhotoGroupPhoto currentPhotoGroupPhoto;
public Object[] getPhotoGroupPhotoEditPageContext()
{
return new Object[]
{ photoGroupClass, currentPhotoGroupPhoto };
}
@Inject
private HibernatePersistenceService hibernatePersistenceService;
private PhotoGroup activePhotoGroup;
@Persist
@Property
private Collection photoGroupCollection;
public Collection loadPhotoGroupCollection(Class collectionClass)
{
DetachedCriteria criteria =
DetachedCriteria.forClass(collectionClass);
// criteria.add(Restrictions.eq("id", 1));
return
hibernatePersistenceService.getInstances(collectionClass, criteria);
}
@Inject
private DescriptorService descriptorService;
@Inject
private BlobManager blobManager;
public Link getPhotoGroupPhotoLink()
{
TynamoPropertyDescriptor propertyDescriptor =
TynamoUTIL.findPropertyDescriptorProperty(descriptorService,
PhotoGroupPhoto.class, "photo");
PhotoGroupPhoto currentObject = (PhotoGroupPhoto)
currentPhotoGroupPhoto;
String contentType = currentObject.getPhoto().getContentType();
String fileName = currentObject.getPhoto().getFileName();
String filePath = currentObject.getPhoto().getFilePath();
return
blobManager.createBlobLink(TynamoUTIL.findPropertyDescriptorProperty(descriptorService,
PhotoGroupPhoto.class, "photo"), currentPhotoGroupPhoto);
}
@Inject
private Messages messages;
@Inject
private AlertManager alertManager;
private AdminLayout findAdminLayout()
{
Session session = TynamoUTIL.factory.openSession();
AdminLayout result = (AdminLayout)
session.createCriteria(AdminLayout.class).add(Restrictions.eq("id",
1)).uniqueResult();
session.close();
return result;
}
private HitCounter findHitCounter()
{
Session session = TynamoUTIL.factory.openSession();
HitCounter result = (HitCounter)
session.createCriteria(HitCounter.class).add(Restrictions.eq("id",
1)).uniqueResult();
session.close();
return result;
}
@Property
@Persist
Integer tabsIndex, aLevelTabsIndex, bLevelTabsIndex;
@Property
@Persist
private Block tab0,tab1,tab2,tab3,tab4,tab5,tab6,tab7,tab8,tab9;
@Property
@Persist
private Block tab01,tab02,tab03,tab04,tab05;
@Property
@Persist
private Block tab11,tab12,tab13,tab14,tab15;
/**
* GRID For Player DAO Methods
*/
@Property(write = false)
private Class beanType;
@Property
private Object bean;
public Object[] getShowPageContext()
{
return new Object[]{beanType, bean};
}
@Persist
@Property
private Collection players;
@Persist
@Property
private Player player;
public Collection loadCollection(Class collectionClass)
{
DetachedCriteria criteria =
DetachedCriteria.forClass(collectionClass);
// criteria.add(Restrictions.eq("id", 1));
return
hibernatePersistenceService.getInstances(collectionClass, criteria);
}
public String getTitle() {
return "Welcome to Home Page";
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]