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 14:56:44 UTC
[15/22] 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/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 52be7d6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
+++ /dev/null
@@ -1,58 +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 Warnings 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 = "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/2c7cfbfe/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 deafb1a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
+++ /dev/null
@@ -1,319 +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.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.facets.object.choices.enums.EnumFacet;
-import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-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.edit.EditAction;
-import org.apache.isis.viewer.scimpi.dispatcher.edit.FieldEditState;
-import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-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;
-
-public class EditObject extends AbstractElementProcessor {
-
- // REVIEW: confirm this rendering context
- private final Where where = Where.OBJECT_FORMS;
-
- @Override
- public void process(final Request request) {
- final RequestContext context = request.getContext();
-
- final String objectId = request.getOptionalProperty(OBJECT);
- final String forwardEditedTo = request.getOptionalProperty(VIEW);
- final String forwardErrorTo = request.getOptionalProperty(ERROR);
- final String cancelTo = request.getOptionalProperty(CANCEL_TO);
- final boolean hideNonEditableFields = request.isRequested(HIDE_UNEDITABLE, false);
- final boolean showIcon = request.isRequested(SHOW_ICON, showIconByDefault());
- final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
- String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
- String formTitle = request.getOptionalProperty(FORM_TITLE);
- final String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
- final String variable = request.getOptionalProperty(RESULT_NAME);
- final String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
- final String scope = request.getOptionalProperty(SCOPE);
- final String className = request.getOptionalProperty(CLASS, "edit full");
- final String completionMessage = request.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 = request.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();
- }
- };
-
- request.setBlockContent(containedBlock);
- request.processUtilCloseTag();
-
- final AuthenticationSession session = IsisContext.getAuthenticationSession();
- List<ObjectAssociation> viewFields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.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(Contributed.EXCLUDED);
- 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(request, EditAction.ACTION + ".app", hiddenFieldArray, formFields, className, id, formTitle,
- labelDelimiter, null, null, buttonTitle, errors, cancelTo);
- request.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 RequestContext 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 RequestContext 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()) {
- ResolveFieldUtil.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 RequestContext 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 RequestContext 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 RequestContext 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 RequestContext 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/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
deleted file mode 100644
index 35a9158..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
+++ /dev/null
@@ -1,105 +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 org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.all.help.HelpFacet;
-import org.apache.isis.core.metamodel.facets.objectvalue.maxlen.MaxLengthFacet;
-import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacet;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectFeature;
-import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.metamodel.facets.value.password.PasswordValueFacet;
-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.view.form.InputField;
-
-public class FieldFactory {
-
- public static void initializeField(final RequestContext context, final ObjectAdapter object, final ObjectFeature param, final ObjectAdapter[] optionsForParameter, final boolean isRequired, final InputField field) {
-
- field.setLabel(param.getName());
- field.setDescription(param.getDescription());
- field.setDataType(param.getSpecification().getShortIdentifier());
- if (param instanceof ObjectMember) {
- field.setHelpReference(((ObjectMember) param).getHelp());
- } else {
- final HelpFacet helpFacet = param.getFacet(HelpFacet.class);
- final String value = helpFacet.value();
- field.setHelpReference(value);
- }
- field.setRequired(isRequired);
- field.setHidden(false);
-
- if (param.getSpecification().getFacet(ParseableFacet.class) != null) {
- final int maxLength = param.getFacet(MaxLengthFacet.class).value();
- field.setMaxLength(maxLength);
-
- final TypicalLengthFacet typicalLengthFacet = param.getFacet(TypicalLengthFacet.class);
- if (typicalLengthFacet.isDerived() && maxLength > 0) {
- field.setWidth(maxLength);
- } else {
- field.setWidth(typicalLengthFacet.value());
- }
-
- final MultiLineFacet multiLineFacet = param.getFacet(MultiLineFacet.class);
- field.setHeight(multiLineFacet.numberOfLines());
- field.setWrapped(!multiLineFacet.preventWrapping());
-
- final ObjectSpecification spec = param.getSpecification();
- if (spec.containsFacet(BooleanValueFacet.class)) {
- field.setType(InputField.CHECKBOX);
- } else if (spec.containsFacet(PasswordValueFacet.class)) {
- field.setType(InputField.PASSWORD);
- } else {
- field.setType(InputField.TEXT);
- }
-
- } else {
- field.setType(InputField.REFERENCE);
- }
-
- if (optionsForParameter != null) {
- final int noOptions = optionsForParameter.length;
- final String[] optionValues = new String[noOptions];
- final String[] optionTitles = new String[noOptions];
- for (int j = 0; j < optionsForParameter.length; j++) {
- final int i = j; // + (field.isRequired() ? 0 : 1);
- optionValues[i] = getValue(context, optionsForParameter[j]);
- optionTitles[i] = optionsForParameter[j].titleString();
- }
- field.setOptions(optionTitles, optionValues);
- }
- }
-
- private static String getValue(final RequestContext context, final ObjectAdapter field) {
- if (field == null) {
- return "";
- }
- if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
- return context.mapObject(field, Scope.INTERACTION);
- } else {
- return field.getObject().toString();
- }
- }
-}
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/edit/FormEntry.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java
deleted file mode 100644
index 5d57740..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.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.edit;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class FormEntry extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
- final String field = request.getRequiredProperty(FIELD);
- final String value = request.getRequiredProperty(VALUE);
- final boolean isHidden = request.isRequested(HIDDEN, true);
- block.exclude(field);
- // TODO this is replaced because the field is marked as hidden!
- final String content = "reference <input type=\"" + (isHidden ? "hidden" : "text") + "\" disabled=\"disabled\" name=\"" + field + "\" value=\"" + value + "\" />";
- block.replaceContent(field, content);
- }
-
- @Override
- public String getName() {
- return "form-entry";
- }
-
-}
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/edit/FormField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java
deleted file mode 100644
index 55c7425..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.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.edit;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class FormField extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
- final String field = request.getRequiredProperty(FIELD);
- if (block.isVisible(field)) {
- request.pushNewBuffer();
- request.processUtilCloseTag();
- final String content = request.popBuffer();
- block.replaceContent(field, content);
- }
- }
-
- @Override
- public String getName() {
- return "form-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/edit/FormFieldBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java
deleted file mode 100644
index 294a239..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.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.edit;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.InclusionList;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class FormFieldBlock extends InclusionList {
- private final Map<String, String> content = new HashMap<String, String>();
- private final Map<String, String> values = new HashMap<String, String>();
-
- public void replaceContent(final String field, final String htmlString) {
- content.put(field, htmlString);
- }
-
- public boolean hasContent(final String name) {
- return content.containsKey(name);
- }
-
- public String getContent(final String name) {
- return content.get(name);
- }
-
- public boolean isVisible(final String name) {
- return true;
- }
-
- public boolean isNullable(final String name) {
- return true;
- }
-
- public ObjectAdapter getCurrent(final String name) {
- return null;
- }
-
- public void value(final String field, final String value) {
- values.put(field, value);
- }
-
- public void setUpValues(final InputField[] inputFields) {
- for (final InputField inputField : inputFields) {
- final String name = inputField.getName();
- inputField.setValue(values.get(name));
- }
- }
-
-}
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/edit/HiddenField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
deleted file mode 100644
index 71019ea..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
+++ /dev/null
@@ -1,48 +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 org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.TagOrderException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class HiddenField extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final BlockContent blockContent = request.getBlockContent();
- if (!(blockContent instanceof FormFieldBlock)) {
- throw new TagOrderException(request);
- }
-
- final String field = request.getOptionalProperty("name");
- final String value = request.getRequiredProperty("value");
- final FormFieldBlock block = (FormFieldBlock) blockContent;
- block.value(field, value);
- block.exclude(field);
- }
-
- @Override
- public String getName() {
- return "hidden-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/edit/RadioListField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
deleted file mode 100644
index 7b3c1e6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
+++ /dev/null
@@ -1,70 +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.Iterator;
-
-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.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class RadioListField extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
- final String field = request.getRequiredProperty(FIELD);
- if (block.isVisible(field)) {
- final String id = request.getRequiredProperty(COLLECTION);
- final String exclude = request.getOptionalProperty("exclude");
-
- final ObjectAdapter collection = request.getContext().getMappedObjectOrResult(id);
-
- final RequestContext context = request.getContext();
- final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
- final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-
- final StringBuffer buffer = new StringBuffer();
-
- while (iterator.hasNext()) {
- final ObjectAdapter element = iterator.next();
- final Scope scope = Scope.INTERACTION;
- final String elementId = context.mapObject(element, scope);
- if (exclude != null && context.getMappedObject(exclude) == element) {
- continue;
- }
- final String title = element.titleString();
- final String checked = "";
- buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + " />" + title + "</input><br/>\n");
- }
-
- block.replaceContent(field, buffer.toString());
- }
- }
-
- @Override
- public String getName() {
- return "radio-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/edit/Selector.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
deleted file mode 100644
index e814f28..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
+++ /dev/null
@@ -1,158 +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.Iterator;
-
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-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.ObjectAction;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionForm;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.CreateFormParameter;
-
-public class Selector extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
- final String field = request.getRequiredProperty(FIELD);
- if (block.isVisible(field)) {
- processElement(request, block, field);
- }
- request.skipUntilClose();
- }
-
- private void processElement(final Request request, final FormFieldBlock block, final String field) {
- final String type = request.getOptionalProperty(TYPE, "dropdown");
- if (!request.isPropertySpecified(METHOD) && request.isPropertySpecified(COLLECTION)) {
- final String id = request.getRequiredProperty(COLLECTION, Request.NO_VARIABLE_CHECKING);
- final String selector = showSelectionList(request, id, block.getCurrent(field), block.isNullable(field), type);
- block.replaceContent(field, selector);
- } else {
- final String objectId = request.getOptionalProperty(OBJECT);
- final String methodName = request.getRequiredProperty(METHOD);
- final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
- final ObjectAction action = MethodsUtils.findAction(object, methodName);
- if (action.getParameterCount() == 0) {
- final ObjectAdapter collection = action.execute(object, new ObjectAdapter[0]);
- final String selector = showSelectionList(request, collection, block.getCurrent(field), block.isNullable(field), type);
- block.replaceContent(field, selector);
- } else {
- final String id = "selector_options";
- final String id2 = (String) request.getContext().getVariable(id);
- final String selector = showSelectionList(request, id2, block.getCurrent(field), block.isNullable(field), type);
-
- final CreateFormParameter parameters = new CreateFormParameter();
- parameters.objectId = objectId;
- parameters.methodName = methodName;
- parameters.buttonTitle = request.getOptionalProperty(BUTTON_TITLE, "Search");
- parameters.formTitle = request.getOptionalProperty(FORM_TITLE);
- parameters.className = request.getOptionalProperty(CLASS, "selector");
- parameters.id = request.getOptionalProperty(ID);
-
- parameters.resultName = id;
- parameters.forwardResultTo = request.getContext().getResourceFile();
- parameters.forwardVoidTo = "error";
- parameters.forwardErrorTo = parameters.forwardResultTo;
- parameters.scope = Scope.REQUEST.name();
- request.pushNewBuffer();
- ActionForm.createForm(request, parameters);
- block.replaceContent(field, selector);
-
- request.appendHtml(request.popBuffer());
- }
- }
- }
-
- private String showSelectionList(final Request request, final String collectionId, final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
- if (collectionId != null && !collectionId.equals("")) {
- final ObjectAdapter collection = request.getContext().getMappedObjectOrResult(collectionId);
- return showSelectionList(request, collection, selectedItem, allowNotSet, type);
- } else {
- return null;
- }
- }
-
- private String showSelectionList(final Request request, final ObjectAdapter collection, final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
- final String field = request.getRequiredProperty(FIELD);
- final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-
- if (type.equals("radio")) {
- return radioButtonList(request, field, allowNotSet, collection, selectedItem, facet);
- } else if (type.equals("list")) {
- final String size = request.getOptionalProperty("size", "5");
- return dropdownList(request, field, allowNotSet, collection, selectedItem, size, facet);
- } else if (type.equals("dropdown")) {
- return dropdownList(request, field, allowNotSet, collection, selectedItem, null, facet);
- } else {
- throw new UnknownTypeException(type);
- }
- }
-
- private String radioButtonList(final Request request, final String field, final boolean allowNotSet, final ObjectAdapter collection, final ObjectAdapter selectedItem, final CollectionFacet facet) {
- final RequestContext context = request.getContext();
- final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
- final StringBuffer buffer = new StringBuffer();
- if (allowNotSet) {
- buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"null\"></input><br/>\n");
- }
- while (iterator.hasNext()) {
- final ObjectAdapter element = iterator.next();
- final String elementId = context.mapObject(element, Scope.INTERACTION);
- final String title = element.titleString();
- final String checked = element == selectedItem ? "checked=\"checked\"" : "";
- buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + ">" + title + "</input><br/>\n");
- }
-
- return buffer.toString();
- }
-
- private String dropdownList(final Request request, final String field, final boolean allowNotSet, final ObjectAdapter collection, final ObjectAdapter selectedItem, String size, final CollectionFacet facet) {
- final RequestContext context = request.getContext();
- final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
- final StringBuffer buffer = new StringBuffer();
- size = size == null ? "" : " size =\"" + size + "\"";
- buffer.append("<select name=\"" + field + "\"" + size + " >\n");
- if (allowNotSet) {
- buffer.append(" <option value=\"null\"></option>\n");
- }
- while (iterator.hasNext()) {
- final ObjectAdapter element = iterator.next();
- final String elementId = context.mapObject(element, Scope.INTERACTION);
- final String title = element.titleString();
- final String checked = element == selectedItem ? "selected=\"selected\"" : "";
- buffer.append(" <option value=\"" + elementId + "\"" + checked + ">" + title + "</option>\n");
- }
- buffer.append("</select>\n");
- return buffer.toString();
- }
-
- @Override
- public String getName() {
- return "selector";
- }
-
-}
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/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 0c12990..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.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ExcludeField extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final String field = request.getOptionalProperty(NAME);
- final InclusionList block = (InclusionList) request.getBlockContent();
- block.exclude(field);
- }
-
- @Override
- public String getName() {
- return "exclude";
- }
-
-}
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/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 bff9858..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.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class IncludeField extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final String field = request.getOptionalProperty(NAME);
- final InclusionList block = (InclusionList) request.getBlockContent();
- block.include(field);
- }
-
- @Override
- public String getName() {
- return "include";
- }
-
-}
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/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 1fdc2f6..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.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/2c7cfbfe/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 74a24e6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
+++ /dev/null
@@ -1,45 +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.AbstractElementProcessor;
-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.Request;
-
-public class LinkField extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final String field = request.getOptionalProperty(NAME);
- final String variable = request.getOptionalProperty(REFERENCE_NAME, RequestContext.RESULT);
- final String scope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
- final String forwardView = request.getOptionalProperty(VIEW, "_generic." + Dispatcher.EXTENSION);
- final LinkedFieldsBlock tag = (LinkedFieldsBlock) request.getBlockContent();
- tag.link(field, variable, scope, forwardView);
- }
-
- @Override
- public String getName() {
- return "link";
- }
-
-}
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/field/LinkedFieldsBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
deleted file mode 100644
index 5049a3d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
+++ /dev/null
@@ -1,47 +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.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-public class LinkedFieldsBlock extends InclusionList {
- private final Map<String, LinkedObject> linkedFields = new HashMap<String, LinkedObject>();
-
- public void link(final String field, final String variable, final String scope, final String forwardView) {
- include(field);
- linkedFields.put(field, new LinkedObject(variable, scope, forwardView));
- }
-
- public LinkedObject[] linkedFields(final List<ObjectAssociation> fields) {
- final LinkedObject[] includedFields = new LinkedObject[fields.size()];
- for (int i = 0; i < fields.size(); i++) {
- final String id2 = fields.get(i).getId();
- if (fields.get(i).isOneToOneAssociation() && linkedFields.containsKey(id2)) {
- includedFields[i] = linkedFields.get(id2);
- }
- }
- return includedFields;
- }
-
-}
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/field/LinkedObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
deleted file mode 100644
index d2c8548..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
+++ /dev/null
@@ -1,58 +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.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-
-public class LinkedObject {
- private final String variable;
- private final String scope;
- private String forwardView;
-
- public LinkedObject(final String variable, final String scope, final String forwardView) {
- this.variable = variable;
- this.scope = scope;
- this.forwardView = forwardView;
- }
-
- public LinkedObject(final String forwardView) {
- this.forwardView = forwardView;
- scope = Scope.INTERACTION.toString();
- variable = RequestContext.RESULT;
- }
-
- public String getVariable() {
- return variable;
- }
-
- public String getScope() {
- return scope;
- }
-
- public String getForwardView() {
- return forwardView;
- }
-
- public void setForwardView(final String path) {
- forwardView = path;
- }
-
-}
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/form/HiddenInputField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
deleted file mode 100644
index 9245bc6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
+++ /dev/null
@@ -1,41 +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.form;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-public class HiddenInputField {
- private final String value;
- private final String name;
-
- public HiddenInputField(final String name, final String value) {
- this.value = value;
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public String getValue() {
- return StringEscapeUtils.escapeHtml(value);
- }
-
-}
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/form/HtmlFormBuilder.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
deleted file mode 100644
index fd44cc8..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
+++ /dev/null
@@ -1,214 +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.form;
-
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-
-public class HtmlFormBuilder {
-
- public static void createForm(
- final Request request,
- final String action,
- final HiddenInputField[] hiddenFields,
- final InputField[] fields,
- final String className,
- final String id,
- final String formTitle,
- final String labelDelimiter,
- final String description,
- final String helpReference,
- final String buttonTitle,
- final String errors,
- final String cancelTo) {
-
- String classSegment = " class=\"" + className + (id == null ? "\"" : "\" id=\"" + id + "\"");
- request.appendHtml("<form " + classSegment + " action=\"" + action + "\" method=\"post\" accept-charset=\"UTF-8\">\n");
- if (formTitle != null && formTitle.trim().length() > 0) {
- classSegment = " class=\"title\"";
- request.appendHtml("<div" + classSegment + ">");
- request.appendAsHtmlEncoded(formTitle);
- request.appendHtml("</div>\n");
- }
-
- // TODO reinstate fieldsets when we can specify them
- // request.appendHtml("<fieldset>\n");
-
- final String cls = "errors";
- if (errors != null) {
- request.appendHtml("<div class=\"" + cls + "\">");
- request.appendAsHtmlEncoded(errors);
- request.appendHtml("</div>");
- }
- for (final HiddenInputField hiddenField : hiddenFields) {
- if (hiddenField == null) {
- continue;
- }
- request.appendHtml(" <input type=\"hidden\" name=\"" + hiddenField.getName() + "\" value=\"");
- request.appendAsHtmlEncoded(hiddenField.getValue());
- request.appendHtml("\" />\n");
- }
- request.appendHtml(request.getContext().interactionFields());
- for (final InputField fld : fields) {
- if (fld.isHidden()) {
- request.appendHtml(" <input type=\"hidden\" name=\"" + fld.getName() + "\" value=\"");
- request.appendAsHtmlEncoded(fld.getValue());
- request.appendHtml("\" />\n");
- } else {
- final String errorSegment = fld.getErrorText() == null ? "" : "<span class=\"error\">" + fld.getErrorText() + "</span>";
- final String fieldSegment = createField(fld);
- final String helpSegment = HelpLink.createHelpSegment(fld.getDescription(), fld.getHelpReference());
- final String title = fld.getDescription().equals("") ? "" : " title=\"" + fld.getDescription() + "\"";
- request.appendHtml(" <div class=\"field " + fld.getName() + "\"><label class=\"label\" " + title + ">");
- request.appendAsHtmlEncoded(fld.getLabel());
- request.appendHtml(labelDelimiter + "</label>" + fieldSegment + errorSegment + helpSegment + "</div>\n");
- }
- }
-
- request.appendHtml(" <input class=\"button\" type=\"submit\" value=\"");
- request.appendAsHtmlEncoded(buttonTitle);
- request.appendHtml("\" name=\"execute\" />\n");
- HelpLink.append(request, description, helpReference);
- // TODO alllow forms to be cancelled, returning to previous page.
- // request.appendHtml(" <div class=\"action\"><a class=\"button\" href=\"reset\">Cancel</a></div>");
-
- if (cancelTo != null) {
- request.appendHtml(" <input class=\"button\" type=\"button\" value=\"");
- request.appendAsHtmlEncoded("Cancel");
- request.appendHtml("\" onclick=\"window.location = '" + cancelTo + "'\" name=\"cancel\" />\n");
- }
-
- // TODO reinstate fieldsets when we can specify them
- // request.appendHtml("</fieldset>\n");
- request.appendHtml("</form>\n");
- }
-
- private static String createField(final InputField field) {
- if (field.isHidden()) {
- if (field.getType() == InputField.REFERENCE) {
- return createObjectField(field, "hidden");
- } else {
- return "";
- }
- } else {
- if (field.getType() == InputField.HTML) {
- return "<span class=\"value\">" + field.getHtml() + "</span>";
- } else if (field.getOptionsText() != null) {
- return createOptions(field);
- } else if (field.getType() == InputField.REFERENCE) {
- return createObjectField(field, "text");
- } else if (field.getType() == InputField.CHECKBOX) {
- return createCheckbox(field);
- } else if (field.getType() == InputField.PASSWORD) {
- return createPasswordField(field);
- } else if (field.getType() == InputField.TEXT) {
- if (field.getHeight() > 1) {
- return createTextArea(field);
- } else {
- return createTextField(field);
- }
- } else {
- throw new UnknownTypeException(field.toString());
- }
- }
- }
-
- private static String createObjectField(final InputField field, final String type) {
- return field.getHtml();
- }
-
- private static String createTextArea(final InputField field) {
- final String columnsSegment = field.getWidth() == 0 ? "" : " cols=\"" + field.getWidth() / field.getHeight() + "\"";
- final String rowsSegment = field.getHeight() == 0 ? "" : " rows=\"" + field.getHeight() + "\"";
- final String wrapSegment = !field.isWrapped() ? "" : " wrap=\"off\"";
- final String requiredSegment = !field.isRequired() ? "" : " class=\"required\"";
- final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
- final String maxLength = field.getMaxLength() == 0 ? "" : " maxlength=\"" + field.getMaxLength() + "\"";
- return "<textarea" + requiredSegment + " name=\"" + field.getName() + "\"" + columnsSegment + rowsSegment + wrapSegment
- + maxLength + disabled + ">" + Request.getEncoder().encoder(field.getValue()) + "</textarea>";
- }
-
- private static String createPasswordField(final InputField field) {
- final String extra = " autocomplete=\"off\"";
- return createTextField(field, "password", extra);
- }
-
- private static String createTextField(final InputField field) {
- return createTextField(field, "text", "");
- }
-
- private static String createTextField(final InputField field, final String type, final String additionalAttributes) {
- final String value = field.getValue();
- final String valueSegment = value == null ? "" : " value=\"" + Request.getEncoder().encoder(value) + "\"";
- final String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth() + "\"";
- final String maxLengthSegment = field.getMaxLength() == 0 ? "" : " maxlength=\"" + field.getMaxLength() + "\"";
- final String requiredSegment = !field.isRequired() ? "" : " required";
- final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
- return "<input class=\"" + field.getDataType() + requiredSegment + "\" type=\"" + type + "\" name=\"" + field.getName() + "\"" +
- valueSegment + lengthSegment + maxLengthSegment + disabled + additionalAttributes + " />";
- }
-
- private static String createCheckbox(final InputField field) {
- final String entryText = field.getValue();
- final String valueSegment = entryText != null && entryText.toLowerCase().equals("true") ? " checked=\"checked\"" : "";
- final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
- return "<input type=\"checkbox\" name=\"" + field.getName() + "\" value=\"true\" " + valueSegment + disabled + " />";
- }
-
- private static String createOptions(final InputField field) {
- final String[] options = field.getOptionsText();
- final String[] ids = field.getOptionValues();
- final int length = options.length;
- final String classSegment = field.isRequired() && length == 0 ? " class=\"required\"" : "";
- final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
- final StringBuffer str = new StringBuffer();
- str.append("\n <select name=\"" + field.getName() + "\"" + disabled + classSegment + ">\n");
- boolean offerOther = false;
- for (int i = 0; i < length; i++) {
- final String selectedSegment = field.getValue() == null || ids[i].equals(field.getValue()) ? " selected=\"selected\"" : "";
- if (field.getType() == InputField.TEXT && options[i].equals("__other")) {
- offerOther = true;
- } else {
- str.append(" <option value=\"" + Request.getEncoder().encoder(ids[i]) + "\"" + selectedSegment + ">" + Request.getEncoder().encoder(options[i]) + "</option>\n");
- }
- }
- if (!field.isRequired() || length == 0) {
- final String selectedSegment = field.getValue() == null || field.getValue().equals("") ? " selected=\"selected\"" : "";
- str.append(" <option value=\"null\"" + selectedSegment + "></option>\n");
- }
- if (offerOther) {
- str.append(" <option value=\"-OTHER-\">Other:</option>\n");
- }
- str.append(" </select>");
- if (field.getType() == InputField.TEXT) {
- final String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth() + "\"";
- final String hideSegment = " style=\"display: none;\" "; // TODO
- // only
- // hide
- // when JS
- // enabled
- str.append(" <input type=\"text\" name=\"" + field.getName() + "-other\"" + hideSegment + lengthSegment + disabled + " />");
- }
- str.append("\n");
- return str.toString();
- }
-
-}
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/form/InputField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
deleted file mode 100644
index 0382cc4..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
+++ /dev/null
@@ -1,224 +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.form;
-
-import org.apache.isis.core.commons.util.ToString;
-
-public class InputField {
- public static final int REFERENCE = 1;
- public static final int TEXT = 2;
- public static final int PASSWORD = 3;
- public static final int CHECKBOX = 4;
- public static final int HTML = 5;
-
- private int type;
-
- private String label;
- private String description = "";
- private String helpReference;
- private String errorText;
- private final String name;
- private String dataType;
-
- private int maxLength = 0;
- private int width;
- private int height = 1;
- private boolean isWrapped = false;
-
- private boolean isRequired = true;
- private boolean isEditable = true;
- private boolean isHidden = false;
-
- private String[] optionsText;
- private String[] optionValues;
-
- private String value;
- private String html;
-
- public InputField(final String name) {
- this.name = name;
- }
-
- public String getErrorText() {
- return errorText;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public String getHelpReference() {
- return helpReference;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isEditable() {
- return isEditable;
- }
-
- public String getValue() {
- return value;
- }
-
- public String getHtml() {
- return html;
- }
-
- public boolean isHidden() {
- return isHidden;
- }
-
- public String[] getOptionsText() {
- return optionsText;
- }
-
- public String[] getOptionValues() {
- return optionValues;
- }
-
- public int getWidth() {
- return width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public boolean isWrapped() {
- return isWrapped;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public int getMaxLength() {
- return maxLength;
- }
-
- public int getType() {
- return type;
- }
-
- public void setErrorText(final String errorText) {
- this.errorText = errorText;
- }
-
- public void setDescription(final String description) {
- this.description = description;
- }
-
- public void setHelpReference(final String helpReference) {
- this.helpReference = helpReference;
- }
-
- public void setLabel(final String label) {
- this.label = label;
- }
-
- public void setEditable(final boolean isEditable) {
- this.isEditable = isEditable;
- isRequired = isRequired && isEditable;
- }
-
- public void setValue(final String entryText) {
- this.value = entryText;
- }
-
- public void setHtml(final String html) {
- this.html = html;
- }
-
- public void setHidden(final boolean isHidden) {
- this.isHidden = isHidden;
- }
-
- public void setWidth(final int width) {
- this.width = width;
- }
-
- public void setOptions(final String[] optionsText, final String[] optionValues) {
- this.optionsText = optionsText;
- this.optionValues = optionValues;
- }
-
- public void setHeight(final int height) {
- this.height = height;
- }
-
- public void setWrapped(final boolean isWrapped) {
- this.isWrapped = isWrapped;
- }
-
- public void setRequired(final boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public void setMaxLength(final int maxLength) {
- this.maxLength = maxLength;
- }
-
- public void setType(final int type) {
- this.type = type;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- @Override
- public String toString() {
- final ToString str = new ToString(this);
- str.append("name", name);
- String typeName;
- switch (type) {
- case CHECKBOX:
- typeName = "checkbox";
- break;
- case REFERENCE:
- typeName = "reference";
- break;
- case TEXT:
- typeName = "text";
- break;
- default:
- typeName = "unset";
- break;
- }
- str.append("type", typeName);
- str.append("datatype", dataType);
- str.append("editable", isEditable);
- str.append("hidden", isHidden);
- str.append("required", isRequired);
- return str.toString();
- }
-
-}
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/logon/Logoff.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java
deleted file mode 100644
index 1632f5d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java
+++ /dev/null
@@ -1,38 +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.logon;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.logon.LogoutAction;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Logoff extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- LogoutAction.logoutUser(request.getContext());
- }
-
- @Override
- public String getName() {
- return "logoff";
- }
-
-}