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 2016/05/21 07:10:20 UTC
[19/56] [abbrv] [partial] isis git commit: ISIS-1335: deleting the
mothballed directory.
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/IconElementFactory.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/IconElementFactory.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/IconElementFactory.java
deleted file mode 100644
index 4f16f27..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/IconElementFactory.java
+++ /dev/null
@@ -1,60 +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.icon;
-
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewFactory;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.base.BlankView;
-
-public class IconElementFactory implements ViewFactory {
- private final ViewSpecification objectSpec;
- private final ViewSpecification collectionSpec;
- private final boolean createViewsForEmptyContent;
-
- public IconElementFactory() {
- this(null, null, false);
- }
-
- public IconElementFactory(final ViewSpecification objectSpec, final ViewSpecification collectionSpec, final boolean createViewsForEmptyContent) {
- this.objectSpec = this.objectSpec == null ? new SubviewIconSpecification() : objectSpec;
- this.collectionSpec = this.collectionSpec == null ? new SubviewIconSpecification() : collectionSpec;
- this.createViewsForEmptyContent = createViewsForEmptyContent;
- }
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- if (content.isObject()) {
- if (content.getAdapter() == null) {
- return createViewsForEmptyContent ? new BlankView(content) : null;
- } else {
- return objectSpec.createView(content, axes, -1);
- }
- } else if (content.isCollection()) {
- return collectionSpec.createView(content, axes, -1);
- } else {
- // TODO decide what to do with values: use factory, use another
- // SubviewSpec, or ignore always
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/IconSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/IconSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/IconSpecification.java
deleted file mode 100644
index 9aefbc2..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/IconSpecification.java
+++ /dev/null
@@ -1,93 +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.icon;
-
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.base.IconGraphic;
-import org.apache.isis.viewer.dnd.view.text.ObjectTitleText;
-
-public class IconSpecification implements ViewSpecification {
- private final boolean isSubView;
- private final boolean isReplaceable;
-
- public IconSpecification() {
- this(true, true);
- }
-
- IconSpecification(final boolean isSubView, final boolean isReplaceable) {
- this.isSubView = isSubView;
- this.isReplaceable = isReplaceable;
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return requirement.isClosed() && requirement.isObject() && requirement.hasReference();
- }
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- final Text style = Toolkit.getText(ColorsAndFonts.TEXT_NORMAL);
- final Icon icon = new Icon(content, this);
- icon.setTitle(new ObjectTitleText(icon, style));
- icon.setSelectedGraphic(new IconGraphic(icon, style));
- return icon;
- }
-
- @Override
- public String getName() {
- return "Icon";
- }
-
- @Override
- public boolean isSubView() {
- return isSubView;
- }
-
- @Override
- public boolean isReplaceable() {
- return isReplaceable;
- }
-
- @Override
- public boolean isResizeable() {
- return false;
- }
-
- public View decorateSubview(final View subview) {
- return subview;
- }
-
- @Override
- public boolean isOpen() {
- return false;
- }
-
- @Override
- public boolean isAligned() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/LargeIconSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/LargeIconSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/LargeIconSpecification.java
deleted file mode 100644
index 6fdb2ba..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/LargeIconSpecification.java
+++ /dev/null
@@ -1,90 +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.icon;
-
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.base.IconGraphic;
-import org.apache.isis.viewer.dnd.view.border.ObjectBorder;
-import org.apache.isis.viewer.dnd.view.text.ObjectTitleText;
-
-public class LargeIconSpecification implements ViewSpecification {
- private static final int DEFAULT_SIZE = 64;
- private final int size;
-
- public LargeIconSpecification() {
- this(DEFAULT_SIZE);
- }
-
- LargeIconSpecification(final int size) {
- this.size = size;
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return requirement.isClosed() && requirement.isObject() && requirement.hasReference() && requirement.isSubview();
- }
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- final Text style = Toolkit.getText(ColorsAndFonts.TEXT_NORMAL);
- final Icon icon = new Icon(content, this);
- icon.setTitle(new ObjectTitleText(icon, style));
- icon.setSelectedGraphic(new IconGraphic(icon, size));
- icon.setVertical(true);
- return new ObjectBorder(icon);
- }
-
- @Override
- public String getName() {
- return "Image";
- }
-
- @Override
- public boolean isSubView() {
- return true;
- }
-
- @Override
- public boolean isReplaceable() {
- return false;
- }
-
- @Override
- public boolean isResizeable() {
- return false;
- }
-
- @Override
- public boolean isOpen() {
- return false;
- }
-
- @Override
- public boolean isAligned() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/RootIconSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/RootIconSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/RootIconSpecification.java
deleted file mode 100644
index eeba48a..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/RootIconSpecification.java
+++ /dev/null
@@ -1,80 +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.icon;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Click;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.Placement;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.Workspace;
-import org.apache.isis.viewer.dnd.view.base.AbstractViewDecorator;
-import org.apache.isis.viewer.dnd.view.border.ObjectBorder;
-import org.apache.isis.viewer.dnd.view.option.UserActionAbstract;
-
-class IconOpenAction extends AbstractViewDecorator {
- protected IconOpenAction(final View wrappedView) {
- super(wrappedView);
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet menuOptions) {
- super.viewMenuOptions(menuOptions);
- menuOptions.add(new UserActionAbstract("Close") {
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- getView().dispose();
- // getWorkspace().removeObject((ObjectAdapter)
- // view.getContent().getAdapter());
- }
- });
- }
-
- private void openIcon() {
- getWorkspace().addWindowFor(getContent().getAdapter(), new Placement(getLocation()));
- }
-
- @Override
- public void secondClick(final Click click) {
- openIcon();
- }
-}
-
-public class RootIconSpecification extends IconSpecification {
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return super.canDisplay(requirement) && requirement.is(ViewRequirement.ROOT);
- }
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- final View icon = super.createView(content, axes, sequence);
- return new ObjectBorder(new IconOpenAction(icon));
- }
-
- @Override
- public boolean isReplaceable() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/SubviewIconSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/SubviewIconSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/SubviewIconSpecification.java
deleted file mode 100644
index 6d0d6d0..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/icon/SubviewIconSpecification.java
+++ /dev/null
@@ -1,61 +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.icon;
-
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.border.ObjectBorder;
-import org.apache.isis.viewer.dnd.view.field.OneToOneField;
-import org.apache.isis.viewer.dnd.view.lookup.OpenObjectDropDownBorder;
-
-public class SubviewIconSpecification extends IconSpecification {
- private static final ViewSpecification spec = new IconSpecification();
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return super.canDisplay(requirement) && requirement.is(ViewRequirement.CLOSED) && requirement.is(ViewRequirement.SUBVIEW);
- }
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- final View view = super.createView(content, axes, sequence);
- /*
- * boolean isEditable = content instanceof OneToOneField &&
- * ((OneToOneField) content).isEditable().isAllowed(); boolean
- * hasOptions = content.isOptionEnabled(); if (isEditable && hasOptions)
- * { return new OpenObjectDropDownBorder(view, spec); } return view;
- */
-
- if (content instanceof OneToOneField && ((OneToOneField) content).isEditable().isVetoed()) {
- return new ObjectBorder(view);
- } else {
- if (content.isOptionEnabled()) {
- return new ObjectBorder(new OpenObjectDropDownBorder(view, spec));
- } else {
- return new ObjectBorder(view);
- }
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ClickImpl.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ClickImpl.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ClickImpl.java
deleted file mode 100644
index 1c4e4ec..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ClickImpl.java
+++ /dev/null
@@ -1,84 +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.interaction;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Offset;
-import org.apache.isis.viewer.dnd.view.Click;
-
-/**
- * Describes a mouse click event.
- */
-public class ClickImpl extends PointerEvent implements Click {
- private final Location location;
- private final Location locationWithinViewer;
-
- /**
- * Creates a new click event object.
- *
- * @param mouseLocation
- * the location of the mouse relative to the viewer
- * @param modifiers
- * the button and key held down during the click (@see
- * java.awt.event.MouseEvent)
- */
- public ClickImpl(final Location mouseLocation, final int modifiers) {
- super(modifiers);
-
- this.location = new Location(mouseLocation);
- this.locationWithinViewer = new Location(mouseLocation);
- }
-
- @Override
- public Location getLocation() {
- return location;
- }
-
- @Override
- public Location getLocationWithinViewer() {
- return locationWithinViewer;
- }
-
- /**
- * Translate the location of this event by the specified offset.
- */
- @Override
- public void subtract(final int x, final int y) {
- location.subtract(x, y);
- }
-
- @Override
- public String toString() {
- return "Click [location=" + location + "," + super.toString() + "]";
- }
-
- public void add(final Offset offset) {
- location.add(offset.getDeltaX(), offset.getDeltaY());
- }
-
- public void subtract(final Offset offset) {
- subtract(offset.getDeltaX(), offset.getDeltaY());
- }
-
- @Override
- public void subtract(final Location location) {
- subtract(location.getX(), location.getY());
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ContentDragImpl.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ContentDragImpl.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ContentDragImpl.java
deleted file mode 100644
index cb5ddb7..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ContentDragImpl.java
+++ /dev/null
@@ -1,165 +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.interaction;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.ContentDrag;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.Viewer;
-import org.apache.isis.viewer.dnd.view.Workspace;
-
-public class ContentDragImpl extends DragImpl implements ContentDrag {
- private final View dragView;
- private Location location;
- private View previousTarget;
- private final Content sourceContent;
- private View target;
- private final Workspace workspace;
- private final Location offset;
- private final View source;
-
- /**
- * Creates a new drag event. The source view has its pickup(), and then,
- * exited() methods called on it. The view returned by the pickup method
- * becomes this event overlay view, which is moved continuously so that it
- * tracks the pointer,
- *
- * @param source
- * the view over which the pointer was when this event started
- */
- public ContentDragImpl(final View source, final Location offset, final View dragView) {
- if (dragView == null) {
- throw new NullPointerException();
- }
- workspace = source.getWorkspace();
- sourceContent = source.getContent();
- this.dragView = dragView;
- this.offset = offset;
- this.source = source.getView();
- }
-
- /**
- * Cancels drag by calling dragOut() on the current target, and changes the
- * cursor back to the default.
- */
- @Override
- public void cancel(final Viewer viewer) {
- if (target != null) {
- target.dragOut(this);
- }
- viewer.clearAction();
- }
-
- @Override
- public void drag(final View target, final Location location, final int mods) {
- this.location = location;
- this.target = target;
- this.mods = mods;
-
- moveDragView();
- crossBoundary(target);
- target.drag(this);
- }
-
- private void crossBoundary(final View target) {
- if (target != previousTarget) {
- if (previousTarget != null) {
- previousTarget.dragOut(this);
- previousTarget = null;
- }
-
- target.dragIn(this);
- previousTarget = target;
- }
- }
-
- private void moveDragView() {
- if (dragView != null) {
- dragView.markDamaged();
- final Location newLocation = new Location(this.location);
- newLocation.subtract(offset);
- dragView.setLocation(newLocation);
- dragView.limitBoundsWithin(workspace.getSize());
- dragView.markDamaged();
- }
- }
-
- /**
- * Ends the drag by calling drop() on the current target, and changes the
- * cursor back to the default.
- */
- @Override
- public void end(final Viewer viewer) {
- viewer.getSpy().addAction("drop on " + target);
- target.drop(this);
- viewer.clearAction();
- }
-
- @Override
- public View getOverlay() {
- return dragView;
- }
-
- @Override
- public View getSource() {
- return source;
- }
-
- /**
- * Returns the Content object from the source view.
- */
- @Override
- public Content getSourceContent() {
- return sourceContent;
- }
-
- @Override
- public Location getTargetLocation() {
- final Location location = new Location(this.location);
- location.subtract(target.getAbsoluteLocation());
- // location.add(-getOffset().getX(), -getOffset().getY());
- // location.add(-getOffset().getX(), -getOffset().getY());
-
- return location;
- }
-
- @Override
- public Location getOffset() {
- return offset;
- }
-
- /**
- * Returns the current target view.
- */
- @Override
- public View getTargetView() {
- return target;
- }
-
- @Override
- public String toString() {
- return "ContentDrag [" + super.toString() + "]";
- }
-
- @Override
- public void subtract(final int left, final int top) {
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/DragImpl.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/DragImpl.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/DragImpl.java
deleted file mode 100644
index 55a1f89..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/DragImpl.java
+++ /dev/null
@@ -1,54 +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.interaction;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.view.DragEvent;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.Viewer;
-
-public abstract class DragImpl extends PointerEvent implements DragEvent {
- protected DragImpl() {
- super(0);
- }
-
- /**
- * Indicates the drag has been cancelled; no action should be taken.
- */
- @Override
- public abstract void cancel(final Viewer viewer);
-
- /**
- * Indicates that the drag state has changed.
- */
- @Override
- public abstract void drag(final View target, final Location location, final int mods);
-
- /**
- * Indicates the drag has properly ended (the mouse button has been
- * released)
- *
- */
- @Override
- public abstract void end(final Viewer viewer);
-
- @Override
- public abstract View getOverlay();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/DragStartImpl.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/DragStartImpl.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/DragStartImpl.java
deleted file mode 100644
index 3fd5784..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/DragStartImpl.java
+++ /dev/null
@@ -1,61 +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.interaction;
-
-import org.apache.isis.core.commons.util.ToString;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Offset;
-import org.apache.isis.viewer.dnd.view.DragStart;
-
-public class DragStartImpl extends PointerEvent implements DragStart {
- private final Location location;
-
- public DragStartImpl(final Location location, final int mods) {
- super(mods);
- this.location = location;
- }
-
- @Override
- public Location getLocation() {
- return location;
- }
-
- @Override
- public void subtract(final Location location) {
- this.location.subtract(location);
- }
-
- @Override
- public void subtract(final int x, final int y) {
- location.subtract(x, y);
- }
-
- public void add(final Offset offset) {
- location.add(offset.getDeltaX(), offset.getDeltaY());
- }
-
- @Override
- public String toString() {
- final ToString str = new ToString(this);
- str.append("location", location);
- str.append("buttons", super.toString());
- return str.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/KeyboardActionImpl.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/KeyboardActionImpl.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/KeyboardActionImpl.java
deleted file mode 100644
index 7fcab94..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/KeyboardActionImpl.java
+++ /dev/null
@@ -1,61 +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.interaction;
-
-import org.apache.isis.viewer.dnd.view.KeyboardAction;
-
-public class KeyboardActionImpl implements KeyboardAction {
-
- final int keyCode;
- final int modifiers;
- private boolean isConsumed;
-
- public KeyboardActionImpl(final int keyCode, final int modifiers) {
- this.keyCode = keyCode;
- this.modifiers = modifiers;
- isConsumed = false;
- }
-
- @Override
- public int getKeyCode() {
- return keyCode;
- }
-
- @Override
- public char getKeyChar() {
- return (char) keyCode;
- }
-
- @Override
- public int getModifiers() {
- return modifiers;
- }
-
- @Override
- public boolean isConsumed() {
- return isConsumed;
- }
-
- @Override
- public void consume() {
- isConsumed = true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/PointerEvent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/PointerEvent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/PointerEvent.java
deleted file mode 100644
index 8367021..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/PointerEvent.java
+++ /dev/null
@@ -1,108 +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.interaction;
-
-import java.awt.event.InputEvent;
-
-/**
- * Details an event involving the pointer, such as a click or drag.
- */
-public abstract class PointerEvent {
- protected int mods;
-
- /**
- * Creates a new pointer event object.
- *
- * @param mods
- * the button and key modifiers (@see java.awt.event.MouseEvent)
- */
- PointerEvent(final int mods) {
- this.mods = mods;
- }
-
- public boolean button1() {
- return (isButton1() && !isShift()) || (isButton2() && isShift());
- }
-
- public boolean button2() {
- return (isButton2() && !isShift()) || (isButton1() && isShift());
- }
-
- public boolean button3() {
- return isButton3();
- }
-
- /**
- * Returns true if the 'Alt' key is depressed
- */
- public boolean isAlt() {
- return (mods & InputEvent.ALT_MASK) > 0;
- }
-
- /**
- * Returns true if the left-hand button on the mouse is depressed
- */
- private boolean isButton1() {
- return (mods & InputEvent.BUTTON1_MASK) > 0;
- }
-
- /**
- * Returns true if the middle button on the mouse is depressed
- */
- private boolean isButton2() {
- return (mods & InputEvent.BUTTON2_MASK) > 0;
- }
-
- /**
- * Returns true if the right-hand button on the mouse is depressed
- */
- private boolean isButton3() {
- return (mods & InputEvent.BUTTON3_MASK) > 0;
- }
-
- /**
- * Returns true if the control key is depressed
- */
- public boolean isCtrl() {
- return (mods & InputEvent.CTRL_MASK) > 0;
- }
-
- /**
- * Returns true if the 'Alt' key is depressed
- */
- public boolean isMeta() {
- return (mods & InputEvent.META_MASK) > 0;
- }
-
- /**
- * Returns true if the shift key is depressed
- */
- public boolean isShift() {
- return (mods & InputEvent.SHIFT_MASK) > 0;
- }
-
- @Override
- public String toString() {
- final String buttons = (isButton1() ? "^" : "-") + (isButton2() ? "^" : "-") + (isButton3() ? "^" : "-");
- final String modifiers = (isShift() ? "S" : "-") + (isAlt() ? "A" : "-") + (isCtrl() ? "C" : "-");
-
- return "buttons=" + buttons + ",modifiers=" + modifiers;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/SimpleInternalDrag.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/SimpleInternalDrag.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/SimpleInternalDrag.java
deleted file mode 100644
index e05f452..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/SimpleInternalDrag.java
+++ /dev/null
@@ -1,115 +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.interaction;
-
-import org.apache.isis.core.commons.util.ToString;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Offset;
-import org.apache.isis.viewer.dnd.drawing.Padding;
-import org.apache.isis.viewer.dnd.view.InternalDrag;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.Viewer;
-
-public class SimpleInternalDrag extends DragImpl implements InternalDrag {
- private final Location location;
- // TODO replace Location with Offset
- private final Location offset;
- private final View view;
-
- /**
- * Creates a new drag event. The source view has its pickup(), and then,
- * exited() methods called on it. The view returned by the pickup method
- * becomes this event overlay view, which is moved continuously so that it
- * tracks the pointer,
- *
- * @param view
- * the view over which the pointer was when this event started
- * @param location
- * the location within the viewer (the Frame/Applet/Window etc)
- *
- * TODO combine the two constructors
- */
- public SimpleInternalDrag(final View view, final Location location) {
- this.view = view;
-
- this.location = new Location(location);
- offset = view.getAbsoluteLocation();
-
- final Padding targetPadding = view.getPadding();
- final Padding containerPadding = view.getView().getPadding();
- offset.add(containerPadding.getLeft() - targetPadding.getLeft(), containerPadding.getTop() - targetPadding.getTop());
-
- this.location.subtract(offset);
- }
-
- public SimpleInternalDrag(final View view, final Offset off) {
- this.view = view;
-
- location = new Location();
-
- offset = new Location(off.getDeltaX(), off.getDeltaY());
-
- final Padding targetPadding = view.getPadding();
- final Padding containerPadding = view.getView().getPadding();
- offset.add(containerPadding.getLeft() - targetPadding.getLeft(), containerPadding.getTop() - targetPadding.getTop());
-
- this.location.subtract(offset);
- }
-
- @Override
- public void cancel(final Viewer viewer) {
- view.dragCancel(this);
- }
-
- @Override
- public void drag(final View target, final Location location, final int mods) {
- this.location.setX(location.getX());
- this.location.setY(location.getY());
- this.location.subtract(offset);
- view.drag(this);
- }
-
- @Override
- public void end(final Viewer viewer) {
- view.dragTo(this);
- }
-
- /**
- * Gets the location of the pointer relative to the view.
- */
- @Override
- public Location getLocation() {
- return new Location(location);
- }
-
- @Override
- public View getOverlay() {
- return null;
- }
-
- @Override
- public String toString() {
- final ToString s = new ToString(this, super.toString());
- s.append("location", location);
- s.append("relative", getLocation());
- return s.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ViewDragImpl.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ViewDragImpl.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ViewDragImpl.java
deleted file mode 100644
index 9bf31e8..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/interaction/ViewDragImpl.java
+++ /dev/null
@@ -1,145 +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.interaction;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Offset;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewDrag;
-import org.apache.isis.viewer.dnd.view.Viewer;
-import org.apache.isis.viewer.dnd.view.Workspace;
-
-public class ViewDragImpl extends DragImpl implements ViewDrag {
- private Location location;
- /**
- * Offset from the view's top-left corner to the pointer (relative to the
- * view).
- */
- private final Offset overlayOffset;
- private final View sourceView;
- private final View overlayView;
- private View targetView;
- private final Workspace viewsWorkspace;
-
- /**
- * Creates a new drag event. The source view has its pickup(), and then,
- * exited() methods called on it. The view returned by the pickup method
- * becomes this event overlay view, which is moved continuously so that it
- * tracks the pointer.
- *
- * @param view
- * the view over which the pointer was when this event started
- */
- public ViewDragImpl(final View view, final Offset offset, final View dragView) {
- this.sourceView = view;
- this.overlayView = dragView;
- this.overlayOffset = offset;
-
- viewsWorkspace = view.getWorkspace();
- }
-
- /**
- * getView().getAbsoluteLocation().getX(),
- * -getView().getAbsoluteLocation().getY() Cancel drag by changing cursor
- * back to pointer.
- */
- @Override
- public void cancel(final Viewer viewer) {
- getSourceView().getFeedbackManager().showDefaultCursor();
- }
-
- /**
- * Moves the overlay view so it follows the pointer
- */
- protected void drag(final Viewer viewer) {
- if (overlayView != null) {
- overlayView.markDamaged();
- updateDraggingLocation();
- overlayView.markDamaged();
- }
- }
-
- @Override
- public void drag(final View target, final Location location, final int mods) {
- this.location = location;
- if (overlayView != null) {
- overlayView.markDamaged();
- updateDraggingLocation();
- // this.location.subtract(target.getAbsoluteLocation());
- viewsWorkspace.getViewManager().getSpy().addTrace(target, " over", getLocation());
- targetView = target;
- target.drag(this);
- overlayView.markDamaged();
- }
- }
-
- /**
- * Ends the drag by calling drop() on the workspace.
- */
- @Override
- public void end(final Viewer viewer) {
- viewer.clearAction();
- targetView.drop(this);
- }
-
- @Override
- public View getOverlay() {
- return overlayView;
- }
-
- @Override
- public Location getLocation() {
- return location;
- }
-
- @Override
- public View getSourceView() {
- return sourceView;
- }
-
- @Override
- public Location getViewDropLocation() {
- final Location viewLocation = new Location(location);
- viewLocation.subtract(overlayOffset);
- return viewLocation;
- }
-
- public void subtract(final Location location) {
- location.subtract(location);
- }
-
- @Override
- public String toString() {
- return "ViewDrag [" + super.toString() + "]";
- }
-
- private void updateDraggingLocation() {
- final Location viewLocation = new Location(location);
- viewLocation.subtract(overlayOffset);
- overlayView.setLocation(viewLocation);
- overlayView.limitBoundsWithin(viewsWorkspace.getSize());
- }
-
- @Override
- public void subtract(final int x, final int y) {
- location.subtract(x, y);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalCollectionBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalCollectionBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalCollectionBorder.java
deleted file mode 100644
index 9ea2cc5..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalCollectionBorder.java
+++ /dev/null
@@ -1,128 +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.list;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetUtils;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.Color;
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.ObjectContent;
-import org.apache.isis.viewer.dnd.view.Placement;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewState;
-import org.apache.isis.viewer.dnd.view.base.AbstractBorder;
-import org.apache.isis.viewer.dnd.view.base.IconGraphic;
-import org.apache.isis.viewer.dnd.view.composite.CompositeViewDecorator;
-import org.apache.isis.viewer.dnd.view.field.OneToManyField;
-
-public class InternalCollectionBorder extends AbstractBorder {
- public static class Factory implements CompositeViewDecorator {
- @Override
- public View decorate(final View child, final Axes axes) {
- return new InternalCollectionBorder(child);
- }
- }
-
- private final IconGraphic icon;
-
- protected InternalCollectionBorder(final View wrappedView) {
- super(wrappedView);
-
- icon = new InternalCollectionIconGraphic(this, Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
- left = icon.getSize().getWidth();
- }
-
- @Override
- protected void debugDetails(final DebugBuilder debug) {
- debug.append("InternalCollectionBorder ");
- }
-
- @Override
- public Size getRequiredSize(final Size maximumSize) {
- final Size size = super.getRequiredSize(maximumSize);
- size.ensureWidth(left + 45 + right);
- size.ensureHeight(24);
- return size;
- }
-
- @Override
- public void draw(final Canvas canvas) {
- icon.draw(canvas, 0, getBaseline());
-
- final ObjectAdapter collection = getContent().getAdapter();
- final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
- final ViewState state = getState();
- final Color color;
- if (state.canDrop()) {
- color = Toolkit.getColor(ColorsAndFonts.COLOR_VALID);
- } else if (state.cantDrop()) {
- color = Toolkit.getColor(ColorsAndFonts.COLOR_INVALID);
- } else {
- color = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2);
- }
- if (collection == null || facet.size(collection) == 0) {
- canvas.drawText("empty", left, getBaseline(), color, Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
- } else {
- final int x = icon.getSize().getWidth() / 2;
- final int x2 = x + 4;
- final int y = icon.getSize().getHeight() + 1;
- final int y2 = getSize().getHeight() - 5;
- canvas.drawLine(x, y, x, y2, color);
- canvas.drawLine(x, y2, x2, y2, color);
- }
- super.draw(canvas);
- }
-
- @Override
- public void contentMenuOptions(final UserActionSet options) {
- super.contentMenuOptions(options);
- // final ObjectSpecification specification = ((OneToManyField)
- // getContent()).getSpecification();
- // OptionFactory.addCreateOptions(specification, options);
- }
-
- @Override
- public void objectActionResult(final ObjectAdapter result, final Placement placement) {
- // same as in TreeNodeBorder
- final OneToManyField internalCollectionContent = (OneToManyField) getContent();
- final OneToManyAssociation field = internalCollectionContent.getOneToManyAssociation();
- final ObjectAdapter target = ((ObjectContent) getParent().getContent()).getObject();
-
- final Consent valid = field.isValidToAdd(target, result);
- if (valid.isAllowed()) {
- field.addElement(target, result);
- }
- super.objectActionResult(result, placement);
- }
-
- @Override
- public String toString() {
- return "InternalCollectionBorder/" + wrappedView;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalCollectionIconGraphic.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalCollectionIconGraphic.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalCollectionIconGraphic.java
deleted file mode 100644
index 737ace8..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalCollectionIconGraphic.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.list;
-
-import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.base.IconGraphic;
-
-public class InternalCollectionIconGraphic extends IconGraphic {
-
- public InternalCollectionIconGraphic(final View view, final Text text) {
- super(view, text);
- }
-
- /*
- * protected Image iconPicture(ObjectAdapter object) { final
- * InternalCollection cls = (InternalCollection) object; final
- * ObjectSpecification spec = cls.getElementSpecification(); Image icon =
- * loadIcon(spec, ""); if(icon == null) { icon = loadIcon(spec, ""); }
- * return icon; }
- */
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalListSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalListSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalListSpecification.java
deleted file mode 100644
index 77f4229..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/InternalListSpecification.java
+++ /dev/null
@@ -1,34 +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.list;
-
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-
-public class InternalListSpecification extends SimpleListSpecification {
-
- public InternalListSpecification() {
- addViewDecorator(new InternalCollectionBorder.Factory());
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return super.canDisplay(requirement) && requirement.is(ViewRequirement.SUBVIEW);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/SimpleListSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/SimpleListSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/SimpleListSpecification.java
deleted file mode 100644
index b3d0bef..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/list/SimpleListSpecification.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.list;
-
-import org.apache.isis.viewer.dnd.icon.IconElementFactory;
-import org.apache.isis.viewer.dnd.view.ViewFactory;
-import org.apache.isis.viewer.dnd.view.composite.AbstractCollectionViewSpecification;
-
-// TODO use the superclass instead
-public class SimpleListSpecification extends AbstractCollectionViewSpecification {
-
- @Override
- protected ViewFactory createElementFactory() {
- return new IconElementFactory();
- }
-
- @Override
- public String getName() {
- return "List";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/PerspectiveContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/PerspectiveContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/PerspectiveContent.java
deleted file mode 100644
index 47ad1aa..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/PerspectiveContent.java
+++ /dev/null
@@ -1,130 +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.service;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.consent.Veto;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.runtime.userprofile.PerspectiveEntry;
-import org.apache.isis.viewer.dnd.drawing.Image;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.content.AbstractContent;
-
-public class PerspectiveContent extends AbstractContent {
- private final PerspectiveEntry perspective;
-
- public PerspectiveContent(final PerspectiveEntry perspective) {
- this.perspective = perspective;
- }
-
- @Override
- public void debugDetails(final DebugBuilder debug) {
- debug.appendln("perspective", perspective);
- }
-
- @Override
- public ObjectAdapter getAdapter() {
- return null;
- }
-
- @Override
- public String getDescription() {
- return null;
- }
-
- @Override
- public String getHelp() {
- return "";
- }
-
- @Override
- public String getId() {
- return "";
- }
-
- @Override
- public ObjectAdapter[] getOptions() {
- return null;
- }
-
- @Override
- public ObjectSpecification getSpecification() {
- return null;
- }
-
- @Override
- public boolean isObject() {
- return false;
- }
-
- @Override
- public boolean isOptionEnabled() {
- return false;
- }
-
- @Override
- public boolean isTransient() {
- return false;
- }
-
- @Override
- public String title() {
- return perspective.getTitle();
- }
-
- @Override
- public String toString() {
- return "Perspective: " + perspective;
- }
-
- @Override
- public String windowTitle() {
- return perspective.getTitle();
- }
-
- @Override
- public Consent canDrop(final Content sourceContent) {
- return Veto.DEFAULT;
- }
-
- @Override
- public ObjectAdapter drop(final Content sourceContent) {
- return null;
- }
-
- @Override
- public String getIconName() {
- return "icon";
- }
-
- @Override
- public Image getIconPicture(final int iconHeight) {
- return null;
- }
-
- public void parseTextEntry(final String entryText) {
- }
-
- public PerspectiveEntry getPerspective() {
- return perspective;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceBorder.java
deleted file mode 100644
index 2b8f750..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceBorder.java
+++ /dev/null
@@ -1,110 +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.service;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.Color;
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.Click;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewState;
-import org.apache.isis.viewer.dnd.view.base.AbstractBorder;
-
-public class ServiceBorder extends AbstractBorder {
- private static final int BORDER = 13;
-
- public ServiceBorder(final int size, final View wrappedView) {
- super(wrappedView);
-
- top = size;
- left = size;
- bottom = size;
- right = size + BORDER;
- }
-
- public ServiceBorder(final View wrappedView) {
- this(1, wrappedView);
- }
-
- @Override
- protected void debugDetails(final DebugBuilder debug) {
- debug.append("ServiceBorder " + top + " pixels");
- }
-
- @Override
- public void draw(final Canvas canvas) {
- super.draw(canvas);
-
- Color color = null;
- final ViewState state = getState();
- final boolean hasFocus = getViewManager().hasFocus(getView());
- if (hasFocus) {
- color = Toolkit.getColor(ColorsAndFonts.COLOR_IDENTIFIED);
- } else if (state.isObjectIdentified()) {
- color = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2);
- }
-
- final Size s = getSize();
- if (color != null) {
- if (hasFocus) {
- final int xExtent = s.getWidth() - left;
- for (int i = 0; i < left; i++) {
- canvas.drawRectangle(i, i, xExtent - 2 * i, s.getHeight() - 2 * i, color);
- }
- } else {
- final int xExtent = s.getWidth();
- for (int i = 0; i < left; i++) {
- canvas.drawRectangle(i, i, xExtent - 2 * i, s.getHeight() - 2 * i, color);
- }
- canvas.drawLine(xExtent - BORDER, left, xExtent - BORDER, left + s.getHeight(), color);
- canvas.drawSolidRectangle(xExtent - BORDER + 1, left, BORDER - 2, s.getHeight() - 2 * left, Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3));
- }
- }
- }
-
- @Override
- public void entered() {
- getState().setContentIdentified();
- getState().setViewIdentified();
- wrappedView.entered();
- markDamaged();
- }
-
- @Override
- public void exited() {
- getState().clearObjectIdentified();
- getState().clearViewIdentified();
- wrappedView.exited();
- markDamaged();
- }
-
- @Override
- public void secondClick(final Click click) {
- // ignore - prevents the super class opening a view
- }
-
- @Override
- public String toString() {
- return wrappedView.toString() + "/ServiceBorder [" + getSpecification() + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceIcon.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceIcon.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceIcon.java
deleted file mode 100644
index a1baa90..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceIcon.java
+++ /dev/null
@@ -1,86 +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.service;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.userprofile.PerspectiveEntry;
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.icon.Icon;
-import org.apache.isis.viewer.dnd.util.Properties;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.DragEvent;
-import org.apache.isis.viewer.dnd.view.DragStart;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.Workspace;
-import org.apache.isis.viewer.dnd.view.action.OptionFactory;
-import org.apache.isis.viewer.dnd.view.base.IconGraphic;
-import org.apache.isis.viewer.dnd.view.option.CloseViewOption;
-import org.apache.isis.viewer.dnd.view.text.ObjectTitleText;
-
-public class ServiceIcon extends Icon {
- private final static int ICON_SIZE;
- private final static int LARGE_ICON_SIZE = 34;
- private final static String LARGE_ICON_SIZE_PROPERTY;
-
- static {
- LARGE_ICON_SIZE_PROPERTY = Properties.PROPERTY_BASE + "large-icon-size";
- ICON_SIZE = IsisContext.getConfiguration().getInteger(LARGE_ICON_SIZE_PROPERTY, LARGE_ICON_SIZE);
- }
-
- public ServiceIcon(final Content content, final ViewSpecification specification) {
- super(content, specification);
- setTitle(new ObjectTitleText(this, Toolkit.getText(ColorsAndFonts.TEXT_ICON)));
- setSelectedGraphic(new IconGraphic(this, ICON_SIZE));
- setVertical(true);
- }
-
- @Override
- public void contentMenuOptions(final UserActionSet options) {
- options.setColor(Toolkit.getColor(ColorsAndFonts.COLOR_MENU_CONTENT));
- OptionFactory.addObjectMenuOptions(getContent().getAdapter(), options);
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet options) {
- options.setColor(Toolkit.getColor(ColorsAndFonts.COLOR_MENU_VIEW));
-
- options.add(new CloseViewOption() {
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- final PerspectiveContent parent = (PerspectiveContent) view.getParent().getContent();
- final PerspectiveEntry perspective = parent.getPerspective();
- final ServiceObject serviceContent = (ServiceObject) view.getContent();
- final ObjectAdapter element = serviceContent.getObject();
- perspective.removeFromServices(element);
- super.execute(workspace, view, at);
- }
- });
- }
-
- @Override
- public DragEvent dragStart(final DragStart drag) {
- return Toolkit.getViewFactory().createDragContentOutline(this, drag.getLocation());
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceIconSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceIconSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceIconSpecification.java
deleted file mode 100644
index ebb4d5a..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceIconSpecification.java
+++ /dev/null
@@ -1,71 +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.service;
-
-import org.apache.isis.viewer.dnd.icon.Icon;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-
-public class ServiceIconSpecification implements ViewSpecification {
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return requirement.isFor(ServiceObject.class) && requirement.getSpecification().isService();
- }
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- final Icon icon = new ServiceIcon(content, this);
- return new ServiceBorder(icon);
- }
-
- @Override
- public String getName() {
- return "Service Icon";
- }
-
- @Override
- public boolean isAligned() {
- return false;
- }
-
- @Override
- public boolean isOpen() {
- return false;
- }
-
- @Override
- public boolean isReplaceable() {
- return false;
- }
-
- @Override
- public boolean isResizeable() {
- return false;
- }
-
- @Override
- public boolean isSubView() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceObject.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceObject.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceObject.java
deleted file mode 100644
index 4bba0af..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/service/ServiceObject.java
+++ /dev/null
@@ -1,181 +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.service;
-
-import java.util.Arrays;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.consent.Veto;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.viewer.dnd.drawing.Image;
-import org.apache.isis.viewer.dnd.drawing.ImageFactory;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-import org.apache.isis.viewer.dnd.view.content.AbstractContent;
-
-public class ServiceObject extends AbstractContent {
- private final ObjectAdapter adapter;
-
- public ServiceObject(final ObjectAdapter adapter) {
- this.adapter = adapter;
- }
-
- public Consent canClear() {
- return Veto.DEFAULT;
- }
-
- public Consent canSet(final ObjectAdapter dragSource) {
- return Veto.DEFAULT;
- }
-
- public void clear() {
- throw new IsisException("Invalid call");
- }
-
- @Override
- public void debugDetails(final DebugBuilder debug) {
- debug.appendln("service", adapter);
- }
-
- @Override
- public ObjectAdapter getAdapter() {
- return adapter;
- }
-
- @Override
- public String getDescription() {
- final String specName = getSpecification().getSingularName();
- final String objectTitle = getObject().titleString();
- return specName + (specName.equalsIgnoreCase(objectTitle) ? "" : ": " + objectTitle) + " " + getSpecification().getDescription();
- }
-
- @Override
- public String getHelp() {
- return "";
- }
-
- @Override
- public String getId() {
- return "";
- }
-
- public ObjectAdapter getObject() {
- return adapter;
- }
-
- @Override
- public ObjectAdapter[] getOptions() {
- return null;
- }
-
- @Override
- public ObjectSpecification getSpecification() {
- return adapter.getSpecification();
- }
-
- @Override
- public boolean isObject() {
- return false;
- }
-
- @Override
- public boolean isOptionEnabled() {
- return false;
- }
-
- @Override
- public boolean isTransient() {
- return adapter != null && adapter.isTransient();
- }
-
- public void setObject(final ObjectAdapter object) {
- throw new IsisException("Invalid call");
- }
-
- @Override
- public String title() {
- return adapter.titleString();
- }
-
- @Override
- public String toString() {
- return "Service Object [" + adapter + "]";
- }
-
- @Override
- public String windowTitle() {
- return (isTransient() ? "UNSAVED " : "") + getSpecification().getSingularName();
- }
-
- @Override
- public Consent canDrop(final Content sourceContent) {
- final ObjectAction action = actionFor(sourceContent);
- if (action == null) {
- return Veto.DEFAULT;
- } else {
- final ObjectAdapter source = sourceContent.getAdapter();
- final Consent parameterSetValid = action.isProposedArgumentSetValid(adapter, new ObjectAdapter[] { source });
- parameterSetValid.setDescription("Execute '" + action.getName() + "' with " + source.titleString());
- return parameterSetValid;
- }
- }
-
- private ObjectAction actionFor(final Content sourceContent) {
- ObjectAction action;
- action = adapter.getSpecification().getObjectAction(ActionType.USER, null, Arrays.asList(sourceContent.getSpecification()));
- return action;
- }
-
- @Override
- public ObjectAdapter drop(final Content sourceContent) {
- final ObjectAction action = actionFor(sourceContent);
- final ObjectAdapter source = sourceContent.getAdapter();
- return action.execute(adapter, new ObjectAdapter[] { source });
- }
-
- @Override
- public String getIconName() {
- final ObjectAdapter object = getObject();
- return object == null ? null : object.getIconName();
- }
-
- @Override
- public Image getIconPicture(final int iconHeight) {
- final ObjectAdapter adapter = getObject();
- final ObjectSpecification specification = adapter.getSpecification();
- final Image icon = ImageFactory.getInstance().loadIcon(specification, iconHeight, null);
- return icon;
- }
-
- public void parseTextEntry(final String entryText) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet options) {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/AbstractTableSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/AbstractTableSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/AbstractTableSpecification.java
deleted file mode 100644
index 427925f..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/AbstractTableSpecification.java
+++ /dev/null
@@ -1,114 +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.table;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewFactory;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.base.Layout;
-import org.apache.isis.viewer.dnd.view.collection.CollectionContent;
-import org.apache.isis.viewer.dnd.view.composite.CollectionElementBuilder;
-import org.apache.isis.viewer.dnd.view.composite.CompositeViewDecorator;
-import org.apache.isis.viewer.dnd.view.composite.CompositeViewSpecification;
-import org.apache.isis.viewer.dnd.view.composite.StackLayout;
-
-public abstract class AbstractTableSpecification extends CompositeViewSpecification {
-
- public AbstractTableSpecification() {
- builder = new CollectionElementBuilder(new ViewFactory() {
- TableRowSpecification rowSpecification = new TableRowSpecification();
-
- // TODO do directly without specification
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- // ViewSpecification rowSpecification = new
- // SubviewIconSpecification();
- return rowSpecification.createView(content, axes, -1);
- }
- });
-
- addSubviewDecorator(new TableRowBorder.Factory());
-
- addViewDecorator(new CompositeViewDecorator() {
- @Override
- public View decorate(final View view, final Axes axes) {
- axes.getAxis(TableAxis.class).setRoot(view);
- return view;
- }
- });
- }
-
- @Override
- public Layout createLayout(final Content content, final Axes axes) {
- return new StackLayout();
- }
-
- @Override
- public void createAxes(final Content content, final Axes axes) {
- axes.add(new TableAxisImpl((CollectionContent) content), TableAxis.class);
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- if (!requirement.isCollection() || !requirement.isOpen()) {
- return false;
- } else {
- final CollectionContent collectionContent = (CollectionContent) requirement.getContent();
- final ObjectSpecification elementSpecification = collectionContent.getElementSpecification();
- final List<ObjectAssociation> fields = elementSpecification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);
- for (int i = 0; i < fields.size(); i++) {
- if (fields.get(i).isOneToOneAssociation()) {
- return true;
- }
- }
- return false;
- }
- }
-
- /*
- * protected View decorateView(View view) { TableAxis tableAxis =
- * (TableAxis) view.getViewAxisForChildren(); tableAxis.setRoot(view);
- * return view; // return doCreateView(table, content, axis); } protected
- * abstract View doCreateView(final View table, final Content content, final
- * ViewAxis axis);
- */
-
- @Override
- public String getName() {
- return "Standard Table";
- }
-
- @Override
- public boolean isReplaceable() {
- return false;
- }
-
- @Override
- public boolean isResizeable() {
- return true;
- }
-}