Index: addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView.java =================================================================== --- addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView.java (revision 23240) +++ addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView.java (revision ) @@ -152,38 +152,93 @@ super.detachModel(); }; + /** + * Gets a {@link org.hippoecm.frontend.plugins.standards.list.TableDefinition} whichs contains all columns and + * information needed for the view. + * @return the {@link org.hippoecm.frontend.plugins.standards.list.TableDefinition} with all data + */ protected TableDefinition getTableDefinition() { List columns = new ArrayList(); - ListColumn column = new ListColumn(new StringResourceModel("history-name", this, null), null); + addNameColumn(columns); + addTimeColumn(columns); + addUserColumn(columns); + addStateColumn(columns); + + return new TableDefinition(columns); + } + + /** + * Adds a {@link org.hippoecm.frontend.plugins.standards.list.ListColumn} containing the state information to the list of columns. + * @param columns the list of columns. + */ + private void addStateColumn(List columns) { + ListColumn column = new ListColumn(new StringResourceModel("history-state", this, null), "state"); + column.setRenderer(new EmptyRenderer()); + column.setAttributeModifier(new IListAttributeModifier() { + private static final long serialVersionUID = 1L; + + public AttributeModifier[] getCellAttributeModifiers(IModel model) { + Revision revision = (Revision) model.getObject(); + StateIconAttributes attrs = new StateIconAttributes((JcrNodeModel) revision.getDocument()); + AttributeModifier[] attributes = new AttributeModifier[2]; + attributes[0] = new CssClassAppender(new PropertyModel(attrs, "cssClass")); + attributes[1] = new AttributeAppender("title", new PropertyModel(attrs, "summary"), " "); + return attributes; + } + + public AttributeModifier[] getColumnAttributeModifiers(IModel model) { + return new AttributeModifier[] { new CssClassAppender(new Model("icon-16")) }; + } + }); + columns.add(column); + } + + /** + * Adds a {@link org.hippoecm.frontend.plugins.standards.list.ListColumn} containing the information of the user + * to the list of columns. + * @param columns the list of columns. + */ + private void addUserColumn(List columns) { + ListColumn column = new ListColumn(new StringResourceModel("history-user", this, null), "user"); column.setRenderer(new IListCellRenderer() { private static final long serialVersionUID = 1L; - public Component getRenderer(String id, IModel model) { + public Component getRenderer(String id, final IModel model) { + IModel labelModel = new IModel() { + + public Object getObject() { - Revision revision = (Revision) model.getObject(); + Revision revision = (Revision) model.getObject(); - Node node = revision.getDocument().getObject(); - IModel nameModel; - try { - nameModel = new NodeTranslator(new JcrNodeModel(node.getNode("jcr:frozenNode"))).getNodeName(); - } catch (PathNotFoundException e) { - nameModel = new Model("Missing node " + e.getMessage()); - log.error(e.getMessage(), e); - } catch (RepositoryException e) { - nameModel = new Model("Error " + e.getMessage()); - log.error(e.getMessage(), e); + StateIconAttributes attrs = new StateIconAttributes((JcrNodeModel) revision.getDocument()); + return attrs.getLastModifiedBy(); - } + } - return new Label(id, nameModel); + + public void setObject(Object object) { + throw new UnsupportedOperationException(); - } + } + public void detach() { + model.detach(); + } + }; + return new Label(id, labelModel); + } + public IObservable getObservable(IModel model) { return null; } }); - column.setAttributeModifier(new RevisionDocumentAttributeModifier()); columns.add(column); + } - column = new ListColumn(new StringResourceModel("history-time", this, null), null); + /** + * Adds a {@link org.hippoecm.frontend.plugins.standards.list.ListColumn} containing the time information + * to the list of columns. + * @param columns the list of columns. + */ + private void addTimeColumn(List columns) { + ListColumn column = new ListColumn(new StringResourceModel("history-time", this, null), null); column.setRenderer(new IListCellRenderer() { private static final long serialVersionUID = 1L; @@ -212,28 +267,41 @@ }); columns.add(column); + } - column = new ListColumn(new StringResourceModel("history-state", this, null), "state"); - column.setRenderer(new EmptyRenderer()); - column.setAttributeModifier(new IListAttributeModifier() { + /** + * Adds a {@link org.hippoecm.frontend.plugins.standards.list.ListColumn} containing the name of the document + * to the list of columns. + * @param columns the list of columns. + */ + private void addNameColumn(List columns) { + ListColumn column = new ListColumn(new StringResourceModel("history-name", this, null), null); + column.setRenderer(new IListCellRenderer() { private static final long serialVersionUID = 1L; - public AttributeModifier[] getCellAttributeModifiers(IModel model) { + public Component getRenderer(String id, IModel model) { Revision revision = (Revision) model.getObject(); - StateIconAttributes attrs = new StateIconAttributes((JcrNodeModel) revision.getDocument()); - AttributeModifier[] attributes = new AttributeModifier[2]; - attributes[0] = new CssClassAppender(new PropertyModel(attrs, "cssClass")); - attributes[1] = new AttributeAppender("title", new PropertyModel(attrs, "summary"), " "); - return attributes; + Node node = revision.getDocument().getObject(); + IModel nameModel; + try { + nameModel = new NodeTranslator(new JcrNodeModel(node.getNode("jcr:frozenNode"))).getNodeName(); + } catch (PathNotFoundException e) { + nameModel = new Model("Missing node " + e.getMessage()); + log.error(e.getMessage(), e); + } catch (RepositoryException e) { + nameModel = new Model("Error " + e.getMessage()); + log.error(e.getMessage(), e); - } + } + return new Label(id, nameModel); + } - public AttributeModifier[] getColumnAttributeModifiers(IModel model) { - return new AttributeModifier[] { new CssClassAppender(new Model("icon-16")) }; + public IObservable getObservable(IModel model) { + return null; } + }); + column.setAttributeModifier(new RevisionDocumentAttributeModifier()); columns.add(column); - - return new TableDefinition(columns); } public int getPageSize() { Index: addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView.properties =================================================================== --- addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView.properties (revision 19680) +++ addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView.properties (revision ) @@ -1,3 +1,4 @@ history-name: Name history-time: Date / time -history-state: State \ No newline at end of file +history-state: State +history-user: User \ No newline at end of file Index: addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView_nl.properties =================================================================== --- addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView_nl.properties (revision 19680) +++ addon/reviewed-action/frontend/src/main/java/org/hippoecm/frontend/plugins/reviewedactions/dialogs/RevisionHistoryView_nl.properties (revision ) @@ -1,3 +1,4 @@ history-name: Naam history-time: Datum / tijd -history-state: Toestand \ No newline at end of file +history-state: Toestand +history-user: Gebruiker \ No newline at end of file