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 2014/07/03 17:01:23 UTC
[17/63] [abbrv] [partial] ISIS-832: mothballing components
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/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
deleted file mode 100644
index 6bbbc56..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/tree/TreeLeafNodeExample.java
+++ /dev/null
@@ -1,66 +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.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/680f0c8d/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
deleted file mode 100644
index ab5babc..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectView.java
+++ /dev/null
@@ -1,95 +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.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/680f0c8d/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
deleted file mode 100644
index 8419e29..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestObjectViewWithDragging.java
+++ /dev/null
@@ -1,51 +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.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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class TestObjectViewWithDragging extends TestObjectView {
-
- private static final Logger LOG = LoggerFactory.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/680f0c8d/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
deleted file mode 100644
index d4e5192..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestViews.java
+++ /dev/null
@@ -1,133 +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.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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-
-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/680f0c8d/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
deleted file mode 100644
index b999895..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceSpecification.java
+++ /dev/null
@@ -1,67 +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.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/680f0c8d/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
deleted file mode 100644
index 312f471..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/dnd/example/view/TestWorkspaceView.java
+++ /dev/null
@@ -1,170 +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.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/680f0c8d/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
deleted file mode 100644
index 26ab0be..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/dnd/image/ImageCatalogue.java
+++ /dev/null
@@ -1,126 +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.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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-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/680f0c8d/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
deleted file mode 100644
index 67251b4..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/dnd/viewer/IconImage.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.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/680f0c8d/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
deleted file mode 100644
index 89603d4..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/BarSpecification.java
+++ /dev/null
@@ -1,56 +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.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";
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/BarchartSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/BarchartSpecification.java b/component/viewer/dnd/impl/src/main/src-archived/views/BarchartSpecification.java
deleted file mode 100644
index 1b96732..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/BarchartSpecification.java
+++ /dev/null
@@ -1,52 +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.dnd.special;
-
-import org.apache.isis.object.ObjectAdapter;
-import org.apache.isis.object.CollectionAdapter;
-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.basic.WindowDecorator;
-import org.apache.isis.viewer.dnd.core.AbstractCompositeViewSpecification;
-
-public class BarchartSpecification extends AbstractCompositeViewSpecification implements SubviewSpec {
- private ViewSpecification specification = new BarSpecification();
-
- public BarchartSpecification() {
- builder = new WindowDecorator(new StackLayout(new CollectionElementBuilder(this, false)));
- }
-
- public View createSubview(Content content, ViewAxis axis) {
- return specification.createView(content, axis);
- }
-
- public String getName() {
- return "Percentage Barchart";
- }
-
- public boolean canDisplay(ObjectAdapter object) {
- return object instanceof CollectionAdapter;
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/GridColumnSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/GridColumnSpecification.java b/component/viewer/dnd/impl/src/main/src-archived/views/GridColumnSpecification.java
deleted file mode 100644
index 5848398..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/GridColumnSpecification.java
+++ /dev/null
@@ -1,69 +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.dnd.special;
-
-import org.apache.isis.object.ObjectAdapterRuntimeException;
-import org.apache.isis.viewer.dnd.Content;
-import org.apache.isis.viewer.dnd.ObjectContent;
-import org.apache.isis.viewer.dnd.OneToManyField;
-import org.apache.isis.viewer.dnd.ValueContent;
-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.util.ViewFactory;
-
-class GridColumnSpecification extends AbstractCompositeViewSpecification{
-
- GridColumnSpecification() {
- builder = new ColumnLayout(155, new ObjectFieldBuilder(new ColumnSubviews()));
- }
-
- public String getName() {
- return "Grid Column";
- }
-
- private static class ColumnSubviews implements SubviewSpec {
- public View createSubview(Content content, ViewAxis axis) {
- ViewFactory factory = Skylark.getViewFactory();
-
- ViewSpecification specification;
-
- if (content instanceof OneToManyField) {
- specification = new ScheduleSpecification();
- } else if (content instanceof ValueContent) {
- specification = factory.getValueFieldSpecification((ValueContent) content);
- } else if (content instanceof ObjectContent) {
- specification = factory.getIconizedSubViewSpecification((ObjectContent) content);
- } else {
- throw new ObjectAdapterRuntimeException();
- }
-
- return specification.createView(content, axis);
- }
-
- public View decorateSubview(View view) {
- return view;
- }
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/GridLayout.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/GridLayout.java b/component/viewer/dnd/impl/src/main/src-archived/views/GridLayout.java
deleted file mode 100644
index 31a5a81..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/GridLayout.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.viewer.dnd.special;
-
-import org.apache.isis.viewer.dnd.CompositeViewBuilder;
-import org.apache.isis.viewer.dnd.Location;
-import org.apache.isis.viewer.dnd.Size;
-import org.apache.isis.viewer.dnd.View;
-import org.apache.isis.viewer.dnd.core.AbstractBuilderDecorator;
-
-public class GridLayout extends AbstractBuilderDecorator {
- public GridLayout(CompositeViewBuilder design) {
- super(design);
- }
-
- public Size getRequiredSize(View view) {
- int height = 0;
- int width = 0;
- View views[] = view.getSubviews();
-
- for (int i = 0; i < views.length; i++) {
- View v = views[i];
- Size s = v.getRequiredSize();
- height = Math.max(height, s.getHeight());
- width += s.getWidth();
- }
-
- return new Size(width, height);
- }
-
- public boolean isOpen() {
- return true;
- }
-
- public void layout(View view) {
- int x = 0, y = 0;
- View views[] = view.getSubviews();
-
- for (int i = 0; i < views.length; i++) {
- View v = views[i];
- Size s = v.getRequiredSize();
- v.setSize(s);
- v.setLocation(new Location(x, y));
- x += s.getWidth();
- }
- }
-
-
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/GridSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/GridSpecification.java b/component/viewer/dnd/impl/src/main/src-archived/views/GridSpecification.java
deleted file mode 100644
index d90841b..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/GridSpecification.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.viewer.dnd.special;
-
-import org.apache.isis.object.ObjectAdapter;
-import org.apache.isis.object.CollectionAdapter;
-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.basic.WindowDecorator;
-import org.apache.isis.viewer.dnd.core.AbstractCompositeViewSpecification;
-
-public class GridSpecification extends AbstractCompositeViewSpecification implements SubviewSpec {
- GridColumnSpecification columnSpecification = new GridColumnSpecification();
-
- public GridSpecification() {
- builder = new WindowDecorator(new GridLayout(new CollectionElementBuilder(this, false)));
- }
-
- public View createSubview(Content content, ViewAxis axis) {
- return columnSpecification.createView(content, axis);
- }
-
- public String getName() {
- return "Grid";
- }
-
- public boolean canDisplay(ObjectAdapter adapter) {
- return object instanceof CollectionAdapter;
- }
-
- public boolean isReplaceable() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/OptionFieldSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/OptionFieldSpecification.java b/component/viewer/dnd/impl/src/main/src-archived/views/OptionFieldSpecification.java
deleted file mode 100644
index 8966d10..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/OptionFieldSpecification.java
+++ /dev/null
@@ -1,67 +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.dnd.metal;
-
-import org.apache.isis.object.ObjectAdapter;
-import org.apache.isis.viewer.dnd.Click;
-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.basic.SimpleIdentifier;
-import org.apache.isis.viewer.dnd.core.AbstractFieldSpecification;
-import org.apache.isis.viewer.dnd.special.OpenOptionFieldBorder;
-
-import javax.swing.text.html.Option;
-
-
-
-public class OptionFieldSpecification extends AbstractFieldSpecification {
- public boolean canDisplay(ObjectAdapter object) {
- return object instanceof Option;
- }
-
- public View createView(Content content, ViewAxis axis) {
- return new SimpleIdentifier(new OptionSelectionFieldBorder(new OptionSelectionField(content, this, axis)));
- }
-
- public String getName() {
- return "Drop down list";
- }
-}
-
-
-class OptionSelectionFieldBorder extends OpenOptionFieldBorder {
-
- public OptionSelectionFieldBorder(OptionSelectionField wrappedView) {
- super(wrappedView);
- }
-
- protected View createOverlay() {
- return new OptionSelectionFieldOverlay((OptionSelectionField) wrappedView);
- }
-
- public void firstClick(Click click) {
- if (canChangeValue()) {
- super.firstClick(click);
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/OptionSelectionField.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/OptionSelectionField.java b/component/viewer/dnd/impl/src/main/src-archived/views/OptionSelectionField.java
deleted file mode 100644
index a45f777..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/OptionSelectionField.java
+++ /dev/null
@@ -1,96 +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.dnd.value;
-
-import org.apache.isis.object.InvalidEntryException;
-import org.apache.isis.object.ObjectAdapter;
-import org.apache.isis.viewer.dnd.Click;
-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.basic.SimpleIdentifier;
-import org.apache.isis.viewer.dnd.core.AbstractFieldSpecification;
-import org.apache.isis.viewer.dnd.special.OpenOptionFieldBorder;
-
-import javax.swing.text.html.Option;
-
-public class OptionSelectionField extends TextField {
-
- private String selected;
-
- public static class Specification extends AbstractFieldSpecification {
- public boolean canDisplay(ObjectAdapter object) {
- return object.getObject() instanceof Option;
- }
-
- public View createView(Content content, ViewAxis axis) {
- return new SimpleIdentifier(new OptionSelectionFieldBorder(new OptionSelectionField(content, this, axis)));
- }
-
- public String getName() {
- return "Drop down list";
- }
- }
-
- public OptionSelectionField(Content content, ViewSpecification specification, ViewAxis axis) {
- super(content, specification, axis, false);
- }
-
- Option getOption() {
- ObjectContent content = ((ObjectContent) getContent());
- Option value = (Option) content.getObject().getObject();
-
- return value;
- }
-
- void set(String selected) {
- this.selected = selected;
- initiateSave();
- }
-
- protected void save() {
- try {
- parseEntry(selected);
- } catch (InvalidEntryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-}
-
-class OptionSelectionFieldBorder extends OpenOptionFieldBorder {
-
- public OptionSelectionFieldBorder(OptionSelectionField wrappedView) {
- super(wrappedView);
- }
-
- protected View createOverlay() {
- return new OptionSelectionFieldOverlay((OptionSelectionField) wrappedView);
- }
-
- public void firstClick(Click click) {
- if (canChangeValue()) {
- super.firstClick(click);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/OptionSelectionFieldOverlay.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/OptionSelectionFieldOverlay.java b/component/viewer/dnd/impl/src/main/src-archived/views/OptionSelectionFieldOverlay.java
deleted file mode 100644
index cc3e987..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/OptionSelectionFieldOverlay.java
+++ /dev/null
@@ -1,81 +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.dnd.value;
-
-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.Size;
-import org.apache.isis.viewer.dnd.Style;
-import org.apache.isis.viewer.dnd.Text;
-import org.apache.isis.viewer.dnd.View;
-import org.apache.isis.viewer.dnd.core.AbstractView;
-
-public class OptionSelectionFieldOverlay extends AbstractView implements View {
- private String options[];
- private int rowHeight;
-
- private OptionSelectionField field;
- private static final Text STYLE = Toolkit.getText(ColorsAndFonts.TEXT_NORMAL);
-
- public OptionSelectionFieldOverlay(OptionSelectionField field) {
- super(field.getContent(), null, null);
- this.field = field;
-
- options = field.getOption().getOptions();
- rowHeight = STYLE.getHeight();
- }
-
- public Size getRequiredSize() {
- Size size = new Size();
- for (int i = 0; i < options.length; i++) {
- size.extendHeight(rowHeight);
- size.ensureWidth(STYLE.stringWidth(options[i]));
- }
- size.extendHeight(2 * VPADDING);
- size.extendWidth(2 * HPADDING);
- return size;
- }
-
- public int getBaseline() {
- return STYLE.getAscent();
- }
-
- public void draw(Canvas canvas) {
- Size size = getSize();
- canvas.drawSolidRectangle(0,0, size.getWidth() - 1, size.getHeight() - 1, Toolkit.getColor(ColorsAndFonts.COLOR_WHITE));
- canvas.drawRectangle(0,0, size.getWidth() - 1, size.getHeight() - 1, Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY2));
- int x = HPADDING;
- int y = VPADDING;
- for (int i = 0; i < options.length; i++) {
- canvas.drawText(options[i], x, y + getBaseline(), Toolkit.getColor(ColorsAndFonts.COLOR_BLACK), STYLE);
- y += rowHeight;
- }
- }
-
- public void firstClick(Click click) {
- int y = click.getLocation().getY() - VPADDING;
- int row = y / rowHeight;
- field.set(options[row]);
- dispose();
- }
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/PercentageBarField.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/PercentageBarField.java b/component/viewer/dnd/impl/src/main/src-archived/views/PercentageBarField.java
deleted file mode 100644
index 54226ac..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/PercentageBarField.java
+++ /dev/null
@@ -1,124 +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.dnd.value;
-
-import org.apache.isis.object.ObjectAdapter;
-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.Color;
-import org.apache.isis.viewer.dnd.Content;
-import org.apache.isis.viewer.dnd.InternalDrag;
-import org.apache.isis.viewer.dnd.Size;
-import org.apache.isis.viewer.dnd.Style;
-import org.apache.isis.viewer.dnd.ValueContent;
-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.basic.SimpleIdentifier;
-import org.apache.isis.viewer.dnd.core.AbstractFieldSpecification;
-
-
-public class PercentageBarField extends AbstractField {
-
- public static class Specification extends AbstractFieldSpecification {
- public View createView(Content content, ViewAxis axis) {
- return new SimpleIdentifier(new PercentageBarField(content, this, axis));
- }
-
- public String getName() {
- return "Percentage graph";
- }
-
- public boolean canDisplay(ObjectAdapter object) {
- return object.getObject() instanceof Percentage;
- }
- }
-
- protected PercentageBarField(Content content, ViewSpecification specification, ViewAxis axis) {
- super(content, specification, axis);
- }
-
- private Percentage entry = new Percentage();
-
- public void drag(InternalDrag drag) {
- float x = drag.getLocation().getX() - 2;
- setValue(x);
- }
-
- private void setValue(float x) {
- float max = getSize().getWidth() - 4;
-
- if ((x >= 0) && (x <= max)) {
- entry.setValue(x / max);
- initiateSave();
- }
- }
-
- protected void save() {
- /* try {
- saveValue(entry);
- } catch(InvalidEntryException e) {
- throw new NotImplementedException();
- }
- */
- }
-
- public void draw(Canvas canvas) {
- super.draw(canvas);
-
- Color color = getState().isObjectIdentified() ? Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY2) : Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY1);
- Size size = getSize();
- int width = size.getWidth();
- int height = size.getHeight();
- canvas.drawRectangle(0, 0, width - 1, height - 1, color);
-
- Percentage p = getPercentage();
- int length = (int) ((width - 4) * p.floatValue());
- canvas.drawSolidRectangle(2, 2, length, height - 5, Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY3));
- canvas.drawRectangle(2, 2, length, height - 5, color);
- canvas.drawText(p.title().toString(), 6, height - 5 - Toolkit.getText(ColorsAndFonts.TEXT_NORMAL).getDescent(), color,
- Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
- }
-
- public void firstClick(Click click) {
- float x = click.getLocation().getX() - 2;
- setValue(x);
- }
-
- private Percentage getPercentage() {
- ValueContent content = ((ValueContent) getContent());
- Percentage percentage = (Percentage) content.getObject().getObject();
-
- return percentage;
- }
-
- public Size getRequiredSize() {
- Size size = super.getRequiredSize();
- size.extendWidth(304);
- return size;
-
- }
-/*
- public void refresh() {
- }
-*/
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleBlockSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleBlockSpecification.java b/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleBlockSpecification.java
deleted file mode 100644
index f97065c..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleBlockSpecification.java
+++ /dev/null
@@ -1,67 +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.dnd.special;
-
-import org.apache.isis.object.ObjectAdapterRuntimeException;
-import org.apache.isis.object.ObjectSpecification;
-import org.apache.isis.object.ObjectSpecificationLoader;
-import org.apache.isis.object.reflect.ObjectField;
-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.basic.SimpleIdentifier;
-import org.apache.isis.viewer.dnd.core.AbstractCompositeViewSpecification;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ScheduleBlockSpecification extends AbstractCompositeViewSpecification{
- private static final Logger LOG = LoggerFactory.getLogger(ScheduleBlockView.class);
-
- public View createView(Content content, ViewAxis axis) {
- ObjectSpecification nc = ((ObjectContent) content).getObject().getSpecification();
- ObjectField[] flds = nc.getFields();
- ObjectField timePeriodField = null;
- ObjectField colorField = null;
- for (int i = 0; i < flds.length; i++) {
- ObjectField field = flds[i];
- if(field.getType().isOfType(Isis.getSpecificationLoader().loadSpecification(TimePeriod.class))) {
- LOG.debug("found TimePeriod field " + field);
- timePeriodField = field;
- }
- if(field.getType().isOfType(Isis.getSpecificationLoader().loadSpecification(org.apache.isis.application.value.Color.class))) {
- LOG.debug("found Color field " + field);
- colorField = field;
- }
- }
- if(timePeriodField == null) {
- throw new ObjectAdapterRuntimeException("Can't create Shedule view without a TimePeriod");
- } else {
- return new SimpleIdentifier(new ScheduleBlockView(content, this, axis, timePeriodField, colorField));
- }
- }
-
- public String getName() {
- return "Schedule Block";
- }
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleBlockView.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleBlockView.java b/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleBlockView.java
deleted file mode 100644
index 80e11eb..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleBlockView.java
+++ /dev/null
@@ -1,150 +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.dnd.special;
-
-import org.apache.isis.object.ObjectAdapter;
-import org.apache.isis.object.reflect.ObjectField;
-import org.apache.isis.extensions.dndviewer.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.Canvas;
-import org.apache.isis.viewer.dnd.Color;
-import org.apache.isis.viewer.dnd.Content;
-import org.apache.isis.viewer.dnd.InternalDrag;
-import org.apache.isis.viewer.dnd.Location;
-import org.apache.isis.viewer.dnd.ObjectContent;
-import org.apache.isis.viewer.dnd.Size;
-import org.apache.isis.viewer.dnd.Style;
-import org.apache.isis.viewer.dnd.ViewAreaType;
-import org.apache.isis.viewer.dnd.ViewAxis;
-import org.apache.isis.viewer.dnd.ViewSpecification;
-import org.apache.isis.viewer.dnd.basic.IconGraphic;
-import org.apache.isis.viewer.dnd.basic.ObjectTitleText;
-import org.apache.isis.viewer.dnd.basic.TitleText;
-import org.apache.isis.viewer.dnd.core.ObjectView;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class ScheduleBlockView extends ObjectView {
- private static final Logger LOG = LoggerFactory.getLogger(ScheduleBlockView.class);
- private ObjectField timePeriodField;
- private ObjectField colorField;
- private TitleText text;
- private IconGraphic icon;
-
- public ScheduleBlockView(Content content, ViewSpecification specification, ViewAxis axis, ObjectField timePeriodField, ObjectField colorField) {
- super(content, specification, axis);
- this.timePeriodField = timePeriodField;
- this.colorField = colorField;
-
- icon = new IconGraphic(this, Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
- text = new ObjectTitleText(this, Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
- }
-
- public void draw(Canvas canvas) {
- super.draw(canvas);
-
- Color color;
- if(colorField == null) {
- color = Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY3);
- } else {
- ObjectAdapter object = ((ObjectContent) getContent()).getObject();
- org.apache.isis.application.value.Color fieldColor = (org.apache.isis.application.value.Color) object.getField(colorField);
- color = new Color((fieldColor).intValue());
- }
-
-
- Size size = getSize();
- int width = size.getWidth() - 1;
- int height = size.getHeight() - 1;
- canvas.drawSolidRectangle(0, 0, width, height, color);
- canvas.drawRectangle(0, 0, width, height, Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY2));
-
- int x = 0;
- int baseline = icon.getBaseline();
- icon.draw(canvas, x, baseline);
- x += icon.getSize().getWidth();
- text.draw(canvas, x, baseline);
-
- }
-
- public ViewAreaType viewAreaType(Location mouseLocation) {
- int objectBoundary = icon.getSize().getWidth();
-
- return mouseLocation.getX() > objectBoundary ? ViewAreaType.INTERNAL : ViewAreaType.CONTENT;
- }
- /*
- public View dragFrom(Location location) {
- int direction;
-
- if(location.getY() <= 8) {
- direction = ViewResizeOutline.TOP;
- } else if(location.getY() >= getSize().getHeight() - 8) {
- direction = ViewResizeOutline.BOTTOM;
- } else {
- direction = ViewResizeOutline.CENTER;
- }
-
- // TODO this should be done via static method that creates and displays overlay
- ViewResizeOutline outlineView =new ViewResizeOutline(this, direction);
-
-// outlineView.setLocation(getView().getLocationWithinViewer());
-// outlineView.setSize(getView().getSize());
-
- getViewManager().setOverlayView(outlineView);
- LOG.debug("drag view start " + location);
- return outlineView;
- }
- */
-
- public void dragTo(InternalDrag drag) {
- ObjectAdapter object = ((ObjectContent) getContent()).getObject();
- TimePeriod tp = calculate(drag);
- TimePeriod timePeriod = (TimePeriod) getObject().getField(timePeriodField);
- ((TimePeriod) timePeriod.getValue()).copyObject(tp);
-// ((Appointment) object).getTime().copyObject(tp);
- invalidateLayout();
- }
-
- public void drag(InternalDrag drag) {
- ViewResizeOutline outlineView = (ViewResizeOutline) drag.getOverlay();
- outlineView.setDisplay(calculate(drag).title().toString());
- }
-
- private TimePeriod calculate(InternalDrag drag) {
- // TODO this fails when the layout decorator is itself decorated (e.g. by a WindowBorder!
- ScheduleLayout layout = (ScheduleLayout) getParent().getSpecification();
-
- Location location = drag.getLocation();
- location.move(0, -getView().getLocation().getY());
- int top = drag.getOverlay().getLocation().getY() - location.getY();
- int bottom = top + drag.getOverlay().getSize().getHeight();
-
- LOG.debug(top + " " + bottom);
-
- TimePeriod tp = new TimePeriod();
- tp.setValue(layout.getTime(getParent(), top), layout.getTime(getParent(), bottom));
-
- return tp;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleLayout.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleLayout.java b/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleLayout.java
deleted file mode 100644
index 99ccf3d..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleLayout.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.viewer.dnd.special;
-
-import org.apache.isis.object.ObjectAdapter;
-import org.apache.isis.object.ObjectSpecification;
-import org.apache.isis.object.ObjectSpecificationLoader;
-import org.apache.isis.object.reflect.ObjectField;
-import org.apache.isis.viewer.dnd.Location;
-import org.apache.isis.viewer.dnd.ObjectContent;
-import org.apache.isis.viewer.dnd.Size;
-import org.apache.isis.viewer.dnd.View;
-import org.apache.isis.viewer.dnd.core.AbstractBuilderDecorator;
-
-import java.sql.Time;
-
-class ScheduleLayout extends AbstractBuilderDecorator {
- private final int from = 7 * Time.HOUR;
- private final int to = Time.HOUR * 10;
-
- public ScheduleLayout(CollectionElementBuilder viewer) {
- super(viewer);
- }
-
- public Size getRequiredSize(View view) {
- return new Size(155, 400);
- }
-
- public void layout(View view) {
- ObjectField field = null;
- int x = 0;
- Size size = view.getSize();
- size.contract(view.getPadding());
-
- int width = size.getWidth();
- int maxHeight = size.getHeight();
-
- View[] views = view.getSubviews();
-
- for (int i = 0; i < views.length; i++) {
- View v = views[i];
- ObjectAdapter object = ((ObjectContent) v.getContent()).getObject();
-
- if (field == null) {
- ObjectSpecification nc = object.getSpecification();
- ObjectField[] fields = nc.getFields();
-
- for (int j = 0; j < fields.length; j++) {
- field = fields[j];
-
- if (field.getType().isOfType(Isis.getSpecificationLoader().loadSpecification(TimePeriod.class))) {
- break;
- }
- }
- }
-
- TimePeriod tp = (TimePeriod) object.getField(field);
- int y = (int) (((tp.getStart().longValue() - from) * maxHeight) / to);
- int height = (int) (((tp.getEnd().longValue() - tp.getStart().longValue()) * maxHeight) / to);
-
- v.setLocation(new Location(x, y));
- v.setSize(new Size(width, height));
- }
- }
-
- public Time getTime(View view, int y) {
- Size size = view.getSize();
- int maxHeight = size.getHeight();
-
- int longtime = (y * to) / maxHeight + from;
- Time t = new Time();
- t.setValue(longtime);
- return t;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleSpecification.java b/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleSpecification.java
deleted file mode 100644
index edda47f..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/ScheduleSpecification.java
+++ /dev/null
@@ -1,51 +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.dnd.special;
-
-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.core.AbstractCompositeViewSpecification;
-
-public class ScheduleSpecification extends AbstractCompositeViewSpecification{
-
- ScheduleSpecification() {
- builder = new ScheduleLayout(new CollectionElementBuilder(new ScheduleBlockSubviews(), true));
- }
-
- public String getName() {
- return "Schedule";
- }
-
- private static class ScheduleBlockSubviews implements SubviewSpec {
- private ScheduleBlockSpecification blockSpecification = new ScheduleBlockSpecification();
-
- public View createSubview(Content content, ViewAxis axis) {
- return blockSpecification.createView(content, axis);
- }
-
- public View decorateSubview(View view) {
- return view;
- }
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/src-archived/views/TimePeriodBarField.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/src-archived/views/TimePeriodBarField.java b/component/viewer/dnd/impl/src/main/src-archived/views/TimePeriodBarField.java
deleted file mode 100644
index 8aac540..0000000
--- a/component/viewer/dnd/impl/src/main/src-archived/views/TimePeriodBarField.java
+++ /dev/null
@@ -1,133 +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.dnd.value;
-
-import org.apache.isis.object.InvalidEntryException;
-import org.apache.isis.object.ObjectAdapter;
-import org.apache.isis.extensions.dndviewer.ColorsAndFonts;
-import org.apache.isis.utility.NotImplementedException;
-import org.apache.isis.viewer.dnd.Canvas;
-import org.apache.isis.viewer.dnd.Color;
-import org.apache.isis.viewer.dnd.Content;
-import org.apache.isis.viewer.dnd.InternalDrag;
-import org.apache.isis.viewer.dnd.ObjectContent;
-import org.apache.isis.viewer.dnd.Size;
-import org.apache.isis.viewer.dnd.Style;
-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.AbstractFieldSpecification;
-
-import java.sql.Time;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class TimePeriodBarField extends AbstractField {
-
- public static class Specification extends AbstractFieldSpecification {
- public View createView(Content content, ViewAxis axis) {
- return new TimePeriodBarField(content, this, axis);
- }
-
- public String getName() {
- return "Period graph";
- }
-
- public boolean canDisplay(ObjectAdapter object) {
- return object instanceof TimePeriod;
- }
- }
- private static final Logger LOG = LoggerFactory.getLogger(TimePeriodBarField.class);
- private int endTime;
- // private int startTime;
-
- protected TimePeriodBarField(Content content, ViewSpecification specification, ViewAxis axis) {
- super(content, specification, axis);
- }
-
- public void drag(InternalDrag drag) {
- float x = drag.getLocation().getX() - 2;
- float max = getSize().getWidth() - 4;
-
- if ((x >= 0) && (x <= max)) {
- int time = (int) (x / max * 3600 * 24);
- endTime = time;
- initiateSave();
- }
- }
-
- protected void save() {
- Time end = getPeriod().getEnd();
- end.setValue(endTime);
-
- Time start = getPeriod().getStart();
-
- TimePeriod tp = new TimePeriod();
- tp.setValue(start, end);
- try {
- parseEntry(tp.title().toString());
- } catch (InvalidEntryException e) {
- throw new NotImplementedException();
- }
- LOG.debug("adjust time " + endTime + " " + getPeriod());
- markDamaged();
- }
-
- public void draw(Canvas canvas) {
- super.draw(canvas);
-
- Color color = getState().isObjectIdentified() ? Toolkit.getColor("primary2") : Toolkit.getColor("secondary1");
- Size size = getSize();
- int width = size.getWidth();
- int height = size.getHeight();
- canvas.drawRectangle(0, 0, width - 1, height - 1, color);
-
- TimePeriod p = getPeriod();
-
- int max = width - 4;
- int start = (int) ((p.isEmpty() ? 0 : (p.getStart().longValue() * max)) / (3600 * 24)) + 2;
- int end = (int) ((p.isEmpty() ? max : (p.getEnd().longValue() * max)) / (3600 * 24)) + 2;
- canvas.drawSolidRectangle(start, 2, end - start, height - 5, Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY3));
- canvas.drawRectangle(start, 2, end - start, height - 5, color);
- canvas.drawText(p.title().toString(), start + 3, height - 5 - Toolkit.getText(ColorsAndFonts.TEXT_NORMAL).getDescent(),
- color, Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
- }
-
- private TimePeriod getPeriod() {
- ObjectContent content = ((ObjectContent) getContent());
- TimePeriod period = (TimePeriod) content.getObject().getObject();
-
- return period;
- }
-
- public Size getRequiredSize() {
- Size size = super.getRequiredSize();
- size.extendWidth(304);
- return size;
- }
-/*
- public void refresh() {
- }
- */
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/site/apt/index.apt b/component/viewer/dnd/impl/src/site/apt/index.apt
deleted file mode 100644
index 830ae9f..0000000
--- a/component/viewer/dnd/impl/src/site/apt/index.apt
+++ /dev/null
@@ -1,37 +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.
-
-
-
-DnD Viewer
-
- The Drag and Drop (DnD) viewer is non-web graphical user interface that employs a
- desktop metaphor for interacting with domain objects. It renders each domain object
- as an icon or a window and allows the user to manage and manipulate them using the mouse
- and keyboard. Dragging and dropping domain objects plays a major role in
- this interface, hence its name.
-
-Customization
-
- The DnD viewer defines its own API to allow new views to be defined. These can be for
- entities, for entity properties (and action parameters), for entity collections, and
- for collections of entities.
-
-Further Info
-
- See this module's {{{./apidocs/index.html}Javadoc}} and the {{{./docbkx/html/guide/isis-dnd-viewer.html}user guide}} for more information.
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/site/apt/jottings.apt b/component/viewer/dnd/impl/src/site/apt/jottings.apt
deleted file mode 100644
index 7391f77..0000000
--- a/component/viewer/dnd/impl/src/site/apt/jottings.apt
+++ /dev/null
@@ -1,38 +0,0 @@
-~~ Licensed to the Apache Software Foundation (ASF) under one
-~~ or more contributor license agreements. See the NOTICE file
-~~ distributed with this work for additional information
-~~ regarding copyright ownership. The ASF licenses this file
-~~ to you under the Apache License, Version 2.0 (the
-~~ "License"); you may not use this file except in compliance
-~~ with the License. You may obtain a copy of the License at
-~~
-~~ http://www.apache.org/licenses/LICENSE-2.0
-~~
-~~ Unless required by applicable law or agreed to in writing,
-~~ software distributed under the License is distributed on an
-~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-~~ KIND, either express or implied. See the License for the
-~~ specific language governing permissions and limitations
-~~ under the License.
-
-
-
-Jottings
-
- This page is to capture any random jottings relating to this module prior
- to being moved into formal documentation.
-
-
-Useful tools for the DND developer
-
- When space is limited us the limitText method in the TextUtils class. This will return the maximum amount of text to fit a specified space.
-
-------
-TextUtils.limitText(title, TITLE_STYLE, availableWidth);
-----
-
-
-User Profiles
-
- When the DND viewer is exited (DndViewer.quit()) a call is made to saveDesktop() that will
- cause the UserProifile to be persisted under the user's name. This is stored using the UserProfileStore
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/site/site.xml
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/site/site.xml b/component/viewer/dnd/impl/src/site/site.xml
deleted file mode 100644
index edde1f3..0000000
--- a/component/viewer/dnd/impl/src/site/site.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?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.
--->
-<project>
-
- <body>
- <breadcrumbs>
- <item name="DnD"/>
- </breadcrumbs>
-
- <menu name="DnD Viewer">
- <item name="About" href="index.html" />
- <item name="Jottings" href="jottings.html" />
- </menu>
-
- <menu name="Viewer Modules">
- <item name="HTML" href="../html/index.html" />
- <item name="Scimpi" href="../scimpi/index.html" />
- <item name="Wicket" href="../wicket/index.html" />
- <item name="RestfulObjects" href="../restfulobjects/index.html" />
- <item name="JUnit Support" href="../junit/index.html" />
- <item name="BDD Integration" href="../bdd/index.html" />
- <item name="DnD" href="../dnd/index.html" />
- </menu>
-
- <menu name="Documentation">
- <item name="${docbkxGuideTitle} (PDF)" href="docbkx/pdf/${docbkxGuideName}.pdf" />
- <item name="${docbkxGuideTitle} (HTML)" href="docbkx/html/guide/${docbkxGuideName}.html" />
- </menu>
-
- <menu name="Maven Reports" ref="reports" />
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/ContentDragTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/ContentDragTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/ContentDragTest.java
deleted file mode 100644
index 570e9d4..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/ContentDragTest.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.dnd;
-
-import junit.framework.TestCase;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.interaction.ContentDragImpl;
-import org.apache.isis.viewer.dnd.view.ContentDrag;
-
-public class ContentDragTest extends TestCase {
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testLocation() {
- final DummyView sourceView = new DummyView();
- sourceView.setParent(new DummyWorkspaceView());
- sourceView.setupLocation(new Location(1000, 1000));
-
- final ContentDrag drag = new ContentDragImpl(sourceView, new Location(10, 10), new DummyView());
- assertEquals(new Location(10, 10), drag.getOffset());
-
- final DummyView targetView = new DummyView();
- targetView.setupAbsoluteLocation(new Location(100, 100));
-
- // drag.drag(targetView, new Location(120, 120), 0);
- // assertEquals(new Location(20, 20), drag.getTargetLocation());
- }
-}