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 2012/12/08 15:56:02 UTC
[31/53] [partial] ISIS-188: making structure of component viewers
consistent
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ButtonBorderExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ButtonBorderExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ButtonBorderExample.java
new file mode 100644
index 0000000..eba0a26
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ButtonBorderExample.java
@@ -0,0 +1,124 @@
+/*
+ * 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.dnd.example.border;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.noa.reflect.Allow;
+import org.apache.isis.noa.reflect.Consent;
+import org.apache.isis.noa.reflect.ObjectActionType;
+import org.apache.isis.noa.reflect.Veto;
+import org.apache.isis.viewer.dnd.ButtonAction;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.border.ButtonBorder;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestObjectView;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+
+
+public class ButtonBorderExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new ButtonBorderExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ButtonAction[] actions = new ButtonAction[] { new ButtonAction() {
+
+ public Consent disabled(final View view) {
+ return Allow.DEFAULT;
+ }
+
+ public void execute(final Workspace workspace, final View view, final Location at) {
+ view.getFeedbackManager().addMessage("Button 1 pressed");
+ }
+
+ public String getDescription(final View view) {
+ return "Button that can be pressed";
+ }
+
+ public String getName(final View view) {
+ return "Action";
+ }
+
+ public ObjectActionType getType() {
+ return USER;
+ }
+
+ public boolean isDefault() {
+ return true;
+ }
+
+ public String getHelp(final View view) {
+ return null;
+ }
+ },
+
+ new ButtonAction() {
+
+ public Consent disabled(final View view) {
+ return Veto.DEFAULT;
+ }
+
+ public void execute(final Workspace workspace, final View view, final Location at) {
+ view.getFeedbackManager().addMessage("Button 2 pressed");
+ }
+
+ public String getDescription(final View view) {
+ return "Button that can't be pressed";
+ }
+
+ public String getName(final View view) {
+ return "Disabled";
+ }
+
+ public ObjectActionType getType() {
+ return USER;
+ }
+
+ public boolean isDefault() {
+ return false;
+ }
+
+ public String getHelp(final View view) {
+ return null;
+ }
+ } };
+
+ ObjectAdapter object = createExampleObjectForView();
+ Content content = new RootObject(object);
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ View view = new ButtonBorder(actions, new TestObjectView(content, specification, axis, 200, 80, "VIEW in border"));
+
+ view.setLocation(new Location(100, 100));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/CompoundBorderExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/CompoundBorderExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/CompoundBorderExample.java
new file mode 100644
index 0000000..c9ae957
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/CompoundBorderExample.java
@@ -0,0 +1,80 @@
+/*
+ * 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.dnd.example.border;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.border.ObjectBorder;
+import org.apache.isis.viewer.dnd.border.ScrollBorder;
+import org.apache.isis.viewer.dnd.border.WindowBorder;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestObjectView;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+
+
+public class CompoundBorderExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new CompoundBorderExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ObjectAdapter object = createExampleObjectForView();
+ Content content = new RootObject(object);
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ View v = new TestObjectView(content, specification, axis, 300, 120, "normal");
+
+ View objectBorder = new ObjectBorder(1, v);
+
+ View scrollBorder = new ScrollBorder(objectBorder);
+ scrollBorder.setSize(new Size(200, 200));
+
+ View view = new WindowBorder(scrollBorder, false);
+ view.setLocation(new Location(50, 60));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view = new WindowBorder(new TestObjectView(content, specification, axis, 100, 30, "active"), false);
+ view.setLocation(new Location(200, 300));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view.getState().setActive();
+
+ view = new WindowBorder(new TestObjectView(content, specification, axis, 100, 30, "view identified"), false);
+ view.setLocation(new Location(200, 400));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view.getState().setInactive();
+ view.getState().setRootViewIdentified();
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ObjectBorderExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ObjectBorderExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ObjectBorderExample.java
new file mode 100644
index 0000000..4172ff2
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ObjectBorderExample.java
@@ -0,0 +1,86 @@
+/*
+ * 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.dnd.example.border;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.border.ObjectBorder;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestObjectView;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+
+
+public class ObjectBorderExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new ObjectBorderExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ObjectAdapter object = createExampleObjectForView();
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ Content content = new RootObject(object);
+ View view = new ObjectBorder(1, new TestObjectView(content, specification, axis, 200, 90, "Normal"));
+ view.setLocation(new Location(100, 20));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view = new ObjectBorder(4, new TestObjectView(content, specification, axis, 100, 50, "wide border"));
+ view.setLocation(new Location(100, 160));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ view.getState().setContentIdentified();
+
+ view = new ObjectBorder(1, new TestObjectView(content, specification, axis, 100, 50, "identified"));
+ view.setLocation(new Location(100, 350));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ view.getState().setContentIdentified();
+
+ view = new ObjectBorder(1, new TestObjectView(content, specification, axis, 100, 50, "active"));
+ view.setLocation(new Location(100, 230));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ view.getState().setActive();
+
+ view = new ObjectBorder(1, new TestObjectView(content, specification, axis, 100, 50, "can drop"));
+ view.setLocation(new Location(100, 290));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ view.getState().setCanDrop();
+
+ view = new ObjectBorder(1, new TestObjectView(content, specification, axis, 100, 50, "can't drop"));
+ view.setLocation(new Location(100, 410));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ view.getState().setCantDrop();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ScrollBorderExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ScrollBorderExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ScrollBorderExample.java
new file mode 100644
index 0000000..18debbd
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/ScrollBorderExample.java
@@ -0,0 +1,67 @@
+/*
+ * 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.dnd.example.border;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.border.ScrollBorder;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestObjectViewWithDragging;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+
+
+public class ScrollBorderExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new ScrollBorderExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ObjectAdapter object = createExampleObjectForView();
+ Content content = new RootObject(object);
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ View view = new ScrollBorder(new TestObjectViewWithDragging(content, specification, axis, 800, 800, "both"));
+ view.setLocation(new Location(50, 60));
+ view.setSize(new Size(216, 216));
+ workspace.addView(view);
+
+ view = new ScrollBorder(new TestObjectViewWithDragging(content, specification, axis, 200, 800, "vertical"));
+ view.setLocation(new Location(300, 60));
+ view.setSize(new Size(216, 216));
+ workspace.addView(view);
+
+ view = new ScrollBorder(new TestObjectViewWithDragging(content, specification, axis, 800, 200, "horizontal"));
+ view.setLocation(new Location(550, 60));
+ view.setSize(new Size(216, 216));
+ workspace.addView(view);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/WindowBorderExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/WindowBorderExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/WindowBorderExample.java
new file mode 100644
index 0000000..de26f93
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/border/WindowBorderExample.java
@@ -0,0 +1,72 @@
+/*
+ * 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.dnd.example.border;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.border.WindowBorder;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestObjectView;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+
+
+public class WindowBorderExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new WindowBorderExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ObjectAdapter object = createExampleObjectForView();
+ Content content = new RootObject(object);
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ View view = new WindowBorder(new TestObjectView(content, specification, axis, 300, 120, "normal"), false);
+ view.setLocation(new Location(50, 60));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view = new WindowBorder(new TestObjectView(content, specification, axis, 100, 30, "active"), false);
+ view.setLocation(new Location(200, 300));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view.getState().setActive();
+
+ view = new WindowBorder(new TestObjectView(content, specification, axis, 100, 30, "view identified"), false);
+ view.setLocation(new Location(200, 400));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view.getState().setInactive();
+ view.getState().setRootViewIdentified();
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/ParentView.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/ParentView.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/ParentView.java
new file mode 100644
index 0000000..59a208b
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/ParentView.java
@@ -0,0 +1,32 @@
+/*
+ * 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.dnd.example.field;
+
+import org.apache.isis.viewer.dnd.view.simple.AbstractView;
+
+
+public class ParentView extends AbstractView {
+
+ protected ParentView() {
+ super(null, null, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/PasswordFieldExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/PasswordFieldExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/PasswordFieldExample.java
new file mode 100644
index 0000000..6ff318f
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/PasswordFieldExample.java
@@ -0,0 +1,80 @@
+/*
+ * 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.dnd.example.field;
+
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+import org.apache.isis.viewer.dnd.view.field.PasswordField;
+
+
+public class PasswordFieldExample extends TestViews {
+ public static void main(final String[] args) {
+ new PasswordFieldExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ View parent = new ParentView();
+
+ Content content = new DummyTextParseableField("password");
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ PasswordField textField = new PasswordField(content, specification, axis);
+ textField.setParent(parent);
+ // textField.setMaxWidth(200);
+ textField.setLocation(new Location(50, 20));
+ textField.setSize(textField.getRequiredSize(new Size()));
+ workspace.addView(textField);
+
+ textField = new PasswordField(content, specification, axis);
+ textField.setParent(parent);
+ // textField.setMaxWidth(80);
+ textField.setLocation(new Location(50, 80));
+ textField.setSize(textField.getRequiredSize(new Size()));
+ workspace.addView(textField);
+
+ content = new DummyTextParseableField("pa");
+ PasswordField view = new PasswordField(content, specification, axis);
+ view.setParent(parent);
+ // view.setMaxWidth(200);
+ view.setLocation(new Location(50, 140));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view = new PasswordField(content, specification, axis);
+ view.setParent(parent);
+ // view.setMaxWidth(80);
+ view.setLocation(new Location(50, 250));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ }
+
+ protected boolean showOutline() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/TextFieldExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/TextFieldExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/TextFieldExample.java
new file mode 100644
index 0000000..329c120
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/field/TextFieldExample.java
@@ -0,0 +1,339 @@
+/*
+ * 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.dnd.example.field;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.noa.adapter.Oid;
+import org.apache.isis.noa.adapter.ResolveState;
+import org.apache.isis.noa.adapter.Version;
+import org.apache.isis.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.noa.reflect.Allow;
+import org.apache.isis.noa.reflect.Consent;
+import org.apache.isis.noa.reflect.ObjectAction;
+import org.apache.isis.noa.reflect.ObjectActionInstance;
+import org.apache.isis.noa.reflect.ObjectActionType;
+import org.apache.isis.noa.reflect.OneToManyAssociation;
+import org.apache.isis.noa.reflect.OneToManyAssociationInstance;
+import org.apache.isis.noa.reflect.OneToOneAssociation;
+import org.apache.isis.noa.reflect.OneToOneAssociationInstance;
+import org.apache.isis.noa.reflect.listeners.ObjectListener;
+import org.apache.isis.noa.spec.ObjectSpecification;
+import org.apache.isis.noa.util.DebugString;
+import org.apache.isis.noa.util.NotImplementedException;
+import org.apache.isis.nof.core.util.AsString;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.TextParseableContent;
+import org.apache.isis.viewer.dnd.UserActionSet;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.drawing.Image;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+import org.apache.isis.viewer.dnd.view.field.SingleLineTextField;
+import org.apache.isis.viewer.dnd.view.field.WrappedTextField;
+
+
+class DummyTextParseableField implements TextParseableContent {
+ private ObjectAdapter object = new ObjectAdapter() {
+
+ public String asEncodedString(Object object) {
+ return null;
+ }
+
+ public String getIconName() {
+ return null;
+ }
+
+ public Object getObject() {
+ return null;
+ }
+
+ public ObjectSpecification getSpecification() {
+ return null;
+ }
+
+ public void parseTextEntry(Object original, final String text) {
+ DummyTextParseableField.this.text = text;
+ }
+
+ public Object restoreFromEncodedString(final String data) {
+ return null;
+ }
+
+ public String titleString() {
+ return text;
+ }
+
+ public String toString() {
+ AsString str = new AsString(this);
+ str.append("text", text);
+ return str.toString();
+ }
+
+ public void setMask(String mask) {}
+
+ public int defaultTypicalLength() {
+ return 0;
+ }
+
+ public void addObjectListener(ObjectListener listener) {}
+
+ public void fireChangedEvent() {}
+
+ public ObjectActionInstance getActionInstance(ObjectAction action) {
+ return null;
+ }
+
+ public ObjectActionInstance[] getActionInstances(ObjectActionType type) {
+ return null;
+ }
+
+ public OneToManyAssociationInstance getOneToManyAssociation(OneToManyAssociation field) {
+ return null;
+ }
+
+ public OneToManyAssociationInstance[] getOneToManyAssociationInstances() {
+ return null;
+ }
+
+ public OneToOneAssociationInstance getOneToOneAssociation(OneToOneAssociation field) {
+ return null;
+ }
+
+ public OneToOneAssociationInstance[] getOneToOneAssociationInstances() {
+ return null;
+ }
+
+ public void removeObjectListener(ObjectListener listener) {}
+
+ public void changeState(ResolveState newState) {}
+
+ public void checkLock(Version version) {}
+
+ public Oid getOid() {
+ return null;
+ }
+
+ public ResolveState getResolveState() {
+ return null;
+ }
+
+ public Version getVersion() {
+ return null;
+ }
+
+ public void setOptimisticLock(Version version) {}
+
+ public void replacePojo(Object pojo) {
+ throw new NotImplementedException();
+ }
+
+ public TypeOfFacet getTypeOfFacet() {
+ return null;
+ }
+
+ public void setTypeOfFacet(TypeOfFacet typeOfFacet) {}
+
+ };
+ private String text;
+
+ public DummyTextParseableField(final String text) {
+ this.text = text;
+ }
+
+ public Consent canDrop(final Content sourceContent) {
+ return null;
+ }
+
+ public void clear() {}
+
+ public void contentMenuOptions(UserActionSet options) {}
+
+ public void debugDetails(final DebugString debug) {}
+
+ public ObjectAdapter drop(final Content sourceContent) {
+ return null;
+ }
+
+ public void entryComplete() {}
+
+ public String getDescription() {
+ return null;
+ }
+
+ public String getHelp() {
+ return null;
+ }
+
+ public String getIconName() {
+ return null;
+ }
+
+ public Image getIconPicture(int iconHeight) {
+ return null;
+ }
+
+ public String getId() {
+ return null;
+ }
+
+ public ObjectAdapter getAdapter() {
+ return getObject();
+ }
+
+ public ObjectAdapter getObject() {
+ return object;
+ }
+
+ public int getMaximumLength() {
+ return 0;
+ }
+
+ public int getTypicalLineLength() {
+ return 0;
+ }
+
+ public ObjectSpecification getSpecification() {
+ return null;
+ }
+
+ public boolean isCollection() {
+ return false;
+ }
+
+ public Consent isEditable() {
+ return Allow.DEFAULT;
+ }
+
+ public boolean isEmpty() {
+ return false;
+ }
+
+ public boolean isObject() {
+ return false;
+ }
+
+ public boolean isPersistable() {
+ return false;
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public boolean isTextParseable() {
+ return true;
+ }
+
+ public void parseTextEntry(final String entryText) {}
+
+ public String title() {
+ return null;
+ }
+
+ public void viewMenuOptions(UserActionSet options) {}
+
+ public String windowTitle() {
+ return null;
+ }
+
+ public ObjectAdapter[] getOptions() {
+ return null;
+ }
+
+ public boolean isOptionEnabled() {
+ return false;
+ }
+
+ public int getNoLines() {
+ return 1;
+ }
+
+ public boolean canClear() {
+ return false;
+ }
+
+ public boolean canWrap() {
+ return false;
+ }
+
+ public String titleString(ObjectAdapter value) {
+ return null;
+ }
+
+}
+
+public class TextFieldExample extends TestViews {
+ private static final String LONG_TEXT = "Apache Isis - a framework that exposes behaviourally complete business\n"
+ + "objects directly to the user. Copyright (C) 2010 Apache Software Foundation\n";
+
+ private static final String SHORT_TEXT = "Short length of text for small field";
+
+ public static void main(final String[] args) {
+ new TextFieldExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ View parent = new ParentView();
+
+ TextParseableContent content = new DummyTextParseableField(SHORT_TEXT);
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ SingleLineTextField textField = new SingleLineTextField(content, specification, axis, true);
+ textField.setParent(parent);
+ textField.setWidth(200);
+ textField.setLocation(new Location(50, 20));
+ textField.setSize(textField.getRequiredSize(new Size()));
+ workspace.addView(textField);
+
+ textField = new SingleLineTextField(content, specification, axis, false);
+ textField.setParent(parent);
+ textField.setWidth(80);
+ textField.setLocation(new Location(50, 80));
+ textField.setSize(textField.getRequiredSize(new Size()));
+ workspace.addView(textField);
+
+ content = new DummyTextParseableField(LONG_TEXT);
+ WrappedTextField view = new WrappedTextField(content, specification, axis, false);
+ view.setParent(parent);
+ view.setNoLines(5);
+ view.setWidth(200);
+ view.setWrapping(false);
+ view.setLocation(new Location(50, 140));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view = new WrappedTextField(content, specification, axis, true);
+ view.setParent(parent);
+ view.setNoLines(8);
+ view.setWidth(500);
+ view.setWrapping(false);
+ view.setLocation(new Location(50, 250));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/message/ErrorViewExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/message/ErrorViewExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/message/ErrorViewExample.java
new file mode 100644
index 0000000..dcb5f93
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/message/ErrorViewExample.java
@@ -0,0 +1,59 @@
+/*
+ * 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.dnd.example.message;
+
+import org.apache.isis.noa.ObjectAdapterRuntimeException;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+import org.apache.isis.viewer.dnd.view.message.DetailedMessageViewSpecification;
+import org.apache.isis.viewer.dnd.view.message.ExceptionMessageContent;
+import org.apache.isis.viewer.dnd.view.message.MessageDialogSpecification;
+
+
+
+public class ErrorViewExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new ErrorViewExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ Object object = new ObjectAdapterRuntimeException("The test exception message");
+ Content content = new ExceptionMessageContent((Throwable) object);
+ ViewAxis axis = null;
+
+ View view = new MessageDialogSpecification().createView(content, axis);
+ view.setLocation(new Location(100, 30));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ View view2 = new DetailedMessageViewSpecification().createView(content, axis);
+ view2.setLocation(new Location(100, 260));
+ view2.setSize(view2.getMaximumSize());
+ workspace.addView(view2);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/table/ScrollableTableBorderExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/table/ScrollableTableBorderExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/table/ScrollableTableBorderExample.java
new file mode 100644
index 0000000..7aa733c
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/table/ScrollableTableBorderExample.java
@@ -0,0 +1,73 @@
+/*
+ * 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.dnd.example.table;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.border.ScrollBorder;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestObjectViewWithDragging;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+
+
+public class ScrollableTableBorderExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new ScrollableTableBorderExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ObjectAdapter object = createExampleObjectForView();
+ Content content = new RootObject(object);
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ TestHeaderView leftHeader = new TestHeaderView(axis, 40, 800);
+ TestHeaderView topHeader = new TestHeaderView(axis, 800, 20);
+ View view = new ScrollBorder(new TestObjectViewWithDragging(content, specification, axis, 800, 800, "both"), leftHeader,
+ topHeader);
+ view.setLocation(new Location(50, 60));
+ view.setSize(new Size(216, 216));
+ view.setParent(workspace);
+ workspace.addView(view);
+
+ view = new ScrollBorder(new TestObjectViewWithDragging(content, specification, axis, 200, 800, "vertical"));
+ view.setLocation(new Location(300, 60));
+ view.setSize(new Size(216, 216));
+ view.setParent(workspace);
+ workspace.addView(view);
+
+ view = new ScrollBorder(new TestObjectViewWithDragging(content, specification, axis, 800, 200, "horizontal"));
+ view.setLocation(new Location(550, 60));
+ view.setSize(new Size(216, 216));
+ view.setParent(workspace);
+ workspace.addView(view);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/table/TestHeaderView.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/table/TestHeaderView.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/table/TestHeaderView.java
new file mode 100644
index 0000000..eb97beb
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/table/TestHeaderView.java
@@ -0,0 +1,96 @@
+/*
+ * 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.dnd.example.table;
+
+import org.apache.isis.viewer.dnd.Canvas;
+import org.apache.isis.viewer.dnd.Click;
+import org.apache.isis.viewer.dnd.Drag;
+import org.apache.isis.viewer.dnd.DragStart;
+import org.apache.isis.viewer.dnd.InternalDrag;
+import org.apache.isis.viewer.dnd.SimpleInternalDrag;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.view.simple.AbstractView;
+import org.apache.isis.viewer.dnd.viewer.AwtColor;
+
+
+public class TestHeaderView extends AbstractView {
+
+ private int requiredWidth;
+ private int requiredHeight;
+
+ public TestHeaderView(final ViewAxis axis, final int width, final int height) {
+ super(null, null, axis);
+ setMaximumSize(new Size(width, height));
+ }
+
+ public void draw(final Canvas canvas) {
+ super.draw(canvas);
+ int width = getSize().getWidth();
+ int height = getSize().getHeight();
+ canvas.clearBackground(this, AwtColor.GRAY);
+ canvas.drawRectangle(0, 0, width - 1, height - 1, AwtColor.BLUE);
+ canvas.drawLine(0, 0, width - 1, height - 1, AwtColor.ORANGE);
+ canvas.drawLine(width - 1, 0, 0, height - 1, AwtColor.ORANGE);
+ }
+
+ public Size getRequiredSize(final Size maximumSize) {
+ return new Size(requiredWidth, requiredHeight);
+ }
+
+ public void setMaximumSize(final Size size) {
+ requiredHeight = size.getHeight();
+ requiredWidth = size.getWidth();
+
+ setSize(size);
+ }
+
+ public void firstClick(final Click click) {
+ debug("first click " + click);
+ }
+
+ public void secondClick(final Click click) {
+ debug("second click " + click);
+ }
+
+ public void mouseMoved(final Location location) {
+ debug("mouse moved " + location);
+ }
+
+ private void debug(final String str) {
+ getViewManager().getSpy().addAction(str);
+ }
+
+ public Drag dragStart(final DragStart drag) {
+ debug("drag start in header " + drag);
+ return new SimpleInternalDrag(getParent(), drag.getLocation());
+ }
+
+ public void drag(final InternalDrag drag) {
+ debug("drag in header " + drag);
+ super.drag(drag);
+ }
+
+ public void dragTo(final InternalDrag drag) {
+ debug("drag to in header " + drag);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/NodeBorderExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/NodeBorderExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/NodeBorderExample.java
new file mode 100644
index 0000000..3f2b4d7
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/NodeBorderExample.java
@@ -0,0 +1,62 @@
+/*
+ * 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.dnd.example.tree;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.noa.util.NotImplementedException;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestObjectView;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+import org.apache.isis.viewer.dnd.tree.TreeBrowserFrame;
+import org.apache.isis.viewer.dnd.tree.TreeNodeBorder;
+
+
+public class NodeBorderExample extends TestViews {
+
+ private TreeNodeBorder view;
+
+ public static void main(final String[] args) {
+ new NodeBorderExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ObjectAdapter object = createExampleObjectForView();
+ ViewSpecification specification = new ExampleViewSpecification();
+ if (true) {
+ throw new NotImplementedException("Need to create the corrext axis to for the nodes to access");
+ }
+ ViewAxis axis = new TreeBrowserFrame(null, null);
+
+ Content content = new RootObject(object);
+ view = new TreeNodeBorder(new TestObjectView(content, specification, axis, 200, 90, "Tree node"), null);
+ view.setLocation(new Location(60, 60));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/ResizeBorderExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/ResizeBorderExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/ResizeBorderExample.java
new file mode 100644
index 0000000..d76b515
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/ResizeBorderExample.java
@@ -0,0 +1,62 @@
+/*
+ * 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.dnd.example.tree;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.basic.TextFieldResizeBorder;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.ExampleViewSpecification;
+import org.apache.isis.viewer.dnd.example.view.TestObjectViewWithDragging;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+import org.apache.isis.viewer.dnd.tree.TreeBrowserResizeBorder;
+
+
+public class ResizeBorderExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new ResizeBorderExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ObjectAdapter object = createExampleObjectForView();
+ Content content = new RootObject(object);
+ ViewSpecification specification = new ExampleViewSpecification();
+ ViewAxis axis = null;
+
+ View view = new TextFieldResizeBorder(new TestObjectViewWithDragging(content, specification, axis, 400, 400, "resizing"));
+ view.setLocation(new Location(50, 60));
+ view.setSize(new Size(100, 24));
+ workspace.addView(view);
+
+ view = new TreeBrowserResizeBorder(new TestObjectViewWithDragging(content, specification, axis, 400, 400, "resizing"));
+ view.setLocation(new Location(50, 120));
+ view.setSize(new Size(200, 200));
+ workspace.addView(view);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeExample.java
new file mode 100644
index 0000000..aa92cb8
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeExample.java
@@ -0,0 +1,67 @@
+/*
+ * 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.dnd.example.tree;
+
+import org.apache.isis.noa.adapter.ResolveState;
+import org.apache.isis.nof.testsystem.TestProxyAdapter;
+import org.apache.isis.nof.testsystem.TestSpecification;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.basic.TreeBrowserSpecification;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+import org.apache.isis.viewer.dnd.tree.TreeBrowserFrame;
+import org.apache.isis.viewer.dnd.view.form.WindowFormSpecification;
+
+
+
+public class TreeExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new TreeExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ TestProxyAdapter object = new TestProxyAdapter();
+ object.setupSpecification(new TestSpecification());
+ object.setupResolveState(ResolveState.TRANSIENT);
+
+ ViewAxis axis = new TreeBrowserFrame(null, null);
+
+ Content content = new RootObject(object);
+
+ View view = new TreeBrowserSpecification().createView(content, axis);
+ view.setLocation(new Location(100, 50));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view = new WindowFormSpecification().createView(content, axis);
+ view.setLocation(new Location(100, 200));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeLeafNodeExample.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeLeafNodeExample.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeLeafNodeExample.java
new file mode 100644
index 0000000..6bbbc56
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeLeafNodeExample.java
@@ -0,0 +1,66 @@
+/*
+ * 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.dnd.example.tree;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.content.RootObject;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.example.view.TestViews;
+import org.apache.isis.viewer.dnd.tree.ClosedCollectionNodeSpecification;
+import org.apache.isis.viewer.dnd.tree.TreeBrowserFrame;
+
+
+public class TreeLeafNodeExample extends TestViews {
+
+ public static void main(final String[] args) {
+ new TreeLeafNodeExample();
+ }
+
+ protected void views(final Workspace workspace) {
+ ObjectAdapter object = createExampleObjectForView();
+ ViewAxis axis = new TreeBrowserFrame(null, null);
+
+ Content content = new RootObject(object);
+
+ View view = new ClosedCollectionNodeSpecification().createView(content, axis);
+ view.setLocation(new Location(100, 20));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+
+ view = new ClosedCollectionNodeSpecification().createView(content, axis);
+ view.setLocation(new Location(100, 60));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ view.getState().setContentIdentified();
+
+ view = new ClosedCollectionNodeSpecification().createView(content, axis);
+ view.setLocation(new Location(100, 100));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ view.getState().setCanDrop();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectView.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectView.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectView.java
new file mode 100644
index 0000000..ab5babc
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectView.java
@@ -0,0 +1,95 @@
+/*
+ * 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.dnd.example.view;
+
+import org.apache.isis.extensions.dndviewer.ColorsAndFonts;
+import org.apache.isis.viewer.dnd.Canvas;
+import org.apache.isis.viewer.dnd.Click;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.Drag;
+import org.apache.isis.viewer.dnd.DragStart;
+import org.apache.isis.viewer.dnd.Toolkit;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.view.simple.AbstractView;
+
+
+public class TestObjectView extends AbstractView {
+
+ private int requiredWidth;
+ private int requiredHeight;
+ private final String label;
+
+ public TestObjectView(final Content content, final ViewSpecification specification, final ViewAxis axis, final int width, final int height, final String label) {
+ super(content, specification, axis);
+ this.requiredWidth = width;
+ this.requiredHeight = height;
+ this.label = label;
+ }
+
+ public void draw(final Canvas canvas) {
+ super.draw(canvas);
+ int width = getSize().getWidth();
+ int height = getSize().getHeight();
+ canvas.clearBackground(this, Toolkit.getColor(0xeeeeee));
+ canvas.drawRectangle(0, 0, width - 1, height - 1, Toolkit.getColor(0xcccccc));
+ canvas.drawLine(0, 0, width - 1, height - 1, Toolkit.getColor(0xff0000));
+ canvas.drawLine(width - 1, 0, 0, height - 1, Toolkit.getColor(0xff0000));
+ canvas.drawText(label, 2, Toolkit.getText(ColorsAndFonts.TEXT_NORMAL).getAscent() + 2, Toolkit.getColor(0), Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
+ }
+
+ public Size getRequiredSize(final Size maximumSize) {
+ return new Size(requiredWidth, requiredHeight);
+ }
+
+ public void setMaximumSize(final Size size) {
+ requiredHeight = size.getHeight();
+ requiredWidth = size.getWidth();
+
+ setSize(size);
+ }
+
+ public void firstClick(final Click click) {
+ debug("first click " + click);
+ super.firstClick(click);
+ }
+
+ public void secondClick(final Click click) {
+ debug("second click " + click);
+ super.secondClick(click);
+ }
+
+ public void mouseMoved(final Location location) {
+ debug("mouse moved " + location);
+ super.mouseMoved(location);
+ }
+
+ private void debug(final String str) {
+ getViewManager().getSpy().addAction(str);
+ }
+
+ public Drag dragStart(final DragStart drag) {
+ debug("drag start " + drag);
+ return super.dragStart(drag);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectViewWithDragging.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectViewWithDragging.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectViewWithDragging.java
new file mode 100644
index 0000000..1c008fb
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectViewWithDragging.java
@@ -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.viewer.dnd.example.view;
+
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.Drag;
+import org.apache.isis.viewer.dnd.DragStart;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+
+import org.apache.log4j.Logger;
+
+
+public class TestObjectViewWithDragging extends TestObjectView {
+
+ private static final Logger LOG = Logger.getLogger(TestObjectViewWithDragging.class);
+
+ public TestObjectViewWithDragging(final
+ Content content, final
+ ViewSpecification specification, final
+ ViewAxis axis, final
+ int width, final
+ int height, final
+ String label) {
+ super(content, specification, axis, width, height, label);
+ }
+
+ public Drag dragStart(final DragStart drag) {
+ LOG.debug("drag start " + drag.getLocation());
+ return super.dragStart(drag);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestViews.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestViews.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestViews.java
new file mode 100644
index 0000000..ae04653
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestViews.java
@@ -0,0 +1,132 @@
+/*
+ * 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.dnd.example.view;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.noa.adapter.ResolveState;
+import org.apache.isis.nof.core.context.IsisContext;
+import org.apache.isis.nof.core.image.java.AwtTemplateImageLoaderInstaller;
+import org.apache.isis.nof.core.util.InfoDebugFrame;
+import org.apache.isis.nof.core.util.IsisConfiguration;
+import org.apache.isis.nof.testsystem.TestProxyAdapter;
+import org.apache.isis.nof.testsystem.TestProxySystem;
+import org.apache.isis.nof.testsystem.TestSpecification;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.Toolkit;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.debug.DebugView;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.image.ImageFactory;
+import org.apache.isis.viewer.dnd.notifier.ViewUpdateNotifier;
+import org.apache.isis.viewer.dnd.viewer.AwtToolkit;
+import org.apache.isis.viewer.dnd.viewer.ViewerFrame;
+import org.apache.isis.viewer.dnd.viewer.XViewer;
+
+import org.apache.log4j.BasicConfigurator;
+
+
+
+public class TestViews {
+ protected TestProxySystem system;
+
+ protected ObjectAdapter createExampleObjectForView() {
+ TestProxyAdapter object = new TestProxyAdapter();
+ object.setupTitleString("ExampleObjectForView");
+ object.setupSpecification(new TestSpecification());
+ object.setupResolveState(ResolveState.GHOST);
+ return object;
+ }
+
+ public static void main(final String[] args) {
+ new TestViews();
+ }
+
+ protected TestViews() {
+ BasicConfigurator.configure();
+
+ system = new TestProxySystem();
+ system.init();
+
+ configure(IsisContext.getConfiguration());
+
+
+ new ImageFactory(new AwtTemplateImageLoaderInstaller().createLoader());
+ new AwtToolkit();
+
+
+ XViewer viewer = (XViewer) Toolkit.getViewer();
+ ViewerFrame frame = new ViewerFrame();
+ frame.setViewer(viewer);
+ viewer.setRenderingArea(frame);
+ viewer.setUpdateNotifier(new ViewUpdateNotifier());
+
+ Toolkit.debug = false;
+
+ Workspace workspace = workspace();
+ viewer.setRootView(workspace);
+ viewer.init();
+ views(workspace);
+
+ viewer.showSpy();
+
+ InfoDebugFrame debug = new InfoDebugFrame();
+ debug.setInfo(new DebugView(workspace));
+ debug.setSize(800, 600);
+ debug.setLocation(400, 300);
+ debug.show();
+
+ frame.setBounds(200, 100, 800, 600);
+ frame.init();
+ frame.show();
+ viewer.sizeChange();
+
+ debug.showDebugForPane();
+ }
+
+ protected void configure(final IsisConfiguration configuration) {}
+
+ protected void views(final Workspace workspace) {
+ Content content = null;
+ ViewSpecification specification = null;
+ ViewAxis axis = null;
+ TestObjectView view = new TestObjectView(content, specification, axis, 100, 200, "object");
+ view.setLocation(new Location(100, 60));
+ view.setSize(view.getRequiredSize(new Size()));
+ workspace.addView(view);
+ }
+
+ protected Workspace workspace() {
+ TestWorkspaceView workspace = new TestWorkspaceView(null);
+ workspace.setShowOutline(showOutline());
+ // NOTE - viewer seems to ignore the placement of the workspace view
+ // TODO fix the viewer so the root view is displayed at specified location
+ // workspace.setLocation(new Location(50, 50));
+ workspace.setSize(workspace.getRequiredSize(new Size()));
+ return workspace;
+ }
+
+ protected boolean showOutline() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceSpecification.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceSpecification.java
new file mode 100644
index 0000000..b999895
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceSpecification.java
@@ -0,0 +1,67 @@
+/*
+ * 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.dnd.example.view;
+
+import org.apache.isis.viewer.dnd.CompositeViewBuilder;
+import org.apache.isis.viewer.dnd.CompositeViewSpecification;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.drawing.Size;
+
+
+public class TestWorkspaceSpecification implements CompositeViewSpecification {
+
+ public void setRequiredSize(final Size size) {}
+
+ public CompositeViewBuilder getSubviewBuilder() {
+ return null;
+ }
+
+ public View createView(final Content content, final ViewAxis axis) {
+ return null;
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public boolean isAligned() {
+ return false;
+ }
+
+ public boolean isOpen() {
+ return false;
+ }
+
+ public boolean isReplaceable() {
+ return false;
+ }
+
+ public boolean isSubView() {
+ return false;
+ }
+
+ public boolean canDisplay(final Content content) {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceView.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceView.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceView.java
new file mode 100644
index 0000000..312f471
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceView.java
@@ -0,0 +1,170 @@
+/*
+ * 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.dnd.example.view;
+
+import org.apache.isis.noa.adapter.ObjectAdapter;
+import org.apache.isis.noa.util.DebugString;
+import org.apache.isis.extensions.dndviewer.ColorsAndFonts;
+import org.apache.isis.viewer.dnd.Canvas;
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.Toolkit;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.Workspace;
+import org.apache.isis.viewer.dnd.drawing.Bounds;
+import org.apache.isis.viewer.dnd.drawing.Color;
+import org.apache.isis.viewer.dnd.drawing.Location;
+import org.apache.isis.viewer.dnd.drawing.Size;
+import org.apache.isis.viewer.dnd.view.simple.AbstractView;
+
+import java.util.Vector;
+
+
+public class TestWorkspaceView extends AbstractView implements Workspace {
+ private static final Color markerDark = Toolkit.getColor(0xcccccc);
+ private static final Color markerLight = Toolkit.getColor(0xf0f0f0);
+ private final Vector views = new Vector();
+ private boolean showOutline;
+
+ public View[] getSubviews() {
+ View[] array = new View[views.size()];
+ views.copyInto(array);
+ return array;
+ }
+
+ protected TestWorkspaceView(final Content content) {
+ super(content, new TestWorkspaceSpecification(), null);
+ }
+
+ public void debug(DebugString debug) {
+ View[] subviews = getSubviews();
+ for (int i = 0; i < subviews.length; i++) {
+ subviews[i].debug(debug);
+ debug.append("\nContent: ");
+ debug.append(subviews[i].getContent() == null ? "none" : ("" + subviews[i].getContent().getAdapter()));
+ debug.append("\n----------------\n");
+ }
+ }
+
+ public void draw(final Canvas canvas) {
+ Bounds bounds = getBounds();
+ canvas.drawRectangle(0, 0, bounds.getWidth(), bounds.getHeight(), Toolkit.getColor(0x0000ff));
+ canvas.drawText("Test Workspace", 10, 20, Toolkit.getColor(0x0000ff), Toolkit.getText(ColorsAndFonts.TEXT_TITLE));
+
+ for (int i = 0; i < views.size(); i++) {
+ View view = (View) views.elementAt(i);
+
+ if (showOutline()) {
+ final Size requiredSize = view.getSize();
+ final Location location = view.getLocation();
+
+ final int width = requiredSize.getWidth();
+ final int height = requiredSize.getHeight();
+ final int baseline = location.getY() + view.getBaseline();
+ final int left = location.getX() - 10;
+ final int top = location.getY() - 10;
+ final int right = left + 10 + width - 1 + 10;
+ final int bottom = top + 10 + height - 1 + 10;
+
+ // horizontal lines
+ canvas.drawLine(left, top + 10, right, top + 10, markerDark);
+ canvas.drawLine(left, bottom - 10, right, bottom - 10, markerDark);
+
+ // vertical lines
+ canvas.drawLine(left + 10, top, left + 10, bottom, markerDark);
+ canvas.drawLine(right - 10, top, right - 10, bottom, markerDark);
+
+ canvas.drawRectangle(left + 10, top + 10, width - 1, height - 1, markerLight);
+
+ canvas.drawLine(left, baseline, left + 10, baseline, markerDark);
+ canvas.drawLine(right - 10, baseline, right, baseline, markerDark);
+ canvas.drawLine(left + 10, baseline, right - 10, baseline, markerLight);
+ }
+ Canvas subcanvas = canvas.createSubcanvas(view.getBounds());
+ view.draw(subcanvas);
+ }
+
+ }
+
+ private boolean showOutline() {
+ return showOutline;
+ }
+
+ public void setShowOutline(final boolean showOutline) {
+ this.showOutline = showOutline;
+ }
+
+ public View subviewFor(final Location location) {
+ for (int i = 0; i < views.size(); i++) {
+ View view = (View) views.elementAt(i);
+ if (view.getBounds().contains(location)) {
+ return view;
+ }
+ }
+
+ return null;
+ }
+
+ public void layout(final Size maximumSize) {
+ for (int i = 0; i < views.size(); i++) {
+ View view = (View) views.elementAt(i);
+ view.layout(new Size());
+ }
+
+ }
+
+ public Size getRequiredSize(final Size maximumSize) {
+ return new Size(600, 400);
+ }
+
+ public Workspace getWorkspace() {
+ return this;
+ }
+
+ public View addIconFor(final ObjectAdapter adapter, final Location at) {
+ return null;
+ }
+
+ public View addOpenViewFor(final ObjectAdapter object, final Location at) {
+ return null;
+ }
+
+ public View createSubviewFor(final ObjectAdapter object, final boolean asIcon) {
+ return null;
+ }
+
+ public void lower(final View view) {}
+
+ public void raise(final View view) {}
+
+ public void removeViewsFor(final ObjectAdapter object) {}
+
+ public void removeView(final View view) {
+ System.out.println("remove view " + view);
+ }
+
+ public void addView(final View view) {
+ views.addElement(view);
+ view.setParent(this);
+ }
+
+ public void removeObject(ObjectAdapter object) {}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/image/ImageCatalogue.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/image/ImageCatalogue.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/image/ImageCatalogue.java
new file mode 100644
index 0000000..efa32b1
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/image/ImageCatalogue.java
@@ -0,0 +1,125 @@
+/*
+ * 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.dnd.image;
+
+import java.awt.Canvas;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.Toolkit;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+
+import org.apache.log4j.BasicConfigurator;
+
+
+public class ImageCatalogue extends Frame {
+ private static final String DIRECTORY = "src/images/";
+ private String[] files;
+ private Image[] images;
+ private int HEIGHT = 60;
+ private int WIDTH = 120;
+ private static MediaTracker mt = new MediaTracker(new Canvas());
+
+ public ImageCatalogue() {
+ File dir = new File(DIRECTORY);
+ if (!dir.exists()) {
+ throw new RuntimeException("No directory " + dir);
+ }
+ System.out.println(dir.getAbsolutePath());
+ files = dir.list();
+ images = new Image[files.length];
+
+ for (int i = 0; i < files.length; i++) {
+ String file = files[i];
+ String url = DIRECTORY + file;
+ Image image = Toolkit.getDefaultToolkit().createImage(url);
+ if (image != null) {
+ mt.addImage(image, 0);
+ try {
+ mt.waitForAll();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (mt.isErrorAny()) {
+ System.err.println("Failed to load image from resource: " + url + " " + mt.getErrorsAny()[0]);
+
+ mt.removeImage(image);
+ image = null;
+ }
+ }
+ System.out.println("Image " + image + " loaded from " + url);
+
+ images[i] = image;
+
+ if (images[i] == null) {
+ System.err.println(file + " not loaded");
+ }
+ }
+
+ addWindowListener(new WindowAdapter() {
+ public void windowClosing(final WindowEvent e) {
+ dispose();
+ }
+ });
+ setSize(300, 300);
+ show();
+ }
+
+ public static void main(final String[] args) {
+ // PropertyConfigurator.configure("log4j.testing.properties");
+ BasicConfigurator.configure();
+ new ImageCatalogue();
+ }
+
+ public void paint(final Graphics g) {
+ int width = getWidth();
+ int height = getHeight();
+ int x = getInsets().left;
+ int y = getInsets().top;
+
+ g.setFont(new Font("Sans", 0, 9));
+
+ for (int i = 0; i < images.length; i++) {
+ Image image = images[i];
+
+ if (image != null) {
+ g.drawImage(image, x, y, 32, 32, null);
+ }
+
+ g.drawString(files[i], x, y + HEIGHT - 3);
+
+ x = x + WIDTH;
+
+ if (x >= width) {
+ x = 0;
+ y = y + HEIGHT;
+
+ if (y >= height) {
+ break;
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/dnd/viewer/IconImage.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/dnd/viewer/IconImage.java b/component/viewer/dnd/impl/src/main/src-archived/dnd/viewer/IconImage.java
new file mode 100644
index 0000000..67251b4
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/dnd/viewer/IconImage.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.dnd.viewer;
+
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Insets;
+
+
+
+public class IconImage extends Frame {
+
+ public IconImage(String fileName) {
+ Image image = getToolkit().getImage(fileName);
+ setIconImage(image);
+ setSize(150, 150);
+ show();
+ }
+
+ public static void main(String[] args) {
+ new IconImage(args[0]);
+ }
+
+ public void paint(Graphics g) {
+ Insets in = insets();
+ g.drawImage(getIconImage(), in.left, in.top, this);
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/eb613703/component/viewer/dnd/impl/src/main/src-archived/views/BarSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/BarSpecification.java b/component/viewer/dnd/impl/src/main/src-archived/views/BarSpecification.java
new file mode 100644
index 0000000..89603d4
--- /dev/null
+++ b/component/viewer/dnd/impl/src/main/src-archived/views/BarSpecification.java
@@ -0,0 +1,56 @@
+/*
+ * 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.dnd.special;
+
+import org.apache.isis.viewer.dnd.Content;
+import org.apache.isis.viewer.dnd.ObjectContent;
+import org.apache.isis.viewer.dnd.View;
+import org.apache.isis.viewer.dnd.ViewAxis;
+import org.apache.isis.viewer.dnd.ViewSpecification;
+import org.apache.isis.viewer.dnd.core.AbstractCompositeViewSpecification;
+import org.apache.isis.viewer.dnd.value.PercentageBarField;
+
+class BarSpecification extends AbstractCompositeViewSpecification {
+ public BarSpecification() {
+ builder = new StackLayout(new ObjectFieldBuilder(new DataFormSubviews()));
+ }
+
+ private static class DataFormSubviews implements SubviewSpec {
+ public View createSubview(Content content, ViewAxis axis) {
+ if(content instanceof ObjectContent && ((ObjectContent) content).getObject() instanceof Percentage) {
+ ViewSpecification specification = new PercentageBarField.Specification();
+ return specification.createView(content, axis);
+ }
+
+ return null;
+ }
+
+ public View decorateSubview(View view) {
+ return view;
+ }
+ }
+
+ public String getName() {
+ return "Data Form";
+ }
+}
+
+