Add done-editing

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8162 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Logneon
2008-02-04 12:06:34 +00:00
parent 37b4171602
commit 7a9d7440d6
7 changed files with 326 additions and 124 deletions

View File

@@ -0,0 +1,65 @@
package org.alfresco.web.bean.coci;
import java.util.StringTokenizer;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.version.Version;
import org.alfresco.web.app.Application;
/**
* This bean class handle done-editing(commit) dialog.
*
*/
public class CCDoneEditingDialog extends CheckinCheckoutDialog
{
private final static String MSG_DONE = "done";
private final static String MSG_TITLE = "done_editing_title";
/**
* @return Returns label for new version with major changes
*/
public String getMajorNewVersionLabel()
{
Version curVersion = property.getVersionQueryService().getCurrentVersion(property.getDocument().getNodeRef());
StringTokenizer st = new StringTokenizer(curVersion.getVersionLabel(), ".");
return (Integer.valueOf(st.nextToken()) + 1) + ".0";
}
/**
* @return Returns label for new version with minor changes
*/
public String getMinorNewVersionLabel()
{
Version curVersion = property.getVersionQueryService().getCurrentVersion(property.getDocument().getNodeRef());
StringTokenizer st = new StringTokenizer(curVersion.getVersionLabel(), ".");
return st.nextToken() + "." + (Integer.valueOf(st.nextToken()) + 1);
}
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return checkinFileOK(context, outcome);
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_DONE);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getContainerTitle()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_TITLE) + " '" + property.getDocument().getName() + "'";
}
}