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:11 UTC
[10/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/composite/ObjectFieldBuilder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ObjectFieldBuilder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ObjectFieldBuilder.java
deleted file mode 100644
index b8f2d9f..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ObjectFieldBuilder.java
+++ /dev/null
@@ -1,196 +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.composite;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.core.commons.ensure.Assert;
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.util.AdapterUtils;
-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.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.ObjectContent;
-import org.apache.isis.viewer.dnd.view.SubviewDecorator;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewFactory;
-import org.apache.isis.viewer.dnd.view.base.FieldErrorView;
-import org.apache.isis.viewer.dnd.view.content.FieldContent;
-
-public class ObjectFieldBuilder extends AbstractViewBuilder {
- private static final Logger LOG = LoggerFactory.getLogger(ObjectFieldBuilder.class);
-
- // REVIEW: confirm this rendering context
- private final Where where = Where.OBJECT_FORMS;
-
- private final ViewFactory subviewDesign;
-
- // TODO remove - transitional
- public ObjectFieldBuilder(final ViewFactory subviewDesign) {
- this.subviewDesign = subviewDesign;
- }
-
- public ObjectFieldBuilder(final ViewFactory subviewDesign, final SubviewDecorator subviewDecorator) {
- this.subviewDesign = subviewDesign;
- addSubviewDecorator(subviewDecorator);
- }
-
- @Override
- public void build(final View view, final Axes axes) {
- Assert.assertEquals("ensure the view is the complete decorated view", view.getView(), view);
-
- final Content content = view.getContent();
- final ObjectAdapter object = ((ObjectContent) content).getObject();
-
- LOG.debug("build view " + view + " for " + object);
-
- final ObjectSpecification spec = object.getSpecification();
- final Filter<ObjectAssociation> filter = ObjectAssociation.Filters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object, where);
- final List<ObjectAssociation> flds = spec.getAssociations(Contributed.EXCLUDED, filter);
-
- if (view.getSubviews().length == 0) {
- initialBuild(view, axes, object, flds);
- } else {
- updateBuild(view, axes, object, flds);
- }
- }
-
- private void initialBuild(final View view, final Axes axes, final ObjectAdapter object, final List<ObjectAssociation> flds) {
- LOG.debug(" as new build");
- // addViewAxes(view);
- for (int f = 0; f < flds.size(); f++) {
- final ObjectAssociation field = flds.get(f);
- addField(view, axes, object, field, f);
- }
- }
-
- private void addField(final View view, final Axes axes, final ObjectAdapter object, final ObjectAssociation field, final int fieldNumber) {
- final View fieldView = createFieldView(view, axes, object, fieldNumber, field);
- if (fieldView != null) {
- view.addView(decorateSubview(axes, fieldView));
- }
- }
-
- private void updateBuild(final View view, final Axes axes, final ObjectAdapter object, final List<ObjectAssociation> flds) {
- LOG.debug(" as update build");
- /*
- * 1/ To remove fields: look through views and remove any that don't
- * exists in visible fields
- *
- * 2/ From remaining views, check for changes as already being done, and
- * replace if needed
- *
- * 3/ Finally look through fields to see if there is no existing
- * subview; and add one
- */
-
- View[] subviews = view.getSubviews();
-
- // remove views for fields that no longer exist
- outer: for (int i = 0; i < subviews.length; i++) {
- final FieldContent fieldContent = ((FieldContent) subviews[i].getContent());
-
- for (int j = 0; j < flds.size(); j++) {
- final ObjectAssociation field = flds.get(j);
- if (fieldContent.getField() == field) {
- continue outer;
- }
- }
- view.removeView(subviews[i]);
- }
-
- // update existing fields if needed
- subviews = view.getSubviews();
- for (int i = 0; i < subviews.length; i++) {
- final View subview = subviews[i];
- final ObjectAssociation field = ((FieldContent) subview.getContent()).getField();
- final ObjectAdapter value = field.get(object);
-
- if (field.isOneToManyAssociation()) {
- subview.update(value);
- } else if (field.isOneToOneAssociation()) {
- final ObjectAdapter existing = subview.getContent().getAdapter();
-
- // if the field is parseable then it may have been modified; we
- // need to replace what was
- // typed in with the actual title.
- if (!field.getSpecification().isParseable()) {
- final boolean changedValue = value != existing;
- final boolean isDestroyed = existing != null && existing.isDestroyed();
- if (changedValue || isDestroyed) {
- View fieldView;
- fieldView = createFieldView(view, axes, object, i, field);
- if (fieldView != null) {
- view.replaceView(subview, decorateSubview(axes, fieldView));
- } else {
- view.addView(new FieldErrorView("No field for " + value));
- }
- }
- } else {
- if (AdapterUtils.exists(value) && !AdapterUtils.wrappedEqual(value, existing)) {
- final View fieldView = createFieldView(view, axes, object, i, field);
- view.replaceView(subview, decorateSubview(axes, fieldView));
- } else {
- subview.refresh();
- }
- }
- } else {
- throw new UnknownTypeException(field.getName());
- }
- }
-
- // add new fields
- outer2: for (int j = 0; j < flds.size(); j++) {
- final ObjectAssociation field = flds.get(j);
- for (int i = 0; i < subviews.length; i++) {
- final FieldContent fieldContent = ((FieldContent) subviews[i].getContent());
- if (fieldContent.getField() == field) {
- continue outer2;
- }
- }
- addField(view, axes, object, field, j);
- }
- }
-
- private View createFieldView(final View view, final Axes axes, final ObjectAdapter object, final int fieldNumber, final ObjectAssociation field) {
- if (field == null) {
- throw new NullPointerException();
- }
-
- if (field.isOneToOneAssociation()) {
- IsisContext.getPersistenceSession().resolveField(object, field);
- }
-
- final Content content1 = Toolkit.getContentFactory().createFieldContent(field, object);
- final View fieldView = subviewDesign.createView(content1, axes, fieldNumber);
- return fieldView;
- }
-
-}
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/composite/ReplaceViewBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ReplaceViewBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ReplaceViewBorder.java
deleted file mode 100644
index 7252e52..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ReplaceViewBorder.java
+++ /dev/null
@@ -1,57 +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.composite;
-
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.form.FormSpecification;
-import org.apache.isis.viewer.dnd.view.Axes;
-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 ReplaceViewBorder extends AbstractBorder {
-
- protected ReplaceViewBorder(final View view) {
- super(view);
- }
-
- @Override
- public void draw(final Canvas canvas) {
- super.draw(canvas);
-
- final Bounds b = getButtonBounds();
- canvas.drawRoundedRectangle(b.getX(), b.getY(), b.getWidth(), b.getHeight(), 6, 6, Toolkit.getColor(0xfff));
- }
-
- @Override
- public void firstClick(final Click click) {
- if (getButtonBounds().contains(click.getLocation())) {
- final View view = new FormSpecification().createView(getContent(), new Axes(), 0);
- getWorkspace().replaceView(getParent(), view);
- }
- }
-
- private Bounds getButtonBounds() {
- final int x = getSize().getWidth() - 28;
- return new Bounds(x, 8, 20, 16);
- }
-}
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/composite/StackLayout.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/StackLayout.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/StackLayout.java
deleted file mode 100644
index 3d224c3..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/StackLayout.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.view.composite;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.base.Layout;
-
-/**
- * A stack layout stacks its components vertically, one on top of the other,
- * working down from the top. Each component is given the space it requests.
- * Components adopt the width of the widest component when that component's view
- * specification's <code>isAligned</code> method returns <code>true</code>, or
- * the layout's <code>fixedWidth</code> flag is set (via the two parameter
- * constructor).
- *
- */
-public class StackLayout implements Layout {
- private final boolean fixedWidth;
-
- public StackLayout() {
- this.fixedWidth = false;
- }
-
- public StackLayout(final boolean fixedWidth) {
- this.fixedWidth = fixedWidth;
- }
-
- @Override
- public Size getRequiredSize(final View view) {
- int height = 0;
- int width = 0;
- final View views[] = view.getSubviews();
-
- for (final View v : views) {
- final Size s = v.getRequiredSize(new Size(Integer.MAX_VALUE, Integer.MAX_VALUE));
- width = Math.max(width, s.getWidth());
- height += s.getHeight();
- }
-
- return new Size(width, height);
- }
-
- @Override
- public void layout(final View view, final Size maximumSize) {
- final int x = 0;
- int y = 0;
- final View subviews[] = view.getSubviews();
-
- int maxWidth = 0;
- for (final View v : subviews) {
- final Size s = v.getRequiredSize(new Size(maximumSize));
- maxWidth = Math.max(maxWidth, s.getWidth());
- }
-
- for (final View v : subviews) {
- final Size s = v.getRequiredSize(new Size(maximumSize));
- s.limitWidth(maximumSize.getWidth());
- if (fixedWidth || v.getSpecification().isAligned()) {
- s.ensureWidth(maxWidth);
- }
- v.setSize(s);
- v.setLocation(new Location(x, y));
- y += s.getHeight();
- }
- }
-
-}
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/composite/StandardFields.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/StandardFields.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/StandardFields.java
deleted file mode 100644
index 9caba31..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/StandardFields.java
+++ /dev/null
@@ -1,74 +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.composite;
-
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.GlobalViewFactory;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewFactory;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-
-/**
- * A view factory for the components of a container
- */
-public class StandardFields implements ViewFactory {
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- final GlobalViewFactory factory = Toolkit.getViewFactory();
-
- int requirement = 0;
- if (content.isObject()) {
- requirement = objectRequirement();
- } else if (content.isTextParseable()) {
- requirement = textParseableRequirement();
- } else if (content.isCollection()) {
- requirement = collectionRequirement();
- } else {
- throw new UnknownTypeException(content);
- }
-
- if (requirement != 0 && include(content, sequence)) {
- final ViewRequirement viewRequirement = new ViewRequirement(content, requirement);
- return factory.createView(viewRequirement);
- } else {
- return null;
- }
- }
-
- protected boolean include(final Content content, final int sequence) {
- return true;
- }
-
- protected int objectRequirement() {
- return ViewRequirement.CLOSED | ViewRequirement.SUBVIEW;
- }
-
- protected int textParseableRequirement() {
- return ViewRequirement.CLOSED | ViewRequirement.SUBVIEW;
- }
-
- protected int collectionRequirement() {
- return ViewRequirement.CLOSED | 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/view/composite/ViewBuilder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ViewBuilder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ViewBuilder.java
deleted file mode 100644
index 4d6fef5..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/composite/ViewBuilder.java
+++ /dev/null
@@ -1,58 +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.composite;
-
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.SubviewDecorator;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-import org.apache.isis.viewer.dnd.view.View;
-
-public interface ViewBuilder {
-
- void addSubviewDecorator(SubviewDecorator decorator);
-
- void createAxes(Axes axes, Content content);
-
- void build(View view, Axes axes);
-
- /**
- * Indicates whether this view is expanded, or iconized.
- *
- * @return true if it is showing the object's details; false if it is
- * showing the object only.
- */
- boolean isOpen();
-
- /**
- * Indicates whether this view can be replaced with another view (for the
- * same value or reference).
- *
- * @return true if it can be replaced by another view; false if it can't be
- * replaces
- */
- boolean isReplaceable();
-
- boolean isSubView();
-
- boolean canDragView();
-
- void viewMenuOptions(UserActionSet options, View 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/view/content/AbstractContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractContent.java
deleted file mode 100644
index ac2ca9f..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractContent.java
+++ /dev/null
@@ -1,58 +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.content;
-
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-
-public abstract class AbstractContent implements Content {
- @Override
- public void contentMenuOptions(final UserActionSet options) {
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public boolean isObject() {
- return false;
- }
-
- @Override
- public boolean isPersistable() {
- return false;
- }
-
- @Override
- public boolean isTextParseable() {
- return false;
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet options) {
- }
-
- @Override
- public String windowTitle() {
- return "";
- }
-}
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/content/AbstractObjectContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractObjectContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractObjectContent.java
deleted file mode 100644
index 6586e08..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractObjectContent.java
+++ /dev/null
@@ -1,294 +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.content;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.query.QueryFindAllInstances;
-import org.apache.isis.core.commons.ensure.Assert;
-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.consent.Veto;
-import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.Persistability;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-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.Image;
-import org.apache.isis.viewer.dnd.drawing.ImageFactory;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.ObjectContent;
-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.Workspace;
-import org.apache.isis.viewer.dnd.view.option.UserActionAbstract;
-
-public abstract class AbstractObjectContent extends AbstractContent implements ObjectContent {
-
- public static final class ExplorationInstances extends UserActionAbstract {
-
- public ExplorationInstances() {
- super("Instances", ActionType.EXPLORATION);
- }
-
- @Override
- public Consent disabled(final View view) {
- final ObjectAdapter object = view.getContent().getAdapter();
- return ConsentAbstract.allowIf(object != null);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- final ObjectAdapter object = view.getContent().getAdapter();
- final ObjectSpecification spec = object.getSpecification();
- final ObjectAdapter instances = IsisContext.getPersistenceSession().findInstances(new QueryFindAllInstances(spec.getFullIdentifier()), QueryCardinality.MULTIPLE);
- workspace.objectActionResult(instances, new Placement(view));
- }
- }
-
- public static final class ExplorationClone extends UserActionAbstract {
-
- public ExplorationClone() {
- super("Clone", ActionType.EXPLORATION);
- }
-
- @Override
- public Consent disabled(final View view) {
- final ObjectAdapter object = view.getContent().getAdapter();
- return ConsentAbstract.allowIf(object != null);
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- final ObjectAdapter original = view.getContent().getAdapter();
- // ObjectAdapter original = getObject();
- final ObjectSpecification spec = original.getSpecification();
-
- final ObjectAdapter clone = getPersistenceSession().createTransientInstance(spec);
- final List<ObjectAssociation> fields = spec.getAssociations(Contributed.EXCLUDED);
- for (int i = 0; i < fields.size(); i++) {
- final ObjectAdapter fld = fields.get(i).get(original);
-
- if (fields.get(i).isOneToOneAssociation()) {
- ((OneToOneAssociation) fields.get(i)).setAssociation(clone, fld);
- } else if (fields.get(i).isOneToManyAssociation()) {
- // clone.setValue((OneToOneAssociation) fields[i],
- // fld.getObject());
- }
- }
-
- workspace.objectActionResult(clone, new Placement(view));
- }
- }
-
- public static final class DebugClearResolvedOption extends UserActionAbstract {
-
- private DebugClearResolvedOption() {
- super("Clear resolved", ActionType.DEBUG);
- }
-
- @Override
- public Consent disabled(final View view) {
- final ObjectAdapter object = view.getContent().getAdapter();
- return ConsentAbstract.allowIf(object == null || !object.isTransient() || object.isGhost());
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- final ObjectAdapter object = view.getContent().getAdapter();
- object.changeState(ResolveState.GHOST);
- }
- }
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
- // be hidden/disabled, but will be visible/enabled (perhaps incorrectly)
- // for any other value for Where
- protected final Where where = Where.ANYWHERE;
-
- @Override
- public abstract Consent canClear();
-
- @Override
- public Consent canDrop(final Content sourceContent) {
- final ObjectAdapter target = getObject();
- if (!(sourceContent instanceof ObjectContent) || target == null) {
- // TODO: move logic into Facet
- return new Veto(String.format("Can't drop %s onto empty target", sourceContent.getAdapter().titleString()));
- } else {
- final ObjectAdapter source = ((ObjectContent) sourceContent).getObject();
- return canDropOntoObject(target, source);
- }
- }
-
- private Consent canDropOntoObject(final ObjectAdapter target, final ObjectAdapter source) {
- final ObjectAction action = dropAction(source, target);
- if (action != null) {
- final Consent parameterSetValid = action.isProposedArgumentSetValid(target, new ObjectAdapter[] { source });
- parameterSetValid.setDescription("Execute '" + action.getName() + "' with " + source.titleString());
- return parameterSetValid;
- } else {
- return setFieldOfMatchingType(target, source);
- }
- }
-
- private Consent setFieldOfMatchingType(final ObjectAdapter targetAdapter, final ObjectAdapter sourceAdapter) {
- if (targetAdapter.isTransient() && sourceAdapter.representsPersistent()) {
- // TODO: use Facet for this test instead.
- return new Veto("Can't set field in persistent object with reference to non-persistent object");
- }
- final List<ObjectAssociation> fields = targetAdapter.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(IsisContext.getAuthenticationSession(), targetAdapter, where));
- for (final ObjectAssociation fld : fields) {
- if (!fld.isOneToOneAssociation()) {
- continue;
- }
- if (!sourceAdapter.getSpecification().isOfType(fld.getSpecification())) {
- continue;
- }
- if (fld.get(targetAdapter) != null) {
- continue;
- }
- final Consent associationValid = ((OneToOneAssociation) fld).isAssociationValid(targetAdapter, sourceAdapter);
- if (associationValid.isAllowed()) {
- return associationValid.setDescription("Set field " + fld.getName());
- }
-
- }
- // TODO: use Facet for this test instead
- return new Veto(String.format("No empty field accepting object of type %s in %s", sourceAdapter.getSpecification().getSingularName(), title()));
- }
-
- @Override
- public abstract Consent canSet(final ObjectAdapter dragSource);
-
- @Override
- public abstract void clear();
-
- @Override
- public ObjectAdapter drop(final Content sourceContent) {
- if (!(sourceContent instanceof ObjectContent)) {
- return null;
- }
-
- final ObjectAdapter source = sourceContent.getAdapter();
- Assert.assertNotNull(source);
-
- final ObjectAdapter target = getObject();
- Assert.assertNotNull(target);
-
- if (!canDrop(sourceContent).isAllowed()) {
- return null;
- }
-
- final ObjectAction action = dropAction(source, target);
- if ((action != null) && action.isProposedArgumentSetValid(target, new ObjectAdapter[] { source }).isAllowed()) {
- return action.execute(target, new ObjectAdapter[] { source });
- }
-
- final List<ObjectAssociation> associations = target.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(IsisContext.getAuthenticationSession(), target, where));
-
- for (int i = 0; i < associations.size(); i++) {
- final ObjectAssociation association = associations.get(i);
- if (association.isOneToOneAssociation() && source.getSpecification().isOfType(association.getSpecification())) {
- final OneToOneAssociation otoa = (OneToOneAssociation) association;
- if (association.get(target) == null && otoa.isAssociationValid(target, source).isAllowed()) {
- otoa.setAssociation(target, source);
- break;
- }
- }
- }
-
- return null;
- }
-
- private ObjectAction dropAction(final ObjectAdapter source, final ObjectAdapter target) {
- final ObjectAction action = target.getSpecification().getObjectAction(ActionType.USER, null, Arrays.asList(source.getSpecification()));
- return action;
- }
-
- @Override
- public abstract ObjectAdapter getObject();
-
- @Override
- public boolean isPersistable() {
- return getObject().getSpecification().persistability() == Persistability.USER_PERSISTABLE;
- }
-
- @Override
- public void contentMenuOptions(final UserActionSet options) {
- final ObjectAdapter object = getObject();
- options.addObjectMenuOptions(object);
-
- if (getObject() == null) {
- options.addCreateOptions(getSpecification());
- } else {
- options.add(new ExplorationInstances());
- }
-
- options.add(new ExplorationClone());
- options.add(new DebugClearResolvedOption());
- }
-
- public void parseTextEntry(final String entryText) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public abstract void setObject(final ObjectAdapter object);
-
- @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();
- if (adapter == null) {
- return ImageFactory.getInstance().loadIcon("empty-field", iconHeight, null);
- }
- final ObjectSpecification specification = adapter.getSpecification();
- final Image icon = ImageFactory.getInstance().loadIcon(specification, iconHeight, null);
- return icon;
- }
-
- // ////////////////////////////////////////////////////////////
- // 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/content/AbstractTextParsableContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractTextParsableContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractTextParsableContent.java
deleted file mode 100644
index 6b60e51..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractTextParsableContent.java
+++ /dev/null
@@ -1,82 +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.content;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.title.TitleFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.ParseableEntryActionParameter;
-import org.apache.isis.viewer.dnd.drawing.Image;
-
-public abstract class AbstractTextParsableContent extends AbstractContent {
-
- public abstract void clear();
-
- public abstract void entryComplete();
-
- @Override
- public Image getIconPicture(final int iconHeight) {
- return null;
- }
-
- public abstract boolean isEmpty();
-
- @Override
- public boolean isPersistable() {
- return false;
- }
-
- @Override
- public boolean isTransient() {
- return false;
- }
-
- public abstract void parseTextEntry(final String entryText);
-
- public abstract Consent isEditable();
-
- @Override
- public boolean isTextParseable() {
- return true;
- }
-
- /**
- * @param propertyOrParamValue
- * the target property or parameter
- * @param propertyOrParam
- * the {@link ObjectAssociation} or
- * {@link ParseableEntryActionParameter}
- * @param propertyOrParamTypeSpecification
- * the specification of the type of the property or parameter
- * (for fallback).
- */
- protected String titleString(final ObjectAdapter propertyOrParamValue, final FacetHolder propertyOrParam, final FacetHolder propertyOrParamTypeSpecification) {
-
- final TitleFacet titleFacet = propertyOrParam.getFacet(TitleFacet.class);
- if (titleFacet != null) {
- return titleFacet.title(propertyOrParamValue, null);
- } else {
- return propertyOrParamValue.titleString();
- }
- }
-
-}
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/content/FieldContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/FieldContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/FieldContent.java
deleted file mode 100644
index 06b4dce..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/FieldContent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.view.content;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.dnd.view.Content;
-
-public interface FieldContent extends Content {
-
- String getFieldName();
-
- ObjectAssociation getField();
-
- boolean isMandatory();
-
- Consent isEditable();
-
- ObjectAdapter getParent();
-}
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/content/NullContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/NullContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/NullContent.java
deleted file mode 100644
index 24d6fa1..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/NullContent.java
+++ /dev/null
@@ -1,147 +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.content;
-
-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.spec.ObjectSpecification;
-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 class NullContent implements Content {
-
- private final String title;
-
- public NullContent() {
- this("");
- }
-
- public NullContent(final String title) {
- this.title = title;
- }
-
- @Override
- public Consent canDrop(final Content sourceContent) {
- return null;
- }
-
- @Override
- public void contentMenuOptions(final UserActionSet options) {
- }
-
- @Override
- public void debugDetails(final DebugBuilder debug) {
- }
-
- @Override
- public ObjectAdapter drop(final Content sourceContent) {
- return null;
- }
-
- @Override
- public String getDescription() {
- return null;
- }
-
- @Override
- public String getHelp() {
- return null;
- }
-
- @Override
- public String getIconName() {
- return null;
- }
-
- @Override
- public Image getIconPicture(final int iconHeight) {
- return null;
- }
-
- @Override
- public String getId() {
- return null;
- }
-
- @Override
- public ObjectAdapter getAdapter() {
- return null;
- }
-
- @Override
- public ObjectAdapter[] getOptions() {
- return null;
- }
-
- @Override
- public ObjectSpecification getSpecification() {
- return null;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public boolean isObject() {
- return false;
- }
-
- @Override
- public boolean isOptionEnabled() {
- return false;
- }
-
- @Override
- public boolean isPersistable() {
- return false;
- }
-
- @Override
- public boolean isTransient() {
- return false;
- }
-
- @Override
- public boolean isTextParseable() {
- return false;
- }
-
- public void parseTextEntry(final String entryText) {
- }
-
- @Override
- public String title() {
- return title;
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet options) {
- }
-
- @Override
- public String windowTitle() {
- return title;
- }
-
-}
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/content/RootObject.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/RootObject.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/RootObject.java
deleted file mode 100644
index 0832c5b..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/RootObject.java
+++ /dev/null
@@ -1,131 +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.content;
-
-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;
-
-public class RootObject extends AbstractObjectContent {
- private final ObjectAdapter adapter;
-
- public RootObject(final ObjectAdapter adapter) {
- this.adapter = adapter;
- }
-
- @Override
- public Consent canClear() {
- return Veto.DEFAULT;
- }
-
- @Override
- public Consent canDrop(final Content sourceContent) {
- return super.canDrop(sourceContent);
- }
-
- @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("object", adapter);
- }
-
- @Override
- public ObjectAdapter getAdapter() {
- return adapter;
- }
-
- @Override
- public String getDescription() {
- return getSpecification().getSingularName() + ": " + getObject().titleString() + " " + getSpecification().getDescription();
- }
-
- @Override
- public String getHelp() {
- return "";
- }
-
- @Override
- public String getId() {
- return "";
- }
-
- @Override
- public ObjectAdapter getObject() {
- return adapter;
- }
-
- @Override
- public ObjectAdapter[] getOptions() {
- return null;
- }
-
- @Override
- public ObjectSpecification getSpecification() {
- return adapter.getSpecification();
- }
-
- @Override
- public boolean isObject() {
- return true;
- }
-
- @Override
- public boolean isOptionEnabled() {
- return false;
- }
-
- @Override
- public boolean isTransient() {
- return adapter != null && adapter.isTransient();
- }
-
- @Override
- public void setObject(final ObjectAdapter object) {
- throw new IsisException("Invalid call");
- }
-
- @Override
- public String title() {
- return adapter.titleString();
- }
-
- @Override
- public String toString() {
- return "Root Object [adapter=" + adapter + "]";
- }
-
- @Override
- public String windowTitle() {
- return (isTransient() ? "UNSAVED " : "") + getSpecification().getSingularName();
- }
-}
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/content/TextParseableContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/TextParseableContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/TextParseableContent.java
deleted file mode 100644
index ab6d3fc..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/TextParseableContent.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.content;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.viewer.dnd.view.Content;
-
-public interface TextParseableContent extends Content {
-
- void clear();
-
- Consent canClear();
-
- boolean canWrap();
-
- void entryComplete();
-
- int getMaximumLength();
-
- int getNoLines();
-
- int getTypicalLineLength();
-
- Consent isEditable();
-
- boolean isEmpty();
-
- void parseTextEntry(String entryText);
-
- String titleString(ObjectAdapter value);
-}
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/control/AbstractButtonAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/AbstractButtonAction.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/AbstractButtonAction.java
deleted file mode 100644
index a2316d6..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/AbstractButtonAction.java
+++ /dev/null
@@ -1,70 +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.control;
-
-import org.apache.isis.core.metamodel.consent.Allow;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.viewer.dnd.view.ButtonAction;
-import org.apache.isis.viewer.dnd.view.View;
-
-public abstract class AbstractButtonAction implements ButtonAction {
- private final String name;
- private final boolean defaultButton;
-
- public AbstractButtonAction(final String name) {
- this(name, false);
- }
-
- public AbstractButtonAction(final String name, final boolean defaultButton) {
- this.name = name;
- this.defaultButton = defaultButton;
- }
-
- @Override
- public Consent disabled(final View view) {
- return Allow.DEFAULT;
- }
-
- @Override
- public String getDescription(final View view) {
- return "";
- }
-
- @Override
- public String getHelp(final View view) {
- return "No help available for button";
- }
-
- @Override
- public String getName(final View view) {
- return name;
- }
-
- @Override
- public ActionType getType() {
- return ActionType.USER;
- }
-
- @Override
- public boolean isDefault() {
- return defaultButton;
- }
-}
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/control/AbstractControlView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/AbstractControlView.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/AbstractControlView.java
deleted file mode 100644
index 3824652..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/AbstractControlView.java
+++ /dev/null
@@ -1,505 +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.control;
-
-import java.awt.event.KeyEvent;
-
-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.runtime.userprofile.Options;
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Padding;
-import org.apache.isis.viewer.dnd.drawing.Size;
-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.ContentDrag;
-import org.apache.isis.viewer.dnd.view.DragEvent;
-import org.apache.isis.viewer.dnd.view.DragStart;
-import org.apache.isis.viewer.dnd.view.Feedback;
-import org.apache.isis.viewer.dnd.view.FocusManager;
-import org.apache.isis.viewer.dnd.view.InternalDrag;
-import org.apache.isis.viewer.dnd.view.KeyboardAction;
-import org.apache.isis.viewer.dnd.view.Placement;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.UserAction;
-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.ViewDrag;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.ViewState;
-import org.apache.isis.viewer.dnd.view.Viewer;
-import org.apache.isis.viewer.dnd.view.Workspace;
-import org.apache.isis.viewer.dnd.view.base.Layout;
-
-public abstract class AbstractControlView implements View {
- protected final UserAction action;
- private final View parent;
- private int width;
- private int x;
- private int y;
- private int height;
- private boolean isOver;
- private boolean isPressed;
-
- public AbstractControlView(final UserAction action, final View target) {
- this.action = action;
- this.parent = target;
- }
-
- @Override
- public Axes getViewAxes() {
- return new Axes();
- }
-
- @Override
- public void addView(final View view) {
- }
-
- @Override
- public Consent canChangeValue() {
- return Veto.DEFAULT;
- }
-
- @Override
- public boolean canFocus() {
- return action.disabled(parent).isAllowed();
- }
-
- @Override
- public boolean contains(final View view) {
- return false;
- }
-
- @Override
- public boolean containsFocus() {
- return false;
- }
-
- @Override
- public void contentMenuOptions(final UserActionSet menuOptions) {
- }
-
- @Override
- public void debug(final DebugBuilder debug) {
- }
-
- @Override
- public void debugStructure(final DebugBuilder b) {
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void drag(final ContentDrag contentDrag) {
- }
-
- @Override
- public void drag(final InternalDrag drag) {
- }
-
- @Override
- public void drag(final ViewDrag drag) {
- }
-
- @Override
- public void dragCancel(final InternalDrag drag) {
- }
-
- @Override
- public View dragFrom(final Location location) {
- return null;
- }
-
- @Override
- public void dragIn(final ContentDrag drag) {
- }
-
- @Override
- public void dragOut(final ContentDrag drag) {
- }
-
- @Override
- public DragEvent dragStart(final DragStart drag) {
- return null;
- }
-
- @Override
- public void dragTo(final InternalDrag drag) {
- }
-
- @Override
- public void draw(final Canvas canvas) {
- }
-
- @Override
- public void drop(final ContentDrag drag) {
- }
-
- @Override
- public void drop(final ViewDrag drag) {
- getParent().drop(drag);
- }
-
- @Override
- public void editComplete(final boolean moveFocus, final boolean toNextField) {
- }
-
- @Override
- public void entered() {
- final View target = getParent();
- final Consent consent = action.disabled(target);
- final String actionText = action.getName(target) + " - " + (consent.isVetoed() ? consent.getReason() : action.getDescription(target));
- getFeedbackManager().setAction(actionText);
-
- isOver = true;
- isPressed = false;
- markDamaged();
- }
-
- @Override
- public void exited() {
- getFeedbackManager().clearAction();
- isOver = false;
- isPressed = false;
- markDamaged();
- }
-
- public void exitedSubview() {
- }
-
- @Override
- public void firstClick(final Click click) {
- executeAction();
- }
-
- private void executeAction() {
- final View target = getParent().getView();
- if (action.disabled(target).isAllowed()) {
- markDamaged();
- getViewManager().saveCurrentFieldEntry();
- action.execute(target.getWorkspace(), target, getLocation());
- }
- }
-
- @Override
- public void focusLost() {
- }
-
- @Override
- public void focusReceived() {
- }
-
- @Override
- public Location getAbsoluteLocation() {
- final Location location = parent.getAbsoluteLocation();
- getViewManager().getSpy().addTrace(this, "parent location", location);
- location.add(x, y);
- getViewManager().getSpy().addTrace(this, "plus view's location", location);
- final Padding pad = parent.getPadding();
- location.add(pad.getLeft(), pad.getTop());
- getViewManager().getSpy().addTrace(this, "plus view's padding", location);
- return location;
- }
-
- public boolean isOver() {
- return isOver;
- }
-
- public boolean isPressed() {
- return isPressed;
- }
-
- @Override
- public int getBaseline() {
- return 0;
- }
-
- @Override
- public Bounds getBounds() {
- return new Bounds(x, y, width, height);
- }
-
- @Override
- public Content getContent() {
- return null;
- }
-
- @Override
- public int getId() {
- return 0;
- }
-
- @Override
- public FocusManager getFocusManager() {
- return getParent() == null ? null : getParent().getFocusManager();
- }
-
- @Override
- public Location getLocation() {
- return new Location(x, y);
- }
-
- @Override
- public Padding getPadding() {
- return null;
- }
-
- @Override
- public View getParent() {
- return parent;
- }
-
- @Override
- public Size getSize() {
- return new Size(width, height);
- }
-
- @Override
- public ViewSpecification getSpecification() {
- return null;
- }
-
- @Override
- public ViewState getState() {
- return null;
- }
-
- @Override
- public View[] getSubviews() {
- return new View[0];
- }
-
- @Override
- public View getView() {
- return this;
- }
-
- @Override
- public Viewer getViewManager() {
- return Toolkit.getViewer();
- }
-
- @Override
- public Feedback getFeedbackManager() {
- return Toolkit.getFeedbackManager();
- }
-
- @Override
- public Workspace getWorkspace() {
- return null;
- }
-
- @Override
- public boolean hasFocus() {
- return getViewManager().hasFocus(getView());
- }
-
- @Override
- public View identify(final Location location) {
- return this;
- }
-
- @Override
- public void invalidateContent() {
- }
-
- @Override
- public void invalidateLayout() {
- }
-
- @Override
- public void keyPressed(final KeyboardAction key) {
- if (key.getKeyCode() == KeyEvent.VK_ENTER) {
- executeAction();
- }
- }
-
- @Override
- public void keyReleased(final KeyboardAction action) {
- }
-
- @Override
- public void keyTyped(final KeyboardAction action) {
- }
-
- @Override
- public void layout() {
- }
-
- @Override
- public void limitBoundsWithin(final Size size) {
- }
-
- @Override
- public void markDamaged() {
- markDamaged(getView().getBounds());
- }
-
- @Override
- public void markDamaged(final Bounds bounds) {
- if (parent == null) {
- getViewManager().markDamaged(bounds);
- } else {
- final Location pos = parent.getLocation();
- bounds.translate(pos.getX(), pos.getY());
- parent.markDamaged(bounds);
- }
- }
-
- @Override
- public void mouseDown(final Click click) {
- final View target = getParent().getView();
- if (action.disabled(target).isAllowed()) {
- markDamaged();
- getViewManager().saveCurrentFieldEntry();
- // action.execute(target.getWorkspace(), target, getLocation());
- }
- final boolean vetoed = action.disabled(target).isVetoed();
- if (!vetoed) {
- isPressed = true;
- markDamaged();
- }
- }
-
- @Override
- public void mouseUp(final Click click) {
- final View target = getParent().getView();
- final boolean vetoed = action.disabled(target).isVetoed();
- if (!vetoed) {
- isPressed = false;
- markDamaged();
- }
- }
-
- @Override
- public void mouseMoved(final Location location) {
- }
-
- @Override
- public void objectActionResult(final ObjectAdapter result, final Placement placement) {
- }
-
- @Override
- public View pickupContent(final Location location) {
- return null;
- }
-
- @Override
- public View pickupView(final Location location) {
- return null;
- }
-
- @Override
- public void print(final Canvas canvas) {
- }
-
- @Override
- public void refresh() {
- }
-
- @Override
- public void removeView(final View view) {
- }
-
- @Override
- public void replaceView(final View toReplace, final View replacement) {
- }
-
- @Override
- public void secondClick(final Click click) {
- }
-
- @Override
- public void setBounds(final Bounds bounds) {
- }
-
- @Override
- public void setFocusManager(final FocusManager focusManager) {
- }
-
- public void setLayout(final Layout layout) {
- }
-
- @Override
- public void setLocation(final Location point) {
- x = point.getX();
- y = point.getY();
- }
-
- @Override
- public void setParent(final View view) {
- }
-
- public void setMaximumSize(final Size size) {
- }
-
- @Override
- public void setSize(final Size size) {
- width = size.getWidth();
- height = size.getHeight();
- }
-
- @Override
- public void setView(final View view) {
- }
-
- @Override
- public View subviewFor(final Location location) {
- return null;
- }
-
- @Override
- public void thirdClick(final Click click) {
- }
-
- @Override
- public void update(final ObjectAdapter object) {
- }
-
- @Override
- public void updateView() {
- }
-
- @Override
- public ViewAreaType viewAreaType(final Location mouseLocation) {
- return null;
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet menuOptions) {
- }
-
- @Override
- public void loadOptions(final Options viewOptions) {
- }
-
- @Override
- public void saveOptions(final Options viewOptions) {
- }
-
-}
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/control/Button.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/Button.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/Button.java
deleted file mode 100644
index 80a48a7..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/Button.java
+++ /dev/null
@@ -1,57 +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.control;
-
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.ButtonAction;
-import org.apache.isis.viewer.dnd.view.View;
-
-public class Button extends AbstractControlView {
- private static ButtonRender buttonRender;
-
- public static void setButtonRender(final ButtonRender buttonRender) {
- Button.buttonRender = buttonRender;
- }
-
- public Button(final ButtonAction action, final View target) {
- super(action, target);
- }
-
- @Override
- public boolean containsFocus() {
- return hasFocus();
- }
-
- @Override
- public void draw(final Canvas canvas) {
- final View target = getParent();
- final String text = action.getName(target);
- final boolean isDisabled = action.disabled(target).isVetoed();
- final boolean isDefault = ((ButtonAction) action).isDefault();
- buttonRender.draw(canvas, getSize(), isDisabled, isDefault, hasFocus(), isOver(), isPressed(), text);
- }
-
- @Override
- public Size getRequiredSize(final Size availableSpace) {
- final String text = action.getName(getView());
- return buttonRender.getMaximumSize(text);
- }
-}
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/control/ButtonRender.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/ButtonRender.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/ButtonRender.java
deleted file mode 100644
index 8407cd7..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/ButtonRender.java
+++ /dev/null
@@ -1,31 +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.control;
-
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.Size;
-
-public interface ButtonRender {
-
- void draw(Canvas canvas, Size size, boolean isDisabled, boolean isDefault, boolean hasFocus, boolean isOver, boolean isPressed, String text);
-
- Size getMaximumSize(String text);
-
-}
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/control/CancelAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/CancelAction.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/CancelAction.java
deleted file mode 100644
index 23a1911..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/control/CancelAction.java
+++ /dev/null
@@ -1,41 +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.control;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.Workspace;
-
-public class CancelAction extends AbstractButtonAction {
- private static final Logger LOG = LoggerFactory.getLogger(CancelAction.class);
-
- public CancelAction() {
- super("Cancel");
- }
-
- @Override
- public void execute(final Workspace workspace, final View view, final Location at) {
- LOG.debug("cancel pressed");
- view.dispose();
- }
-}
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/debug/DebugAdapter.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugAdapter.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugAdapter.java
deleted file mode 100644
index 2ddbe6a..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugAdapter.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.debug;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.util.Dump;
-
-public class DebugAdapter implements DebuggableWithTitle {
- private final ObjectAdapter object;
-
- public DebugAdapter(final ObjectAdapter object) {
- this.object = object;
- }
-
- @Override
- public void debugData(final DebugBuilder debug) {
- dumpObject(object, debug);
- }
-
- @Override
- public String debugTitle() {
- return "Adapter";
- }
-
- private void dumpObject(final ObjectAdapter object, final DebugBuilder info) {
- if (object != null) {
- Dump.adapter(object, info);
- }
- }
-}
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/debug/DebugBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugBorder.java
deleted file mode 100644
index f694b6a..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugBorder.java
+++ /dev/null
@@ -1,64 +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.debug;
-
-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.Text;
-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 DebugBorder extends AbstractBorder {
- public DebugBorder(final View wrappedView) {
- super(wrappedView);
-
- bottom = Toolkit.getText(ColorsAndFonts.TEXT_DEBUG).getTextHeight();
- }
-
- @Override
- protected void debugDetails(final DebugBuilder debug) {
- debug.append("DebugBorder");
- }
-
- @Override
- public void draw(final Canvas canvas) {
- final String debug = getView() + " " + getState();
- final Text text = Toolkit.getText(ColorsAndFonts.TEXT_DEBUG);
- final int baseline = wrappedView.getSize().getHeight() + text.getAscent();
- final Color color = Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BASELINE);
- canvas.drawText(debug, 0, baseline, color, text);
-
- super.draw(canvas);
- }
-
- @Override
- public String toString() {
- return wrappedView.toString() + "/DebugBorder";
- }
-
- @Override
- public void firstClick(final Click click) {
- new DebugOption().execute(getWorkspace(), getView(), click.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/view/debug/DebugContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugContent.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugContent.java
deleted file mode 100644
index 40b3b38..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugContent.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.view.debug;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-
-public class DebugContent implements DebuggableWithTitle {
- private final View view;
-
- public DebugContent(final View display) {
- this.view = display;
- }
-
- @Override
- public void debugData(final DebugBuilder debug) {
- final Content content = view.getContent();
- if (content != null) {
- String type = content.getClass().getName();
- type = type.substring(type.lastIndexOf('.') + 1);
- debug.appendln("Content", type);
-
- debug.indent();
-
- content.debugDetails(debug);
-
- debug.appendln("Icon name", content.getIconName());
- debug.appendln("Icon ", content.getIconPicture(32));
- debug.appendln("Window title", content.windowTitle());
-
- debug.appendln("Object", content.isObject());
- debug.appendln("Collection", content.isCollection());
-
- debug.appendln("Text Parseable", content.isTextParseable());
-
- debug.unindent();
- } else {
- debug.appendln("Content", "none");
- }
- debug.blankLine();
- }
-
- @Override
- public String debugTitle() {
- return "Content";
- }
-}
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/debug/DebugDrawing.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugDrawing.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugDrawing.java
deleted file mode 100644
index 1b5133a..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugDrawing.java
+++ /dev/null
@@ -1,44 +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.debug;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-import org.apache.isis.viewer.dnd.drawing.DebugCanvas;
-import org.apache.isis.viewer.dnd.view.View;
-
-public class DebugDrawing implements DebuggableWithTitle {
- private final View view;
-
- public DebugDrawing(final View display) {
- this.view = display;
- }
-
- @Override
- public void debugData(final DebugBuilder debug) {
- view.draw(new DebugCanvas(debug, new Bounds(view.getBounds())));
- }
-
- @Override
- public String debugTitle() {
- return "Drawing";
- }
-}
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/debug/DebugDrawingAbsolute.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugDrawingAbsolute.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugDrawingAbsolute.java
deleted file mode 100644
index cf2c62e..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/debug/DebugDrawingAbsolute.java
+++ /dev/null
@@ -1,44 +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.debug;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-import org.apache.isis.viewer.dnd.drawing.DebugCanvasAbsolute;
-import org.apache.isis.viewer.dnd.view.View;
-
-public class DebugDrawingAbsolute implements DebuggableWithTitle {
- private final View view;
-
- public DebugDrawingAbsolute(final View display) {
- this.view = display;
- }
-
- @Override
- public void debugData(final DebugBuilder debug) {
- view.draw(new DebugCanvasAbsolute(debug, new Bounds(view.getAbsoluteLocation(), view.getSize())));
- }
-
- @Override
- public String debugTitle() {
- return "Drawing (Absolute)";
- }
-}