You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/07/03 17:01:22 UTC
[16/63] [abbrv] [partial] ISIS-832: mothballing components
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyCanvas.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyCanvas.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyCanvas.java
deleted file mode 100644
index dd6812e..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyCanvas.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd;
-
-import 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.Image;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Shape;
-import org.apache.isis.viewer.dnd.drawing.Text;
-
-public class DummyCanvas implements Canvas {
-
- public DummyCanvas() {
- super();
- }
-
- @Override
- public Canvas createSubcanvas() {
- return null;
- }
-
- @Override
- public Canvas createSubcanvas(final Bounds bounds) {
- return null;
- }
-
- @Override
- public Canvas createSubcanvas(final int x, final int y, final int width, final int height) {
- return null;
- }
-
- @Override
- public void draw3DRectangle(final int x, final int y, final int width, final int height, final Color color, final boolean raised) {
- }
-
- @Override
- public void drawImage(final Image icon, final int x, final int y) {
- }
-
- @Override
- public void drawImage(final Image icon, final int x, final int y, final int width, final int height) {
- }
-
- @Override
- public void drawLine(final int x, final int y, final int x2, final int y2, final Color color) {
- }
-
- @Override
- public void drawLine(final Location start, final int xExtent, final int yExtent, final Color color) {
- }
-
- @Override
- public void drawOval(final int x, final int y, final int width, final int height, final Color color) {
- }
-
- @Override
- public void drawRectangle(final int x, final int y, final int width, final int height, final Color color) {
- }
-
- @Override
- public void drawRectangleAround(final Bounds bounds, final Color color) {
- }
-
- @Override
- public void drawRoundedRectangle(final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight, final Color color) {
- }
-
- @Override
- public void drawShape(final Shape shape, final Color color) {
- }
-
- @Override
- public void drawShape(final Shape shape, final int x, final int y, final Color color) {
- }
-
- @Override
- public void drawSolidOval(final int x, final int y, final int width, final int height, final Color color) {
- }
-
- @Override
- public void drawSolidRectangle(final int x, final int y, final int width, final int height, final Color color) {
- }
-
- @Override
- public void drawSolidShape(final Shape shape, final Color color) {
- }
-
- @Override
- public void drawSolidShape(final Shape shape, final int x, final int y, final Color color) {
- }
-
- @Override
- public void drawText(final String text, final int x, final int y, final Color color, final Text style) {
- }
-
- @Override
- public void drawText(final String text, final int x, final int y, final int maxWidth, final Color color, final Text style) {
- }
-
- @Override
- public void offset(final int x, final int y) {
- }
-
- @Override
- public boolean overlaps(final Bounds bounds) {
- return false;
- }
-
- @Override
- public void drawDebugOutline(final Bounds bounds, final int baseline, final Color color) {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyContent.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyContent.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyContent.java
deleted file mode 100644
index 128f13e..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyContent.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
-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.drawing.Image;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.UserActionSet;
-
-public class DummyContent implements Content {
-
- private String iconName;
- private String title;
- private String windowTitle;
-
- @Override
- public Consent canDrop(final Content sourceContent) {
- return Veto.DEFAULT;
- }
-
- @Override
- public void debugDetails(final DebugBuilder debug) {
- }
-
- @Override
- public ObjectAdapter drop(final Content sourceContent) {
- return null;
- }
-
- @Override
- public String getIconName() {
- return iconName;
- }
-
- @Override
- public Image getIconPicture(final int iconHeight) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public ObjectAdapter getAdapter() {
- return null;
- }
-
- @Override
- public ObjectSpecification getSpecification() {
- return null;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public boolean isObject() {
- return false;
- }
-
- @Override
- public boolean isPersistable() {
- return false;
- }
-
- @Override
- public boolean isTransient() {
- return false;
- }
-
- @Override
- public boolean isTextParseable() {
- return false;
- }
-
- @Override
- public void contentMenuOptions(final UserActionSet options) {
- }
-
- public void parseTextEntry(final String entryText) {
- }
-
- public void setupIconName(final String iconName) {
- this.iconName = iconName;
- }
-
- public void setupTitle(final String title) {
- this.title = title;
- }
-
- public void setupWindowTitle(final String windowTitle) {
- this.windowTitle = windowTitle;
- }
-
- @Override
- public String title() {
- return title;
- }
-
- @Override
- public String windowTitle() {
- return windowTitle;
- }
-
- @Override
- public String getDescription() {
- return null;
- }
-
- @Override
- public String getId() {
- return null;
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet options) {
- }
-
- @Override
- public String getHelp() {
- return null;
- }
-
- @Override
- public ObjectAdapter[] getOptions() {
- return null;
- }
-
- @Override
- public boolean isOptionEnabled() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyView.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyView.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyView.java
deleted file mode 100644
index f0f9d54..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyView.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd;
-
-import java.util.Vector;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
-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.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 class DummyView implements View {
- private Size requiredSize = new Size(100, 10);
- private Size size;
- private View parent;
- private View view;
- private Location location = new Location(0, 0);
- private Location absoluteLocation;
- private Content content;
- private ViewSpecification specification;
- public int invlidateLayout;
- public int invalidateContent;
- private final ViewState state = new ViewState();
- private final Vector<View> subviews = new Vector<View>();
- private boolean allowSubviewsToBeAdded;
- private final Axes axes = new Axes();
-
- public DummyView() {
- setView(this);
- }
-
- public DummyView(final int width, final int height) {
- this();
- setupRequiredSize(new Size(width, height));
- }
-
- @Override
- public Size getRequiredSize(final Size availableSpace) {
- return new Size(requiredSize);
- }
-
- @Override
- public Consent canChangeValue() {
- return Veto.DEFAULT;
- }
-
- @Override
- public boolean canFocus() {
- return false;
- }
-
- @Override
- public boolean contains(final View view) {
- return false;
- }
-
- @Override
- public boolean containsFocus() {
- return false;
- }
-
- @Override
- public void contentMenuOptions(final UserActionSet menuOptions) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void debug(final DebugBuilder debug) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void debugStructure(final DebugBuilder b) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void dispose() {
- final Workspace workspace = getWorkspace();
- if (workspace != null) {
- workspace.removeView(this);
- }
- }
-
- @Override
- public void drag(final InternalDrag drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void drag(final ViewDrag drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void dragCancel(final InternalDrag drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public View dragFrom(final Location location) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void drag(final ContentDrag contentDrag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void dragIn(final ContentDrag drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void dragOut(final ContentDrag drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public DragEvent dragStart(final DragStart drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void dragTo(final InternalDrag drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void draw(final Canvas canvas) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void drop(final ContentDrag drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void drop(final ViewDrag drag) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void editComplete(final boolean moveFocus, final boolean toNextField) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void entered() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void exited() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void firstClick(final Click click) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void focusLost() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void focusReceived() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public Location getAbsoluteLocation() {
- return absoluteLocation;
- }
-
- @Override
- public int getBaseline() {
- return 0;
- }
-
- @Override
- public Bounds getBounds() {
- return new Bounds(location, size);
- }
-
- @Override
- public Content getContent() {
- return content;
- }
-
- @Override
- public FocusManager getFocusManager() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public int getId() {
- return 0;
- }
-
- @Override
- public Location getLocation() {
- return location;
- }
-
- @Override
- public Padding getPadding() {
- return new Padding();
- }
-
- @Override
- public View getParent() {
- return parent;
- }
-
- @Override
- public Size getSize() {
- return size;
- }
-
- @Override
- public ViewSpecification getSpecification() {
- return specification;
- }
-
- @Override
- public ViewState getState() {
- return state;
- }
-
- @Override
- public void addView(final View view) {
- if (allowSubviewsToBeAdded) {
- subviews.add(view);
- } else {
- throw new IsisException("Can't add view. Do you need to set the allowSubviewsToBeAdded flag?");
- }
- }
-
- @Override
- public void removeView(final View view) {
- if (allowSubviewsToBeAdded) {
- subviews.remove(view);
- } else {
- throw new IsisException("Can't remove view. Do you need to set the allowSubviewsToBeAdded flag?");
- }
- }
-
- @Override
- public View[] getSubviews() {
- return subviews.toArray(new View[subviews.size()]);
- }
-
- @Override
- public View getView() {
- return view;
- }
-
- @Override
- public Viewer getViewManager() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public Feedback getFeedbackManager() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public Workspace getWorkspace() {
- return getParent() == null ? null : getParent().getWorkspace();
- }
-
- @Override
- public boolean hasFocus() {
- return false;
- }
-
- @Override
- public View identify(final Location mouseLocation) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void invalidateContent() {
- invalidateContent++;
- }
-
- @Override
- public void invalidateLayout() {
- invlidateLayout++;
- }
-
- @Override
- public void keyPressed(final KeyboardAction key) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void keyReleased(final KeyboardAction action) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void keyTyped(final KeyboardAction action) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void layout() {
- }
-
- @Override
- public void limitBoundsWithin(final Size size) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void markDamaged() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void markDamaged(final Bounds bounds) {
- }
-
- @Override
- public void mouseDown(final Click click) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void mouseMoved(final Location location) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void objectActionResult(final ObjectAdapter result, final Placement placement) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public View pickupContent(final Location location) {
- return null;
- }
-
- @Override
- public View pickupView(final Location location) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void print(final Canvas canvas) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void refresh() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void replaceView(final View toReplace, final View replacement) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void secondClick(final Click click) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void setBounds(final Bounds bounds) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void setFocusManager(final FocusManager focusManager) {
- throw new NotYetImplementedException();
- }
-
- public void setLayout(final Layout layout) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void setLocation(final Location location) {
- this.location = location;
- }
-
- @Override
- public void setParent(final View view) {
- parent = view.getView();
- }
-
- @Override
- public void setSize(final Size size) {
- this.size = size;
- }
-
- @Override
- public void setView(final View view) {
- this.view = view;
- }
-
- @Override
- public View subviewFor(final Location location) {
- for (final View view : getSubviews()) {
- if (view.getBounds().contains(location)) {
- return view;
- }
- }
- return null;
- }
-
- @Override
- public void thirdClick(final Click click) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void update(final ObjectAdapter object) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void updateView() {
- throw new NotYetImplementedException();
- }
-
- @Override
- public ViewAreaType viewAreaType(final Location mouseLocation) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public void viewMenuOptions(final UserActionSet menuOptions) {
- throw new NotYetImplementedException();
- }
-
- public void setupLocation(final Location location) {
- this.location = location;
- }
-
- public void setupAbsoluteLocation(final Location location) {
- this.absoluteLocation = location;
- }
-
- public void setupContent(final Content content) {
- this.content = content;
- }
-
- public void setupRequiredSize(final Size size) {
- this.requiredSize = size;
- }
-
- public void setupSpecification(final ViewSpecification specification) {
- this.specification = specification;
- }
-
- public void setupSubviews(final View[] views) {
- for (final View view : views) {
- subviews.add(view);
- }
- }
-
- @Override
- public void mouseUp(final Click click) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public Axes getViewAxes() {
- return axes;
- }
-
- public void setupAllowSubviewsToBeAdded(final boolean allowSubviewsToBeAdded) {
- this.allowSubviewsToBeAdded = allowSubviewsToBeAdded;
- }
-
- @Override
- public void loadOptions(final Options viewOptions) {
- }
-
- @Override
- public void saveOptions(final Options viewOptions) {
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyViewSpecification.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyViewSpecification.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyViewSpecification.java
deleted file mode 100644
index 9764b82..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyViewSpecification.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;
-
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-
-public class DummyViewSpecification implements ViewSpecification {
-
- private Size size;
-
- public DummyViewSpecification() {
- }
-
- public DummyViewSpecification(final Size size) {
- this.size = size;
- }
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- final DummyView dummyView = new DummyView();
- dummyView.setupRequiredSize(new Size(size));
- return dummyView;
- }
-
- @Override
- public String getName() {
- return null;
- }
-
- @Override
- public boolean isAligned() {
- return false;
- }
-
- @Override
- public boolean isOpen() {
- return false;
- }
-
- @Override
- public boolean isReplaceable() {
- return false;
- }
-
- @Override
- public boolean isResizeable() {
- return false;
- }
-
- @Override
- public boolean isSubView() {
- return false;
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return false;
- }
-
- public void setupCreatedViewsSize(final Size size) {
- this.size = size;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyWorkspaceView.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyWorkspaceView.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyWorkspaceView.java
deleted file mode 100644
index 989fcbe..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/DummyWorkspaceView.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.dnd.view.Placement;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.Workspace;
-
-public class DummyWorkspaceView extends DummyView implements Workspace {
-
- public DummyWorkspaceView() {
- setupAllowSubviewsToBeAdded(true);
- }
-
- @Override
- public View addIconFor(final ObjectAdapter adapter, final Placement placement) {
- return createAndAddView();
- }
-
- private DummyView createAndAddView() {
- final DummyView view = new DummyView();
- addView(view);
- return view;
- }
-
- @Override
- public View addWindowFor(final ObjectAdapter object, final Placement placement) {
- return createAndAddView();
- }
-
- public View createSubviewFor(final ObjectAdapter object, final boolean asIcon) {
- return createAndAddView();
- }
-
- @Override
- public void lower(final View view) {
- }
-
- @Override
- public void raise(final View view) {
- }
-
- public void removeViewsFor(final ObjectAdapter object) {
- }
-
- @Override
- public Workspace getWorkspace() {
- return this;
- }
-
- public void removeObject(final ObjectAdapter object) {
- }
-
- @Override
- public void addDialog(final View dialog, final Placement placement) {
- }
-
- @Override
- public void addWindow(final View window, final Placement placement) {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/InternalDragTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/InternalDragTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/InternalDragTest.java
deleted file mode 100644
index bd43adc..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/InternalDragTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd;
-
-import junit.framework.TestCase;
-
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.interaction.SimpleInternalDrag;
-import org.apache.isis.viewer.dnd.view.InternalDrag;
-
-public class InternalDragTest extends TestCase {
- public static void main(final String[] args) {
- junit.textui.TestRunner.run(InternalDragTest.class);
- }
-
- public void testDragStart() {
- final DummyView view = new DummyView();
- view.setupAbsoluteLocation(new Location(30, 60));
-
- final InternalDrag id = new SimpleInternalDrag(view, new Location(100, 110));
- assertEquals(new Location(70, 50), id.getLocation());
-
- // id.drag(null, new Location(110, 130), 0);
- // assertEquals(new Location(80, 70), id.getLocation());
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/TestToolkit.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/TestToolkit.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/TestToolkit.java
deleted file mode 100644
index a9198e5..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/TestToolkit.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd;
-
-import java.util.Enumeration;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
-import org.apache.isis.viewer.dnd.drawing.Background;
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-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.Size;
-import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.view.BackgroundTask;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.DragEvent;
-import org.apache.isis.viewer.dnd.view.Feedback;
-import org.apache.isis.viewer.dnd.view.GlobalViewFactory;
-import org.apache.isis.viewer.dnd.view.InteractionSpy;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.UndoStack;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.Viewer;
-import org.apache.isis.viewer.dnd.viewer.basic.NullColor;
-import org.apache.isis.viewer.dnd.viewer.drawing.DummyText;
-
-public class TestToolkit extends Toolkit {
-
- public static void createInstance() {
- if (getInstance() == null) {
- new TestToolkit();
- }
- }
-
- private TestToolkit() {
- }
-
- @Override
- protected void init() {
- colorsAndFonts = new ColorsAndFonts() {
-
- @Override
- public int defaultBaseline() {
- return 0;
- }
-
- @Override
- public int defaultFieldHeight() {
- return 0;
- }
-
- @Override
- public Color getColor(final int rgbColor) {
- return null;
- }
-
- @Override
- public Color getColor(final String name) {
- return new NullColor();
- }
-
- @Override
- public Text getText(final String name) {
- return new DummyText();
- }
-
- @Override
- public void init() {
- }
- };
-
- viewer = new Viewer() {
-
- @Override
- public void addToNotificationList(final View view) {
- }
-
- @Override
- public void clearAction() {
- }
-
- @Override
- public void clearOverlayView() {
- }
-
- @Override
- public void clearOverlayView(final View view) {
- }
-
- @Override
- public void disposeUnneededViews() {
- }
-
- @Override
- public Object getClipboard(final Class<?> class1) {
- return null;
- }
-
- @Override
- public InteractionSpy getSpy() {
- return null;
- }
-
- UndoStack undoStack = new UndoStack();
-
- @Override
- public UndoStack getUndoStack() {
- return undoStack;
- }
-
- @Override
- public boolean hasFocus(final View view) {
- return false;
- }
-
- @Override
- public boolean isRunningAsExploration() {
- return false;
- }
-
- @Override
- public boolean isRunningAsPrototype() {
- return false;
- }
-
- @Override
- public void markDamaged(final Bounds bounds) {
- }
-
- @Override
- public void removeFromNotificationList(final View view) {
- }
-
- @Override
- public void scheduleRepaint() {
- }
-
- @Override
- public void saveCurrentFieldEntry() {
- }
-
- @Override
- public String selectFilePath(final String title, final String directory) {
- return null;
- }
-
- @Override
- public void setBackground(final Background background) {
- }
-
- @Override
- public void setClipboard(final String clip, final Class<?> class1) {
- }
-
- @Override
- public void setKeyboardFocus(final View view) {
- }
-
- @Override
- public void setOverlayView(final View view) {
- }
-
- @Override
- public void showInOverlay(final Content content, final Location location) {
- }
-
- @Override
- public void showDebugFrame(final DebuggableWithTitle[] info, final Location at) {
- }
-
- @Override
- public Size getOverlaySize() {
- return null;
- }
-
- @Override
- public void saveOpenObjects() {
- }
-
- };
-
- feedbackManager = new Feedback() {
-
- @Override
- public void showArrowCursor() {
- }
-
- @Override
- public void showCrosshairCursor() {
- }
-
- @Override
- public void showDefaultCursor() {
- }
-
- @Override
- public void showException(final Throwable e) {
- }
-
- @Override
- public void showHandCursor() {
- }
-
- @Override
- public void showMoveCursor() {
- }
-
- @Override
- public void showResizeDownCursor() {
- }
-
- @Override
- public void showResizeDownLeftCursor() {
- }
-
- @Override
- public void showResizeDownRightCursor() {
- }
-
- @Override
- public void showResizeLeftCursor() {
- }
-
- @Override
- public void showResizeRightCursor() {
- }
-
- @Override
- public void showResizeUpCursor() {
- }
-
- @Override
- public void showResizeUpLeftCursor() {
- }
-
- @Override
- public void showResizeUpRightCursor() {
- }
-
- @Override
- public void showTextCursor() {
- }
-
- @Override
- public void addMessage(final String string) {
- }
-
- @Override
- public void clearAction() {
- }
-
- @Override
- public void clearBusy(final View view) {
- }
-
- @Override
- public void clearError() {
- }
-
- @Override
- public String getStatusBarOutput() {
- return null;
- }
-
- @Override
- public boolean isBusy(final View view) {
- return false;
- }
-
- @Override
- public void setAction(final String string) {
- }
-
- @Override
- public void setBusy(final View view, final BackgroundTask task) {
- }
-
- @Override
- public void setError(final String string) {
- }
-
- @Override
- public void setViewDetail(final String string) {
- }
-
- @Override
- public void showBusyState(final View view) {
- }
-
- @Override
- public void showMessagesAndWarnings() {
- }
- };
-
- viewFactory = new GlobalViewFactory() {
-
- @Override
- public Enumeration<ViewSpecification> availableViews(final ViewRequirement viewRequirement) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public View createDialog(final Content content) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public DragEvent createDragContentOutline(final View view, final Location location) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public View createDragViewOutline(final View view) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public View createMinimizedView(final View view) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public View createView(final ViewRequirement requirement) {
- return new DummyView();
- }
-
- @Override
- public void debugData(final DebugBuilder debug) {
- }
-
- @Override
- public String debugTitle() {
- throw new UnexpectedCallException();
- }
-
- @Override
- public void addSpecification(final ViewSpecification spec) {
- }
-
- @Override
- public Enumeration<ViewSpecification> availableDesigns(final ViewRequirement viewRequirement) {
- return null;
- }
-
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/ViewManagerTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/ViewManagerTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/ViewManagerTest.java
deleted file mode 100644
index 2230da8..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/ViewManagerTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd;
-
-import junit.framework.TestCase;
-import junit.textui.TestRunner;
-
-public class ViewManagerTest extends TestCase {
- // private final static Component COMPONENT = new Component() {
- // };
-
- public static void main(final String[] args) {
- TestRunner.run(ViewManagerTest.class);
- }
-
- public void testNone() {
- }
-
- /*
- * public void testMouseClick() { MockWorkspace workspace = new
- * MockWorkspace(null); MockView view = new MockView();
- * workspace.setupIdentifyView(view);
- *
- * ViewManager manager = new ViewManager(workspace, null);
- *
- * view.setupGetAbsoluteLocation(new Location(10, 10));
- * view.setupIndicatesForView(true); view.setExpectedFirstClickCalls(1);
- *
- * manager.mouseClicked(createMouseEvent(10, 20, 1,
- * MouseEvent.BUTTON1_MASK));
- *
- * view.verify(); }
- *
- * public void testPopupMouseClick() { MockWorkspace workspace = new
- * MockWorkspace(null); MockView view = new MockView();
- * workspace.setupIdentifyView(view);
- *
- * MockPopupMenu popup = new MockPopupMenu(); ViewManager manager = new
- * ViewManager(workspace, popup);
- *
- * view.setupGetAbsoluteLocation(new Location(10, 10));
- * view.setupIndicatesForView(true);
- *
- * workspace.addExpectedSetIdentifiedViewValues(view);
- *
- * popup.addExpectedInitValues(view, true, true);
- * view.setupGetAbsoluteLocation(new Location(10, 10));
- * view.setupIndicatesForView(true); // popup.setupGetParent(null); //
- * popup.setupIndicatesForView(true);
- *
- * manager.mouseClicked(createMouseEvent(10, 20, 1,
- * MouseEvent.BUTTON3_MASK));
- *
- * popup.verify(); view.verify();
- *
- * popup.setExpectedFirstClickCalls(1); }
- *
- * private MouseEvent createMouseEvent(final int x, final int y, final int
- * count, final int button) { return new MouseEvent(COMPONENT, 0, 0, button,
- * x, y, count, false); }
- */
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/ConfigurableListViewSpecificationTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/ConfigurableListViewSpecificationTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/ConfigurableListViewSpecificationTest.java
deleted file mode 100644
index 3620de2..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/ConfigurableListViewSpecificationTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.configurable;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.Enumeration;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.viewer.dnd.TestToolkit;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.collection.CollectionContent;
-
-public class ConfigurableListViewSpecificationTest {
- private GridListSpecification viewSpecification;
- private CollectionContent collectionContent;
- private Mockery context;
-
- @Before
- public void setup() {
- org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
- TestToolkit.createInstance();
-
- viewSpecification = new GridListSpecification();
-
- context = new Mockery();
- collectionContent = context.mock(CollectionContent.class);
- context.checking(new Expectations() {
- {
- one(collectionContent).isCollection();
- will(returnValue(true));
- }
- });
- }
-
- @Test
- public void requiresOpenCollection() throws Exception {
- final ViewRequirement requirement = new ViewRequirement(collectionContent, ViewRequirement.OPEN);
- assertTrue(viewSpecification.canDisplay(requirement));
- }
-
- @Test
- public void requiresOpenObject() throws Exception {
- final ViewRequirement requirement = new ViewRequirement(collectionContent, ViewRequirement.OPEN);
- assertTrue(viewSpecification.canDisplay(requirement));
- }
-
- @Test
- public void requiresClosedCollection() throws Exception {
- final Content objectContent = context.mock(Content.class, "object");
- context.checking(new Expectations() {
- {
- one(objectContent).isCollection();
- will(returnValue(false));
- }
- });
- final ViewRequirement requirement = new ViewRequirement(objectContent, ViewRequirement.CLOSED);
- assertTrue(!viewSpecification.canDisplay(requirement));
- }
-
- // @Test
- public void testname() throws Exception {
- context.checking(new Expectations() {
- {
- one(collectionContent).allElements();
- will(returnValue(new Enumeration() {
- @Override
- public boolean hasMoreElements() {
- return false;
- }
-
- @Override
- public Object nextElement() {
- return null;
- }
- }));
- }
- });
-
- /*
- * TODO Fails trying to load user profile form NO system. View view =
- * viewSpecification.createView(collectionContent, new Axes(), 0); Axes
- * axes = view.getViewAxes(); GridLayout axis =
- * axes.getAxis(GridLayout.class); assertEquals(1, axis.getSize());
- *
- *
- * ConfigurationAxis configurationAxis =
- * axes.getAxis(ConfigurationAxis.class);
- * assertNotNull(configurationAxis);
- */
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelTest.java
deleted file mode 100644
index 55dba77..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelTest.java
+++ /dev/null
@@ -1,155 +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.configurable;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNull;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.viewer.dnd.DummyView;
-import org.apache.isis.viewer.dnd.TestToolkit;
-import org.apache.isis.viewer.dnd.configurable.PanelView.Position;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Size;
-
-public class PanelTest {
-
- private Panel panel;
- private DummyView view2;
- private DummyView view1;
- private DummyView view3;
-
- @Before
- public void setup() {
- org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
- TestToolkit.createInstance();
-
- view1 = new DummyView();
- view1.setupRequiredSize(new Size(200, 100));
- view2 = new DummyView();
- view2.setupRequiredSize(new Size(150, 120));
- view3 = new DummyView();
- view3.setupRequiredSize(new Size(150, 120));
-
- panel = new Panel();
- panel.addView(view1, null);
- panel.addView(view2, Position.East);
-
- }
-
- @Test
- public void firstPanelInTopLeft() throws Exception {
- panel.layout(Size.createMax());
- assertEquals(new Location(0, 0), view1.getLocation());
- }
-
- @Test
- public void firstPanelSizeSetToRequiredSize() throws Exception {
- assertNull(view1.getSize());
- panel.layout(Size.createMax());
- assertEquals(new Size(200, 100), view1.getSize());
- }
-
- @Test
- public void totalSizeIsWidthPlusMaxHeigth() throws Exception {
- assertEquals(new Size(350, 120), panel.getRequiredSize(Size.createMax()));
- }
-
- @Test
- public void addingToSouth() throws Exception {
- panel = new Panel();
- panel.addView(view1, Position.East);
- panel.addView(view2, Position.South);
- panel.addView(view3, Position.South);
-
- assertEquals(new Size(200, 340), panel.getRequiredSize(Size.createMax()));
- }
-
- @Test
- public void addingToEast() throws Exception {
- panel.addView(view3, Position.East);
-
- assertEquals(new Size(500, 120), panel.getRequiredSize(Size.createMax()));
- }
-
- @Test
- public void secondPanelLocatedToRightOfFirst() throws Exception {
- panel.layout(Size.createMax());
- assertEquals(new Location(0, 0), view1.getLocation());
- assertEquals(new Location(200, 0), view2.getLocation());
- }
-
- @Test
- public void addingThirdPanelToLeftMovesFirstTwoPanels() throws Exception {
- panel.addView(view3, Position.West);
- panel.layout(Size.createMax());
- assertEquals(new Location(150, 0), view1.getLocation());
- assertEquals(new Location(350, 0), view2.getLocation());
- assertEquals(new Location(0, 0), view3.getLocation());
- }
-
- @Test
- public void nullPostionAddInSameOrientation() throws Exception {
- panel.addView(view3, null);
- assertEquals(new Size(500, 120), panel.getRequiredSize(Size.createMax()));
- }
-
- @Test
- public void addingThirdPanelToBottomIncreasesHeight() throws Exception {
- panel.addView(view3, Position.South);
- assertEquals(new Size(350, 240), panel.getRequiredSize(Size.createMax()));
- }
-
- @Test
- public void addingFouthPanelToLeftIncreasesWidth() throws Exception {
- final DummyView view4 = new DummyView();
- view4.setupRequiredSize(new Size(50, 100));
-
- panel.addView(view3, Position.South);
- panel.addView(view4, Position.East);
- assertEquals(new Size(400, 240), panel.getRequiredSize(Size.createMax()));
- }
-
- @Test
- public void addingThirdPanelToNorthIncreasesHeight() throws Exception {
- panel.addView(view3, Position.North);
- assertEquals(new Size(350, 240), panel.getRequiredSize(Size.createMax()));
- }
-
- @Test
- public void addingThirdPanelToTopPlacesItAboveTheOtherTwo() throws Exception {
- panel.addView(view3, Position.North);
- panel.layout(Size.createMax());
- assertEquals(new Location(0, 120), view1.getLocation());
- assertEquals(new Location(200, 120), view2.getLocation());
- assertEquals(new Location(0, 0), view3.getLocation());
- }
-
- @Test
- public void addingThirdPanelToBottomPlacesItBelowTheOtherTwo() throws Exception {
- panel.addView(view3, Position.South);
- panel.layout(Size.createMax());
- assertEquals(new Location(0, 0), view1.getLocation());
- assertEquals(new Location(200, 0), view2.getLocation());
- assertEquals(new Location(0, 120), view3.getLocation());
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelViewDropTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelViewDropTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelViewDropTest.java
deleted file mode 100644
index d1c1c2b..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelViewDropTest.java
+++ /dev/null
@@ -1,154 +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.configurable;
-
-import static org.junit.Assert.assertEquals;
-
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.dnd.DummyContent;
-import org.apache.isis.viewer.dnd.DummyView;
-import org.apache.isis.viewer.dnd.DummyViewSpecification;
-import org.apache.isis.viewer.dnd.TestToolkit;
-import org.apache.isis.viewer.dnd.configurable.PanelView.Position;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewDrag;
-
-public class PanelViewDropTest {
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_ONLY);
-
- @Mock
- private IsisConfiguration mockConfiguration;
- @Mock
- private ViewDrag viewDrag;
-
- private PanelView view;
- private DummyContent content;
- private Position position;
- private final DummyView sourceView = new DummyView();
-
-
- @Before
- public void setup() {
- org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
-
- TestToolkit.createInstance();
- IsisContext.setConfiguration(mockConfiguration);
-
- content = new DummyContent();
-
- view = new PanelView(content, new DummyViewSpecification()) {
- @Override
- public void addView(final Content content, final Position position) {
- PanelViewDropTest.this.position = position;
- }
-
- @Override
- public synchronized View[] getSubviews() {
- return new View[] { sourceView };
- }
- };
- view.setSize(new Size(200, 100));
- view.setLocation(new Location(400, 200));
- }
-
- @Test
- public void dropOnLeft() throws Exception {
- final ViewDrag drag = dragTo(new Location(405, 250));
- view.drop(drag);
- assertEquals(Position.West, position);
- }
-
- @Test
- public void dropOnRight() throws Exception {
- final ViewDrag drag = dragTo(new Location(595, 250));
- view.drop(drag);
- assertEquals(Position.East, position);
- }
-
- @Test
- public void dropOnTop() throws Exception {
- final ViewDrag drag = dragTo(new Location(500, 205));
- view.drop(drag);
- assertEquals(Position.North, position);
- }
-
- @Test
- public void dropOnBottom() throws Exception {
- final ViewDrag drag = dragTo(new Location(500, 295));
- view.drop(drag);
- assertEquals(Position.South, position);
- }
-
- @Test
- public void dropOnTopLeft() throws Exception {
- final ViewDrag drag = dragTo(new Location(405, 205));
- view.drop(drag);
- assertEquals(Position.North, position);
- }
-
- @Test
- public void dropOnTopRight() throws Exception {
- final ViewDrag drag = dragTo(new Location(595, 205));
- view.drop(drag);
- assertEquals(Position.North, position);
- }
-
- @Test
- public void dropOnBottomLeft() throws Exception {
- final ViewDrag drag = dragTo(new Location(405, 295));
- view.drop(drag);
- assertEquals(Position.South, position);
- }
-
- @Test
- public void dropOnBottomRight() throws Exception {
- final ViewDrag drag = dragTo(new Location(595, 295));
- view.drop(drag);
- assertEquals(Position.South, position);
- }
-
- private ViewDrag dragTo(final Location location) {
- context.checking(new Expectations() {
- {
- exactly(3).of(viewDrag).getSourceView();
- will(returnValue(sourceView));
-
- atLeast(1).of(viewDrag).getLocation();
- will(returnValue(location));
- }
- });
- return viewDrag;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelViewTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelViewTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelViewTest.java
deleted file mode 100644
index 16180dc..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/configurable/PanelViewTest.java
+++ /dev/null
@@ -1,85 +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.configurable;
-
-import static org.junit.Assert.assertEquals;
-
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.dnd.DummyContent;
-import org.apache.isis.viewer.dnd.DummyViewSpecification;
-import org.apache.isis.viewer.dnd.TestToolkit;
-import org.apache.isis.viewer.dnd.configurable.PanelView.Position;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Size;
-
-public class PanelViewTest {
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- @Mock
- private IsisConfiguration mockConfiguration;
-
- private PanelView view;
- private DummyContent content;
- private DummyViewSpecification specification1;
- private DummyViewSpecification specification2;
-
- @Before
- public void setup() {
- org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
- TestToolkit.createInstance();
- IsisContext.setConfiguration(mockConfiguration);
-
- specification1 = new DummyViewSpecification();
- specification1.setupCreatedViewsSize(new Size(200, 100));
- specification2 = new DummyViewSpecification();
- specification2.setupCreatedViewsSize(new Size(150, 120));
-
- content = new DummyContent();
-
- view = new PanelView(content, new DummyViewSpecification());
- view.setInitialViewSpecification(specification1);
- view.getSubviews();
-
- view.addView(new DummyContent(), specification2, Position.East);
- }
-
- @Test
- public void totalSizeIsWidthPlusMaxHeigth() throws Exception {
- assertEquals(new Size(350, 120), view.getRequiredSize(Size.createMax()));
- }
-
- @Test
- public void secondPanelLocatedToRightOfFirst() throws Exception {
- view.layout();
- assertEquals(new Location(0, 0), view.getSubviews()[0].getLocation());
- assertEquals(new Location(200, 0), view.getSubviews()[1].getLocation());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/toolbar/ToolbarTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/toolbar/ToolbarTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/toolbar/ToolbarTest.java
deleted file mode 100644
index edc5c83..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/toolbar/ToolbarTest.java
+++ /dev/null
@@ -1,120 +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.toolbar;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.viewer.dnd.DummyView;
-import org.apache.isis.viewer.dnd.TestToolkit;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.ViewConstants;
-import org.apache.isis.viewer.dnd.view.content.NullContent;
-import org.apache.isis.viewer.dnd.view.look.LookFactory;
-
-public class ToolbarTest {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
-
- private ToolbarView toolbar;
- private DummyView button1;
- private DummyView button2;
- private DummyView button3;
-
-
- @Before
- public void setupDnd() {
- org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
-
- TestToolkit.createInstance();
- LookFactory.init();
-
- toolbar = new ToolbarView(new NullContent(), null);
-
- button1 = new DummyView();
- button1.setupRequiredSize(new Size(120, 10));
- toolbar.addView(button1);
-
- button2 = new DummyView();
- button2.setupRequiredSize(new Size(100, 10));
- toolbar.addView(button2);
-
- button3 = new DummyView();
- button3.setupRequiredSize(new Size(80, 10));
- toolbar.addView(button3);
- }
-
-
- @Test
- public void requiredSizeForButtonsLessThanMaximumWidth() throws Exception {
- final Size size = toolbar.getRequiredSize(Size.createMax());
- assertEquals(new Size(ViewConstants.HPADDING + (100 + ViewConstants.HPADDING) * 3, 10 + ViewConstants.VPADDING), size);
- }
-
- @Test
- public void requiredSizeForButtonsGreaterThanMaximumWidth() throws Exception {
- final Size size = toolbar.getRequiredSize(new Size(250, 100));
- assertEquals(new Size(ViewConstants.HPADDING * 3 + 220, (10 + ViewConstants.VPADDING) * 2), size);
- }
-
- @Test
- public void requiredSizeForButtonsJustGreaterThanMaximumWidth() throws Exception {
- final int width = ViewConstants.HPADDING + (100 + ViewConstants.HPADDING) * 3;
- final Size size = toolbar.getRequiredSize(new Size(width + 1, 100));
- assertEquals(new Size(width, 10 + ViewConstants.VPADDING), size);
- }
-
- @Test
- public void requiredSizeForButtonsSameAsMaximumWidth() throws Exception {
- final Size size = toolbar.getRequiredSize(new Size(ViewConstants.HPADDING + (100 + ViewConstants.HPADDING) * 3, 100));
- assertEquals(new Size(ViewConstants.HPADDING * 3 + 220, (10 + ViewConstants.VPADDING) * 2), size);
- }
-
- @Test
- public void layoutSizeForButtonsAsRequired() throws Exception {
- toolbar.doLayout(Size.createMax());
- assertEquals(new Size(120, 10), button1.getSize());
- assertEquals(new Size(100, 10), button2.getSize());
- assertEquals(new Size(80, 10), button3.getSize());
- }
-
- @Test
- public void layoutLocationForButtonsLessThanMaximumWidth() throws Exception {
- toolbar.doLayout(Size.createMax());
- assertEquals(new Location(ViewConstants.HPADDING, 0), button1.getLocation());
- assertEquals(new Location(ViewConstants.HPADDING * 2 + 120, 0), button2.getLocation());
- assertEquals(new Location(ViewConstants.HPADDING * 3 + 220, 0), button3.getLocation());
- }
-
- @Test
- public void layoutLocationForButtonsGreaterThanMaximumWidth() throws Exception {
- toolbar.doLayout(new Size(250, 100));
- assertEquals(new Location(ViewConstants.HPADDING, 0), button1.getLocation());
- assertEquals(new Location(ViewConstants.HPADDING * 2 + 120, 0), button2.getLocation());
- assertEquals(new Location(ViewConstants.HPADDING, 13), button3.getLocation());
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/util/PropertiesTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/util/PropertiesTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/util/PropertiesTest.java
deleted file mode 100644
index 3e63b34..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/util/PropertiesTest.java
+++ /dev/null
@@ -1,42 +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.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.runtime.userprofile.Options;
-
-public class PropertiesTest {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- @Test
- public void getOptionsCreatesNewOptionsSet() throws Exception {
-
- final Options options = Properties.getOptions("test");
- assertEquals(false, options.names().hasNext());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/view/composite/CompositeViewTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/view/composite/CompositeViewTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/view/composite/CompositeViewTest.java
deleted file mode 100644
index 4c885f2..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/view/composite/CompositeViewTest.java
+++ /dev/null
@@ -1,190 +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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.viewer.dnd.DummyView;
-import org.apache.isis.viewer.dnd.TestToolkit;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.content.NullContent;
-
-public class CompositeViewTest {
-
- private CompositeView view;
- private DummyView component1;
- private int layoutCount;
- private int newBuildCount;
- protected int modifiedBuildCount;
-
- @Before
- public void createView() {
- org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
- TestToolkit.createInstance();
-
- view = new CompositeView(new NullContent(), null) {
- @Override
- protected void buildNewView() {
- newBuildCount++;
- }
-
- @Override
- protected void buildModifiedView() {
- modifiedBuildCount++;
- }
-
- @Override
- protected void buildView() {
- }
-
- @Override
- protected void doLayout(final Size maximumSize) {
- layoutCount++;
- }
-
- @Override
- public Size requiredSize(final Size availableSpace) {
- return null;
- }
- };
- view.setSize(new Size(100, 200));
-
- component1 = new DummyView();
- component1.setupRequiredSize(new Size(100, 20));
- }
-
- @Test
- public void initialLayoutStateIsInvalid() {
- assertTrue(view.isLayoutInvalid());
- }
-
- @Test
- public void layoutStateIsValidAfterLayout() {
- view.layout();
- assertFalse(view.isLayoutInvalid());
- }
-
- @Test
- public void noChangeInSizeLeavesLayoutValid() throws Exception {
- view.layout();
- assertEquals(new Size(100, 200), view.getSize());
- assertFalse(view.isLayoutInvalid());
- }
-
- @Test
- public void changeInSizeInvalidateLayout() throws Exception {
- view.layout();
- view.setSize(new Size(120, 200));
- assertTrue(view.isLayoutInvalid());
- }
-
- @Test
- public void testname() throws Exception {
- assertEquals(0, layoutCount);
- view.layout();
- assertEquals(1, layoutCount);
- }
-
- @Test
- public void testLayoutDoesntGetRepeated() throws Exception {
- view.layout();
- view.layout();
- assertEquals(1, layoutCount);
- }
-
- @Test
- public void testLayoutGetRedoneAfterSizeChanges() throws Exception {
- view.layout();
- view.setSize(new Size(120, 200));
- view.layout();
- assertEquals(2, layoutCount);
- }
-
- @Test
- public void testLayoutGetRedoneAfterNewComponentAdded() throws Exception {
- view.layout();
- view.addView(new DummyView());
- view.layout();
- assertEquals(2, layoutCount);
- }
-
- @Test
- public void testLayoutGetRedoneAfterComponentRemoved() throws Exception {
- view.addView(component1);
- view.layout();
- view.removeView(component1);
- view.layout();
- assertEquals(2, layoutCount);
- }
-
- @Test
- public void testLayoutGetRedoneAfterComponentReplaced() throws Exception {
- view.addView(component1);
- view.layout();
- view.replaceView(component1, new DummyView());
- view.layout();
- assertEquals(2, layoutCount);
- }
-
- @Test
- public void buildNotRepeatedlyCalledWhenNoChangedComponents() throws Exception {
- assertEquals(0, newBuildCount);
- view.getSubviews();
- view.getSubviews();
- assertEquals(1, newBuildCount);
- }
-
- @Test
- public void changesInSizeDontCauseARebuild() throws Exception {
- view.getSubviews();
- view.setSize(new Size(120, 200));
- component1.setSize(new Size(120, 200));
- view.getSubviews();
- assertEquals(1, newBuildCount);
- }
-
- @Test
- public void rebuildAfterContentsInvalidated() throws Exception {
- view.getSubviews();
- view.addView(component1);
- view.invalidateContent();
- view.getSubviews();
- assertEquals(1, newBuildCount);
- assertEquals(1, modifiedBuildCount);
- }
-
- @Test
- public void buildNewWhenNoSubviewsExist() throws Exception {
- view.getSubviews();
- assertEquals(1, newBuildCount);
- }
-
- @Test
- public void buildModifiedWhenSubviewsExist() throws Exception {
- view.addView(component1);
- view.getSubviews();
- assertEquals(1, modifiedBuildCount);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/view/text/CursorPositionTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/view/text/CursorPositionTest.java b/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/view/text/CursorPositionTest.java
deleted file mode 100644
index 240b599..0000000
--- a/component/viewer/dnd/impl/src/test/java/org/apache/isis/viewer/dnd/view/text/CursorPositionTest.java
+++ /dev/null
@@ -1,229 +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.text;
-
-import junit.framework.TestCase;
-
-public class CursorPositionTest extends TestCase {
-
- public static void main(final String[] args) {
- junit.textui.TestRunner.run(CursorPositionTest.class);
- }
-
- private CursorPosition cursor;
-
- private void assertPosition(final int line, final int character, final CursorPosition cursor) {
- assertEquals(line, cursor.getLine());
- assertEquals(character, cursor.getCharacter());
- }
-
- @Override
- protected void setUp() throws Exception {
- final TextFieldContentStub stub = new TextFieldContentStub();
- cursor = new CursorPosition(stub, 12, 3);
- final String text = stub.getText(1);
- assertEquals(35, text.length());
- assertEquals("Now ", text.substring(0, 4));
- assertEquals("is ", text.substring(4, 7));
- assertEquals("the ", text.substring(7, 11));
- assertEquals("winter ", text.substring(11, 18));
- assertEquals("of ", text.substring(18, 21));
- assertEquals("our ", text.substring(21, 25));
- assertEquals("discontent", text.substring(25, 35));
- }
-
- public void testBottom() {
- cursor.bottom();
- assertPosition(15, 35, cursor);
- }
-
- public void testCopy() {
- final CursorPosition copy = new CursorPosition(null, 1, 1);
- copy.asFor(cursor);
- assertPosition(12, 3, copy);
- }
-
- public void testCreate() {
- assertPosition(12, 3, cursor);
- }
-
- public void testEnd() {
- cursor.end();
- assertPosition(12, 35, cursor);
- }
-
- public void testHome() {
- cursor.home();
- assertPosition(12, 0, cursor);
- }
-
- public void testLeft() {
- cursor.left();
- assertPosition(12, 2, cursor);
- cursor.left();
- assertPosition(12, 1, cursor);
- cursor.left();
- assertPosition(12, 0, cursor);
- cursor.left();
- assertPosition(11, 35, cursor);
- }
-
- public void testLeftPastHome() {
- cursor.home();
- cursor.left();
- assertPosition(11, 35, cursor);
- }
-
- public void testLeftPastTop() {
- cursor.top();
- cursor.left();
- assertPosition(0, 0, cursor);
- }
-
- public void testLineDown() {
- cursor.lineDown();
- assertPosition(13, 3, cursor);
- }
-
- public void testLineDownPastBottom() {
- cursor.bottom();
- cursor.lineDown();
- assertPosition(15, 35, cursor);
- }
-
- public void testLineUp() {
- cursor.lineUp();
- assertPosition(11, 3, cursor);
- }
-
- public void testLineUpPastTop() {
- cursor.top();
- cursor.lineUp();
- assertPosition(0, 0, cursor);
- }
-
- public void testPageDown() {
- cursor.pageDown();
- assertPosition(14, 3, cursor);
- cursor.pageDown();
- assertPosition(15, 3, cursor);
- }
-
- public void testRight() {
- cursor.right();
- assertPosition(12, 4, cursor);
- cursor.right();
- assertPosition(12, 5, cursor);
- }
-
- public void testRightPastEnd() {
- cursor.end();
- cursor.right();
- assertPosition(13, 1, cursor);
- cursor.right();
- assertPosition(13, 2, cursor);
- }
-
- public void testRightPastBottom() {
- cursor.bottom();
- cursor.right();
- assertPosition(15, 35, cursor);
- }
-
- public void testRightByNumber() {
- cursor.right(22);
- assertPosition(12, 25, cursor);
- cursor.right(100);
- assertPosition(15, 20, cursor);
- cursor.right(30); // won't move as it would be past end
- assertPosition(15, 20, cursor);
- }
-
- public void testWordLeft() {
- cursor.wordLeft();
- assertPosition(12, 0, cursor);
- cursor.wordLeft();
- assertPosition(11, 25, cursor);
-
- }
-
- public void testWordRight() {
- cursor.wordRight();
- assertPosition(12, 7, cursor);
- cursor.wordRight();
- assertPosition(12, 11, cursor);
- cursor.wordRight();
- assertPosition(12, 18, cursor);
- cursor.wordRight();
- assertPosition(12, 21, cursor);
- cursor.wordRight();
- assertPosition(12, 25, cursor);
- cursor.wordRight();
- assertPosition(13, 0, cursor);
- cursor.wordRight();
- assertPosition(13, 4, cursor);
- cursor.wordRight();
- assertPosition(13, 7, cursor);
- }
-
- public void testSamePostion() {
- CursorPosition other = new CursorPosition(null, 12, 15);
- assertFalse("different character", cursor.samePosition(other));
-
- other = new CursorPosition(null, 7, 3);
- assertFalse("different line", cursor.samePosition(other));
-
- other = new CursorPosition(null, 12, 3);
- assertTrue(cursor.samePosition(other));
- }
-
- public void testPageUp() {
- cursor.pageUp();
- assertPosition(10, 3, cursor);
- cursor.pageUp();
- assertPosition(8, 3, cursor);
- cursor.pageUp();
- assertPosition(6, 3, cursor);
- cursor.pageUp();
- assertPosition(4, 3, cursor);
- cursor.pageUp();
- assertPosition(2, 3, cursor);
- cursor.pageUp();
- assertPosition(0, 3, cursor);
- cursor.pageUp();
- assertPosition(0, 3, cursor);
- }
-
- public void testIsBeforeWhereAtSamePosition() {
- final CursorPosition other = new CursorPosition(null, 12, 3);
- assertFalse(cursor.isBefore(other));
- }
-
- public void testIsBeforeWhere2CharacterAfter() {
- final CursorPosition other = new CursorPosition(null, 12, 5);
- assertTrue(cursor.isBefore(other));
- }
-
- public void testIsBeforeWhere2CharacterBefore() {
- final CursorPosition other = new CursorPosition(null, 12, 1);
- assertFalse(cursor.isBefore(other));
- }
-
-}