use of org.alfresco.web.ui.common.component.UIActionLink in project acs-community-packaging by Alfresco.
the class SpaceDetailsDialog method previousItem.
/**
* Navigates to the previous item in the list Spaces
*/
public void previousItem(ActionEvent event) {
UIActionLink link = (UIActionLink) event.getComponent();
Map<String, String> params = link.getParameterMap();
String id = params.get("id");
if (id != null && id.length() != 0) {
NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id);
List<Node> nodes = this.browseBean.getParentNodes(currNodeRef);
Node previous = null;
if (nodes.size() > 1) {
String currentSortColumn = this.browseBean.getSpacesRichList().getCurrentSortColumn();
if (currentSortColumn != null) {
boolean currentSortDescending = this.browseBean.getSpacesRichList().isCurrentSortDescending();
Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending));
}
previous = NodeListUtils.previousItem(nodes, id);
this.browseBean.setupSpaceAction(previous.getId(), false);
}
if (previous == null) {
Node currNode = new Node(currNodeRef);
this.navigator.setupDispatchContext(currNode);
}
}
}
use of org.alfresco.web.ui.common.component.UIActionLink in project acs-community-packaging by Alfresco.
the class VersionedDocumentDetailsDialog method nextItem.
/**
* Navigates to next item in the list of versioned content for the current VersionHistory
*/
public void nextItem(ActionEvent event) {
// Get the properties of the action event
UIActionLink link = (UIActionLink) event.getComponent();
Map<String, String> params = link.getParameterMap();
String versionLabel = params.get("versionLabel");
// if the version is not specified, get the next version
if (versionLabel == null) {
List<Version> nextVersions = new ArrayList<Version>(this.versionHistory.getSuccessors(this.documentVersion));
// if the version history doesn't contains successor, get the root version (the first one)
if (nextVersions == null || nextVersions.size() < 1) {
this.documentVersion = versionHistory.getRootVersion();
} else {
this.documentVersion = nextVersions.get(0);
}
} else {
this.documentVersion = this.versionHistory.getVersion(versionLabel);
}
}
use of org.alfresco.web.ui.common.component.UIActionLink in project acs-community-packaging by Alfresco.
the class VersionedDocumentDetailsDialog method previousItem.
/**
* Navigates to previous item in the list of versioned content for the current VersionHistory
*/
public void previousItem(ActionEvent event) {
// Get the properties of the action event
UIActionLink link = (UIActionLink) event.getComponent();
Map<String, String> params = link.getParameterMap();
String versionLabel = params.get("versionLabel");
// if the version is not specified, get the next version
if (versionLabel == null) {
Version prevVersion = this.versionHistory.getPredecessor(this.documentVersion);
// if the version history doesn't contains predecessor, get the last version (ie. most recent)
if (prevVersion == null) {
List<Version> allVersions = new ArrayList<Version>(this.versionHistory.getAllVersions());
this.documentVersion = allVersions.get(0);
} else {
this.documentVersion = prevVersion;
}
} else {
this.documentVersion = this.versionHistory.getVersion(versionLabel);
}
}
use of org.alfresco.web.ui.common.component.UIActionLink in project acs-community-packaging by Alfresco.
the class ForumsBean method discuss.
/**
* Event handler called when a user wants to view or participate
* in a discussion on an object
*
* @param event ActionEvent
*/
public void discuss(ActionEvent event) {
UIActionLink link = (UIActionLink) event.getComponent();
Map<String, String> params = link.getParameterMap();
String id = params.get("id");
if (id == null || id.length() == 0) {
throw new AlfrescoRuntimeException("discuss called without an id");
}
FacesContext context = FacesContext.getCurrentInstance();
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), id);
if (this.getNodeService().hasAspect(nodeRef, ForumModel.ASPECT_DISCUSSABLE) == false) {
throw new AlfrescoRuntimeException("discuss called for an object that does not have a discussion!");
}
// as the node has the discussable aspect there must be a discussions child assoc
List<ChildAssociationRef> children = this.getNodeService().getChildAssocs(nodeRef, ForumModel.ASSOC_DISCUSSION, RegexQNamePattern.MATCH_ALL);
// there should only be one child, retrieve it if there is
if (children.size() == 1) {
// show the forum for the discussion
NodeRef forumNodeRef = children.get(0).getChildRef();
this.browseBean.clickSpace(forumNodeRef);
context.getApplication().getNavigationHandler().handleNavigation(context, null, "showForum");
} else {
// this should never happen as the action evaluator should stop the action
// from displaying, just in case print a warning to the console
logger.warn("Node has the discussable aspect but does not have 1 child, it has " + children.size() + " children!");
}
}
use of org.alfresco.web.ui.common.component.UIActionLink in project acs-community-packaging by Alfresco.
the class ForumsDetailsDialog method nextItem.
public void nextItem(ActionEvent event) {
UIActionLink link = (UIActionLink) event.getComponent();
Map<String, String> params = link.getParameterMap();
String id = params.get("id");
if (id != null && id.length() != 0) {
NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id);
List<Node> nodes = this.browseBean.getParentNodes(currNodeRef);
Node next = null;
if (nodes.size() > 1) {
String currentSortColumn = this.browseBean.getSpacesRichList().getCurrentSortColumn();
boolean currentSortDescending = this.browseBean.getSpacesRichList().isCurrentSortDescending();
Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending));
next = NodeListUtils.nextItem(nodes, id);
this.browseBean.setupSpaceAction(next.getId(), false);
}
if (next == null) {
Node currNode = new Node(currNodeRef);
this.navigator.setupDispatchContext(currNode);
}
}
}
Aggregations