You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/03/30 17:43:45 UTC
[16/59] [abbrv] isis git commit: ISIS-720: mothballing scimpi
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
deleted file mode 100644
index 960997d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
+++ /dev/null
@@ -1,65 +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.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Errors extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final String cls = request.getOptionalProperty(CLASS);
- final StringBuffer buffer = new StringBuffer();
- write(request, cls, buffer);
- if (buffer.length() > 0) {
- request.appendHtml("<div class=\"error\">");
- request.appendHtml(buffer.toString());
- request.appendHtml("</div>");
- }
- }
-
- public static void write(final Request request, String cls, final StringBuffer buffer) {
- if (cls == null) {
- cls = "error";
- }
- final String message = (String) request.getContext().getVariable("_error-message");
- if (message != null) {
- buffer.append(message);
- }
- final String details = (String) request.getContext().getVariable("_error-details");
- if (details != null) {
- buffer.append(details);
- }
-
- /*
- * 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 "errors";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
deleted file mode 100644
index f734ce2..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
+++ /dev/null
@@ -1,46 +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.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Feedback extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final String cls = request.getOptionalProperty(CLASS);
- final StringBuffer buffer = new StringBuffer();
- Errors.write(request, cls, buffer);
- Warnings.write(cls, buffer);
- Messages.write(cls, buffer);
- if (buffer.length() > 0) {
- request.appendHtml("<div class=\"feedback\">");
- request.appendHtml(buffer.toString());
- request.appendHtml("</div>");
- }
- }
-
- @Override
- public String getName() {
- return "feedback";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
deleted file mode 100644
index 32e2cd8..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
+++ /dev/null
@@ -1,77 +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.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class FieldLabel extends AbstractElementProcessor {
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
- // be hidden/disabled, but will be visible/enabled (perhaps incorrectly)
- // for any other value for Where
- private final Where where = Where.ANYWHERE;
-
- @Override
- public void process(final Request request) {
- final String id = request.getOptionalProperty(OBJECT);
- final String fieldName = request.getRequiredProperty(FIELD);
- final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
- if (field == null) {
- throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
- }
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
- throw new ForbiddenException(field, ForbiddenException.VISIBLE);
- }
- String delimiter = request.getOptionalProperty("delimiter");
- if (delimiter == null) {
- delimiter = ": ";
- } else if (delimiter.equals("")) {
- delimiter = null;
- }
- write(request, field, delimiter);
- }
-
- @Override
- public String getName() {
- return "label";
- }
-
- public static void write(final Request content, final ObjectAssociation field, final String delimiter) {
- final String description = field.getDescription();
- final String titleSegment = description == null || description.equals("") ? null : ("title=\"" + description + "\"");
- content.appendHtml("<span class=\"label\"" + titleSegment + ">");
- content.appendAsHtmlEncoded(field.getName());
- if (delimiter != null) {
- content.appendHtml("<span class=\"delimiter\">" + delimiter + "</span>");
- }
- content.appendHtml("</span>");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
deleted file mode 100644
index 3e84218..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
+++ /dev/null
@@ -1,118 +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.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.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public class FieldValue extends AbstractElementProcessor {
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
- // be hidden/disabled, but will be visible/enabled (perhaps incorrectly)
- // for any other value for Where
- private final Where where = Where.ANYWHERE;
-
- @Override
- public void process(final Request request) {
- final String className = request.getOptionalProperty(CLASS);
- final String id = request.getOptionalProperty(OBJECT);
- final String fieldName = request.getRequiredProperty(FIELD);
- final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
- if (field == null) {
- throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
- }
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
- throw new ForbiddenException(field, ForbiddenException.VISIBLE);
- }
- final boolean isIconShowing = request.isRequested(SHOW_ICON, showIconByDefault());
- final int truncateTo = Integer.valueOf(request.getOptionalProperty(TRUNCATE, "0")).intValue();
-
- write(request, object, field, null, className, isIconShowing, truncateTo);
- }
-
- @Override
- public String getName() {
- return "field";
- }
-
- public static void write(final Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedField, final String className, final boolean showIcon, final int truncateTo) {
-
- final ObjectAdapter fieldReference = field.get(object);
-
- if (fieldReference != null) {
- final String classSection = "class=\"" + (className == null ? "value" : className) + "\"";
- request.appendHtml("<span " + classSection + ">");
- if (field.isOneToOneAssociation()) {
- try {
- IsisContext.getPersistenceSession().resolveImmediately(fieldReference);
- } catch (final ObjectNotFoundException e) {
- request.appendHtml(e.getMessage() + "</span>");
- }
- }
-
- if (!field.getSpecification().containsFacet(ParseableFacet.class) && showIcon) {
- request.appendHtml("<img class=\"small-icon\" src=\"" + request.getContext().imagePath(fieldReference) + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>");
- }
-
- if (linkedField != null) {
- final String id = request.getContext().mapObject(fieldReference, linkedField.getScope(), Scope.INTERACTION);
- request.appendHtml("<a href=\"" + linkedField.getForwardView() + "?" + linkedField.getVariable() + "=" + id + request.getContext().encodedInteractionParameters() + "\">");
- }
- String value = fieldReference == null ? "" : fieldReference.titleString();
- if (truncateTo > 0 && value.length() > truncateTo) {
- value = value.substring(0, truncateTo) + "...";
- }
-
- // TODO figure out a better way to determine if boolean or a
- // password
- final ObjectSpecification spec = field.getSpecification();
- final BooleanValueFacet facet = spec.getFacet(BooleanValueFacet.class);
- if (facet != null) {
- final boolean flag = facet.isSet(fieldReference);
- final String valueSegment = flag ? " checked=\"checked\"" : "";
- final String disabled = " disabled=\"disabled\"";
- request.appendHtml("<input type=\"checkbox\"" + valueSegment + disabled + " />");
- } else {
- request.appendAsHtmlEncoded(value);
- }
-
- if (linkedField != null) {
- request.appendHtml("</a>");
- }
- request.appendHtml("</span>");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
deleted file mode 100644
index 8a6ab16..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
+++ /dev/null
@@ -1,103 +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.text.DecimalFormat;
-import java.text.Format;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-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.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.facets.value.date.DateValueFacet;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class GetField extends AbstractElementProcessor {
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
- // be hidden/disabled, but will be visible/enabled (perhaps incorrectly)
- // for any other value for Where
- private final Where where = Where.ANYWHERE;
-
- @Override
- public void process(final Request request) {
- final String id = request.getOptionalProperty(OBJECT);
- final String fieldName = request.getRequiredProperty(FIELD);
- final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
- if (object == null) {
- throw new ScimpiException("No object to get field for: " + fieldName + " - " + id);
- }
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
- if (field == null) {
- throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
- }
- final AuthenticationSession session = IsisContext.getAuthenticationSession();
- if (field.isVisible(session, object, where).isVetoed()) {
- throw new ForbiddenException(field, ForbiddenException.VISIBLE);
- }
-
- String pattern = request.getOptionalProperty("decimal-format");
- Format format = null;
- if (pattern != null) {
- format = new DecimalFormat(pattern);
- }
- pattern = request.getOptionalProperty("date-format");
- if (pattern != null) {
- format = new SimpleDateFormat(pattern);
- }
-
- final String name = request.getOptionalProperty(RESULT_NAME, fieldName);
- final String scopeName = request.getOptionalProperty(SCOPE);
- final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
-
- process(request, object, field, format, name, scope);
- }
-
- protected void process(final Request request, final ObjectAdapter object, final ObjectAssociation field, final Format format, final String name, final Scope scope) {
- final ObjectAdapter fieldReference = field.get(object);
- if (format != null && fieldReference.isValue()) {
- final DateValueFacet facet = fieldReference.getSpecification().getFacet(DateValueFacet.class);
- final Date date = facet.dateValue(fieldReference);
- final String value = format.format(date);
- request.appendDebug(" " + object + " -> " + value);
- request.getContext().addVariable(name, Request.getEncoder().encoder(value), scope);
- } else {
- final String source = fieldReference == null ? "" : request.getContext().mapObject(fieldReference, scope);
- request.appendDebug(" " + object + " -> " + source);
- request.getContext().addVariable(name, source, scope);
- }
- }
-
- @Override
- public String getName() {
- return "get-field";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
deleted file mode 100644
index aa3bfff..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
+++ /dev/null
@@ -1,107 +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.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-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.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-/**
- * Element to include another file that will display an object.
- */
-public class IncludeObject extends AbstractElementProcessor {
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
- // be hidden/disabled, but will be visible/enabled (perhaps incorrectly)
- // for any other value for Where
- private final Where where = Where.ANYWHERE;
-
- @Override
- public void process(final Request request) {
- final String path = request.getOptionalProperty("file");
- String id = request.getOptionalProperty(OBJECT);
- final String fieldName = request.getOptionalProperty(FIELD);
- ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
- if (fieldName != null) {
- final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
- throw new ForbiddenException(field, ForbiddenException.VISIBLE);
- }
- object = field.get(object);
- id = request.getContext().mapObject(object, Scope.REQUEST);
- }
-
- if (object != null) {
- IsisContext.getPersistenceSession().resolveImmediately(object);
- request.getContext().addVariable("_object", id, Scope.REQUEST);
- importFile(request, path);
- }
- request.closeEmpty();
- }
-
- private static void importFile(final Request request, final String path) {
- // TODO load in file via HtmlFileParser
- final File file = new File(path);
- BufferedReader reader = null;
- try {
- if (file.exists()) {
- reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
- String line;
- while ((line = reader.readLine()) != null) {
- request.appendHtml(line);
- }
- } else {
- request.appendHtml("<P classs=\"error\">File " + path + " not found to import</P>");
- }
- } catch (final FileNotFoundException e) {
- throw new RuntimeException(e);
- } catch (final IOException e) {
- throw new RuntimeException(e);
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
-
- @Override
- public String getName() {
- return "include-object";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
deleted file mode 100644
index 3bd8352..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
+++ /dev/null
@@ -1,94 +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.Iterator;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public class ListView extends AbstractObjectProcessor {
-
- @Override
- public String checkFieldType(final ObjectAssociation objectField) {
- return objectField.isOneToManyAssociation() ? null : "is not a collection";
- }
-
- @Override
- public void process(final Request request, final ObjectAdapter object) {
- final String linkRowView = request.getOptionalProperty(LINK_VIEW);
- final String linkObjectName = request.getOptionalProperty(ELEMENT_NAME, RequestContext.RESULT);
- final String linkObjectScope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
- LinkedObject linkedRow = null;
- if (linkRowView != null) {
- linkedRow = new LinkedObject(linkObjectName, linkObjectScope, request.getContext().fullUriPath(linkRowView));
- }
- final String bulletType = request.getOptionalProperty("type");
- write(request, object, linkedRow, bulletType);
- }
-
- public static void write(final Request request, final ObjectAdapter collection, final LinkedObject linkRow, final String bulletType) {
-
- if (bulletType == null) {
- request.appendHtml("<ol>");
- } else {
- request.appendHtml("<ul type=\"" + bulletType + "\">");
- }
-
- final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
- final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
- while (iterator.hasNext()) {
- final ObjectAdapter element = iterator.next();
-
- request.appendHtml("<li>");
- if (linkRow != null) {
- final Scope scope = linkRow == null ? Scope.INTERACTION : RequestContext.scope(linkRow.getScope());
- RequestContext context = request.getContext();
- final String rowId = context.mapObject(element, scope);
- request.appendHtml("<a class=\"item-select\" href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable()
- + "=" + rowId + context.encodedInteractionParameters() + "\">");
- }
- request.appendAsHtmlEncoded(element.titleString());
- if (linkRow != null) {
- request.appendHtml("</a>");
- }
-
- request.appendHtml("</li>\n");
- }
- if (bulletType == null) {
- request.appendHtml("</ol>");
- } else {
- request.appendHtml("</ul>");
- }
-
- }
-
- @Override
- public String getName() {
- return "list";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 1efad45..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
+++ /dev/null
@@ -1,84 +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.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-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 Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedObject, final boolean showIcons) {
- if (field.isOneToManyAssociation()) {
- final String noColumnsString = request.getOptionalProperty("no-columns", "3");
- final String tableClass = request.getOptionalProperty("table-class");
- final String rowClassesList = request.getOptionalProperty("row-classes", ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
- String[] rowClasses = new String[0];
- if (rowClassesList != null) {
- rowClasses = rowClassesList.split("[,|/]");
- }
- int noColumns;
- ResolveFieldUtil.resolveField(object, field);
- final ObjectAdapter collection = field.get(object);
- final ObjectSpecification elementSpec = collection.getElementSpecification();
- final List<ObjectAssociation> fields = elementSpec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);
- 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(request, collection, summary, rowBuilder, null, tableClass, rowClasses);
- } else {
- super.addField(request, object, field, linkedObject, showIcons);
- }
- }
-
- @Override
- public String getName() {
- return "long-form";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 8ec1420..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.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.commons.authentication.MessageBroker;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Messages extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final String cls = request.getOptionalProperty(CLASS);
- final StringBuffer buffer = new StringBuffer();
- write(cls, buffer);
- if (buffer.length() > 0) {
- request.appendHtml("<div class=\"feedback\">");
- request.appendHtml(buffer.toString());
- request.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/2c7cfbfe/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 7af46ab..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.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-/**
- * <swf:selected name="selected" object="${action}" equals="${subaction}" />
- */
-public class SelectedObject extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final String name = request.getOptionalProperty(NAME, "selected");
- final String objectId = request.getRequiredProperty(OBJECT);
- final String equalsId = request.getOptionalProperty("equals");
- final String title = request.getOptionalProperty(BUTTON_TITLE);
-
- final ObjectAdapter object = request.getContext().getMappedObjectOrResult(objectId);
- final ObjectAdapter other = request.getContext().getMappedObjectOrResult(equalsId);
- if (object == other || object.equals(title)) {
- // TODO title is not being used!
- request.getContext().addVariable(ID, " id=\"" + name + "\" ", Scope.INTERACTION);
- } else {
- request.getContext().addVariable(ID, "", Scope.INTERACTION);
- }
- request.closeEmpty();
- }
-
- @Override
- public String getName() {
- return "selected";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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/2c7cfbfe/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 2927fab..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.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.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/2c7cfbfe/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 e726e29..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.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
-
-public class TableBuilder extends AbstractTableView {
-
- @Override
- protected TableContentWriter createRowBuilder(final Request request, final RequestContext context, final String parent, final List<ObjectAssociation> allFields, final ObjectAdapter collection) {
-
- final String title = request.getOptionalProperty(TABLE_TITLE);
- final String variable = request.getOptionalProperty(ELEMENT_NAME, ELEMENT);
- final String headerClass = request.getOptionalProperty("head-" + CLASS);
-
- final TableBlock block = new TableBlock();
- block.setCollection(collection);
- block.setElementName(variable);
- request.setBlockContent(block);
- request.pushNewBuffer();
- request.processUtilCloseTag();
- final String headers = request.popBuffer();
- return new TableContentWriter() {
-
- @Override
- public void writeFooters(final PageWriter writer) {
- }
-
- public void tidyUp() {
- request.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 Request request, final RequestContext context, final ObjectAdapter element) {
- context.addVariable(variable, context.mapObject(element, Scope.REQUEST), Scope.REQUEST);
- final RepeatMarker end = request.createMarker();
- final RepeatMarker marker = block.getMarker();
- marker.repeat();
- request.processUtilCloseTag();
- end.repeat();
- }
- };
- }
-
- @Override
- public String getName() {
- return "table-builder";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 3f99218..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
+++ /dev/null
@@ -1,94 +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.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-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 Request request) {
- final TableBlock tableBlock = (TableBlock) request.getBlockContent();
- final String id = request.getOptionalProperty(OBJECT);
- final String fieldName = request.getRequiredProperty(FIELD);
- final String linkView = request.getOptionalProperty(LINK_VIEW);
- String className = request.getOptionalProperty(CLASS);
- className = className == null ? "" : " class=\"" + className + "\"";
- RequestContext context = request.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());
- }
- request.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 = request.getOptionalProperty(RESULT_NAME, fieldName);
- context.addVariable(name, Request.getEncoder().encoder(source), Scope.REQUEST);
-
- if (linkView != null) {
- final String linkId = context.mapObject(object, Scope.REQUEST);
- final String linkName = request.getOptionalProperty(LINK_NAME, RequestContext.RESULT);
- final String linkObject = request.getOptionalProperty(LINK_OBJECT, linkId);
- request.appendHtml("<a href=\"" + linkView + "?" + linkName + "=" + linkObject + context.encodedInteractionParameters() + "\">");
- } else if(tableBlock.getlinkView() != null) {
- String linkObjectInVariable = tableBlock.getElementName();
- final String linkId = (String) context.getVariable(linkObjectInVariable);
- request.appendHtml("<a href=\"" + tableBlock.getlinkView() + "?" + tableBlock.getlinkName() + "=" + linkId + context.encodedInteractionParameters() + "\">");
- }
- request.pushNewBuffer();
- request.processUtilCloseTag();
- final String buffer = request.popBuffer();
- if (buffer.trim().length() == 0) {
- request.appendAsHtmlEncoded(fieldReference == null ? "" : fieldReference.titleString());
- } else {
- request.appendHtml(buffer);
- }
- if (linkView != null) {
- request.appendHtml("</a>");
- }
- } else {
- request.skipUntilClose();
- }
- request.appendHtml("</td>");
- }
-
- @Override
- public String getName() {
- return "table-cell";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 10da109..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.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public interface TableContentWriter {
-
- void writeCaption(PageWriter writer);
-
- void writeHeaders(PageWriter writer);
-
- void writeFooters(PageWriter writer);
-
- void writeElement(Request request, RequestContext context, ObjectAdapter element);
-
- void tidyUp();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 5595207..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.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class TableEmpty extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final TableBlock tableBlock = (TableBlock) request.getBlockContent();
- final ObjectAdapter collection = tableBlock.getCollection();
- final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
- if (facet.size(collection) == 0) {
- String className = request.getOptionalProperty(CLASS);
- className = className == null ? "" : " class=\"" + className + "\"";
- request.appendHtml("<tr" + className + ">");
- request.pushNewBuffer();
- request.processUtilCloseTag();
- final String buffer = request.popBuffer();
- request.appendHtml(buffer);
- request.appendHtml("</td>");
- } else {
- request.skipUntilClose();
- }
- }
-
- @Override
- public String getName() {
- return "table-empty";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 ff04389..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.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class TableHeader extends AbstractElementProcessor {
-
- @Override
- public String getName() {
- return "table-header";
- }
-
- @Override
- public void process(final Request request) {
- request.appendHtml("<thead><tr>");
- request.processUtilCloseTag();
- request.appendHtml("</tr></thead>");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 eb92656..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.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
-
-public class TableRow extends AbstractElementProcessor {
-
- @Override
- public String getName() {
- return "table-row";
- }
-
- @Override
- public void process(final Request request) {
- final TableBlock block = (TableBlock) request.getBlockContent();
-
- final RepeatMarker start = request.createMarker();
- block.setMarker(start);
-
- final String linkView = request.getOptionalProperty(LINK_VIEW);
- if (linkView != null) {
- block.setlinkView(linkView);
- block.setlinkName(request.getOptionalProperty(LINK_NAME, RequestContext.RESULT));
- }
-
- request.skipUntilClose();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 caf984f..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.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-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 Request request, final RequestContext 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) {
- request.appendHtml("<td>");
- if (linkRow != null) {
- request.appendHtml("<td><a href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable() + "=" + rowId + result + scope + "\">");
- request.appendAsHtmlEncoded(element.titleString());
- request.appendHtml("</a>");
- } else {
- request.appendAsHtmlEncoded(element.titleString());
- }
- request.appendHtml("</td>");
-
- } else {
- if (showTitle) {
- request.appendHtml("<td>");
- request.appendAsHtmlEncoded(element.titleString());
- request.appendHtml("</td>");
- }
-
- for (int i = 0; i < noColumns; i++) {
- if (fields.get(i).isOneToManyAssociation()) {
- continue;
- }
- request.appendHtml("<td>");
- final ObjectAdapter field = fields.get(i).get(element);
- if (field != null) {
- if (showIcons && !fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
- request.appendHtml("<img class=\"" + "small-icon" + "\" src=\"" + request.getContext().imagePath(field) + "\" alt=\"" + fields.get(i).getSpecification().getShortIdentifier() + "\"/>");
- }
- if (linkRow != null) {
- request.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);
- request.appendHtml("<a href=\"" + linkedFields[i].getForwardView() + "?" + linkedFields[i].getVariable() + "=" + id + "\">");
- context.mapObject(fieldObject, RequestContext.scope(linkedFields[i].getScope()));
-
- }
- try {
- request.appendAsHtmlEncoded(field.titleString());
- } catch (final ObjectNotFoundException e) {
- request.appendAsHtmlEncoded(e.getMessage());
- }
- if (linkRow != null || linkedFields[i] != null) {
- request.appendHtml("</a>");
- }
- }
- request.appendHtml("</td>");
-
- }
- }
- request.appendHtml("<td class=\"controls\">");
- if (showSelectOption) {
- request.appendHtml("<a class=\"button element-select\" href=\"" + "_generic." + Dispatcher.EXTENSION + "?" + RequestContext.RESULT + "=" + rowId + result + scope + "\">view</a>");
- }
- if (showEditOption) {
- request.appendHtml(" <a class=\"button element-edit\" href=\"" + "_generic_edit." + Dispatcher.EXTENSION + "?" + RequestContext.RESULT + "=" + rowId + result + scope + "\">edit</a>");
- }
-
- if (showDeleteOption && parent != null) {
- String view = request.getViewPath();
- view = context.fullFilePath(view == null ? context.getResourceFile() : view);
- RemoveElement.write(request, context.getMappedObject(parent), fieldName, element, null, view, view, "delete", "action in-line element-delete confirm");
- }
-
- request.appendHtml("</td>");
-
- }
- }
-
- @Override
- protected TableContentWriter createRowBuilder(
- final Request request,
- final RequestContext context,
- final String parent,
- final List<ObjectAssociation> allFields,
- final ObjectAdapter collection) {
- final String fieldName = request.getOptionalProperty(FIELD);
- final String title = request.getOptionalProperty(FORM_TITLE);
- return rowBuilder(request, context, title, parent, fieldName, allFields, showIconByDefault());
- }
-
- private static TableContentWriter rowBuilder(
- final Request request,
- final RequestContext context,
- final String title,
- final String object,
- final String fieldName,
- final List<ObjectAssociation> allFields,
- final boolean showIconByDefault) {
- final String linkRowView = request.getOptionalProperty(LINK_VIEW);
- final String linkObjectName = request.getOptionalProperty(ELEMENT_NAME, RequestContext.RESULT);
- final String linkObjectScope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
- final LinkedObject linkRow = linkRowView == null ? null : new LinkedObject(linkObjectName, linkObjectScope, context.fullUriPath(linkRowView));
- final boolean includeHeader = request.isRequested(HEADER, true);
- final boolean includeFooter = request.isRequested(FOOTER, false);
-
- final boolean linkFields = request.isRequested("link-fields", true);
- final boolean showTitle = request.isRequested(SHOW_TITLE, false);
- final boolean showIcons = request.isRequested(SHOW_ICON, showIconByDefault);
- final boolean showSelectOption = request.isRequested(SHOW_SELECT, true);
- final boolean showEditOption = request.isRequested(SHOW_EDIT, true);
- final boolean showDeleteOption = request.isRequested(SHOW_DELETE, true);
-
- final String noColumnsString = request.getOptionalProperty("no-columns", "3");
-
- final LinkedFieldsBlock block = new LinkedFieldsBlock();
- request.setBlockContent(block);
- request.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();
- }
-
- request.popBlockContent();
-
- return new SimpleTableBuilder(object, includeHeader, includeFooter, title, noColumns, headers, fields, showTitle,
- showIcons, showSelectOption, showDeleteOption, showEditOption, fieldName, linkedFields, linkRow);
- }
-
- public static void write(
- final Request request,
- 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 RequestContext context = request.getContext();
- final TableContentWriter rowBuilder = rowBuilder(request, context, null, context.mapObject(object, Scope.REQUEST), field.getIdentifier().getMemberName(), fields,
- showIconByDefault);
- write(request, collection, summary, rowBuilder, null, null, null);
- }
-
- @Override
- public String getName() {
- return "table";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/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 d3b6904..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.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public class Title extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final String id = request.getOptionalProperty(OBJECT);
- final String fieldName = request.getOptionalProperty(FIELD);
- final int truncateTo = Integer.valueOf(request.getOptionalProperty(TRUNCATE, "0")).intValue();
- final boolean isIconShowing = request.isRequested(SHOW_ICON, showIconByDefault());
- String className = request.getOptionalProperty(CLASS);
- className = className == null ? "title-icon" : className;
- ObjectAdapter object = MethodsUtils.findObject(request.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) {
- request.appendHtml("<span class=\"object\">");
- IsisContext.getPersistenceSession().resolveImmediately(object);
- if (isIconShowing) {
- final String iconPath = request.getContext().imagePath(object);
- request.appendHtml("<img class=\"" + className + "\" src=\"" + iconPath + "\" />");
- }
- request.appendTruncated(object.titleString(), truncateTo);
- request.appendHtml("</span>");
- }
- request.closeEmpty();
- }
-
- @Override
- public String getName() {
- return "title";
- }
-
-}