incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1386804 - in /incubator/isis/trunk/framework: applib/src/main/java/org/apache/isis/applib/annotation/ core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/
Date Mon, 17 Sep 2012 20:13:34 GMT
Author: danhaywood
Date: Mon Sep 17 20:13:33 2012
New Revision: 1386804

URL: http://svn.apache.org/viewvc?rev=1386804&view=rev
Log:
ISIS-232: facet, first steps on EntityLink

Added:
    incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/AutoComplete.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacet.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacetAbstract.java

Added: incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/AutoComplete.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/AutoComplete.java?rev=1386804&view=auto
==============================================================================
--- incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/AutoComplete.java
(added)
+++ incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/AutoComplete.java
Mon Sep 17 20:13:33 2012
@@ -0,0 +1,78 @@
+/*
+ *  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.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.bookmarks.Bookmark;
+
+/**
+ * Specifies a repository action to use to support auto-complete.
+ */
+@Inherited
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AutoComplete {
+
+    /**
+     * A candidate match for the auto-complete.
+     * 
+     * <p>
+     * The auto-complete action is required to return a list of these instances.
+     * The title can be used by the viewer in the drop down, while the
+     * {@link #getBookmark()} identifies the object.
+     */
+    public static class Candidate {
+        private final String title;
+        private final Bookmark bookmark;
+        public Candidate(String title, Bookmark bookmark) {
+            this.title = title;
+            this.bookmark = bookmark;
+        }
+        public String getTitle() {
+            return title;
+        }
+        public Bookmark getBookmark() {
+            return bookmark;
+        }
+    }
+    
+    /**
+     * The class of the repository to use.
+     * 
+     * <p>
+     * It is sufficient to specify an interface rather than a concrete type.
+     */
+    Class<?> repository();
+    
+    /**
+     * The action to use in order to perform the auto-complete search
+     * (defaults to &quot;autoComplete&quot;).
+     * 
+     * <p>
+     * The action is required to accept a single string parameter, and must return
+     * 
+     */
+    String action() default "autoComplete";
+}

Added: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacet.java?rev=1386804&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacet.java
(added)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacet.java
Mon Sep 17 20:13:33 2012
@@ -0,0 +1,28 @@
+/*
+ *  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.autocomplete;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public interface AutoCompleteFacet extends Facet {
+    public ObjectSpecification getRepositorySpec();
+    public String getActionId();
+}

Added: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacetAbstract.java?rev=1386804&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacetAbstract.java
(added)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/autocomplete/AutoCompleteFacetAbstract.java
Mon Sep 17 20:13:33 2012
@@ -0,0 +1,50 @@
+/*
+ *  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.autocomplete;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public abstract class AutoCompleteFacetAbstract extends FacetAbstract implements AutoCompleteFacet
{
+
+    public static Class<? extends Facet> type() {
+        return AutoCompleteFacet.class;
+    }
+
+    private final ObjectSpecification repositorySpec;
+    private final String actionId;
+
+    public AutoCompleteFacetAbstract(final FacetHolder holder, ObjectSpecification repositorySpec,
String actionId) {
+        super(type(), holder, Derivation.NOT_DERIVED);
+        this.repositorySpec = repositorySpec;
+        this.actionId = actionId;
+    }
+
+    public ObjectSpecification getRepositorySpec() {
+        return repositorySpec;
+    }
+    
+    public String getActionId() {
+        return actionId;
+    }
+
+}



Mime
View raw message