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 2017/09/14 16:46:31 UTC
[01/12] isis git commit: ISIS-1616 - support for "As-is" HTML
rendering
Repository: isis
Updated Branches:
refs/heads/pr-84 [created] 4de5824f9
ISIS-1616 - support for "As-is" HTML rendering
+ introducing a new value type: Markup
+ Markup holds immutable HTML
+ Markup is applicable as action result and as property type
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/cdd7d0a1
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/cdd7d0a1
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/cdd7d0a1
Branch: refs/heads/pr-84
Commit: cdd7d0a138fb220bc19e140d72963404c39688ac
Parents: b441012
Author: hobrom <ho...@gmx.at>
Authored: Fri Aug 18 15:47:02 2017 +0200
Committer: hobrom <ho...@gmx.at>
Committed: Fri Aug 18 15:47:02 2017 +0200
----------------------------------------------------------------------
.../org/apache/isis/applib/value/Markup.java | 76 +++++++++++++
.../facets/value/markup/MarkupValueFacet.java | 29 +++++
...ValueFacetUsingSemanticsProviderFactory.java | 38 +++++++
.../markup/MarkupValueSemanticsProvider.java | 113 +++++++++++++++++++
.../scalars/ScalarPanelTextFieldAbstract.java | 2 +-
.../scalars/markup/MarkupComponent.java | 65 +++++++++++
.../components/scalars/markup/MarkupPanel.java | 83 ++++++++++++++
.../scalars/markup/MarkupPanelFactory.java | 105 +++++++++++++++++
.../scalars/markup/StandaloneMarkupPanel.html | 32 ++++++
.../scalars/markup/StandaloneMarkupPanel.java | 35 ++++++
10 files changed, 577 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java b/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
new file mode 100644
index 0000000..915f119
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
@@ -0,0 +1,76 @@
+/*
+ * 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.applib.value;
+
+import java.io.Serializable;
+
+import org.apache.isis.applib.annotation.Value;
+
+/**
+ * Immutable value type holding pre-rendered HTML.
+ *
+ */
+@Value(semanticsProviderName = "org.apache.isis.core.metamodel.facets.value.markup.MarkupValueSemanticsProvider")
+public class Markup implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private final String html;
+
+ public Markup() {
+ this(null);
+ }
+
+ public Markup(String html) {
+ this.html = html!=null ? html : "";
+ }
+
+ public String asString() {
+ return html;
+ }
+
+ public boolean isEqualTo(final Markup other) {
+ return this.html.equals(other.html);
+ }
+
+ public String title() {
+ return "Markup[lenght="+html.length()+"]";
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ return isEqualTo((Markup) obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return html.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "Markup[lenght="+html.length()+", html="+html+"]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueFacet.java
new file mode 100644
index 0000000..434c24f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueFacet.java
@@ -0,0 +1,29 @@
+/*
+ * 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.core.metamodel.facets.value.markup;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface MarkupValueFacet extends Facet {
+ String markupValue(ObjectAdapter object);
+ ObjectAdapter createValue(ObjectAdapter object, String html);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..740e87c
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueFacetUsingSemanticsProviderFactory.java
@@ -0,0 +1,38 @@
+/*
+ * 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.core.metamodel.facets.value.markup;
+
+import org.apache.isis.applib.value.Markup;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class MarkupValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Markup> {
+
+ @Override
+ public void process(final ProcessClassContext processClassContext) {
+ final Class<?> type = processClassContext.getCls();
+ final FacetHolder holder = processClassContext.getFacetHolder();
+
+ if (type != Markup.class) {
+ return;
+ }
+ addFacets(new MarkupValueSemanticsProvider(holder, getContext()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueSemanticsProvider.java
new file mode 100644
index 0000000..bf19b44
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/markup/MarkupValueSemanticsProvider.java
@@ -0,0 +1,113 @@
+/*
+ * 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.core.metamodel.facets.value.markup;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.value.Markup;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.metamodel.services.ServicesInjector;
+
+public class MarkupValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<Markup> implements MarkupValueFacet {
+
+ private static final int TYPICAL_LENGTH = 0;
+
+ private static Class<? extends Facet> type() {
+ return MarkupValueFacet.class;
+ }
+
+ private static final Markup DEFAULT_VALUE = null;
+
+ /**
+ * Required because implementation of {@link Parser} and
+ * {@link EncoderDecoder}.
+ */
+ public MarkupValueSemanticsProvider() {
+ this(null, null);
+ }
+
+ public MarkupValueSemanticsProvider(final FacetHolder holder, final ServicesInjector context) {
+ super(type(), holder, Markup.class, TYPICAL_LENGTH, null, Immutability.IMMUTABLE, EqualByContent.NOT_HONOURED, DEFAULT_VALUE, context);
+ }
+
+ // //////////////////////////////////////////////////////////////////
+ // Parser
+ // //////////////////////////////////////////////////////////////////
+
+ @Override
+ protected Markup doParse(final Object context, final String html) {
+ return doRestore(html);
+ }
+
+ @Override
+ public String titleString(final Object object) {
+ return object != null? ((Markup)object).asString(): "[null]";
+ }
+
+ @Override
+ public String titleStringWithMask(final Object value, final String usingMask) {
+ return titleString(value);
+ }
+
+ // //////////////////////////////////////////////////////////////////
+ // MarkupValueFacet
+ // //////////////////////////////////////////////////////////////////
+
+ @Override
+ public String markupValue(final ObjectAdapter object) {
+ if (object == null) {
+ return "";
+ }
+ final Markup markup = (Markup) object.getObject();
+ return markup.asString();
+ }
+
+ @Override
+ public ObjectAdapter createValue(final ObjectAdapter object, final String html) {
+ final Markup markup = new Markup(html);
+ return getAdapterManager().adapterFor(markup);
+ }
+
+ // //////////////////////////////////////////////////////////////////
+ // EncoderDecoder
+ // //////////////////////////////////////////////////////////////////
+
+ @Override
+ protected String doEncode(final Object object) {
+ Markup markup = (Markup)object;
+ return markup.asString();
+ }
+
+ @Override
+ protected Markup doRestore(final String html) {
+ return new Markup(html);
+ }
+
+ // /////// toString ///////
+
+ @Override
+ public String toString() {
+ return "MarkupValueSemanticsProvider";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java
index 40cda67..4e6457b 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java
@@ -154,7 +154,7 @@ public abstract class ScalarPanelTextFieldAbstract<T extends Serializable> exten
component.add(new ReplaceDisabledTagWithReadonlyTagBehaviour());
}
- private MarkupContainer createScalarIfRegularFormGroup() {
+ protected MarkupContainer createScalarIfRegularFormGroup() {
Fragment textFieldFragment = createTextFieldFragment("scalarValueContainer");
final String name = getModel().getName();
textField.setLabel(Model.of(name));
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupComponent.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupComponent.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupComponent.java
new file mode 100644
index 0000000..31ab585
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupComponent.java
@@ -0,0 +1,65 @@
+/*
+ * 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.wicket.ui.components.scalars.markup;
+
+import org.apache.isis.applib.value.Markup;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.MarkupStream;
+import org.apache.wicket.markup.html.WebComponent;
+import org.apache.wicket.markup.parser.XmlTag.TagType;
+import org.apache.wicket.model.IModel;
+
+public class MarkupComponent extends WebComponent {
+
+ private static final long serialVersionUID = 1L;
+
+ public MarkupComponent(final String id, IModel<?> model){
+ super(id, model);
+ }
+
+ @Override
+ public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag){
+ final ObjectAdapter objAdapter = (ObjectAdapter) getDefaultModelObject();
+ replaceComponentTagBody(markupStream, openTag, extractHtmlOrElse(objAdapter, ""));
+ }
+
+ @Override
+ protected void onComponentTag(ComponentTag tag) {
+ super.onComponentTag(tag);
+ tag.setType(TagType.OPEN);
+ }
+
+ // -- HELPER
+
+ private CharSequence extractHtmlOrElse(ObjectAdapter objAdapter, final String fallback) {
+
+ if(objAdapter==null || objAdapter.getObject()==null)
+ return fallback;
+
+ final Object value = objAdapter.getObject();
+
+ if(!(value instanceof Markup))
+ return fallback;
+
+ return ((Markup)value).asString();
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupPanel.java
new file mode 100644
index 0000000..633daac
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupPanel.java
@@ -0,0 +1,83 @@
+/*
+ * 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.wicket.ui.components.scalars.markup;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldParseableAbstract;
+import org.apache.isis.viewer.wicket.ui.components.widgets.bootstrap.FormGroup;
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.Model;
+
+/**
+ * Panel for rendering scalars of type {@link org.apache.isis.applib.value.Markup}.
+ */
+public class MarkupPanel extends ScalarPanelTextFieldParseableAbstract
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public MarkupPanel(final String id, final ScalarModel scalarModel) {
+ super(id, scalarModel);
+ }
+
+ @Override
+ protected String getScalarPanelType() {
+ return "markupPanel";
+ }
+
+ @Override
+ protected MarkupContainer createScalarIfRegularFormGroup() {
+
+ if(getModel().isEditMode()) {
+ // fallback to text editor
+ return super.createScalarIfRegularFormGroup();
+ }
+
+ final MarkupComponent markupComponent = createMarkupComponent("scalarValueContainer");
+
+ getTextField().setLabel(Model.of(getModel().getName()));
+
+ final FormGroup formGroup = new FormGroup(ID_SCALAR_IF_REGULAR, getTextField());
+ formGroup.add(markupComponent);
+
+ final String labelCaption = getRendering().getLabelCaption(getTextField());
+ final Label scalarName = createScalarName(ID_SCALAR_NAME, labelCaption);
+
+ formGroup.add(scalarName);
+
+ return formGroup;
+ }
+
+ @Override
+ protected Component createComponentForCompact() {
+ return createMarkupComponent(ID_SCALAR_IF_COMPACT);
+ }
+
+ // -- HELPER
+
+ private MarkupComponent createMarkupComponent(String id) {
+ MarkupComponent markupComponent = new MarkupComponent(id, getModel());
+ markupComponent.setEnabled(false);
+ return markupComponent;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupPanelFactory.java
new file mode 100644
index 0000000..c039489
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/MarkupPanelFactory.java
@@ -0,0 +1,105 @@
+/*
+ * 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.wicket.ui.components.scalars.markup;
+
+import org.apache.isis.applib.value.Markup;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.model.models.ValueModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.wicket.Component;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.IModel;
+
+/**
+ * {@link ComponentFactory} for {@link MarkupPanel}.
+ */
+public class MarkupPanelFactory extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public MarkupPanelFactory(ComponentType componentType) {
+ super(componentType, MarkupPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ switch (getComponentType()) {
+ case SCALAR_NAME_AND_VALUE:
+ return appliesToIfScalar(model);
+ case VALUE:
+ return appliesToIfValue(model);
+ default:
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+ }
+
+ @Override
+ public final Component createComponent(final String id, final IModel<?> model) {
+
+ switch (getComponentType()) {
+ case SCALAR_NAME_AND_VALUE:
+ return createComponentIfScalar(id, model);
+ case VALUE:
+ return createComponentIfValue(id, model);
+ default:
+ return new Label(id, "MarkupPanelFactory.createComponent: case not handled '"+getComponentType()+"'");
+ }
+ }
+
+ // -- VARIANTS OF APPLIES TO
+
+ private ApplicationAdvice appliesToIfScalar(IModel<?> model) {
+ if (!(model instanceof ScalarModel))
+ return ApplicationAdvice.DOES_NOT_APPLY;
+
+ final ScalarModel scalarModel = (ScalarModel) model;
+
+ if(!scalarModel.isScalarTypeAnyOf(org.apache.isis.applib.value.Markup.class))
+ return ApplicationAdvice.DOES_NOT_APPLY;
+
+ return appliesIf( !scalarModel.hasChoices() );
+ }
+
+ private ApplicationAdvice appliesToIfValue(IModel<?> model) {
+ if (!(model instanceof ValueModel))
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ final ValueModel valueModel = (ValueModel) model;
+ final ObjectAdapter adapter = valueModel.getObject();
+ if(adapter==null || adapter.getObject()==null)
+ return ApplicationAdvice.DOES_NOT_APPLY;
+
+ return appliesIf( adapter.getObject() instanceof Markup );
+ }
+
+ // -- VARIANTS OF CREATE COMPONENT
+
+ private final Component createComponentIfScalar(final String id, final IModel<?> model) {
+ return new MarkupPanel(id, (ScalarModel) model);
+ }
+
+ private final Component createComponentIfValue(final String id, final IModel<?> model) {
+ return new StandaloneMarkupPanel(id, (ValueModel) model);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/StandaloneMarkupPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/StandaloneMarkupPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/StandaloneMarkupPanel.html
new file mode 100644
index 0000000..e6e4b64
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/StandaloneMarkupPanel.html
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:panel>
+ <div class="standaloneMarkupPanel standaloneValueComponentType">
+ <div wicket:id="standaloneValue" class="standaloneValue" />
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/cdd7d0a1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/StandaloneMarkupPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/StandaloneMarkupPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/StandaloneMarkupPanel.java
new file mode 100644
index 0000000..60d665d
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/markup/StandaloneMarkupPanel.java
@@ -0,0 +1,35 @@
+/*
+ * 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.wicket.ui.components.scalars.markup;
+
+import org.apache.isis.viewer.wicket.model.models.ValueModel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class StandaloneMarkupPanel extends PanelAbstract<ValueModel> {
+
+ private static final long serialVersionUID = 1L;
+ private static final String ID_STANDALONE_VALUE = "standaloneValue";
+
+ public StandaloneMarkupPanel(final String id, final ValueModel valueModel) {
+ super(id, valueModel);
+ add(new MarkupComponent(ID_STANDALONE_VALUE, getModel()));
+ }
+
+}
[05/12] isis git commit: Merge branch 'master' of
https://github.com/apache/isis
Posted by da...@apache.org.
Merge branch 'master' of https://github.com/apache/isis
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2f7a414f
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2f7a414f
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2f7a414f
Branch: refs/heads/pr-84
Commit: 2f7a414f74afcf046ad96dbb23db060f3c9c46c2
Parents: 6698573 3c0750a
Author: hobrom <ho...@gmx.at>
Authored: Tue Sep 12 10:47:51 2017 +0200
Committer: hobrom <ho...@gmx.at>
Committed: Tue Sep 12 10:47:51 2017 +0200
----------------------------------------------------------------------
.../asciidoc/guides/dg/_dg_ide_intellij.adoc | 68 ++++++++++----------
.../guides/rgcfg/_rgcfg_configuring-core.adoc | 4 +-
.../rgcms/_rgcms_methods_reserved_disable.adoc | 6 +-
.../main/asciidoc/guides/rgmvn/_rgmvn_xsd.adoc | 2 +-
...dless-access_BackgroundCommandExecution.adoc | 2 +-
.../_ugbtb_hints-and-tips_are-you-sure.adoc | 8 +--
...g_disabling-persistence-by-reachability.adoc | 2 +-
.../_ugsec_configuring-isis-to-use-shiro.adoc | 2 +-
...and-tips_configuring-isis-to-use-bypass.adoc | 2 +-
...c_shiro-realm-implementations_ini-realm.adoc | 2 +-
...o-realm-implementations_isis-ldap-realm.adoc | 12 ++--
...ations_isisaddons-security-module-realm.adoc | 4 +-
..._shiro-realm-implementations_jdbc-realm.adoc | 2 +-
.../_ugtst_fixture-scripts_api-and-usage.adoc | 4 +-
...gtst_integ-test-support_wrapper-factory.adoc | 2 +-
.../asciidoc/guides/ugtst/_ugtst_overview.adoc | 2 +-
.../documentation/src/main/asciidoc/index.html | 17 ++++-
.../main/asciidoc/js/toc-scroll/toc-scroll.js | 35 ++++++----
.../_migration-notes_1.14.0-to-1.15.0.adoc | 23 ++++++-
.../documentation/src/main/asciidoc/quotes.adoc | 14 ++++
core/pom.xml | 12 +++-
.../scalars/ScalarPanelSelect2Abstract.java | 4 +-
.../scalars/reference/ReferencePanel.java | 19 +-----
.../valuechoices/ValueChoicesSelect2Panel.java | 24 +------
.../application/manifest/isis.properties | 12 +++-
.../webapp/src/main/webapp/WEB-INF/shiro.ini | 10 +--
26 files changed, 164 insertions(+), 130 deletions(-)
----------------------------------------------------------------------
[07/12] isis git commit: Fix ISIS-1715 menuOrder Dewey Decimal format
not honored
Posted by da...@apache.org.
Fix ISIS-1715 menuOrder Dewey Decimal format not honored
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/1b60ce18
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/1b60ce18
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/1b60ce18
Branch: refs/heads/pr-84
Commit: 1b60ce18f28e7369364e5712c546f6da32099c6a
Parents: 312ac31
Author: hobrom <ho...@gmx.at>
Authored: Tue Sep 12 18:03:50 2017 +0200
Committer: hobrom <ho...@gmx.at>
Committed: Tue Sep 12 18:03:50 2017 +0200
----------------------------------------------------------------------
.../domainservice/DomainServiceMenuOrder.java | 40 +++++++++-------
.../ServicesInstallerFromAnnotation.java | 2 +-
.../serviceactions/ServiceActionUtil.java | 3 --
.../serviceactions/ServiceAndAction.java | 6 +--
.../serviceactions/ServiceAndActionOrder.java | 49 --------------------
5 files changed, 24 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/1b60ce18/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
index f681449..67224b1 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
@@ -22,40 +22,44 @@ package org.apache.isis.core.metamodel.facets.object.domainservice;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.core.commons.compare.SequenceCompare;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
public class DomainServiceMenuOrder {
+
+ private final static String UNDEFINED = "" + Integer.MAX_VALUE;
- public static int compare(ObjectAdapter serviceAdapter1, ObjectAdapter serviceAdapter2) {
-
- return SequenceCompare.compareNullLast(
- orderOf(serviceAdapter1.getSpecification().getCorrespondingClass()),
- orderOf(serviceAdapter2.getSpecification().getCorrespondingClass()) );
- }
+ //TODO can be safely removed
+// public static int compare(ObjectAdapter serviceAdapter1, ObjectAdapter serviceAdapter2) {
+// return SequenceCompare.compareNullLast(
+// orderOf(serviceAdapter1.getSpecification().getCorrespondingClass()),
+// orderOf(serviceAdapter2.getSpecification().getCorrespondingClass()) );
+// }
- // -- HELPER
-
public static String orderOf(final Class<?> cls) {
final DomainServiceLayout domainServiceLayout = cls.getAnnotation(DomainServiceLayout.class);
String dslayoutOrder = domainServiceLayout != null ? domainServiceLayout.menuOrder(): null;
final DomainService domainService = cls.getAnnotation(DomainService.class);
- String dsOrder = domainService != null ? domainService.menuOrder() : "" + Integer.MAX_VALUE;
-
- return minimumOf(dslayoutOrder, dsOrder);
+ String dsOrder = domainService != null ? domainService.menuOrder() : null;
+
+ String min = minimumOf(dslayoutOrder, dsOrder);
+ return min!=null ? min : UNDEFINED;
}
+ // -- HELPER
+
private static String minimumOf(final String dslayoutOrder, final String dsOrder) {
- if(isUndefined(dslayoutOrder)) {
+ if(isUndefined(dslayoutOrder))
return dsOrder;
- }
- if(isUndefined(dsOrder)) {
+ if(isUndefined(dsOrder))
return dslayoutOrder;
- }
- return dslayoutOrder.compareTo(dsOrder) < 0 ? dslayoutOrder : dsOrder;
+
+ //XXX ISIS-1715 honor member order (use Dewey Decimal format)
+ return SequenceCompare.compareNullLast(dslayoutOrder, dsOrder) < 0
+ ? dslayoutOrder
+ : dsOrder;
}
private static boolean isUndefined(final String str) {
- return str == null || str.equals("" + Integer.MAX_VALUE);
+ return str == null || str.equals(UNDEFINED);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b60ce18/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
index e9031bb..5a2ca5a 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
@@ -233,7 +233,7 @@ public class ServicesInstallerFromAnnotation extends ServicesInstallerAbstract {
//endregion
- //region > helpers: orderOf, nameOf, asList
+ //region > helpers: nameOf, asList
private static String nameOf(final Class<?> cls) {
final DomainServiceLayout domainServiceLayout = cls.getAnnotation(DomainServiceLayout.class);
http://git-wip-us.apache.org/repos/asf/isis/blob/1b60ce18/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java
index efc2ea4..3f01ece 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java
@@ -203,9 +203,6 @@ public final class ServiceActionUtil {
collateServiceActions(serviceAdapter, ActionType.USER, serviceActions);
collateServiceActions(serviceAdapter, ActionType.PROTOTYPE, serviceActions);
}
-
- //XXX ISIS-1715 honor member order
- Collections.sort(serviceActions);
final Set<String> serviceNamesInOrder = serviceNamesInOrder(serviceAdapters, serviceActions);
final Map<String, List<ServiceAndAction>> serviceActionsByName = groupByServiceName(serviceActions);
http://git-wip-us.apache.org/repos/asf/isis/blob/1b60ce18/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java
index 65ec519..436edbb 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java
@@ -19,7 +19,7 @@ package org.apache.isis.viewer.wicket.ui.components.actionmenu.serviceactions;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
-class ServiceAndAction implements Comparable<ServiceAndAction> {
+class ServiceAndAction {
final String serviceName;
final EntityModel serviceEntityModel;
final ObjectAction objectAction;
@@ -42,8 +42,4 @@ class ServiceAndAction implements Comparable<ServiceAndAction> {
return serviceName + " ~ " + objectAction.getIdentifier().toFullIdentityString();
}
- @Override
- public int compareTo(ServiceAndAction other) {
- return ServiceAndActionOrder.compare(this, other);
- }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b60ce18/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndActionOrder.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndActionOrder.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndActionOrder.java
deleted file mode 100644
index 19be3e1..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndActionOrder.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.wicket.ui.components.actionmenu.serviceactions;
-
-import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacet;
-import org.apache.isis.core.metamodel.facets.object.domainservice.DomainServiceMenuOrder;
-import org.apache.isis.core.metamodel.layout.memberorderfacet.MemberOrderFacetComparator;
-
-class ServiceAndActionOrder {
-
- private final static MemberOrderFacetComparator memberOrder =
- new MemberOrderFacetComparator(false);
-
- public static int compare(ServiceAndAction a, ServiceAndAction b) {
-
- int c = a.serviceName.compareTo(b.serviceName);
- if(c!=0)
- return c;
-
- c = DomainServiceMenuOrder.compare(
- a.serviceEntityModel.getObject(),
- b.serviceEntityModel.getObject() );
- if(c!=0)
- return c;
-
- return memberOrder.compare(
- a.objectAction.getFacet(MemberOrderFacet.class),
- b.objectAction.getFacet(MemberOrderFacet.class) );
-
- }
-
-}
[02/12] isis git commit: ISIS-1616 - support for "As-is" HTML
rendering
Posted by da...@apache.org.
ISIS-1616 - support for "As-is" HTML rendering
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d795df24
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d795df24
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d795df24
Branch: refs/heads/pr-84
Commit: d795df241a86656c070abb5629149344a98ef212
Parents: cdd7d0a
Author: hobrom <ho...@gmx.at>
Authored: Fri Aug 18 17:28:12 2017 +0200
Committer: hobrom <ho...@gmx.at>
Committed: Fri Aug 18 17:28:12 2017 +0200
----------------------------------------------------------------------
.../registries/components/ComponentFactoryRegistrarDefault.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/d795df24/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
index b9a63c4..ec9e27d 100644
--- a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
+++ b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.wicket.viewer.registries.components;
import com.google.inject.Singleton;
import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistrar;
import org.apache.isis.viewer.wicket.ui.components.about.AboutPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.actionlink.ActionLinkPanelFactory;
@@ -54,6 +55,7 @@ import org.apache.isis.viewer.wicket.ui.components.scalars.jdkmath.JavaMathBigIn
import org.apache.isis.viewer.wicket.ui.components.scalars.jodatime.JodaDateTimePanelFactory;
import org.apache.isis.viewer.wicket.ui.components.scalars.jodatime.JodaLocalDatePanelFactory;
import org.apache.isis.viewer.wicket.ui.components.scalars.jodatime.JodaLocalDateTimePanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.scalars.markup.MarkupPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.scalars.primitive.*;
import org.apache.isis.viewer.wicket.ui.components.scalars.reference.ReferencePanelFactory;
import org.apache.isis.viewer.wicket.ui.components.scalars.string.StringPanelFactory;
@@ -169,6 +171,7 @@ public class ComponentFactoryRegistrarDefault implements ComponentFactoryRegistr
}
protected void addComponentFactoriesForValue(final ComponentFactoryList componentFactories) {
+ componentFactories.add(new MarkupPanelFactory(ComponentType.VALUE));
componentFactories.add(new StandaloneValuePanelFactory());
}
@@ -176,6 +179,8 @@ public class ComponentFactoryRegistrarDefault implements ComponentFactoryRegistr
componentFactories.add(new ReferencePanelFactory());
+ componentFactories.add(new MarkupPanelFactory(ComponentType.SCALAR_NAME_AND_VALUE));
+
componentFactories.add(new BooleanPanelFactory());
componentFactories.add(new BytePanelFactory());
componentFactories.add(new ShortPanelFactory());
[10/12] isis git commit: Merge branch 'ISIS-1715_pr-84'
Posted by da...@apache.org.
Merge branch 'ISIS-1715_pr-84'
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/40107995
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/40107995
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/40107995
Branch: refs/heads/pr-84
Commit: 40107995b25b05d1bc9d72a65cf5512290a7165d
Parents: 09d46bd 1b60ce1
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 14 15:13:24 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 14 17:44:58 2017 +0100
----------------------------------------------------------------------
.../core/commons/compare/SequenceCompare.java | 92 ++++++++++++++++++++
.../domainservice/DomainServiceMenuOrder.java | 65 ++++++++++++++
.../MemberOrderFacetComparator.java | 60 +------------
.../ServicesInstallerFromAnnotation.java | 28 +-----
.../serviceactions/ServiceActionUtil.java | 34 ++++----
.../serviceactions/ServiceAndAction.java | 1 +
6 files changed, 180 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
[03/12] isis git commit: prevent NPE
Posted by da...@apache.org.
prevent NPE
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/45b4d403
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/45b4d403
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/45b4d403
Branch: refs/heads/pr-84
Commit: 45b4d403b032e93f04fd975345cfaf33ce1141bb
Parents: d795df2
Author: hobrom <ho...@gmx.at>
Authored: Fri Aug 18 18:39:52 2017 +0200
Committer: hobrom <ho...@gmx.at>
Committed: Fri Aug 18 18:39:52 2017 +0200
----------------------------------------------------------------------
core/applib/src/main/java/org/apache/isis/applib/value/Markup.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/45b4d403/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java b/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
index 915f119..88eb641 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
@@ -45,7 +45,7 @@ public class Markup implements Serializable {
}
public boolean isEqualTo(final Markup other) {
- return this.html.equals(other.html);
+ return other==null ? false : this.html.equals(other.html);
}
public String title() {
[12/12] isis git commit: ISIS-1715: adds unit test,
removes commented out code.
Posted by da...@apache.org.
ISIS-1715: adds unit test, removes commented out code.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/4de5824f
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/4de5824f
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/4de5824f
Branch: refs/heads/pr-84
Commit: 4de5824f98c8092c32a4a84ce3b0f691b65dc5b4
Parents: e54952a
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 14 17:17:56 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 14 17:45:03 2017 +0100
----------------------------------------------------------------------
.../domainservice/DomainServiceMenuOrder.java | 7 ---
.../DomainServiceMenuOrder_UnitTest.java | 65 ++++++++++++++++++++
2 files changed, 65 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/4de5824f/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
index 67224b1..5443d41 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
@@ -27,13 +27,6 @@ public class DomainServiceMenuOrder {
private final static String UNDEFINED = "" + Integer.MAX_VALUE;
- //TODO can be safely removed
-// public static int compare(ObjectAdapter serviceAdapter1, ObjectAdapter serviceAdapter2) {
-// return SequenceCompare.compareNullLast(
-// orderOf(serviceAdapter1.getSpecification().getCorrespondingClass()),
-// orderOf(serviceAdapter2.getSpecification().getCorrespondingClass()) );
-// }
-
public static String orderOf(final Class<?> cls) {
final DomainServiceLayout domainServiceLayout = cls.getAnnotation(DomainServiceLayout.class);
String dslayoutOrder = domainServiceLayout != null ? domainServiceLayout.menuOrder(): null;
http://git-wip-us.apache.org/repos/asf/isis/blob/4de5824f/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder_UnitTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder_UnitTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder_UnitTest.java
new file mode 100644
index 0000000..2960ea1
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder_UnitTest.java
@@ -0,0 +1,65 @@
+package org.apache.isis.core.metamodel.facets.object.domainservice;
+
+import org.junit.Test;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class DomainServiceMenuOrder_UnitTest {
+
+ @DomainService(menuOrder = "100")
+ public static class ServiceWithDomainService100 {
+ }
+
+ @DomainServiceLayout(menuOrder = "100")
+ public static class ServiceWithDomainServiceLayout100 {
+ }
+
+ @DomainService(menuOrder = "100")
+ @DomainServiceLayout(menuOrder = "101")
+ public static class ServiceWithDomainService100AndDomainServiceLayout101 {
+ }
+
+ @DomainService(menuOrder = "101")
+ @DomainServiceLayout(menuOrder = "100")
+ public static class ServiceWithDomainService101AndDomainServiceLayout100 {
+ }
+
+ @DomainService()
+ @DomainServiceLayout()
+ public static class ServiceWithDomainServiceAndDomainServiceLayout {
+ }
+
+ @DomainService()
+ public static class ServiceWithDomainService {
+ }
+
+ @DomainServiceLayout()
+ public static class ServiceWithDomainServiceLayout {
+ }
+
+ @Test
+ public void orderOf() throws Exception {
+ assertOrder(ServiceWithDomainService.class, Integer.MAX_VALUE - 100);
+ assertOrder(ServiceWithDomainServiceLayout.class, Integer.MAX_VALUE - 100);
+ assertOrder(ServiceWithDomainServiceAndDomainServiceLayout.class, Integer.MAX_VALUE - 100);
+
+ assertOrder(ServiceWithDomainService100.class, 100);
+ assertOrder(ServiceWithDomainServiceLayout100.class, 100);
+
+ assertOrder(ServiceWithDomainService100AndDomainServiceLayout101.class, 100);
+ assertOrder(ServiceWithDomainService101AndDomainServiceLayout100.class, 100);
+ }
+
+ private static void assertOrder(final Class<?> cls, final int expected) {
+ String menuOrder = DomainServiceMenuOrder.orderOf(cls);
+ assertThat(menuOrder, is(equalTo("" + expected)));
+ }
+
+
+
+}
\ No newline at end of file
[08/12] isis git commit: Fix ISIS-1698 CollectionLayout.defaultView
not honored
Posted by da...@apache.org.
Fix ISIS-1698 CollectionLayout.defaultView not honored
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/25c3f8e3
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/25c3f8e3
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/25c3f8e3
Branch: refs/heads/pr-84
Commit: 25c3f8e357f090d09d4592b4d68a3afbe850ae75
Parents: 1b60ce1
Author: hobrom <ho...@gmx.at>
Authored: Tue Sep 12 21:58:51 2017 +0200
Committer: hobrom <ho...@gmx.at>
Committed: Tue Sep 12 21:58:51 2017 +0200
----------------------------------------------------------------------
.../isis/viewer/wicket/ui/components/layout/bs3/col/Col.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/25c3f8e3/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java
index 11dbd06..0770f66 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java
@@ -263,12 +263,14 @@ public class Col extends PanelAbstract<EntityModel> implements HasDynamicallyVis
final RepeatingViewWithDynamicallyVisibleContent collectionRv =
new RepeatingViewWithDynamicallyVisibleContent(ID_COLLECTIONS);
+ final EntityModel entityModel = getModel();
+ final CollectionLayoutData snapshot = entityModel.getCollectionLayoutData();
+
for (CollectionLayoutData collection : collections) {
final String id = collectionRv.newChildId();
// we successively trample over the layout data; but that's ok, this is synchronous code anyway...
- final EntityModel entityModel = getModel();
entityModel.setCollectionLayoutData(collection);
// the entityModel's getLayoutData() provides the hint as to which collection of the entity to render.
@@ -280,6 +282,10 @@ public class Col extends PanelAbstract<EntityModel> implements HasDynamicallyVis
}
div.add(collectionRv);
visible = visible || collectionRv.isVisible();
+
+ //XXX ISIS-1698 restore original state after trampling over
+ entityModel.setCollectionLayoutData(snapshot);
+
} else {
Components.permanentlyHide(div, ID_COLLECTIONS);
}
[11/12] isis git commit: Merge branch 'ISIS-1698_pr-84'
Posted by da...@apache.org.
Merge branch 'ISIS-1698_pr-84'
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/e54952a7
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/e54952a7
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/e54952a7
Branch: refs/heads/pr-84
Commit: e54952a72fafb3c73c5b0134e39b5f9351b57ab2
Parents: 4010799 25c3f8e
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 14 15:13:59 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 14 17:45:01 2017 +0100
----------------------------------------------------------------------
.../isis/viewer/wicket/ui/components/layout/bs3/col/Col.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[09/12] isis git commit: Merge branch 'ISIS-1616_pr-84'
Posted by da...@apache.org.
Merge branch 'ISIS-1616_pr-84'
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/09d46bdf
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/09d46bdf
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/09d46bdf
Branch: refs/heads/pr-84
Commit: 09d46bdf48043c2fa52623fe996af6baa028d9c8
Parents: ce866aa 2f7a414
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 14 15:12:10 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 14 17:44:55 2017 +0100
----------------------------------------------------------------------
.../org/apache/isis/applib/value/Markup.java | 76 +++++++++++++
.../facets/value/markup/MarkupValueFacet.java | 29 +++++
...ValueFacetUsingSemanticsProviderFactory.java | 38 +++++++
.../markup/MarkupValueSemanticsProvider.java | 113 +++++++++++++++++++
.../ComponentFactoryRegistrarDefault.java | 5 +
.../scalars/ScalarPanelTextFieldAbstract.java | 2 +-
.../scalars/markup/MarkupComponent.java | 65 +++++++++++
.../components/scalars/markup/MarkupPanel.java | 83 ++++++++++++++
.../scalars/markup/MarkupPanelFactory.java | 105 +++++++++++++++++
.../scalars/markup/StandaloneMarkupPanel.html | 32 ++++++
.../scalars/markup/StandaloneMarkupPanel.java | 35 ++++++
11 files changed, 582 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[04/12] isis git commit: typo
Posted by da...@apache.org.
typo
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/66985739
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/66985739
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/66985739
Branch: refs/heads/pr-84
Commit: 6698573948003018bf32b1c95a80f4e16515237a
Parents: 45b4d40
Author: hobrom <ho...@gmx.at>
Authored: Fri Aug 18 18:50:21 2017 +0200
Committer: hobrom <ho...@gmx.at>
Committed: Fri Aug 18 18:50:21 2017 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/isis/applib/value/Markup.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/66985739/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java b/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
index 88eb641..212c334 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/value/Markup.java
@@ -49,7 +49,7 @@ public class Markup implements Serializable {
}
public String title() {
- return "Markup[lenght="+html.length()+"]";
+ return "Markup[length="+html.length()+"]";
}
@Override
@@ -70,7 +70,7 @@ public class Markup implements Serializable {
@Override
public String toString() {
- return "Markup[lenght="+html.length()+", html="+html+"]";
+ return "Markup[length="+html.length()+", html="+html+"]";
}
}
[06/12] isis git commit: Fix ISIS-1715 menuOrder not honored
Posted by da...@apache.org.
Fix ISIS-1715 menuOrder not honored
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/312ac31b
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/312ac31b
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/312ac31b
Branch: refs/heads/pr-84
Commit: 312ac31b770308a4dd14b115f30fcfc1cf2d45b4
Parents: 2f7a414
Author: hobrom <ho...@gmx.at>
Authored: Tue Sep 12 16:31:47 2017 +0200
Committer: hobrom <ho...@gmx.at>
Committed: Tue Sep 12 16:31:47 2017 +0200
----------------------------------------------------------------------
.../core/commons/compare/SequenceCompare.java | 92 ++++++++++++++++++++
.../domainservice/DomainServiceMenuOrder.java | 61 +++++++++++++
.../MemberOrderFacetComparator.java | 60 +------------
.../ServicesInstallerFromAnnotation.java | 26 +-----
.../serviceactions/ServiceActionUtil.java | 35 ++++----
.../serviceactions/ServiceAndAction.java | 7 +-
.../serviceactions/ServiceAndActionOrder.java | 49 +++++++++++
7 files changed, 231 insertions(+), 99 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/312ac31b/core/metamodel/src/main/java/org/apache/isis/core/commons/compare/SequenceCompare.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/compare/SequenceCompare.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/compare/SequenceCompare.java
new file mode 100644
index 0000000..39b5355
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/compare/SequenceCompare.java
@@ -0,0 +1,92 @@
+/*
+ * 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.core.commons.compare;
+
+import java.util.StringTokenizer;
+
+public class SequenceCompare {
+
+ public static int compareNullLast(String sequence1, String sequence2) {
+ if (sequence1 == null && sequence2 == null) {
+ return 0;
+ }
+
+ if (sequence1 == null && sequence2 != null) {
+ return +1; // non-null before null
+ }
+ if (sequence1 != null && sequence2 == null) {
+ return -1; // non-null before null
+ }
+
+ final String[] components1 = componentsFor(sequence1);
+ final String[] components2 = componentsFor(sequence2);
+
+ final int length1 = components1.length;
+ final int length2 = components2.length;
+
+ // shouldn't happen but just in case.
+ if (length1 == 0 && length2 == 0) {
+ return 0;
+ }
+
+ // continue to loop until we run out of components.
+ int n = 0;
+ while (true) {
+ final int length = n + 1;
+ // check if run out of components in either side
+ if (length1 < length && length2 >= length) {
+ return -1; // o1 before o2
+ }
+ if (length2 < length && length1 >= length) {
+ return +1; // o2 before o1
+ }
+ if (length1 < length && length2 < length) {
+ // run out of components
+ return 0;
+ }
+ // we have this component on each side
+
+ int componentCompare = 0;
+ try {
+ final Integer c1 = Integer.valueOf(components1[n]);
+ final Integer c2 = Integer.valueOf(components2[n]);
+ componentCompare = c1.compareTo(c2);
+ } catch (final NumberFormatException nfe) {
+ // not integers compare as strings
+ componentCompare = components1[n].compareTo(components2[n]);
+ }
+
+ if (componentCompare != 0) {
+ return componentCompare;
+ }
+ // this component is the same; lets look at the next
+ n++;
+ }
+ }
+
+ private static String[] componentsFor(final String sequence) {
+ final StringTokenizer tokens = new StringTokenizer(sequence, ".", false);
+ final String[] components = new String[tokens.countTokens()];
+ for (int i = 0; tokens.hasMoreTokens(); i++) {
+ components[i] = tokens.nextToken();
+ }
+ return components;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/312ac31b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
new file mode 100644
index 0000000..f681449
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceMenuOrder.java
@@ -0,0 +1,61 @@
+/*
+ * 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.core.metamodel.facets.object.domainservice;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.core.commons.compare.SequenceCompare;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+
+public class DomainServiceMenuOrder {
+
+ public static int compare(ObjectAdapter serviceAdapter1, ObjectAdapter serviceAdapter2) {
+
+ return SequenceCompare.compareNullLast(
+ orderOf(serviceAdapter1.getSpecification().getCorrespondingClass()),
+ orderOf(serviceAdapter2.getSpecification().getCorrespondingClass()) );
+ }
+
+ // -- HELPER
+
+ public static String orderOf(final Class<?> cls) {
+ final DomainServiceLayout domainServiceLayout = cls.getAnnotation(DomainServiceLayout.class);
+ String dslayoutOrder = domainServiceLayout != null ? domainServiceLayout.menuOrder(): null;
+ final DomainService domainService = cls.getAnnotation(DomainService.class);
+ String dsOrder = domainService != null ? domainService.menuOrder() : "" + Integer.MAX_VALUE;
+
+ return minimumOf(dslayoutOrder, dsOrder);
+ }
+
+ private static String minimumOf(final String dslayoutOrder, final String dsOrder) {
+ if(isUndefined(dslayoutOrder)) {
+ return dsOrder;
+ }
+ if(isUndefined(dsOrder)) {
+ return dslayoutOrder;
+ }
+ return dslayoutOrder.compareTo(dsOrder) < 0 ? dslayoutOrder : dsOrder;
+ }
+
+ private static boolean isUndefined(final String str) {
+ return str == null || str.equals("" + Integer.MAX_VALUE);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/312ac31b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layout/memberorderfacet/MemberOrderFacetComparator.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layout/memberorderfacet/MemberOrderFacetComparator.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layout/memberorderfacet/MemberOrderFacetComparator.java
index 2314454..05474af 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layout/memberorderfacet/MemberOrderFacetComparator.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layout/memberorderfacet/MemberOrderFacetComparator.java
@@ -20,8 +20,8 @@
package org.apache.isis.core.metamodel.layout.memberorderfacet;
import java.util.Comparator;
-import java.util.StringTokenizer;
+import org.apache.isis.core.commons.compare.SequenceCompare;
import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacet;
public class MemberOrderFacetComparator implements Comparator<MemberOrderFacet> {
@@ -47,63 +47,9 @@ public class MemberOrderFacetComparator implements Comparator<MemberOrderFacet>
if (ensureInSameGroup && !m1.name().equals(m2.name())) {
throw new IllegalArgumentException("Not in same group");
}
+
+ return SequenceCompare.compareNullLast(m1.sequence(), m2.sequence());
- final String sequence1 = m1.sequence();
- final String sequence2 = m2.sequence();
-
- final String[] components1 = componentsFor(sequence1);
- final String[] components2 = componentsFor(sequence2);
-
- final int length1 = components1.length;
- final int length2 = components2.length;
-
- // shouldn't happen but just in case.
- if (length1 == 0 && length2 == 0) {
- return 0;
- }
-
- // continue to loop until we run out of components.
- int n = 0;
- while (true) {
- final int length = n + 1;
- // check if run out of components in either side
- if (length1 < length && length2 >= length) {
- return -1; // o1 before o2
- }
- if (length2 < length && length1 >= length) {
- return +1; // o2 before o1
- }
- if (length1 < length && length2 < length) {
- // run out of components
- return 0;
- }
- // we have this component on each side
-
- int componentCompare = 0;
- try {
- final Integer c1 = Integer.valueOf(components1[n]);
- final Integer c2 = Integer.valueOf(components2[n]);
- componentCompare = c1.compareTo(c2);
- } catch (final NumberFormatException nfe) {
- // not integers compare as strings
- componentCompare = components1[n].compareTo(components2[n]);
- }
-
- if (componentCompare != 0) {
- return componentCompare;
- }
- // this component is the same; lets look at the next
- n++;
- }
- }
-
- private static String[] componentsFor(final String sequence) {
- final StringTokenizer tokens = new StringTokenizer(sequence, ".", false);
- final String[] components = new String[tokens.countTokens()];
- for (int i = 0; tokens.hasMoreTokens(); i++) {
- components[i] = tokens.nextToken();
- }
- return components;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/312ac31b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
index 9f2da65..e9031bb 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
@@ -46,6 +46,7 @@ import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.applib.services.classdiscovery.ClassDiscoveryServiceUsingReflections;
import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+import org.apache.isis.core.metamodel.facets.object.domainservice.DomainServiceMenuOrder;
import org.apache.isis.core.metamodel.util.DeweyOrderComparator;
import static com.google.common.base.Predicates.and;
@@ -220,7 +221,7 @@ public class ServicesInstallerFromAnnotation extends ServicesInstallerAbstract {
final List<Class<?>> domainServiceClasses = Lists.newArrayList(Iterables.filter(domainServiceTypes, instantiatable()));
for (final Class<?> cls : domainServiceClasses) {
- final String order = orderOf(cls);
+ final String order = DomainServiceMenuOrder.orderOf(cls);
// we want the class name in order to instantiate it
// (and *not* the value of the @DomainServiceLayout(named=...) annotation attribute)
final String fullyQualifiedClassName = cls.getName();
@@ -234,29 +235,6 @@ public class ServicesInstallerFromAnnotation extends ServicesInstallerAbstract {
//region > helpers: orderOf, nameOf, asList
- private static String orderOf(final Class<?> cls) {
- final DomainServiceLayout domainServiceLayout = cls.getAnnotation(DomainServiceLayout.class);
- String dslayoutOrder = domainServiceLayout != null ? domainServiceLayout.menuOrder(): null;
- final DomainService domainService = cls.getAnnotation(DomainService.class);
- String dsOrder = domainService != null ? domainService.menuOrder() : "" + Integer.MAX_VALUE;
-
- return minimumOf(dslayoutOrder, dsOrder);
- }
-
- private static String minimumOf(final String dslayoutOrder, final String dsOrder) {
- if(isUndefined(dslayoutOrder)) {
- return dsOrder;
- }
- if(isUndefined(dsOrder)) {
- return dslayoutOrder;
- }
- return dslayoutOrder.compareTo(dsOrder) < 0 ? dslayoutOrder : dsOrder;
- }
-
- private static boolean isUndefined(final String str) {
- return str == null || str.equals("" + Integer.MAX_VALUE);
- }
-
private static String nameOf(final Class<?> cls) {
final DomainServiceLayout domainServiceLayout = cls.getAnnotation(DomainServiceLayout.class);
String name = domainServiceLayout != null ? domainServiceLayout.named(): null;
http://git-wip-us.apache.org/repos/asf/isis/blob/312ac31b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java
index 9d7569c..efc2ea4 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionUtil.java
@@ -19,27 +19,12 @@
package org.apache.isis.viewer.wicket.ui.components.actionmenu.serviceactions;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.Model;
-import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.filter.Filters;
import org.apache.isis.applib.services.i18n.TranslationService;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -58,8 +43,21 @@ import org.apache.isis.core.runtime.system.session.IsisSessionFactoryBuilder;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
import org.apache.isis.viewer.wicket.model.models.ServiceActionsModel;
import org.apache.isis.viewer.wicket.ui.components.actionmenu.CssClassFaBehavior;
-import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.model.Model;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipBehavior;
import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
@@ -206,6 +204,9 @@ public final class ServiceActionUtil {
collateServiceActions(serviceAdapter, ActionType.PROTOTYPE, serviceActions);
}
+ //XXX ISIS-1715 honor member order
+ Collections.sort(serviceActions);
+
final Set<String> serviceNamesInOrder = serviceNamesInOrder(serviceAdapters, serviceActions);
final Map<String, List<ServiceAndAction>> serviceActionsByName = groupByServiceName(serviceActions);
http://git-wip-us.apache.org/repos/asf/isis/blob/312ac31b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java
index 8aecb15..65ec519 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndAction.java
@@ -19,7 +19,7 @@ package org.apache.isis.viewer.wicket.ui.components.actionmenu.serviceactions;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
-class ServiceAndAction {
+class ServiceAndAction implements Comparable<ServiceAndAction> {
final String serviceName;
final EntityModel serviceEntityModel;
final ObjectAction objectAction;
@@ -41,4 +41,9 @@ class ServiceAndAction {
public String toString() {
return serviceName + " ~ " + objectAction.getIdentifier().toFullIdentityString();
}
+
+ @Override
+ public int compareTo(ServiceAndAction other) {
+ return ServiceAndActionOrder.compare(this, other);
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/312ac31b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndActionOrder.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndActionOrder.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndActionOrder.java
new file mode 100644
index 0000000..19be3e1
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceAndActionOrder.java
@@ -0,0 +1,49 @@
+/*
+ * 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.wicket.ui.components.actionmenu.serviceactions;
+
+import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacet;
+import org.apache.isis.core.metamodel.facets.object.domainservice.DomainServiceMenuOrder;
+import org.apache.isis.core.metamodel.layout.memberorderfacet.MemberOrderFacetComparator;
+
+class ServiceAndActionOrder {
+
+ private final static MemberOrderFacetComparator memberOrder =
+ new MemberOrderFacetComparator(false);
+
+ public static int compare(ServiceAndAction a, ServiceAndAction b) {
+
+ int c = a.serviceName.compareTo(b.serviceName);
+ if(c!=0)
+ return c;
+
+ c = DomainServiceMenuOrder.compare(
+ a.serviceEntityModel.getObject(),
+ b.serviceEntityModel.getObject() );
+ if(c!=0)
+ return c;
+
+ return memberOrder.compare(
+ a.objectAction.getFacet(MemberOrderFacet.class),
+ b.objectAction.getFacet(MemberOrderFacet.class) );
+
+ }
+
+}