08-02-2012 05:27 AM
<?xml version="1.0" encoding="UTF-8"?>
<model name="preview:previewtextmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<namespaces>
<namespace uri="extension.previewtext" prefix="preview"/>
</namespaces>
<aspects>
<aspect name="preview:textable">
<title>PreviewText</title>
<properties>
<property name="preview:previewtext">
<title>Text</title>
<type>d:text</type>
<multiple>false</multiple>
</property>
</properties>
</aspect>
</aspects>
</model>
/**
* Vorschautexte hinzuzufuegen
*/
public class PreviewTextActionExecuter extends ActionExecuterAbstractBase {
/**
* Name des Konzepts
*/
public static final String NAME = "preview";
public static final String PARAM_TAGS = "";
/**
* NodeService fuer den Zugriff auf Nodes
*/
private NodeService nodeService;
/**
* NodeServer von außerhalb setzen (für Zugriffe)
* @param nodeService
*/
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
/**
* Ausfuehren der ausgewaehlten Aktion
* @param action Informationen ueber die Aktion
* @param actionedUponNodeRef Objekt-Node
*/
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
if (this.nodeService.exists(actionedUponNodeRef) == true) {
QName tagAspect = QName.createQName("extension.previewtext", "textable");
if (this.nodeService.hasAspect(actionedUponNodeRef, tagAspect) == false) {
this.nodeService.addAspect(actionedUponNodeRef, tagAspect, null);
}
}
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> params) {
params.add(new ParameterDefinitionImpl("previewtext",
DataTypeDefinition.TEXT, true, getParamDisplayLabel("previewtext")));
}
}
public class PreviewTextActionHandler extends BaseActionHandler {
public static final String PROP_TAGS = "previewtext";
public String getJSPPath() {
return "/jsp/extension/previewtext.jsp";
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps) {
repoProps.put(PreviewTextActionExecuter.PARAM_TAGS,
(String) actionProps.get(PROP_TAGS));
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps) {
actionProps.put(PROP_TAGS, (String)repoProps.get(PreviewTextActionExecuter.PARAM_TAGS));
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps) {
String previewText = (String) actionProps.get(PROP_TAGS);
if (previewText == null) {
previewText = "";
}
return MessageFormat.format(
Application.getMessage(context, "add_previewText"),
new Object[] { previewText });
}
}
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="preview.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/previewTextModel.xml</value>
</list>
</property>
</bean>
<bean id="preview" class="org.alfresco.bag.preview.PreviewTextActionExecuter" parent="action-executer" >
<property name="nodeService">
<ref bean="nodeService" />
</property>
</bean>
<bean id="preview-action-messages" parent="actionResourceBundles">
<property name="resourceBundles">
<list>
<value>org.alfresco.bag.preview.preview-action-messages</value>
</list>
</property>
</bean>
</beans>
08-03-2012 05:47 AM
<config evaluator="string-compare" condition="Action Wizards">
<action-handlers>
<handler name="preview" class="org.alfresco.bag.preview.PreviewTextActionHandler" />
</action-handlers>
</config>>
08-13-2012 04:03 AM
08-13-2012 06:07 AM
08-13-2012 10:37 AM
08-14-2012 04:32 AM
08-14-2012 04:37 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.