You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by rm...@apache.org on 2013/03/24 18:45:15 UTC
[18/24] Restructuring Scimpi to remove dependencies and enable easier
testing.
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
deleted file mode 100644
index a157858..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociationFilters;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableView.SimpleTableBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public class LongFormView extends AbstractFormView {
-
- @Override
- protected void addField(final TagProcessor tagProcessor, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedObject, final boolean showIcons) {
- if (field.isOneToManyAssociation()) {
- final String noColumnsString = tagProcessor.getOptionalProperty("no-columns", "3");
- final String tableClass = tagProcessor.getOptionalProperty("table-class");
- final String rowClassesList = tagProcessor.getOptionalProperty("row-classes", ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
- String[] rowClasses = new String[0];
- if (rowClassesList != null) {
- rowClasses = rowClassesList.split("[,|/]");
- }
- int noColumns;
- IsisContext.getPersistenceSession().resolveField(object, field);
- final ObjectAdapter collection = field.get(object);
- final ObjectSpecification elementSpec = collection.getElementSpecification();
- final List<ObjectAssociation> fields = elementSpec.getAssociations(ObjectAssociationFilters.WHEN_VISIBLE_IRRESPECTIVE_OF_WHERE);
- if (noColumnsString.equalsIgnoreCase("all")) {
- noColumns = fields.size();
- } else {
- noColumns = Math.min(fields.size(), Integer.valueOf(noColumnsString));
- }
- // final boolean isFieldEditable = field.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed();
- final String summary = "Table of elements in " + field.getName();
- // TableView.write(request, summary, object, field, collection, noColumns, fields, isFieldEditable, showIconByDefault(), tableClass, rowClasses, linkedObject);
-
-
- final String headers[] = new String[fields.size()];
- int h = 0;
- for (int i = 0; i < noColumns; i++) {
- if (fields.get(i).isOneToManyAssociation()) {
- continue;
- }
- headers[h++] = fields.get(i).getName();
- }
-
- final LinkedObject[] linkedFields = new LinkedObject[fields.size()];
-
-
- final TableContentWriter rowBuilder =new SimpleTableBuilder(object.titleString(), true, false, "", noColumns, headers, fields, false,
- showIcons, false, false, false, field.getName(), linkedFields, null);
- TableView.write(tagProcessor, collection, summary, rowBuilder, null, tableClass, rowClasses);
- } else {
- super.addField(tagProcessor, object, field, linkedObject, showIcons);
- }
- }
-
- @Override
- public String getName() {
- return "long-form";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
deleted file mode 100644
index 21fae12..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import java.util.List;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class Messages extends AbstractElementProcessor {
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final String cls = tagProcessor.getOptionalProperty(CLASS);
- final StringBuffer buffer = new StringBuffer();
- write(cls, buffer);
- if (buffer.length() > 0) {
- tagProcessor.appendHtml("<div class=\"feedback\">");
- tagProcessor.appendHtml(buffer.toString());
- tagProcessor.appendHtml("</div>");
- }
-
- }
-
- public static void write(String cls, final StringBuffer buffer) {
- if (cls == null) {
- cls = "message";
- }
- final MessageBroker messageBroker = IsisContext.getMessageBroker();
- final List<String> messages = messageBroker.getMessages();
- for (final String message : messages) {
- buffer.append("<div class=\"" + cls + "\">" + message + "</div>");
- }
- }
-
- @Override
- public String getName() {
- return "messages";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
deleted file mode 100644
index bba9d03..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-/**
- * <swf:selected name="selected" object="${action}" equals="${subaction}" />
- */
-public class SelectedObject extends AbstractElementProcessor {
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final String name = tagProcessor.getOptionalProperty(NAME, "selected");
- final String objectId = tagProcessor.getRequiredProperty(OBJECT);
- final String equalsId = tagProcessor.getOptionalProperty("equals");
- final String title = tagProcessor.getOptionalProperty(BUTTON_TITLE);
-
- final ObjectAdapter object = tagProcessor.getContext().getMappedObjectOrResult(objectId);
- final ObjectAdapter other = tagProcessor.getContext().getMappedObjectOrResult(equalsId);
- if (object == other || object.equals(title)) {
- // TODO title is not being used!
- tagProcessor.getContext().addVariable(ID, " id=\"" + name + "\" ", Scope.INTERACTION);
- } else {
- tagProcessor.getContext().addVariable(ID, "", Scope.INTERACTION);
- }
- tagProcessor.closeEmpty();
- }
-
- @Override
- public String getName() {
- return "selected";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
deleted file mode 100644
index 31e903b..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-public class ShortFormView extends AbstractFormView {
-
- @Override
- protected boolean ignoreField(final ObjectAssociation field) {
- return field.isOneToManyAssociation();
- }
-
- @Override
- public String getName() {
- return "short-form";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
deleted file mode 100644
index 6fa85b9..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor.RepeatMarker;
-
-public class TableBlock implements BlockContent {
-
- // {{ collection
- private ObjectAdapter collection;
-
- public void setCollection(final ObjectAdapter collection) {
- this.collection = collection;
- }
-
- public ObjectAdapter getCollection() {
- return collection;
- }
- // }}
-
- // {{ linkView
- private String linkView;
-
- public String getlinkView() {
- return linkView;
- }
-
- public void setlinkView(final String linkView) {
- this.linkView = linkView;
- }
- // }}
-
- // {{ linkName
- private String linkName;
-
- public String getlinkName() {
- return linkName;
- }
-
- public void setlinkName(final String linkName) {
- this.linkName = linkName;
- }
- // }}
-
- // {{ elementName
- private String elementName;
-
- public String getElementName() {
- return elementName;
- }
-
- public void setElementName(final String linkObject) {
- this.elementName = linkObject;
- }
- // }}
-
- private RepeatMarker marker;
-
- public RepeatMarker getMarker() {
- return marker;
- }
-
- public void setMarker(final RepeatMarker marker) {
- this.marker = marker;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
deleted file mode 100644
index b1d526b..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor.RepeatMarker;
-
-public class TableBuilder extends AbstractTableView {
-
- @Override
- protected TableContentWriter createRowBuilder(final TagProcessor tagProcessor, final Request context, final String parent, final List<ObjectAssociation> allFields, final ObjectAdapter collection) {
-
- final String title = tagProcessor.getOptionalProperty(TABLE_TITLE);
- final String variable = tagProcessor.getOptionalProperty(ELEMENT_NAME, ELEMENT);
- final String headerClass = tagProcessor.getOptionalProperty("head-" + CLASS);
-
- final TableBlock block = new TableBlock();
- block.setCollection(collection);
- block.setElementName(variable);
- tagProcessor.setBlockContent(block);
- tagProcessor.pushNewBuffer();
- tagProcessor.processUtilCloseTag();
- final String headers = tagProcessor.popBuffer();
- return new TableContentWriter() {
-
- @Override
- public void writeFooters(final PageWriter writer) {
- }
-
- public void tidyUp() {
- tagProcessor.popBlockContent();
- }
-
- @Override
- public void writeCaption(PageWriter writer) {
- if (title != null) {
- writer.appendHtml("<caption>");
- writer.appendHtml(title);
- writer.appendHtml("</thead>");
- }
- }
-
- @Override
- public void writeHeaders(final PageWriter writer) {
- final String headerSegment = headerClass == null ? "" : (" class=\"" + headerClass + "\"");
- writer.appendHtml("<thead" + headerSegment + ">");
- writer.appendHtml(headers);
- writer.appendHtml("</thead>");
- }
-
- @Override
- public void writeElement(final TagProcessor tagProcessor, final Request context, final ObjectAdapter element) {
- context.addVariable(variable, context.mapObject(element, Scope.REQUEST), Scope.REQUEST);
- final RepeatMarker end = tagProcessor.createMarker();
- final RepeatMarker marker = block.getMarker();
- marker.repeat();
- tagProcessor.processUtilCloseTag();
- end.repeat();
- }
- };
- }
-
- @Override
- public String getName() {
- return "table-builder";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
deleted file mode 100644
index 80f1753..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.Names;
-import org.apache.isis.viewer.scimpi.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class TableCell extends AbstractElementProcessor {
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ALL_TABLES) or @Disabled(where=Where.ALL_TABLES) will indeed
- // be hidden from all tables but will be visible/enabled (perhaps incorrectly)
- // if annotated with Where.PARENTED_TABLE or Where.STANDALONE_TABLE
- private final Where where = Where.ALL_TABLES;
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final TableBlock tableBlock = (TableBlock) tagProcessor.getBlockContent();
- final String id = tagProcessor.getOptionalProperty(OBJECT);
- final String fieldName = tagProcessor.getRequiredProperty(FIELD);
- final String linkView = tagProcessor.getOptionalProperty(LINK_VIEW);
- String className = tagProcessor.getOptionalProperty(CLASS);
- className = className == null ? "" : " class=\"" + className + "\"";
- Request context = tagProcessor.getContext();
- final ObjectAdapter object = context.getMappedObjectOrVariable(id, tableBlock.getElementName());
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
- if (field == null) {
- throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
- }
- tagProcessor.appendHtml("<td" + className + ">");
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
- final ObjectAdapter fieldReference = field.get(object);
- final String source = fieldReference == null ? "" : context.mapObject(fieldReference, Scope.REQUEST);
- final String name = tagProcessor.getOptionalProperty(RESULT_NAME, fieldName);
- context.addVariable(name, TagProcessor.getEncoder().encoder(source), Scope.REQUEST);
-
- if (linkView != null) {
- final String linkId = context.mapObject(object, Scope.REQUEST);
- final String linkName = tagProcessor.getOptionalProperty(LINK_NAME, Names.RESULT);
- final String linkObject = tagProcessor.getOptionalProperty(LINK_OBJECT, linkId);
- tagProcessor.appendHtml("<a href=\"" + linkView + "?" + linkName + "=" + linkObject + context.encodedInteractionParameters() + "\">");
- } else if(tableBlock.getlinkView() != null) {
- String linkObjectInVariable = tableBlock.getElementName();
- final String linkId = (String) context.getVariable(linkObjectInVariable);
- tagProcessor.appendHtml("<a href=\"" + tableBlock.getlinkView() + "?" + tableBlock.getlinkName() + "=" + linkId + context.encodedInteractionParameters() + "\">");
- }
- tagProcessor.pushNewBuffer();
- tagProcessor.processUtilCloseTag();
- final String buffer = tagProcessor.popBuffer();
- if (buffer.trim().length() == 0) {
- tagProcessor.appendAsHtmlEncoded(fieldReference == null ? "" : fieldReference.titleString());
- } else {
- tagProcessor.appendHtml(buffer);
- }
- if (linkView != null) {
- tagProcessor.appendHtml("</a>");
- }
- } else {
- tagProcessor.skipUntilClose();
- }
- tagProcessor.appendHtml("</td>");
- }
-
- @Override
- public String getName() {
- return "table-cell";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
deleted file mode 100644
index 92a9929..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-
-public interface TableContentWriter {
-
- void writeCaption(PageWriter writer);
-
- void writeHeaders(PageWriter writer);
-
- void writeFooters(PageWriter writer);
-
- void writeElement(TagProcessor tagProcessor, Request context, ObjectAdapter element);
-
- void tidyUp();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
deleted file mode 100644
index 145733f..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class TableEmpty extends AbstractElementProcessor {
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final TableBlock tableBlock = (TableBlock) tagProcessor.getBlockContent();
- final ObjectAdapter collection = tableBlock.getCollection();
- final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
- if (facet.size(collection) == 0) {
- String className = tagProcessor.getOptionalProperty(CLASS);
- className = className == null ? "" : " class=\"" + className + "\"";
- tagProcessor.appendHtml("<tr" + className + ">");
- tagProcessor.pushNewBuffer();
- tagProcessor.processUtilCloseTag();
- final String buffer = tagProcessor.popBuffer();
- tagProcessor.appendHtml(buffer);
- tagProcessor.appendHtml("</td>");
- } else {
- tagProcessor.skipUntilClose();
- }
- }
-
- @Override
- public String getName() {
- return "table-empty";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
deleted file mode 100644
index 22a8e7f..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class TableHeader extends AbstractElementProcessor {
-
- @Override
- public String getName() {
- return "table-header";
- }
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- tagProcessor.appendHtml("<thead><tr>");
- tagProcessor.processUtilCloseTag();
- tagProcessor.appendHtml("</tr></thead>");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
deleted file mode 100644
index e8ba18a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.viewer.scimpi.Names;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor.RepeatMarker;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class TableRow extends AbstractElementProcessor {
-
- @Override
- public String getName() {
- return "table-row";
- }
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final TableBlock block = (TableBlock) tagProcessor.getBlockContent();
-
- final RepeatMarker start = tagProcessor.createMarker();
- block.setMarker(start);
-
- final String linkView = tagProcessor.getOptionalProperty(LINK_VIEW);
- if (linkView != null) {
- block.setlinkView(linkView);
- block.setlinkName(tagProcessor.getOptionalProperty(LINK_NAME, Names.RESULT));
- }
-
- tagProcessor.skipUntilClose();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
deleted file mode 100644
index aa19f74..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
-import org.apache.isis.viewer.scimpi.Names;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedFieldsBlock;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.RemoveElement;
-
-public class TableView extends AbstractTableView {
-
- static final class SimpleTableBuilder implements TableContentWriter {
- private final String parent;
- private final boolean includeHeader;
- private final boolean includeFooter;
- private final String title;
- private final String[] headers;
- private final List<ObjectAssociation> fields;
- private final boolean showTitle;
- private final boolean showIcons;
- private final boolean showSelectOption;
- private final boolean showDeleteOption;
- private final boolean showEditOption;
- private final String fieldName;
- private final LinkedObject[] linkedFields;
- private final LinkedObject linkRow;
- private final int noColumns;
-
- SimpleTableBuilder(
- final String parent,
- final boolean includeHeader,
- final boolean includeFooter,
- final String title,
- final int noColumns,
- final String[] headers,
- final List<ObjectAssociation> fields,
- final boolean showTitle,
- final boolean showIcons,
- final boolean showSelectOption,
- final boolean showDeleteOption,
- final boolean showEditOption,
- final String fieldName,
- final LinkedObject[] linkedFields,
- final LinkedObject linkRow) {
- this.parent = parent;
- this.includeHeader = includeHeader;
- this.includeFooter = includeFooter;
- this.title = title;
- this.showTitle = showTitle;
- this.noColumns = noColumns < 1 ? fields.size() : noColumns;
- this.headers = headers;
- this.fields = fields;
- this.showIcons = showIcons;
- this.showSelectOption = showSelectOption;
- this.showDeleteOption = showDeleteOption;
- this.showEditOption = showEditOption;
- this.fieldName = fieldName;
- this.linkedFields = linkedFields;
- this.linkRow = linkRow;
- }
-
- @Override
- public void writeFooters(final PageWriter writer) {
- if (includeFooter) {
- writer.appendHtml("<tfoot>");
- columnHeaders(writer, headers);
- writer.appendHtml("</tfoot>");
- }
- }
-
- @Override
- public void writeCaption(PageWriter writer) {
- if (title != null) {
- writer.appendHtml("<caption>");
- writer.appendHtml(title);
- writer.appendHtml("</caption>");
- }
- }
-
- @Override
- public void writeHeaders(final PageWriter writer) {
- if (includeHeader) {
- writer.appendHtml("<thead>");
- columnHeaders(writer, headers);
- writer.appendHtml("</thead>");
- }
- }
-
- private void columnHeaders(final PageWriter writer, final String[] headers) {
- writer.appendHtml("<tr class=\"column-headers\">");
- if (showTitle) {
- writer.appendHtml("<th></th>");
- }
- final String[] columnHeaders = headers;
- for (final String columnHeader : columnHeaders) {
- if (columnHeader != null) {
- writer.appendHtml("<th>");
- writer.appendAsHtmlEncoded(columnHeader);
- writer.appendHtml("</th>");
- }
- }
- writer.appendHtml("<th class=\"controls\"></th>");
- writer.appendHtml("</tr>");
- }
-
- public void tidyUp() {
- // request.popBlockContent();
-
- // Is it the block that is left over, or is the collection form not being closed?
- }
-
- @Override
- public void writeElement(final TagProcessor tagProcessor, final Request context, final ObjectAdapter element) {
- final String rowId = context.mapObject(element, Scope.INTERACTION);
- final String scope = linkRow == null ? "" : "&" + SCOPE + "=" + linkRow.getScope();
- String result = "";
- result = context.encodedInteractionParameters();
-
- if (noColumns == 0) {
- tagProcessor.appendHtml("<td>");
- if (linkRow != null) {
- tagProcessor.appendHtml("<td><a href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable() + "=" + rowId + result + scope + "\">");
- tagProcessor.appendAsHtmlEncoded(element.titleString());
- tagProcessor.appendHtml("</a>");
- } else {
- tagProcessor.appendAsHtmlEncoded(element.titleString());
- }
- tagProcessor.appendHtml("</td>");
-
- } else {
- if (showTitle) {
- tagProcessor.appendHtml("<td>");
- tagProcessor.appendAsHtmlEncoded(element.titleString());
- tagProcessor.appendHtml("</td>");
- }
-
- for (int i = 0; i < noColumns; i++) {
- if (fields.get(i).isOneToManyAssociation()) {
- continue;
- }
- tagProcessor.appendHtml("<td>");
- final ObjectAdapter field = fields.get(i).get(element);
- if (field != null) {
- if (showIcons && !fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
- tagProcessor.appendHtml("<img class=\"" + "small-icon" + "\" src=\"" + tagProcessor.getContext().imagePath(field) + "\" alt=\"" + fields.get(i).getSpecification().getShortIdentifier() + "\"/>");
- }
- if (linkRow != null) {
- tagProcessor.appendHtml("<a href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable() + "=" + rowId + result + scope + "\">");
- } else if (linkedFields[i] != null) {
- final ObjectAdapter fieldObject = fields.get(i).get(element);
- final String id = context.mapObject(fieldObject, Scope.INTERACTION);
- tagProcessor.appendHtml("<a href=\"" + linkedFields[i].getForwardView() + "?" + linkedFields[i].getVariable() + "=" + id + "\">");
- context.mapObject(fieldObject, Request.scope(linkedFields[i].getScope()));
-
- }
- try {
- tagProcessor.appendAsHtmlEncoded(field.titleString());
- } catch (final ObjectNotFoundException e) {
- tagProcessor.appendAsHtmlEncoded(e.getMessage());
- }
- if (linkRow != null || linkedFields[i] != null) {
- tagProcessor.appendHtml("</a>");
- }
- }
- tagProcessor.appendHtml("</td>");
-
- }
- }
- tagProcessor.appendHtml("<td class=\"controls\">");
- if (showSelectOption) {
- tagProcessor.appendHtml("<a class=\"button element-select\" href=\"" + "_generic." + Names.EXTENSION + "?" + Names.RESULT + "=" + rowId + result + scope + "\">view</a>");
- }
- if (showEditOption) {
- tagProcessor.appendHtml(" <a class=\"button element-edit\" href=\"" + "_generic_edit." + Names.EXTENSION + "?" + Names.RESULT + "=" + rowId + result + scope + "\">edit</a>");
- }
-
- if (showDeleteOption && parent != null) {
- String view = tagProcessor.getViewPath();
- view = context.fullFilePath(view == null ? context.getResourceFile() : view);
- RemoveElement.write(tagProcessor, context.getMappedObject(parent), fieldName, element, null, view, view, "delete", "action in-line element-delete confirm");
- }
-
- tagProcessor.appendHtml("</td>");
-
- }
- }
-
- @Override
- protected TableContentWriter createRowBuilder(
- final TagProcessor tagProcessor,
- final Request context,
- final String parent,
- final List<ObjectAssociation> allFields,
- final ObjectAdapter collection) {
- final String fieldName = tagProcessor.getOptionalProperty(FIELD);
- final String title = tagProcessor.getOptionalProperty(FORM_TITLE);
- return rowBuilder(tagProcessor, context, title, parent, fieldName, allFields, showIconByDefault());
- }
-
- private static TableContentWriter rowBuilder(
- final TagProcessor tagProcessor,
- final Request context,
- final String title,
- final String object,
- final String fieldName,
- final List<ObjectAssociation> allFields,
- final boolean showIconByDefault) {
- final String linkRowView = tagProcessor.getOptionalProperty(LINK_VIEW);
- final String linkObjectName = tagProcessor.getOptionalProperty(ELEMENT_NAME, Names.RESULT);
- final String linkObjectScope = tagProcessor.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
- final LinkedObject linkRow = linkRowView == null ? null : new LinkedObject(linkObjectName, linkObjectScope, context.fullUriPath(linkRowView));
- final boolean includeHeader = tagProcessor.isRequested(HEADER, true);
- final boolean includeFooter = tagProcessor.isRequested(FOOTER, false);
-
- final boolean linkFields = tagProcessor.isRequested("link-fields", true);
- final boolean showTitle = tagProcessor.isRequested(SHOW_TITLE, false);
- final boolean showIcons = tagProcessor.isRequested(SHOW_ICON, showIconByDefault);
- final boolean showSelectOption = tagProcessor.isRequested(SHOW_SELECT, true);
- final boolean showEditOption = tagProcessor.isRequested(SHOW_EDIT, true);
- final boolean showDeleteOption = tagProcessor.isRequested(SHOW_DELETE, true);
-
- final String noColumnsString = tagProcessor.getOptionalProperty("no-columns", "3");
-
- final LinkedFieldsBlock block = new LinkedFieldsBlock();
- tagProcessor.setBlockContent(block);
- tagProcessor.processUtilCloseTag();
- final List<ObjectAssociation> fields = block.includedFields(allFields);
- final LinkedObject[] linkedFields = block.linkedFields(fields);
- for (int i = 0; i < linkedFields.length; i++) {
- if (linkedFields[i] == null && linkFields && !fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
- linkedFields[i] = new LinkedObject("_generic.shtml");
- }
- if (linkedFields[i] != null) {
- linkedFields[i].setForwardView(context.fullUriPath(linkedFields[i].getForwardView()));
- }
- }
-
- int noColumns;
- if (noColumnsString.equalsIgnoreCase("all")) {
- noColumns = fields.size();
- } else {
- noColumns = Math.min(fields.size(), Integer.valueOf(noColumnsString));
- }
-
- final String headers[] = new String[noColumns];
- int h = 0;
- for (int i = 0; i < noColumns; i++) {
- if (fields.get(i).isOneToManyAssociation()) {
- continue;
- }
- headers[h++] = fields.get(i).getName();
- }
-
- tagProcessor.popBlockContent();
-
- return new SimpleTableBuilder(object, includeHeader, includeFooter, title, noColumns, headers, fields, showTitle,
- showIcons, showSelectOption, showDeleteOption, showEditOption, fieldName, linkedFields, linkRow);
- }
-
- public static void write(
- final TagProcessor tagProcessor,
- final String summary,
- final ObjectAdapter object,
- final ObjectAssociation field,
- final ObjectAdapter collection,
- final int noColumns,
- final List<ObjectAssociation> fields,
- final boolean linkAllFields,
- final boolean showIconByDefault,
- final String tableClass,
- final String[] rowClasses,
- LinkedObject linkedObject) {
- final LinkedObject[] linkedFields = new LinkedObject[fields.size()];
- if (linkAllFields) {
- for (int i = 0; i < linkedFields.length; i++) {
- if (fields.get(i).isOneToOneAssociation()) {
- linkedFields[i] = linkedObject == null ? new LinkedObject("_generic.shtml") : linkedObject;
- }
- }
- }
-
- final String headers[] = new String[fields.size()];
- int h = 0;
- for (int i = 0; i < fields.size(); i++) {
- if (fields.get(i).isOneToManyAssociation()) {
- continue;
- }
- headers[h++] = fields.get(i).getName();
- }
-
- final Request context = tagProcessor.getContext();
- final TableContentWriter rowBuilder = rowBuilder(tagProcessor, context, null, context.mapObject(object, Scope.REQUEST), field.getIdentifier().getMemberName(), fields,
- showIconByDefault);
- write(tagProcessor, collection, summary, rowBuilder, null, null, null);
- }
-
- @Override
- public String getName() {
- return "table";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
deleted file mode 100644
index 76f8278..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class Title extends AbstractElementProcessor {
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final String id = tagProcessor.getOptionalProperty(OBJECT);
- final String fieldName = tagProcessor.getOptionalProperty(FIELD);
- final int truncateTo = Integer.valueOf(tagProcessor.getOptionalProperty(TRUNCATE, "0")).intValue();
- final boolean isIconShowing = tagProcessor.isRequested(SHOW_ICON, showIconByDefault());
- String className = tagProcessor.getOptionalProperty(CLASS);
- className = className == null ? "title-icon" : className;
- ObjectAdapter object = MethodsUtils.findObject(tagProcessor.getContext(), id);
- if (fieldName != null) {
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE).isVetoed()) {
- throw new ForbiddenException(field, ForbiddenException.VISIBLE);
- }
- object = field.get(object);
- }
-
- if (object != null) {
- tagProcessor.appendHtml("<span class=\"object\">");
- IsisContext.getPersistenceSession().resolveImmediately(object);
- if (isIconShowing) {
- final String iconPath = tagProcessor.getContext().imagePath(object);
- tagProcessor.appendHtml("<img class=\"" + className + "\" src=\"" + iconPath + "\" />");
- }
- tagProcessor.appendTruncated(object.titleString(), truncateTo);
- tagProcessor.appendHtml("</span>");
- }
- tagProcessor.closeEmpty();
- }
-
- @Override
- public String getName() {
- return "title";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
deleted file mode 100644
index f6ea1a3..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import java.util.List;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class Warnings extends AbstractElementProcessor {
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final String cls = tagProcessor.getOptionalProperty(CLASS);
- final StringBuffer buffer = new StringBuffer();
- write(cls, buffer);
- if (buffer.length() > 0) {
- tagProcessor.appendHtml("<div class=\"feedback\">");
- tagProcessor.appendHtml(buffer.toString());
- tagProcessor.appendHtml("</div>");
- }
- }
-
- public static void write(String cls, final StringBuffer buffer) {
- if (cls == null) {
- cls = "warning";
- }
- final MessageBroker messageBroker = IsisContext.getMessageBroker();
- final List<String> warnings = messageBroker.getWarnings();
- for (final String warning : warnings) {
- buffer.append("<div class=\"" + cls + "\">" + warning + "</div>");
- }
- }
-
- @Override
- public String getName() {
- return "warnings";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
deleted file mode 100644
index 468fc6a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.edit;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociationFilters;
-import org.apache.isis.core.progmodel.facets.object.choices.enums.EnumFacet;
-import org.apache.isis.core.progmodel.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.action.EditAction;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.structure.FieldEditState;
-import org.apache.isis.viewer.scimpi.dispatcher.structure.FormState;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.HiddenInputField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.HtmlFormBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.widget.FieldFactory;
-import org.apache.isis.viewer.scimpi.dispatcher.view.widget.FormFieldBlock;
-
-public class EditObject extends AbstractElementProcessor {
-
- // REVIEW: confirm this rendering context
- private final Where where = Where.OBJECT_FORMS;
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final Request context = tagProcessor.getContext();
-
- final String objectId = tagProcessor.getOptionalProperty(OBJECT);
- final String forwardEditedTo = tagProcessor.getOptionalProperty(VIEW);
- final String forwardErrorTo = tagProcessor.getOptionalProperty(ERROR);
- final String cancelTo = tagProcessor.getOptionalProperty(CANCEL_TO);
- final boolean hideNonEditableFields = tagProcessor.isRequested(HIDE_UNEDITABLE, false);
- final boolean showIcon = tagProcessor.isRequested(SHOW_ICON, showIconByDefault());
- final String labelDelimiter = tagProcessor.getOptionalProperty(LABEL_DELIMITER, ":");
- String buttonTitle = tagProcessor.getOptionalProperty(BUTTON_TITLE);
- String formTitle = tagProcessor.getOptionalProperty(FORM_TITLE);
- final String formId = tagProcessor.getOptionalProperty(FORM_ID, tagProcessor.nextFormId());
- final String variable = tagProcessor.getOptionalProperty(RESULT_NAME);
- final String resultOverride = tagProcessor.getOptionalProperty(RESULT_OVERRIDE);
- final String scope = tagProcessor.getOptionalProperty(SCOPE);
- final String className = tagProcessor.getOptionalProperty(CLASS, "edit full");
- final String completionMessage = tagProcessor.getOptionalProperty(MESSAGE);
-
- final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
- final String actualObjectId = context.mapObject(object, Scope.INTERACTION);
- final String version = context.mapVersion(object);
-
- final String id = tagProcessor.getOptionalProperty(ID, object.getSpecification().getShortIdentifier());
-
- final FormState entryState = (FormState) context.getVariable(ENTRY_FIELDS);
-
- final ObjectSpecification specification = object.getSpecification();
- final FormFieldBlock containedBlock = new FormFieldBlock() {
- @Override
- public boolean isVisible(final String name) {
- final ObjectAssociation fld = specification.getAssociation(name);
- final boolean isVisible = fld.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed();
- final boolean isUseable = fld.isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
- return isVisible && isUseable;
- }
-
- @Override
- public ObjectAdapter getCurrent(final String name) {
- ObjectAdapter value = null;
- if (entryState != null) {
- final FieldEditState field2 = entryState.getField(name);
- value = field2.getValue();
- }
- if (value == null) {
- final ObjectAssociation fld = specification.getAssociation(name);
- value = fld.get(object);
- }
- return value;
- }
-
- @Override
- public boolean isNullable(final String name) {
- final ObjectAssociation fld = specification.getAssociation(name);
- return !fld.isMandatory();
- }
- };
-
- tagProcessor.setBlockContent(containedBlock);
- tagProcessor.processUtilCloseTag();
-
- final AuthenticationSession session = IsisContext.getAuthenticationSession();
- List<ObjectAssociation> viewFields = specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, object, where));
- viewFields = containedBlock.includedFields(viewFields);
- final InputField[] formFields = createFields(viewFields);
-
- initializeFields(context, object, formFields, entryState, !hideNonEditableFields);
- setDefaults(context, object, formFields, entryState, showIcon);
-
- copyFieldContent(context, object, formFields, showIcon);
- overrideWithHtml(context, containedBlock, formFields);
- String errors = null;
- if (entryState != null && entryState.isForForm(formId)) {
- copyEntryState(context, object, formFields, entryState);
- errors = entryState.getError();
- }
-
- final String errorView = context.fullFilePath(forwardErrorTo == null ? context.getResourceFile() : forwardErrorTo);
- final List<HiddenInputField> hiddenFields = new ArrayList<HiddenInputField>();
- hiddenFields.add(new HiddenInputField("_" + OBJECT, actualObjectId));
- hiddenFields.add(new HiddenInputField("_" + VERSION, version));
- hiddenFields.add(new HiddenInputField("_" + FORM_ID, formId));
- hiddenFields.add(completionMessage == null ? null : new HiddenInputField("_" + MESSAGE, completionMessage));
- hiddenFields.add(forwardEditedTo == null ? null : new HiddenInputField("_" + VIEW, context.fullFilePath(forwardEditedTo)));
- hiddenFields.add(new HiddenInputField("_" + ERROR, errorView));
- hiddenFields.add(variable == null ? null : new HiddenInputField("_" + RESULT_NAME, variable));
- hiddenFields.add(resultOverride == null ? null : new HiddenInputField("_" + RESULT_OVERRIDE, resultOverride));
- hiddenFields.add(scope == null ? null : new HiddenInputField("_" + SCOPE, scope));
-
- if (!object.isTransient()) {
- // ensure all booleans are included so the pass back TRUE if set.
- final List<ObjectAssociation> fields2 = object.getSpecification().getAssociations();
- for (int i = 0; i < fields2.size(); i++) {
- final ObjectAssociation field = fields2.get(i);
- if (!viewFields.contains(field) && field.getSpecification().containsFacet(BooleanValueFacet.class)) {
- final String fieldId = field.getId();
- final String value = getValue(context, field.get(object));
- hiddenFields.add(new HiddenInputField(fieldId, value));
- }
- }
- }
-
- if (formTitle == null) {
- formTitle = specification.getSingularName();
- }
-
- if (buttonTitle == null) {
- buttonTitle = "Save " + specification.getSingularName();
- } else if (buttonTitle.equals("")) {
- buttonTitle = "Save";
- }
-
- final HiddenInputField[] hiddenFieldArray = hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]);
- HtmlFormBuilder.createForm(tagProcessor, EditAction.ACTION + ".app", hiddenFieldArray, formFields, className, id, formTitle,
- labelDelimiter, null, null, buttonTitle, errors, cancelTo);
- tagProcessor.popBlockContent();
- }
-
- private InputField[] createFields(final List<ObjectAssociation> fields) {
- final InputField[] formFields = new InputField[fields.size()];
- int length = 0;
- for (int i = 0; i < fields.size(); i++) {
- if (!fields.get(i).isOneToManyAssociation()) {
- formFields[i] = new InputField(fields.get(i).getId());
- length++;
- }
- }
- final InputField[] array = new InputField[length];
- for (int i = 0, j = 0; i < formFields.length; i++) {
- if (formFields[i] != null) {
- array[j++] = formFields[i];
- }
- }
- return array;
- }
-
- // TODO duplicated in ActionForm#initializeFields
- private void initializeFields(final Request context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState, final boolean includeUnusableFields) {
- for (final InputField formField : formFields) {
- final String fieldId = formField.getName();
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
- final AuthenticationSession session = IsisContext.getAuthenticationSession();
- final Consent usable = field.isUsable(session, object, where);
- final ObjectAdapter[] options = field.getChoices(object);
- FieldFactory.initializeField(context, object, field, options, field.isMandatory(), formField);
-
- final boolean isEditable = usable.isAllowed();
- if (!isEditable) {
- formField.setDescription(usable.getReason());
- }
- formField.setEditable(isEditable);
- final boolean hiddenField = field.isVisible(session, object, where).isVetoed();
- final boolean unusable = usable.isVetoed();
- final boolean hideAsUnusable = unusable && !includeUnusableFields;
- if (hiddenField || hideAsUnusable) {
- formField.setHidden(true);
- }
- }
- }
-
- private void copyFieldContent(final Request context, final ObjectAdapter object, final InputField[] formFields, final boolean showIcon) {
- for (final InputField inputField : formFields) {
- final String fieldName = inputField.getName();
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
- IsisContext.getPersistenceSession().resolveField(object, field);
- final ObjectAdapter fieldValue = field.get(object);
- if (inputField.isEditable()) {
- final String value = getValue(context, fieldValue);
- if (!value.equals("") || inputField.getValue() == null) {
- inputField.setValue(value);
- }
- } else {
- final String entry = getValue(context, fieldValue);
- inputField.setHtml(entry);
- inputField.setType(InputField.HTML);
-
- }
-
- if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
- if (fieldValue != null) {
- final String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(field.getSpecification()) + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>" : "";
- final String entry = iconSegment + fieldValue.titleString();
- inputField.setHtml(entry);
- } else {
- final String entry = "<em>none specified</em>";
- inputField.setHtml(entry);
- }
- }
- }
- }
- }
-
- private void setDefaults(final Request context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState, final boolean showIcon) {
- for (final InputField formField : formFields) {
- final String fieldId = formField.getName();
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
- final ObjectAdapter defaultValue = field.getDefault(object);
- if (defaultValue == null) {
- continue;
- }
-
- final String title = defaultValue.titleString();
- if (field.getSpecification().containsFacet(ParseableFacet.class)) {
- formField.setValue(title);
- } else if (field.isOneToOneAssociation()) {
- final ObjectSpecification objectSpecification = field.getSpecification();
- if (defaultValue != null) {
- final String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification) + "\" alt=\"" + objectSpecification.getShortIdentifier() + "\"/>" : "";
- final String html = iconSegment + title;
- formField.setHtml(html);
- final String value = defaultValue == null ? null : context.mapObject(defaultValue, Scope.INTERACTION);
- formField.setValue(value);
- }
- }
- }
- }
-
- private void overrideWithHtml(final Request context, final FormFieldBlock containedBlock, final InputField[] formFields) {
- for (final InputField formField : formFields) {
- final String fieldId = formField.getName();
- if (containedBlock.hasContent(fieldId)) {
- final String content = containedBlock.getContent(fieldId);
- if (content != null) {
- formField.setHtml(content);
- formField.setValue(null);
- formField.setType(InputField.HTML);
- }
- }
- }
- }
-
- private void copyEntryState(final Request context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState) {
- for (final InputField formField : formFields) {
- final String fieldId = formField.getName();
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() && formField.isEditable()) {
- final FieldEditState fieldState = entryState.getField(field.getId());
- final String entry = fieldState == null ? "" : fieldState.getEntry();
- formField.setValue(entry);
- final String error = fieldState == null ? "" : fieldState.getError();
- formField.setErrorText(error);
- }
- }
- }
-
- private String getValue(final Request context, final ObjectAdapter field) {
- if (field == null || field.isTransient()) {
- return "";
- }
- final ObjectSpecification specification = field.getSpecification();
- if (specification.containsFacet(EnumFacet.class)) {
- return String.valueOf(field.getObject());
- } else if (specification.getFacet(ParseableFacet.class) == null) {
- return context.mapObject(field, Scope.INTERACTION);
- } else {
- return field.titleString();
- }
- }
-
- @Override
- public String getName() {
- return "edit";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
deleted file mode 100644
index 247aa92..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.field;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class ExcludeField extends AbstractElementProcessor {
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final String field = tagProcessor.getOptionalProperty(NAME);
- final InclusionList block = (InclusionList) tagProcessor.getBlockContent();
- block.exclude(field);
- }
-
- @Override
- public String getName() {
- return "exclude";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
deleted file mode 100644
index 0d176d2..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.field;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class IncludeField extends AbstractElementProcessor {
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final String field = tagProcessor.getOptionalProperty(NAME);
- final InclusionList block = (InclusionList) tagProcessor.getBlockContent();
- block.include(field);
- }
-
- @Override
- public String getName() {
- return "include";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
deleted file mode 100644
index 3a72451..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.field;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.collect.Lists;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class InclusionList implements BlockContent {
- private final Set<String> includedList = new HashSet<String>();
- private final Set<String> excludedList = new HashSet<String>();
-
- private boolean inIncludedList(final String fieldName) {
- return includedList.size() == 0 || includedList.contains(fieldName) || includedList.contains("all");
- }
-
- private boolean inExcludedList(final String fieldName) {
- return excludedList.contains(fieldName) || excludedList.contains("all");
- }
-
- public void include(final String field) {
- includedList.add(field);
- }
-
- public void exclude(final String field) {
- excludedList.add(field);
- }
-
- public List<ObjectAssociation> includedFields(final List<ObjectAssociation> originalFields) {
- final List<ObjectAssociation> includedFields = Lists.newArrayList();
- for (int i = 0; i < originalFields.size(); i++) {
- final String id2 = originalFields.get(i).getId();
- if (includes(id2)) {
- includedFields.add(originalFields.get(i));
- }
- }
-
- return includedFields;
- }
-
- public void hideExcludedParameters(final InputField[] inputFields) {
- for (final InputField inputField : inputFields) {
- final String id2 = inputField.getName();
- if (!includes(id2)) {
- inputField.setHidden(true);
- }
- }
- }
-
- public boolean includes(final String id) {
- return inIncludedList(id) && !inExcludedList(id);
- }
-
- public List<ObjectAction> includedActions(final List<ObjectAction> originalActions) {
- final List<ObjectAction> includedActions = Lists.newArrayList();
- for (int i = 0; i < originalActions.size(); i++) {
- final String id2 = originalActions.get(i).getId();
- if (includes(id2)) {
- includedActions.add(originalActions.get(i));
- }
- }
-
- return includedActions;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
deleted file mode 100644
index e36612d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.field;
-
-import org.apache.isis.viewer.scimpi.Names;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class LinkField extends AbstractElementProcessor {
-
- @Override
- public void process(final TagProcessor tagProcessor) {
- final String field = tagProcessor.getOptionalProperty(NAME);
- final String variable = tagProcessor.getOptionalProperty(REFERENCE_NAME, Names.RESULT);
- final String scope = tagProcessor.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
- final String forwardView = tagProcessor.getOptionalProperty(VIEW, "_generic." + Names.EXTENSION);
- final LinkedFieldsBlock tag = (LinkedFieldsBlock) tagProcessor.getBlockContent();
- tag.link(field, variable, scope, forwardView);
- }
-
- @Override
- public String getName() {
- return "link";
- }
-
-}