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:13 UTC
[12/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/view/border/SaveState.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SaveState.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SaveState.java
deleted file mode 100644
index d5b3fa1..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SaveState.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.view.border;
-
-class SaveState {
- StringBuffer missingFields = new StringBuffer();
- StringBuffer invalidFields = new StringBuffer();
-
- void addMissingField(final String parameterName) {
- if (missingFields.length() > 0) {
- missingFields.append(", ");
- }
- missingFields.append(parameterName);
- }
-
- void addInvalidField(final String parameterName) {
- if (invalidFields.length() > 0) {
- invalidFields.append(", ");
- }
- invalidFields.append(parameterName);
- }
-
- String getMessage() {
- String error = "";
- if (missingFields.length() > 0) {
- if (error.length() > 0) {
- error += "; ";
- }
- error += "Fields needed: " + missingFields;
- }
- if (invalidFields.length() > 0) {
- if (error.length() > 0) {
- error += "; ";
- }
- error += "Invalid fields: " + invalidFields;
- }
- return error;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SaveTransientObjectBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SaveTransientObjectBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SaveTransientObjectBorder.java
deleted file mode 100644
index 2d73959..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SaveTransientObjectBorder.java
+++ /dev/null
@@ -1,176 +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.view.border;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Allow;
-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.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.view.ButtonAction;
-import org.apache.isis.viewer.dnd.view.Content;
-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.content.FieldContent;
-import org.apache.isis.viewer.dnd.view.content.RootObject;
-import org.apache.isis.viewer.dnd.view.control.AbstractButtonAction;
-
-public class SaveTransientObjectBorder extends ButtonBorder {
- private static final Logger LOG = LoggerFactory.getLogger(SaveTransientObjectBorder.class);
-
- private static class CloseAction extends AbstractButtonAction {
- public CloseAction() {
- super("Discard");
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- close(workspace, view);
- }
- }
-
- private static class SaveAction extends AbstractButtonAction {
- public SaveAction() {
- super("Save");
- }
-
- @Override
- public Consent disabled(final View view) {
- return canSave(view);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- save(view);
- // by recreating the view the transient border is removed
- final ViewSpecification spec = view.getSpecification();
- final View newView = spec.createView(view.getContent(), view.getViewAxes(), -1);
- workspace.replaceView(view, newView);
- }
- }
-
- private static Consent canSave(final View view) {
-
- final ObjectAdapter transientNO = view.getContent().getAdapter();
-
- // check each of the fields, and capture invalid state if known
- final SaveState saveState = new SaveState();
- checkFields(saveState, view, transientNO);
- final StringBuilder errorBuf = new StringBuilder(saveState.getMessage());
-
- final ObjectSpecification viewContentSpec = view.getContent().getSpecification();
- final Consent consent = viewContentSpec.isValid(transientNO);
- if (consent.isVetoed()) {
- if (errorBuf.length() > 0) {
- errorBuf.append("; ");
- }
- errorBuf.append(consent.getReason());
- }
-
- if (errorBuf.length() == 0) {
- return Allow.DEFAULT;
- } else {
- return new Veto(errorBuf.toString());
- }
- }
-
- private static void checkFields(final SaveState saveState, final View view, final ObjectAdapter forObject) {
- if (view.getContent().getAdapter() != forObject) {
- return;
- }
-
- final View[] subviews = view.getSubviews();
- for (final View fieldView : subviews) {
- final Content content = fieldView.getContent();
- if (content instanceof RootObject) {
- checkFields(saveState, fieldView, forObject);
- } else if (content instanceof FieldContent) {
- final boolean isMandatory = ((FieldContent) content).isMandatory();
- final boolean isEditable = ((FieldContent) content).isEditable().isAllowed();
- final ObjectAdapter field = content.getAdapter();
- final boolean isFieldEmpty = field == null;
- if (isMandatory && isEditable && isFieldEmpty) {
- final String parameterName = ((FieldContent) content).getFieldName();
- saveState.addMissingField(parameterName);
-
- } else if (fieldView.getState().isInvalid()) {
- final String parameterName = ((FieldContent) content).getFieldName();
- saveState.addInvalidField(parameterName);
- }
- }
- }
- }
-
- private static class SaveAndCloseAction extends AbstractButtonAction {
- public SaveAndCloseAction() {
- super("Save & Close");
- }
-
- @Override
- public Consent disabled(final View view) {
- return canSave(view);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- save(view);
- close(workspace, view);
- }
- }
-
- private static void close(final Workspace workspace, final View view) {
- view.dispose();
- }
-
- private static ObjectAdapter save(final View view) {
- final ObjectAdapter transientObject = view.getContent().getAdapter();
- try {
- getPersistenceSession().makePersistent(transientObject);
- } catch (final RuntimeException e) {
- LOG.info("exception saving " + transientObject + ", aborting transaction" + e.getMessage());
- throw e;
- }
- return transientObject;
- }
-
- // /////////////////////////////////////////////////////
- // Constructor
- // /////////////////////////////////////////////////////
-
- public SaveTransientObjectBorder(final View view) {
- super(new ButtonAction[] { new SaveAction(), new SaveAndCloseAction(), new CloseAction(), }, view);
- }
-
- // /////////////////////////////////////////////////////
- // Dependencies (from context)
- // /////////////////////////////////////////////////////
-
- private static Persistor getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBar.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBar.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBar.java
deleted file mode 100644
index bf0f512..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBar.java
+++ /dev/null
@@ -1,88 +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.view.border;
-
-public class ScrollBar {
- private int maximum;
- private int minimum;
- private int scrollPosition = 0;
- private int visibleAmount;
-
- public ScrollBar() {
- super();
- }
-
- public void setPostion(final int position) {
- scrollPosition = Math.min(position, maximum);
- scrollPosition = Math.max(scrollPosition, minimum);
- }
-
- public void firstClick(final int x, final boolean alt) {
- if (alt) {
- setPostion(x - visibleAmount / 2);
- } else {
- if (x < scrollPosition) {
- setPostion(scrollPosition - visibleAmount);
- } else if (x > scrollPosition + visibleAmount) {
- setPostion(scrollPosition + visibleAmount);
- }
- }
- }
-
- public int getMaximum() {
- return maximum;
- }
-
- public int getMinimum() {
- return minimum;
- }
-
- public int getPosition() {
- return scrollPosition;
- }
-
- public int getVisibleAmount() {
- return visibleAmount;
- }
-
- public void limit() {
- if (scrollPosition > maximum) {
- scrollPosition = maximum;
- }
- }
-
- public void reset() {
- scrollPosition = 0;
- }
-
- public boolean isOnThumb(final int pos) {
- return pos > scrollPosition && pos < scrollPosition + visibleAmount;
- }
-
- public void setSize(final int viewportSize, final int contentSize) {
- visibleAmount = contentSize == 0 ? 0 : (viewportSize * viewportSize / contentSize);
- maximum = viewportSize - visibleAmount;
- }
-
- public void secondClick(final int y) {
- final int midpoint = (maximum + visibleAmount) / 2;
- setPostion(y < midpoint ? minimum : maximum);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBarRender.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBarRender.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBarRender.java
deleted file mode 100644
index e3307fb..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBarRender.java
+++ /dev/null
@@ -1,26 +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.view.border;
-
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-
-public interface ScrollBarRender {
- void draw(Canvas canvas, boolean isHorizontal, int x, int y, int width, int height, int scrollPosition, int visibleAmount);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBorder.java
deleted file mode 100644
index 3e092b2..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ScrollBorder.java
+++ /dev/null
@@ -1,773 +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.view.border;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-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.Location;
-import org.apache.isis.viewer.dnd.drawing.Offset;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.interaction.SimpleInternalDrag;
-import org.apache.isis.viewer.dnd.view.Click;
-import org.apache.isis.viewer.dnd.view.ContentDrag;
-import org.apache.isis.viewer.dnd.view.DragEvent;
-import org.apache.isis.viewer.dnd.view.DragStart;
-import org.apache.isis.viewer.dnd.view.InternalDrag;
-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.ViewAreaType;
-import org.apache.isis.viewer.dnd.view.Workspace;
-import org.apache.isis.viewer.dnd.view.base.AbstractViewDecorator;
-import org.apache.isis.viewer.dnd.view.base.NullView;
-import org.apache.isis.viewer.dnd.view.option.UserActionAbstract;
-
-/**
- * A scroll border provides a window on a larger view, providing scrollbars as a
- * way of moving the visible part of that view around the actual visible viewing
- * area. To achieve this the view is divided up into five main areas, not all of
- * which are used. In the centre is the viewing area of the underlying view. At
- * the bottom and to the right... At the top and to the left are headers that
- */
-public class ScrollBorder extends AbstractViewDecorator {
- private static ScrollBarRender render;
- private static final int CENTER = 3;
- private static final int NORTH = 1;
- private static final int SOUTH = 5;
- private static final int CORNER = 0;
- private static final int SCROLLBAR_WIDTH = 16;
- private static final int WEST = 2;
- private static final int EAST = 4;
-
- public static void setRender(final ScrollBarRender render) {
- ScrollBorder.render = render;
- }
-
- private final ScrollBar horizontalScrollBar = new ScrollBar();
- private final ScrollBar verticalScrollBar = new ScrollBar();
- protected int bottom;
- protected int left;
- private View leftHeader;
- protected int right;
- private Size size = new Size();
- protected int top;
- private View topHeader;
- private int dragArea = CENTER;
- private int offsetToThumbEdge;
-
- public ScrollBorder(final View view) {
- this(view, new NullView(), new NullView());
- }
-
- /**
- * Note - the leftHeader, if it is specified, view must be the same height
- * as the content view and the rightHeader, if it is specified, must be the
- * same width.
- */
- public ScrollBorder(final View content, final View leftHeader, final View topHeader) {
- super(content);
- bottom = right = SCROLLBAR_WIDTH;
- horizontalScrollBar.setPostion(0);
- verticalScrollBar.setPostion(0);
- setLeftHeader(leftHeader);
- setTopHeader(topHeader);
- }
-
- public void setTopHeader(final View topHeader) {
- this.topHeader = topHeader;
- topHeader.setParent(getView());
- top = topHeader.getRequiredSize(new Size()).getHeight();
- }
-
- public void setLeftHeader(final View leftHeader) {
- this.leftHeader = leftHeader;
- leftHeader.setParent(getView());
- left = leftHeader.getRequiredSize(new Size()).getWidth();
- }
-
- private int adjust(final Click click) {
- return adjust(click.getLocation());
- }
-
- private int adjust(final ContentDrag drag) {
- return adjust(drag.getTargetLocation());
- }
-
- private int adjust(final Location location) {
- final Bounds contentArea = viewportArea();
- final Offset offset = offset();
- final int yOffset = offset.getDeltaY();
- final int xOffset = offset.getDeltaX();
- if (contentArea.contains(location)) {
- location.subtract(left, top);
- location.add(xOffset, yOffset);
- return CENTER;
- } else {
- final int x = location.getX();
- final int y = location.getY();
-
- if (x > contentArea.getX2() && y >= contentArea.getY() && y <= contentArea.getY2()) {
- // vertical scrollbar
- location.subtract(0, contentArea.getY());
- return EAST;
- } else if (y > contentArea.getY2() && x >= contentArea.getX() && x <= contentArea.getX2()) {
- // horzontal scrollbar
- location.subtract(contentArea.getX(), 0);
- return SOUTH;
- } else if (y < contentArea.getY() && x >= contentArea.getX() && x <= contentArea.getX2()) {
- // top border
- location.subtract(left, 0);
- location.add(xOffset, 0);
- return NORTH;
- } else if (x < contentArea.getX() && y >= contentArea.getY() && y <= contentArea.getY2()) {
- // left border
- location.subtract(0, top);
- location.add(0, yOffset);
- return WEST;
- } else {
- // ignore;
- location.setX(-1);
- location.setY(-1);
- return CORNER;
- }
- }
-
- }
-
- protected Bounds viewportArea() {
- return new Bounds(left, top, getSize().getWidth() - left - right, getSize().getHeight() - top - bottom);
- }
-
- @Override
- protected void debugDetails(final DebugBuilder debug) {
- super.debugDetails(debug);
- debug.append("\n Top header: " + (topHeader == null ? "none" : topHeader.toString()));
- debug.append("\n Left header: " + (leftHeader == null ? "none" : leftHeader.toString()));
-
- debug.append("\n Vertical scrollbar ");
- debug.append("\n offset " + top);
- debug.append("\n position " + verticalScrollBar.getPosition());
- debug.append("\n minimum " + verticalScrollBar.getMinimum());
- debug.append("\n maximum " + verticalScrollBar.getMaximum());
- debug.append("\n visible amount " + verticalScrollBar.getVisibleAmount());
-
- debug.append("\n Horizontal scrollbar ");
- debug.append("\n offset " + left);
- debug.append("\n position " + horizontalScrollBar.getPosition());
- debug.append("\n minimum " + horizontalScrollBar.getMinimum());
- debug.append("\n maximum " + horizontalScrollBar.getMaximum());
- debug.append("\n visible amount " + horizontalScrollBar.getVisibleAmount());
- debug.append("\n Viewport area " + viewportArea());
- debug.appendln("\n Offset " + offset());
- }
-
- @Override
- public void drag(final InternalDrag drag) {
- switch (dragArea) {
- case NORTH:
- drag.getLocation().subtract(offset().getDeltaX(), top);
- topHeader.drag(drag);
- break;
-
- case WEST:
- drag.getLocation().subtract(left, offset().getDeltaY());
- leftHeader.drag(drag);
- break;
-
- case CENTER:
- drag.getLocation().subtract(offset());
- wrappedView.drag(drag);
- break;
-
- case SOUTH:
- final int x = drag.getLocation().getX() - left;
- horizontalScrollBar.setPostion(x - offsetToThumbEdge);
- markDamaged();
- break;
-
- case EAST:
- final int y = drag.getLocation().getY() - top;
- verticalScrollBar.setPostion(y - offsetToThumbEdge);
- markDamaged();
- break;
-
- default:
- return;
- }
- }
-
- @Override
- public DragEvent dragStart(final DragStart drag) {
- final int area = adjust(drag);
- dragArea = area;
- switch (dragArea) {
- case NORTH:
- return topHeader.dragStart(drag);
-
- case WEST:
- return leftHeader.dragStart(drag);
-
- case CENTER:
- return wrappedView.dragStart(drag);
-
- case SOUTH:
- return dragStartSouth(drag);
-
- case EAST:
- return dragStartEast(drag);
-
- default:
- return null;
- }
- }
-
- @Override
- public void dragCancel(final InternalDrag drag) {
- switch (dragArea) {
- case NORTH:
- drag.getLocation().subtract(offset().getDeltaX(), top);
- topHeader.dragCancel(drag);
- break;
-
- case WEST:
- drag.getLocation().subtract(left, offset().getDeltaY());
- leftHeader.dragCancel(drag);
- break;
-
- case CENTER:
- drag.getLocation().subtract(offset());
- wrappedView.dragCancel(drag);
- break;
- }
- }
-
- @Override
- public void dragTo(final InternalDrag drag) {
- switch (dragArea) {
- case NORTH:
- drag.getLocation().subtract(offset().getDeltaX(), top);
- topHeader.dragTo(drag);
- break;
-
- case WEST:
- drag.getLocation().subtract(left, offset().getDeltaY());
- leftHeader.dragTo(drag);
- break;
-
- case CENTER:
- drag.getLocation().subtract(offset());
- wrappedView.dragTo(drag);
- break;
-
- case SOUTH:
- case EAST:
- default:
- // ignore
-
- }
- }
-
- @Override
- public View dragFrom(final Location location) {
- adjust(location);
- switch (dragArea) {
- case NORTH:
- return topHeader.dragFrom(location);
-
- case WEST:
- return leftHeader.dragFrom(location);
-
- case CENTER:
- return wrappedView.dragFrom(location);
- }
-
- return null;
- }
-
- @Override
- public void dragIn(final ContentDrag drag) {
- adjust(drag);
- switch (dragArea) {
- case NORTH:
- topHeader.dragIn(drag);
- break;
-
- case WEST:
- leftHeader.dragIn(drag);
- break;
-
- case CENTER:
- wrappedView.dragIn(drag);
- break;
-
- case SOUTH:
- case EAST:
- default:
- System.out.println(this + " ignored");
-
- // ignore
- }
- }
-
- @Override
- public void dragOut(final ContentDrag drag) {
- adjust(drag);
- switch (dragArea) {
- case NORTH:
- topHeader.dragOut(drag);
- break;
-
- case WEST:
- leftHeader.dragOut(drag);
- break;
-
- case CENTER:
- wrappedView.dragOut(drag);
- break;
-
- case SOUTH:
- case EAST:
- default:
- // ignore
- }
- }
-
- private DragEvent dragStartEast(final DragStart drag) {
- final Location location = drag.getLocation();
- final int y = location.getY();
- if (verticalScrollBar.isOnThumb(y)) {
- // offset is the distance from the left/top of the thumb to the
- // pointer
- offsetToThumbEdge = y - verticalScrollBar.getPosition();
- return new SimpleInternalDrag(this, new Offset(super.getAbsoluteLocation()));
- } else {
- return null;
- }
- }
-
- private DragEvent dragStartSouth(final DragStart drag) {
- final Location location = drag.getLocation();
- final int x = location.getX();
- if (horizontalScrollBar.isOnThumb(x)) {
- offsetToThumbEdge = x - horizontalScrollBar.getPosition();
- return new SimpleInternalDrag(this, new Offset(super.getAbsoluteLocation()));
- } else {
- return null;
- }
- }
-
- private int adjust(final DragStart drag) {
- return adjust(drag.getLocation());
- }
-
- @Override
- public void draw(final Canvas canvas) {
- final Bounds contents = viewportArea();
- final Offset offset = offset();
- final int x = offset.getDeltaX();
- final int y = offset.getDeltaY();
-
- final int contentWidth = contents.getWidth();
- final int contentHeight = contents.getHeight();
-
- final Canvas headerCanvasLeft = canvas.createSubcanvas(0, top, left, contentHeight);
- headerCanvasLeft.offset(0, -y);
- leftHeader.draw(headerCanvasLeft);
-
- final Canvas headerCanvasRight = canvas.createSubcanvas(left, 0, contentWidth, top);
- headerCanvasRight.offset(-x, 0);
- topHeader.draw(headerCanvasRight);
-
- final Color thumbColor = Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY2);
- drawVerticalScrollBar(canvas, contentWidth, contentHeight, thumbColor);
- drawHorizontalScrollBar(canvas, contentWidth, contentHeight, thumbColor);
-
- final Canvas contentCanvas = canvas.createSubcanvas(left, top, contentWidth, contentHeight);
- contentCanvas.offset(-x, -y);
-
- if (Toolkit.debug) {
- canvas.drawRectangle(contents.getX(), contents.getY(), contents.getWidth(), contents.getHeight(), Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BOUNDS_DRAW));
- }
-
- // drawContent(canvas, contentWidth, contentHeight);
- wrappedView.draw(contentCanvas);
-
- if (Toolkit.debug) {
- final Size size = getSize();
- canvas.drawRectangle(0, 0, size.getWidth(), size.getHeight(), Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BOUNDS_VIEW));
- canvas.drawLine(0, size.getHeight() / 2, size.getWidth() - 1, size.getHeight() / 2, Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BOUNDS_VIEW));
- canvas.drawLine(0, getBaseline(), size.getWidth() - 1, getBaseline(), Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BASELINE));
- }
-
- }
-
- // TODO merge these two methods
- private void drawVerticalScrollBar(final Canvas canvas, final int contentWidth, final int contentHeight, final Color color) {
- final int verticalVisibleAmount = verticalScrollBar.getVisibleAmount();
- final int verticalScrollPosition = verticalScrollBar.getPosition();
- if (right > 0 && (verticalScrollPosition > top || verticalVisibleAmount < contentHeight)) {
- final int x = contentWidth + left;
- render.draw(canvas, false, x, top, SCROLLBAR_WIDTH, contentHeight, verticalScrollPosition, verticalVisibleAmount);
- /*
- * canvas.drawSolidRectangle(x + 1, top, SCROLLBAR_WIDTH - 1,
- * contentHeight,
- * Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3));
- * canvas.drawSolidRectangle(x + 1, top + verticalScrollPosition,
- * SCROLLBAR_WIDTH - 2, verticalVisibleAmount, color);
- * canvas.drawRectangle(x, top, SCROLLBAR_WIDTH, contentHeight,
- * Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2));
- * canvas.drawRectangle(x + 1, top + verticalScrollPosition,
- * SCROLLBAR_WIDTH - 2, verticalVisibleAmount, Toolkit
- * .getColor(ColorsAndFonts.COLOR_SECONDARY1));
- *
- * DrawingUtil.drawHatching(canvas, x + 3, top +
- * verticalScrollPosition + 4, SCROLLBAR_WIDTH - 6,
- * verticalVisibleAmount - 8,
- * Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY1),
- * Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY3));
- */
- }
- }
-
- private void drawHorizontalScrollBar(final Canvas canvas, final int contentWidth, final int contentHeight, final Color color) {
- final int horizontalScrollPosition = horizontalScrollBar.getPosition();
- final int horizontalVisibleAmount = horizontalScrollBar.getVisibleAmount();
- if (bottom > 0 && (horizontalScrollPosition > left || horizontalVisibleAmount < contentWidth)) {
- final int x = 0; // left + horizontalScrollPosition;
- final int y = contentHeight + top;
- render.draw(canvas, true, x, y, contentWidth, SCROLLBAR_WIDTH, horizontalScrollPosition, horizontalVisibleAmount);
- /*
- * canvas.drawSolidRectangle(left, y + 1, contentWidth,
- * SCROLLBAR_WIDTH - 1,
- * Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3));
- * canvas.drawSolidRectangle(x, y + 1, horizontalVisibleAmount,
- * SCROLLBAR_WIDTH - 2, color); canvas.drawRectangle(left, y,
- * contentWidth, SCROLLBAR_WIDTH,
- * Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2 ));
- * canvas.drawRectangle(x, y + 1, horizontalVisibleAmount,
- * SCROLLBAR_WIDTH - 2,
- * Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY1));
- *
- * DrawingUtil.drawHatching(canvas, x + 5, y + 3,
- * horizontalVisibleAmount - 10, SCROLLBAR_WIDTH - 6, Toolkit
- * .getColor(ColorsAndFonts.COLOR_PRIMARY1),
- * Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY3));
- */
- }
- }
-
- @Override
- public void firstClick(final Click click) {
- final int area = adjust(click);
- switch (area) {
- case NORTH:
- topHeader.firstClick(click);
- break;
-
- case WEST:
- leftHeader.firstClick(click);
- break;
-
- case CENTER:
- wrappedView.firstClick(click);
- break;
-
- case SOUTH:
- // TODO allow modified click to move thumb to the pointer, rather
- // than paging.
- horizontalScrollBar.firstClick(click.getLocation().getX(), click.button3());
- break;
-
- case EAST:
- verticalScrollBar.firstClick(click.getLocation().getY(), click.button3());
- break;
-
- default:
- break;
- }
- }
-
- @Override
- public Location getAbsoluteLocation() {
- final Location location = super.getAbsoluteLocation();
- location.subtract(offset());
- return location;
- }
-
- @Override
- public Bounds getBounds() {
- return new Bounds(getLocation(), getSize());
- }
-
- @Override
- public Size getRequiredSize(final Size maximumSize) {
- final Size size = wrappedView.getRequiredSize(new Size(maximumSize));
- if (size.getWidth() > maximumSize.getWidth()) {
- size.extendHeight(SCROLLBAR_WIDTH);
- }
- if (size.getHeight() > maximumSize.getHeight()) {
- size.extendWidth(SCROLLBAR_WIDTH);
- }
- size.extend(left, top);
- size.limitSize(maximumSize);
- return size;
- }
-
- @Override
- public Size getSize() {
- return new Size(size);
- }
-
- @Override
- public View identify(final Location location) {
- getViewManager().getSpy().addTrace(this, "mouse location within border", location);
- getViewManager().getSpy().addTrace(this, "non border area", viewportArea());
-
- final int area = adjust(location);
- switch (area) {
- case NORTH:
- return topHeader.identify(location);
-
- case WEST:
- return leftHeader.identify(location);
-
- case CENTER:
- return wrappedView.identify(location);
-
- case SOUTH:
- getViewManager().getSpy().addTrace(this, "over scroll bar area", viewportArea());
- return getView();
-
- case EAST:
- getViewManager().getSpy().addTrace(this, "over scroll bar area", viewportArea());
- return getView();
-
- default:
- return null;
- }
- }
-
- @Override
- public void limitBoundsWithin(final Size size) {
- super.limitBoundsWithin(size);
- verticalScrollBar.limit();
- horizontalScrollBar.limit();
- }
-
- @Override
- public void markDamaged(final Bounds bounds) {
- /*
- * TODO this only works for the main content area, not for the headers.
- * how do we figure out which area to adjust for?
- */
- final Offset offset = offset();
- bounds.translate(-offset.getDeltaX(), -offset.getDeltaY());
- bounds.translate(left, top);
- super.markDamaged(bounds);
- }
-
- @Override
- public void mouseMoved(final Location location) {
- final int area = adjust(location);
- switch (area) {
- case NORTH:
- topHeader.mouseMoved(location);
- break;
-
- case WEST:
- leftHeader.mouseMoved(location);
- break;
-
- case CENTER:
- // location.add(offset());
- // location.move(-left, -top);
- wrappedView.mouseMoved(location);
- break;
-
- case SOUTH:
- case EAST:
- default:
- break;
- }
- }
-
- private Offset offset() {
- final Bounds contents = viewportArea();
- final int width = contents.getWidth();
- final int x = width == 0 ? 0 : horizontalScrollBar.getPosition() * wrappedView.getRequiredSize(Size.createMax()).getWidth() / width;
- final int height = contents.getHeight();
- final int y = height == 0 ? 0 : verticalScrollBar.getPosition() * wrappedView.getRequiredSize(Size.createMax()).getHeight() / height;
- return new Offset(x, y);
- }
-
- protected boolean overContent(final Location location) {
- return viewportArea().contains(location);
- }
-
- public void reset() {
- horizontalScrollBar.reset();
- verticalScrollBar.reset();
- }
-
- /**
- * Moves the scrollbar to beginning or the end when a double click occurs on
- * that side.
- */
- @Override
- public void secondClick(final Click click) {
- final int area = adjust(click);
- switch (area) {
- case NORTH:
- topHeader.secondClick(click);
- break;
-
- case WEST:
- leftHeader.secondClick(click);
- break;
-
- case CENTER:
- wrappedView.secondClick(click);
- break;
-
- case SOUTH:
- horizontalScrollBar.secondClick(click.getLocation().getX());
- break;
-
- case EAST:
- verticalScrollBar.secondClick(click.getLocation().getY());
- break;
-
- default:
- break;
- }
- }
-
- @Override
- public void thirdClick(final Click click) {
- final int area = adjust(click);
- switch (area) {
- case NORTH:
- topHeader.thirdClick(click);
- break;
-
- case WEST:
- leftHeader.thirdClick(click);
- break;
-
- case CENTER:
- wrappedView.thirdClick(click);
- break;
-
- case SOUTH:
- case EAST:
- default:
- // ignore
- break;
- }
- }
-
- @Override
- public void setBounds(final Bounds bounds) {
- setLocation(bounds.getLocation());
- setSize(bounds.getSize());
- }
-
- @Override
- public void setSize(final Size size) {
- // TODO need to restore the offset after size change - see limitBounds
- // float verticalRatio = ((float) verticalScrollPosition) /
- // contentArea().getHeight();
-
- this.size = new Size(size);
-
- final Size contentSize = wrappedView.getRequiredSize(Size.createMax());
- wrappedView.setSize(contentSize);
-
- final int availableHeight2 = size.getHeight() - top;
- final int contentHeight2 = contentSize.getHeight();
- right = availableHeight2 >= contentHeight2 ? 0 : SCROLLBAR_WIDTH;
-
- final int availableWidth2 = size.getWidth() - left;
- final int contentWidth2 = contentSize.getWidth();
- bottom = availableWidth2 >= contentWidth2 ? 0 : SCROLLBAR_WIDTH;
-
- final Bounds viewport = viewportArea();
-
- final int viewportHeight = viewport.getHeight();
- final int maxContentHeight = Math.max(viewportHeight, contentSize.getHeight());
-
- verticalScrollBar.setSize(viewportHeight, maxContentHeight);
- if (leftHeader != null) {
- leftHeader.setSize(new Size(left, maxContentHeight));
- }
-
- final int viewportWidth = viewport.getWidth();
- final int maxContentWidth = Math.max(viewportWidth, contentSize.getWidth());
-
- horizontalScrollBar.setSize(viewportWidth, maxContentWidth);
- if (topHeader != null) {
- topHeader.setSize(new Size(maxContentWidth, top));
- }
- }
-
- public int getVerticalPosition() {
- return verticalScrollBar.getPosition();
- }
-
- public int getHorizontalPosition() {
- return horizontalScrollBar.getPosition();
- }
-
- @Override
- public ViewAreaType viewAreaType(final Location location) {
- final int area = adjust(location);
- switch (area) {
- case NORTH:
- return topHeader.viewAreaType(location);
-
- case WEST:
- return leftHeader.viewAreaType(location);
-
- case CENTER:
- return wrappedView.viewAreaType(location);
-
- case SOUTH:
- case EAST:
- default:
- return ViewAreaType.INTERNAL;
- }
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet menuOptions) {
- super.viewMenuOptions(menuOptions);
- menuOptions.add(new UserActionAbstract("Reset scroll border", ActionType.DEBUG) {
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- reset();
- invalidateLayout();
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectObjectBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectObjectBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectObjectBorder.java
deleted file mode 100644
index c99271d..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectObjectBorder.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.view.border;
-
-import java.awt.event.KeyEvent;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-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.KeyboardAction;
-import org.apache.isis.viewer.dnd.view.SubviewDecorator;
-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.ViewAxis;
-import org.apache.isis.viewer.dnd.view.Workspace;
-import org.apache.isis.viewer.dnd.view.base.AbstractBorder;
-import org.apache.isis.viewer.dnd.view.option.UserActionAbstract;
-
-public class SelectObjectBorder extends AbstractBorder {
- private final SelectableViewAxis axis;
-
- public static class Factory implements SubviewDecorator {
- @Override
- public ViewAxis createAxis(final Content content) {
- return null;
- }
-
- @Override
- public View decorate(final Axes axes, final View view) {
- if (axes.contains(SelectableViewAxis.class)) {
- final SelectableViewAxis axis = axes.getAxis(SelectableViewAxis.class);
- return new SelectObjectBorder(view, axis);
- } else {
- return view;
- }
- }
- }
-
- protected SelectObjectBorder(final View view, final SelectableViewAxis axis) {
- super(view);
- this.axis = axis;
- }
-
- @Override
- public Axes getViewAxes() {
- final Axes viewAxes = super.getViewAxes();
- viewAxes.add(axis);
- return viewAxes;
- }
-
- @Override
- protected void debugDetails(final DebugBuilder debug) {
- super.debugDetails(debug);
- debug.appendln("axis", axis);
- }
-
- @Override
- public void keyPressed(final KeyboardAction key) {
- if (key.getKeyCode() == KeyEvent.VK_SPACE) {
- selectNode();
- } else {
- super.keyPressed(key);
- }
- }
-
- @Override
- public void firstClick(final Click click) {
- final int x = click.getLocation().getX();
- final int y = click.getLocation().getY();
- if (withinSelectorBounds(x, y) && click.button1()) {
- selectNode();
- } else {
- super.firstClick(click);
- }
- }
-
- private void selectNode() {
- axis.selected(getView());
- }
-
- private boolean withinSelectorBounds(final int x, final int y) {
- return true;
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet options) {
- super.viewMenuOptions(options);
- options.add(new UserActionAbstract("Select node") {
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- selectNode();
- }
-
- @Override
- public String getDescription(final View view) {
- return "Show this node in the right-hand pane";
- }
- });
- }
-
- @Override
- public void draw(final Canvas canvas) {
- if (axis.isSelected(getView())) {
- clearBackground(canvas, Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3));
- }
- super.draw(canvas);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectableViewAxis.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectableViewAxis.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectableViewAxis.java
deleted file mode 100644
index 734cfca..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectableViewAxis.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.view.border;
-
-import org.apache.isis.core.commons.util.ToString;
-import org.apache.isis.viewer.dnd.view.Selectable;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewAxis;
-
-public class SelectableViewAxis implements ViewAxis {
- private View selectedView;
- private final Selectable target;
-
- public SelectableViewAxis(final Selectable view) {
- target = view;
- }
-
- public void selected(final View view) {
- selectedView = view;
- target.setSelectedNode(selectedView);
- }
-
- public boolean isSelected(final View view) {
- return selectedView == view;
- }
-
- @Override
- public String toString() {
- final ToString s = new ToString(this);
- s.append("target", target.getId());
- s.append("selected", selectedView == null ? "none" : selectedView.getId());
- 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/view/border/SelectedBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectedBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectedBorder.java
deleted file mode 100644
index 0a8f3a1..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/SelectedBorder.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.view.border;
-
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-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.base.AbstractBorder;
-
-public class SelectedBorder extends AbstractBorder {
- private final SelectableViewAxis axis;
-
- public SelectedBorder(final View view, final SelectableViewAxis axis) {
- super(view);
- this.axis = axis;
- }
-
- @Override
- public void firstClick(final Click click) {
- axis.selected(getView());
- super.firstClick(click);
- }
-
- @Override
- public void draw(final Canvas canvas) {
- if (axis.isSelected(getView())) {
- final Size size = getSize();
- canvas.drawSolidRectangle(left, right, size.getWidth() - left - right, size.getHeight() - top - bottom, Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY3));
- }
- super.draw(canvas);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/TextFieldResizeBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/TextFieldResizeBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/TextFieldResizeBorder.java
deleted file mode 100644
index ec4bae6..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/TextFieldResizeBorder.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.view.border;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-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.Shape;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.util.Properties;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-
-public class TextFieldResizeBorder extends ResizeBorder {
- public static final int BORDER_WIDTH = IsisContext.getConfiguration().getInteger(Properties.PROPERTY_BASE + "field-resize-border", 5);
-
- public TextFieldResizeBorder(final View view) {
- super(view, RIGHT + DOWN, 1, 1);
- }
-
- @Override
- protected void drawResizeBorder(final Canvas canvas, final Size size) {
- if (resizing) {
- final Shape shape = new Shape(0, 0);
- final int resizeMarkerSize = 10;
- shape.addVector(resizeMarkerSize, 0);
- shape.addVector(0, resizeMarkerSize);
- shape.addVector(-resizeMarkerSize, -resizeMarkerSize);
- final Color color = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3);
- final int height = size.getHeight();
- final int width = size.getWidth();
- canvas.drawSolidShape(shape, width - resizeMarkerSize, height, color);
- canvas.drawRectangle(0, 0, width, height, color);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ViewResizeBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ViewResizeBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ViewResizeBorder.java
deleted file mode 100644
index 8efb9e1..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ViewResizeBorder.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.view.border;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.util.Properties;
-import org.apache.isis.viewer.dnd.view.View;
-
-// TODO enhance so the direction of resizing can be specified (could limit to width on right, height on bottom, or width/height from corner
-public class ViewResizeBorder extends ResizeBorder {
- public static final int BORDER_WIDTH = IsisContext.getConfiguration().getInteger(Properties.PROPERTY_BASE + "tree-resize-border", 7);
-
- private static ResizeViewRender render;
-
- public static void setRender(final ResizeViewRender render) {
- ViewResizeBorder.render = render;
- }
-
- public ViewResizeBorder(final View view) {
- super(view, RIGHT, BORDER_WIDTH, 0);
- }
-
- @Override
- protected void drawResizeBorder(final Canvas canvas, final Size size) {
- final int x = getSize().getWidth() - BORDER_WIDTH;
- final int height = getSize().getHeight() - 1;
- final boolean hasFocus = getParent().containsFocus();
- render.draw(canvas, x, BORDER_WIDTH, height, hasFocus);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ViewResizeOutline.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ViewResizeOutline.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ViewResizeOutline.java
deleted file mode 100644
index 44cf1e8..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/border/ViewResizeOutline.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.view.border;
-
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-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.Toolkit;
-import org.apache.isis.viewer.dnd.view.base.AbstractView;
-import org.apache.isis.viewer.dnd.view.content.NullContent;
-
-public class ViewResizeOutline extends AbstractView {
- private final int thickness = 1;
- private String label = "";
- private final Size size;
-
- protected ViewResizeOutline(final Bounds resizeArea) {
- super(new NullContent());
- size = resizeArea.getSize();
- }
-
- @Override
- public void draw(final Canvas canvas) {
- super.draw(canvas);
-
- final Size s = getSize();
- // LoggerFactory.getLogger(getClass()).debug("drag outline size " + s);
- final Color color = Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY2);
- for (int i = 0; i < thickness; i++) {
- canvas.drawRectangle(i, i, s.getWidth() - i * 2 - 1, s.getHeight() - i * 2 - 1, color);
- }
- canvas.drawText(label, 2, 16, color, Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
- }
-
- public void setDisplay(final String label) {
- this.label = label == null ? "" : label;
- }
-
- @Override
- public void dispose() {
- getFeedbackManager().showDefaultCursor();
- super.dispose();
- }
-
- @Override
- public Size getRequiredSize(final Size availableSpace) {
- return new Size(size);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/AbstractCollectionContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/AbstractCollectionContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/AbstractCollectionContent.java
deleted file mode 100644
index 6257ee2..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/AbstractCollectionContent.java
+++ /dev/null
@@ -1,304 +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.view.collection;
-
-import java.util.Enumeration;
-import java.util.List;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.consent.ConsentAbstract;
-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.ActionType;
-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.drawing.Image;
-import org.apache.isis.viewer.dnd.drawing.ImageFactory;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.Workspace;
-import org.apache.isis.viewer.dnd.view.content.AbstractContent;
-import org.apache.isis.viewer.dnd.view.option.UserActionAbstract;
-
-public abstract class AbstractCollectionContent extends AbstractContent implements CollectionContent {
- private static final TypeComparator TYPE_COMPARATOR = new TypeComparator();
- private static final TitleComparator TITLE_COMPARATOR = new TitleComparator();
- private final static CollectionSorter sorter = new SimpleCollectionSorter();
- private Comparator order;
- private boolean reverse;
-
- @Override
- public final Enumeration<ObjectAdapter> allElements() {
- final ObjectAdapter[] elements = elements();
-
- sorter.sort(elements, order, reverse);
-
- return new Enumeration<ObjectAdapter>() {
- int i = 0;
- int size = elements.length;
-
- @Override
- public boolean hasMoreElements() {
- return i < size;
- }
-
- @Override
- public ObjectAdapter nextElement() {
- return elements[i++];
- }
- };
- }
-
- @Override
- public void debugDetails(final DebugBuilder debug) {
- debug.appendln("order", order);
- debug.appendln("reverse order", reverse);
- }
-
- @Override
- public final boolean isCollection() {
- return true;
- }
-
- @Override
- public ObjectAdapter[] elements() {
- final ObjectAdapter collection = getCollection();
- final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
- final ObjectAdapter[] elementsArray = new ObjectAdapter[facet.size(collection)];
- int i = 0;
- for (final ObjectAdapter element : facet.iterable(collection)) {
- elementsArray[i++] = element;
- }
- return elementsArray;
- }
-
- @Override
- public abstract ObjectAdapter getCollection();
-
- @Override
- public ObjectSpecification getElementSpecification() {
- final ObjectAdapter collection = getCollection();
- return collection.getElementSpecification();
- }
-
- @Override
- public String getDescription() {
- return "Collection";
- }
-
- @Override
- public void contentMenuOptions(final UserActionSet options) {
- final ObjectAdapter collection = getCollection();
- options.addObjectMenuOptions(collection);
-
- // TODO find all collection actions, and make them available
- // not valid ObjectOption.menuOptions((ObjectAdapter) object, options);
- /*
- * Action[] actions =
- * collection.getSpecification().getObjectActions(Action.USER);
- *
- * for (int i = 0; i < actions.length; i++) { final Action action =
- * actions[i]; AbstractUserAction option; option = new
- * AbstractUserAction(actions[i].getId()) { public void execute(final
- * Workspace workspace, final View view, final Location at) {
- * ObjectAdapter result = collection.execute(action, new
- * ObjectAdapter[0]); at.add(20, 20); workspace.addOpenViewFor(result,
- * at); } };
- *
- * if (option != null) { options.add(option); } }
- */
- options.add(new UserActionAbstract("Clear resolved", ActionType.DEBUG) {
- @Override
- public Consent disabled(final View component) {
- return ConsentAbstract.allowIf(collection == null || !(collection.isTransient()) || collection.isGhost());
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- collection.changeState(ResolveState.GHOST);
- }
- });
-
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet options) {
- final UserActionSet sortOptions = options.addNewActionSet("Sort");
-
- sortOptions.add(new UserActionAbstract("Clear") {
- @Override
- public Consent disabled(final View component) {
- return ConsentAbstract.allowIf(order != null);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- order = null;
- view.invalidateContent();
- }
- });
-
- if (reverse) {
- sortOptions.add(new UserActionAbstract("Normal sort order") {
- @Override
- public Consent disabled(final View component) {
- return ConsentAbstract.allowIf(order != null);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- reverse = false;
- view.invalidateContent();
- }
- });
- } else {
- sortOptions.add(new UserActionAbstract("Reverse sort order") {
- @Override
- public Consent disabled(final View component) {
- return ConsentAbstract.allowIf(order != null);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- reverse = true;
- view.invalidateContent();
- }
- });
- }
-
- sortOptions.add(new UserActionAbstract("Sort by title") {
- @Override
- public Consent disabled(final View component) {
- return ConsentAbstract.allowIf(order != TITLE_COMPARATOR);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- order = TITLE_COMPARATOR;
- view.invalidateContent();
- }
- });
-
- sortOptions.add(new UserActionAbstract("Sort by type") {
- @Override
- public Consent disabled(final View component) {
- return ConsentAbstract.allowIf(order != TYPE_COMPARATOR);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- order = TYPE_COMPARATOR;
- view.invalidateContent();
- }
- });
-
- final List<ObjectAssociation> fields = getElementSpecification().getAssociations(Contributed.EXCLUDED);
- for (int i = 0; i < fields.size(); i++) {
- final ObjectAssociation field = fields.get(i);
-
- sortOptions.add(new UserActionAbstract("Sort by " + field.getName()) {
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- order = new FieldComparator(field);
- view.invalidateContent();
- }
- });
- }
- }
-
- @Override
- public void parseTextEntry(final String entryText) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public void setOrder(final Comparator order) {
- this.order = order;
- }
-
- @Override
- public void setOrderByField(final ObjectAssociation field) {
- if (order instanceof FieldComparator && ((FieldComparator) order).getField() == field) {
- reverse = !reverse;
- } else {
- order = new FieldComparator(field);
- reverse = false;
- }
- }
-
- @Override
- public void setOrderByElement() {
- if (order == TITLE_COMPARATOR) {
- reverse = !reverse;
- } else {
- order = TITLE_COMPARATOR;
- reverse = false;
- }
- }
-
- @Override
- public ObjectAssociation getFieldSortOrder() {
- if (order instanceof FieldComparator) {
- return ((FieldComparator) order).getField();
- } else {
- return null;
- }
- }
-
- @Override
- public Image getIconPicture(final int iconHeight) {
- final ObjectAdapter adapter = getCollection();
- if (adapter == null) {
- return ImageFactory.getInstance().loadIcon("emptyField", iconHeight, null);
- }
- final ObjectSpecification specification = adapter.getSpecification();
- Image icon = ImageFactory.getInstance().loadIcon(specification, iconHeight, null);
- if (icon == null) {
- icon = ImageFactory.getInstance().loadDefaultIcon(iconHeight, null);
- }
- return icon;
- }
-
- @Override
- public boolean getOrderByElement() {
- return order == TITLE_COMPARATOR;
- }
-
- @Override
- public boolean getReverseSortOrder() {
- return reverse;
- }
-
- @Override
- public boolean isOptionEnabled() {
- return false;
- }
-
- @Override
- public ObjectAdapter[] getOptions() {
- 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/view/collection/CollectionContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionContent.java
deleted file mode 100644
index c8c0a3c..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionContent.java
+++ /dev/null
@@ -1,73 +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.view.collection;
-
-import java.util.Enumeration;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.dnd.drawing.Image;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-
-public interface CollectionContent extends Content {
-
- Enumeration allElements();
-
- @Override
- void debugDetails(final DebugBuilder debug);
-
- ObjectAdapter[] elements();
-
- ObjectAdapter getCollection();
-
- @Override
- void contentMenuOptions(final UserActionSet options);
-
- @Override
- void viewMenuOptions(final UserActionSet options);
-
- void parseTextEntry(final String entryText);
-
- void setOrder(final Comparator order);
-
- void setOrderByField(final ObjectAssociation field);
-
- void setOrderByElement();
-
- ObjectAssociation getFieldSortOrder();
-
- @Override
- Image getIconPicture(final int iconHeight);
-
- boolean getOrderByElement();
-
- boolean getReverseSortOrder();
-
- @Override
- boolean isOptionEnabled();
-
- @Override
- ObjectAdapter[] getOptions();
-
- ObjectSpecification getElementSpecification();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionElement.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionElement.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionElement.java
deleted file mode 100644
index 67df816..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionElement.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.view.collection;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.exceptions.IsisException;
-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.viewer.dnd.view.content.AbstractObjectContent;
-
-public class CollectionElement extends AbstractObjectContent {
- private final ObjectAdapter adapter;
-
- public CollectionElement(final ObjectAdapter adapter) {
- this.adapter = adapter;
- }
-
- @Override
- public boolean isObject() {
- return true;
- }
-
- @Override
- public boolean isOptionEnabled() {
- return false;
- }
-
- @Override
- public Consent canClear() {
- return Veto.DEFAULT;
- }
-
- @Override
- public Consent canSet(final ObjectAdapter dragSource) {
- return Veto.DEFAULT;
- }
-
- @Override
- public void clear() {
- throw new IsisException("Invalid call");
- }
-
- @Override
- public void debugDetails(final DebugBuilder debug) {
- debug.appendln("element", adapter);
- }
-
- @Override
- public String getId() {
- return "";
- }
-
- @Override
- public String getDescription() {
- return getSpecification().getSingularName() + ": " + getObject().titleString() + " " + getSpecification().getDescription();
- }
-
- @Override
- public String getHelp() {
- return "";
- }
-
- @Override
- public ObjectAdapter getObject() {
- return adapter;
- }
-
- @Override
- public ObjectAdapter getAdapter() {
- return adapter;
- }
-
- @Override
- public ObjectSpecification getSpecification() {
- return adapter.getSpecification();
- }
-
- @Override
- public boolean isTransient() {
- return adapter.isTransient();
- }
-
- @Override
- public void setObject(final ObjectAdapter object) {
- throw new IsisException("Invalid call");
- }
-
- @Override
- public String title() {
- return adapter.titleString();
- }
-
- @Override
- public String windowTitle() {
- return getSpecification().getShortIdentifier();
- }
-
- @Override
- public String toString() {
- return "" + adapter;
- }
-
- @Override
- public ObjectAdapter[] getOptions() {
- 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/view/collection/CollectionSorter.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionSorter.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionSorter.java
deleted file mode 100644
index d68b5b1..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/CollectionSorter.java
+++ /dev/null
@@ -1,32 +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.view.collection;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-
-public interface CollectionSorter {
- boolean REVERSED = true;
- boolean NORMAL = false;
-
- /**
- * Sorts the array of objects into the order specified by the comparator.
- */
- void sort(final ObjectAdapter[] element, Comparator order, boolean reverse);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/Comparator.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/Comparator.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/Comparator.java
deleted file mode 100644
index 895fdfd..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/Comparator.java
+++ /dev/null
@@ -1,28 +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.view.collection;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-
-public interface Comparator {
- void init(ObjectAdapter element);
-
- int compare(ObjectAdapter sortedElement);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/FieldComparator.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/FieldComparator.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/FieldComparator.java
deleted file mode 100644
index 257d822..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/collection/FieldComparator.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.view.collection;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-public class FieldComparator implements Comparator {
- private final ObjectAssociation field;
- private String title;
-
- public FieldComparator(final ObjectAssociation field) {
- this.field = field;
- }
-
- @Override
- public void init(final ObjectAdapter element) {
- final ObjectAdapter refTo = field.get(element);
- title = refTo == null ? null : refTo.titleString();
- title = title == null ? "" : title;
- }
-
- @Override
- public int compare(final ObjectAdapter sortedElement) {
- final ObjectAdapter refTo = field.get(sortedElement);
- String sortedTitle = refTo == null ? null : refTo.titleString();
- sortedTitle = sortedTitle == null ? "" : sortedTitle;
- final int compareTo = sortedTitle.compareTo(title);
- return compareTo;
- }
-
- public ObjectAssociation getField() {
- return field;
- }
-}