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:19 UTC
[18/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/table/ColumnWidthStrategy.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/ColumnWidthStrategy.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/ColumnWidthStrategy.java
deleted file mode 100644
index ddfe959..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/ColumnWidthStrategy.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-public interface ColumnWidthStrategy {
- int getMinimumWidth(int i, ObjectAssociation specification);
-
- int getPreferredWidth(int i, ObjectAssociation specification);
-
- int getMaximumWidth(int i, ObjectAssociation specification);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/DefaultColumnWidthStrategy.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/DefaultColumnWidthStrategy.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/DefaultColumnWidthStrategy.java
deleted file mode 100644
index 5c5c4b5..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/DefaultColumnWidthStrategy.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-public class DefaultColumnWidthStrategy implements ColumnWidthStrategy {
-
- private final int minimum;
- private final int preferred;
- private final int maximum;
-
- public DefaultColumnWidthStrategy() {
- this(18, 70, 250);
- }
-
- public DefaultColumnWidthStrategy(final int minimum, final int preferred, final int maximum) {
- if (minimum <= 0) {
- throw new IllegalArgumentException("minimum width must be greater than zero");
- }
- if (preferred <= minimum || preferred >= maximum) {
- throw new IllegalArgumentException("preferred width must be greater than minimum and less than maximum");
- }
- this.minimum = minimum;
- this.preferred = preferred;
- this.maximum = maximum;
- }
-
- @Override
- public int getMinimumWidth(final int i, final ObjectAssociation specification) {
- return minimum;
- }
-
- @Override
- public int getPreferredWidth(final int i, final ObjectAssociation specification) {
- return preferred;
- }
-
- @Override
- public int getMaximumWidth(final int i, final ObjectAssociation specification) {
- return maximum;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/InternalTableSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/InternalTableSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/InternalTableSpecification.java
deleted file mode 100644
index ffaef29..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/InternalTableSpecification.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import 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.base.Layout;
-import org.apache.isis.viewer.dnd.view.border.ScrollBorder;
-import org.apache.isis.viewer.dnd.view.composite.CompositeViewDecorator;
-import org.apache.isis.viewer.dnd.view.composite.StackLayout;
-import org.apache.isis.viewer.dnd.viewer.basic.TableFocusManager;
-
-public class InternalTableSpecification extends AbstractTableSpecification {
- public InternalTableSpecification() {
- addViewDecorator(new CompositeViewDecorator() {
- @Override
- public View decorate(final View view, final Axes axes) {
- final ScrollBorder scrollingView = new ScrollBorder(view);
- // note - the next call needs to be after the creation of the
- // window border
- // so that it exists when the header is set up
- scrollingView.setTopHeader(new TableHeader(view.getContent(), axes.getAxis(TableAxis.class)));
- scrollingView.setFocusManager(new TableFocusManager(scrollingView));
- return scrollingView;
-
- }
- });
-
- }
-
- @Override
- public Layout createLayout(final Content content, final Axes axes) {
- return new StackLayout();
- }
-
- // TODO remove
- /*
- * @Override public View doCreateView(final View view, final Content
- * content, final ViewAxis axis) { final ScrollBorder scrollingView = new
- * ScrollBorder(view); // note - the next call needs to be after the
- * creation of the window border // so that it exists when the header is set
- * up scrollingView.setTopHeader(new TableHeader(content));
- * scrollingView.setFocusManager(new TableFocusManager(scrollingView));
- * return scrollingView; }
- *
- * protected View decorateView(View view) { super.decorateView(view);
- *
- * final ScrollBorder scrollingView = new ScrollBorder(view); // note - the
- * next call needs to be after the creation of the window border // so that
- * it exists when the header is set up scrollingView.setTopHeader(new
- * TableHeader(view.getContent())); scrollingView.setFocusManager(new
- * TableFocusManager(scrollingView)); return scrollingView; }
- */
- @Override
- public String getName() {
- return "Table";
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableAxis.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableAxis.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableAxis.java
deleted file mode 100644
index 5a5c676..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableAxis.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewAxis;
-
-public interface TableAxis extends ViewAxis {
-
- void ensureOffset(final int offset);
-
- /**
- * Returns the number of the column found at the specificied position,
- * ignoring the columns two borders. Returns 0 for the first column, 1 for
- * second column, etc.
- *
- * If over the column border then returns -1.
- */
- int getColumnAt(final int xPosition);
-
- /**
- * Returns 0 for left side of first column, 1 for right side of first
- * column, 2 for right side of second column, etc.
- *
- * If no column border is identified then returns -1.
- */
- int getColumnBorderAt(final int xPosition);
-
- int getColumnCount();
-
- String getColumnName(final int column);
-
- int getColumnWidth(final int column);
-
- ObjectAssociation getFieldForColumn(final int column);
-
- int getHeaderOffset();
-
- int getLeftEdge(final int resizeColumn);
-
- void invalidateLayout();
-
- void setOffset(final int offset);
-
- void setRoot(final View view);
-
- void setupColumnWidths(final ColumnWidthStrategy strategy);
-
- void setWidth(final int index, final int width);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableAxisImpl.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableAxisImpl.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableAxisImpl.java
deleted file mode 100644
index c9d2854..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableAxisImpl.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.apache.isis.core.commons.util.ToString;
-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.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.collection.CollectionContent;
-
-public class TableAxisImpl implements TableAxis {
- private final List<ObjectAssociation> columns;
- private final String[] columnName;
- private int rowHeaderOffet;
- private View table;
- private final int[] widths;
-
- public TableAxisImpl(final CollectionContent content) {
- // TODO create axis first, then after view built set up the axis
- // details?
- final ObjectSpecification elementSpecification = (content).getElementSpecification();
- final List<ObjectAssociation> accessibleFields = elementSpecification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);
-
- this.columns = tableFields(accessibleFields, content);
- widths = new int[columns.size()];
- columnName = new String[columns.size()];
- for (int i = 0; i < widths.length; i++) {
- columnName[i] = columns.get(i).getName();
- }
-
- // TODO make the setting of the column width strategy external so it can
- // be changed
- setupColumnWidths(new TypeBasedColumnWidthStrategy());
- }
-
- /*
- * public TableAxis(final ObjectAssociation[] columns) { this.columns =
- * columns; widths = new int[columns.length]; columnName = new
- * String[columns.length]; for (int i = 0; i < widths.length; i++) {
- * columnName[i] = columns[i].getName(); } }
- */
- private List<ObjectAssociation> tableFields(final List<ObjectAssociation> viewFields, final CollectionContent content) {
- for (int i = 0; i < viewFields.size(); i++) {
- // final ObjectAssociation objectAssociation = viewFields[i];
- // TODO reinstate check to skip unsuitable types
- /*
- * if (viewFields[i].getSpecification().isOfType(
- * IsisContext.getSpecificationLoader
- * ().loadSpecification(ImageValue.class))) { continue; }
- */
-
- // if
- // (!objectAssociation.isVisible(IsisContext.getAuthenticationSession(),
- // content.getAdapter()).isAllowed()) {
- // continue;
- // }
- // LOG.debug("column " + objectAssociation.getSpecification());
- // if(viewFields[i].getSpecification().isOfType(Isis.getSpecificationLoader().lo));
- }
-
- final List<ObjectAssociation> tableFields = Lists.newArrayList();
- for (int i = 0; i < viewFields.size(); i++) {
- if (!(viewFields.get(i) instanceof OneToManyAssociation)) {
- tableFields.add(viewFields.get(i));
- }
- }
-
- return tableFields;
- }
-
- @Override
- public void ensureOffset(final int offset) {
- rowHeaderOffet = Math.max(rowHeaderOffet, offset + 5);
- }
-
- /**
- * Returns the number of the column found at the specificied position,
- * ignoring the columns two borders. Returns 0 for the first column, 1 for
- * second column, etc.
- *
- * If over the column border then returns -1.
- */
- @Override
- public int getColumnAt(final int xPosition) {
- int edge = getHeaderOffset();
- for (int i = 0, cols = getColumnCount() + 1; i < cols; i++) {
- if (xPosition >= edge - 1 && xPosition <= edge + 1) {
- return -1;
- }
- if (xPosition < edge - 1) {
- return i;
- }
- edge += getColumnWidth(i);
- }
-
- return -1;
- }
-
- /**
- * Returns 0 for left side of first column, 1 for right side of first
- * column, 2 for right side of second column, etc.
- *
- * If no column border is identified then returns -1.
- */
- @Override
- public int getColumnBorderAt(final int xPosition) {
- int edge = getHeaderOffset();
- for (int i = 0, cols = getColumnCount(); i < cols; i++) {
- if (xPosition >= edge - 1 && xPosition <= edge + 1) {
- return i;
- }
- edge += getColumnWidth(i);
- }
- if (xPosition >= edge - 1 && xPosition <= edge + 1) {
- return getColumnCount();
- }
-
- return -1;
- }
-
- @Override
- public int getColumnCount() {
- return columnName.length;
- }
-
- @Override
- public String getColumnName(final int column) {
- return columnName[column];
- }
-
- @Override
- public int getColumnWidth(final int column) {
- return widths[column];
- }
-
- @Override
- public ObjectAssociation getFieldForColumn(final int column) {
- return columns.get(column);
- }
-
- @Override
- public int getHeaderOffset() {
- return rowHeaderOffet;
- }
-
- @Override
- public int getLeftEdge(final int resizeColumn) {
- int width = getHeaderOffset();
- for (int i = 0, cols = getColumnCount(); i < resizeColumn && i < cols; i++) {
- width += getColumnWidth(i);
- }
- return width;
- }
-
- @Override
- public void invalidateLayout() {
- final View[] rows = table.getSubviews();
- for (final View row : rows) {
- row.invalidateLayout();
- }
- table.invalidateLayout();
- }
-
- @Override
- public void setOffset(final int offset) {
- rowHeaderOffet = offset;
- }
-
- @Override
- public void setRoot(final View view) {
- table = view;
- }
-
- @Override
- public void setupColumnWidths(final ColumnWidthStrategy strategy) {
- for (int i = 0; i < widths.length; i++) {
- widths[i] = strategy.getPreferredWidth(i, columns.get(i));
- }
- }
-
- @Override
- public void setWidth(final int index, final int width) {
- widths[index] = width;
- }
-
- @Override
- public String toString() {
- final ToString str = new ToString(this);
- str.append("columns", columnName.length);
- str.append("header offset", rowHeaderOffet);
- str.append("table", table);
- return str.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java
deleted file mode 100644
index eb65a03..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.ensure.Assert;
-import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.progmodel.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.progmodel.facets.value.image.ImageValueFacet;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.dnd.field.CheckboxField;
-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.ObjectContent;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.base.BlankView;
-import org.apache.isis.viewer.dnd.view.base.FieldErrorView;
-import org.apache.isis.viewer.dnd.view.composite.AbstractViewBuilder;
-import org.apache.isis.viewer.dnd.view.content.TextParseableContent;
-import org.apache.isis.viewer.dnd.view.field.OneToOneFieldImpl;
-import org.apache.isis.viewer.dnd.view.field.TextParseableFieldImpl;
-import org.apache.isis.viewer.dnd.viewer.basic.UnlinedTextFieldSpecification;
-
-class TableCellBuilder extends AbstractViewBuilder {
- private static final Logger LOG = LoggerFactory.getLogger(TableCellBuilder.class);
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ALL_TABLES) will indeed be hidden from all tables
- // but will be shown (perhaps incorrectly) if annotated with Where.PARENTED_TABLE
- // or Where.STANDALONE_TABLE
- private final Where where = Where.ALL_TABLES;
-
-
- private void addField(final View view, final Axes axes, final ObjectAdapter object, final ObjectAssociation field) {
- final ObjectAdapter value = field.get(object);
- View fieldView;
- fieldView = createFieldView(view, axes, object, field, value);
- if (fieldView != null) {
- view.addView(decorateSubview(axes, fieldView));
- } else {
- view.addView(new FieldErrorView("No field for " + value));
- }
- }
-
- @Override
- public void build(final View view, final Axes axes) {
- Assert.assertEquals("ensure the view is complete decorated view", view.getView(), view);
-
- final Content content = view.getContent();
- final ObjectAdapter object = ((ObjectContent) content).getObject();
-
- if (view.getSubviews().length == 0) {
- initialBuild(object, view, axes);
- } else {
- updateBuild(object, view, axes);
- }
- }
-
- private void updateBuild(final ObjectAdapter object, final View view, final Axes axes) {
- final TableAxis viewAxis = axes.getAxis(TableAxis.class);
-
- LOG.debug("update view " + view + " for " + object);
- final View[] subviews = view.getSubviews();
- final ObjectSpecification spec = object.getSpecification();
- for (int i = 0; i < subviews.length; i++) {
- final ObjectAssociation field = fieldFromActualSpec(spec, viewAxis.getFieldForColumn(i));
- final View subview = subviews[i];
- final ObjectAdapter value = field.get(object);
-
- // 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 visiblityChange = !field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() ^ (subview instanceof BlankView);
- final ObjectAdapter adapter = subview.getContent().getAdapter();
- final boolean valueChange = value != null && value.getObject() != null && !value.getObject().equals(adapter.getObject());
-
- if (visiblityChange || valueChange) {
- final View fieldView = createFieldView(view, axes, object, field, value);
- view.replaceView(subview, decorateSubview(axes, fieldView));
- }
- subview.refresh();
- } else if (field.isOneToOneAssociation()) {
- final ObjectAdapter existing = ((ObjectContent) subviews[i].getContent()).getObject();
- final boolean changedValue = value != existing;
- if (changedValue) {
- View fieldView;
- fieldView = createFieldView(view, axes, object, field, value);
- if (fieldView != null) {
- view.replaceView(subview, decorateSubview(axes, fieldView));
- } else {
- view.addView(new FieldErrorView("No field for " + value));
- }
- }
- }
- }
- }
-
- private ObjectAssociation fieldFromActualSpec(final ObjectSpecification spec, final ObjectAssociation field) {
- final String fieldName = field.getId();
- return spec.getAssociation(fieldName);
- }
-
- private void initialBuild(final ObjectAdapter object, final View view, final Axes axes) {
- final TableAxis viewAxis = axes.getAxis(TableAxis.class);
- LOG.debug("build view " + view + " for " + object);
- final int len = viewAxis.getColumnCount();
- final ObjectSpecification spec = object.getSpecification();
- for (int f = 0; f < len; f++) {
- if (f > 3) {
- continue;
- }
- final ObjectAssociation field = fieldFromActualSpec(spec, viewAxis.getFieldForColumn(f));
- addField(view, axes, object, field);
- }
- }
-
- private View createFieldView(final View view, final Axes axes, final ObjectAdapter object, final ObjectAssociation field, final ObjectAdapter value) {
- if (field == null) {
- throw new NullPointerException();
- }
- final GlobalViewFactory factory = Toolkit.getViewFactory();
- ViewSpecification cellSpec;
- Content content;
- if (field instanceof OneToManyAssociation) {
- throw new UnexpectedCallException("no collections allowed");
- } else if (field instanceof OneToOneAssociation) {
-
- final ObjectSpecification fieldSpecification = field.getSpecification();
- if (fieldSpecification.isParseable()) {
- content = new TextParseableFieldImpl(object, value, (OneToOneAssociation) field);
- // REVIEW how do we deal with IMAGES?
- if (content.getAdapter() instanceof ImageValueFacet) {
- return new BlankView(content);
- }
-
- if (!field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
- return new BlankView(content);
- }
- if (((TextParseableContent) content).getNoLines() > 0) {
- /*
- * TODO remove this after introducing constraints into view
- * specs that allow the parent view to specify what kind of
- * subviews it can deal
- */
-
- if (fieldSpecification.containsFacet(BooleanValueFacet.class)) {
- cellSpec = new CheckboxField.Specification();
- } else {
- cellSpec = new UnlinedTextFieldSpecification();
- }
- } else {
- return factory.createView(new ViewRequirement(content, ViewRequirement.CLOSED));
- }
- } else {
- content = new OneToOneFieldImpl(object, value, (OneToOneAssociation) field);
-
- if (!field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
- return new BlankView(content);
- }
- return factory.createView(new ViewRequirement(content, ViewRequirement.CLOSED | ViewRequirement.SUBVIEW));
-
- }
-
- } else {
- throw new UnknownTypeException(field);
- }
-
- return cellSpec.createView(content, axes, -1);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableHeader.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableHeader.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableHeader.java
deleted file mode 100644
index 14d66cc..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableHeader.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.Color;
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Shape;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.view.Click;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.DragEvent;
-import org.apache.isis.viewer.dnd.view.DragStart;
-import org.apache.isis.viewer.dnd.view.InternalDrag;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewAreaType;
-import org.apache.isis.viewer.dnd.view.ViewConstants;
-import org.apache.isis.viewer.dnd.view.base.AbstractView;
-import org.apache.isis.viewer.dnd.view.border.ResizeDrag;
-import org.apache.isis.viewer.dnd.view.collection.CollectionContent;
-
-public class TableHeader extends AbstractView {
- private final TableAxis axis;
- private final int height;
- private int resizeColumn;
-
- public TableHeader(final Content content, final TableAxis axis) {
- super(content, null);
- this.axis = axis;
- height = ViewConstants.VPADDING + Toolkit.getText(ColorsAndFonts.TEXT_LABEL).getTextHeight() + ViewConstants.VPADDING;
- }
-
- @Override
- public void firstClick(final Click click) {
- if (click.getLocation().getY() <= height) {
- final int column = axis.getColumnAt(click.getLocation().getX()) - 1;
- if (column == -2) {
- super.firstClick(click);
- } else if (column == -1) {
- ((CollectionContent) getContent()).setOrderByElement();
- invalidateContent();
- } else {
- final ObjectAssociation field = axis.getFieldForColumn(column);
- ((CollectionContent) getContent()).setOrderByField(field);
- invalidateContent();
- }
- } else {
- super.firstClick(click);
- }
- }
-
- @Override
- public void invalidateContent() {
- getParent().invalidateContent();
- }
-
- @Override
- public Size getRequiredSize(final Size availableSpace) {
- return new Size(-1, height);
- }
-
- @Override
- public DragEvent dragStart(final DragStart drag) {
- if (isOverColumnBorder(drag.getLocation())) {
- resizeColumn = axis.getColumnBorderAt(drag.getLocation().getX());
- final Bounds resizeArea = new Bounds(getView().getAbsoluteLocation(), getSize());
- resizeArea.translate(getView().getPadding().getLeft(), getView().getPadding().getTop());
- if (resizeColumn == 0) {
- resizeArea.setWidth(axis.getHeaderOffset());
- } else {
- resizeArea.translate(axis.getLeftEdge(resizeColumn - 1), 0);
- resizeArea.setWidth(axis.getColumnWidth(resizeColumn - 1));
- }
-
- final Size minimumSize = new Size(70, 0);
- return new ResizeDrag(this, resizeArea, ResizeDrag.RIGHT, minimumSize, null);
- } else if (drag.getLocation().getY() <= height) {
- return null;
- } else {
- return super.dragStart(drag);
- }
- }
-
- @Override
- public void dragTo(final InternalDrag drag) {
- if (drag.getOverlay() == null) {
- throw new IsisException("No overlay for drag: " + drag);
- }
- int newWidth = drag.getOverlay().getSize().getWidth();
- newWidth = Math.max(70, newWidth);
- getViewManager().getSpy().addAction("Resize column to " + newWidth);
-
- if (resizeColumn == 0) {
- axis.setOffset(newWidth);
- } else {
- axis.setWidth(resizeColumn - 1, newWidth);
- }
- axis.invalidateLayout();
- }
-
- @Override
- public void draw(final Canvas canvas) {
- super.draw(canvas.createSubcanvas());
-
- final int y = ViewConstants.VPADDING + Toolkit.getText(ColorsAndFonts.TEXT_LABEL).getAscent();
-
- int x = axis.getHeaderOffset() - 2;
-
- if (((CollectionContent) getContent()).getOrderByElement()) {
- drawOrderIndicator(canvas, axis, x - 10);
- }
-
- final Color secondary1 = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY1);
- canvas.drawLine(0, 0, getSize().getWidth() - 1, 0, secondary1);
- canvas.drawLine(0, height - 1, getSize().getWidth() - 1, height - 1, secondary1);
- canvas.drawLine(x, 0, x, getSize().getHeight() - 1, secondary1);
- x++;
- final int columns = axis.getColumnCount();
- final ObjectAssociation fieldSortOrder = ((CollectionContent) getContent()).getFieldSortOrder();
- for (int i = 0; i < columns; i++) {
- if (fieldSortOrder == axis.getFieldForColumn(i)) {
- drawOrderIndicator(canvas, axis, x + axis.getColumnWidth(i) - 10);
- }
-
- canvas.drawLine(0, 0, 0, getSize().getHeight() - 1, secondary1);
- canvas.drawLine(x, 0, x, getSize().getHeight() - 1, secondary1);
- final Canvas headerCanvas = canvas.createSubcanvas(x, 0, axis.getColumnWidth(i) - 1, height);
- headerCanvas.drawText(axis.getColumnName(i), ViewConstants.HPADDING, y, secondary1, Toolkit.getText(ColorsAndFonts.TEXT_LABEL));
- x += axis.getColumnWidth(i);
- }
- // Color secondary2 = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2);
- // canvas.drawLine(x, 0, x, getSize().getHeight() - 1, secondary2);
- // canvas.drawRectangle(0, height, getSize().getWidth() - 1,
- // getSize().getHeight() - height - 1, secondary2);
- }
-
- private void drawOrderIndicator(final Canvas canvas, final TableAxis axis, final int x) {
- Shape arrow;
- arrow = new Shape();
- if (((CollectionContent) getContent()).getReverseSortOrder()) {
- arrow.addPoint(0, 7);
- arrow.addPoint(3, 0);
- arrow.addPoint(6, 7);
- } else {
- arrow.addPoint(0, 0);
- arrow.addPoint(6, 0);
- arrow.addPoint(3, 7);
- }
- // canvas.drawRectangle(x + axis.getColumnWidth(i) - 10, 3, 7, 8,
- // Toolkit.getColor("secondary3"));
- canvas.drawShape(arrow, x, 3, Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2));
- }
-
- @Override
- public View identify(final Location location) {
- getViewManager().getSpy().addTrace("Identify over column " + location);
- if (isOverColumnBorder(location)) {
- getViewManager().getSpy().addAction("Identified over column ");
- return getView();
- }
- return super.identify(location);
- }
-
- private boolean isOverColumnBorder(final Location at) {
- final int x = at.getX();
- return axis.getColumnBorderAt(x) >= 0;
- }
-
- @Override
- public void mouseMoved(final Location at) {
- if (isOverColumnBorder(at)) {
- getFeedbackManager().showResizeRightCursor();
- } else {
- super.mouseMoved(at);
- getFeedbackManager().showDefaultCursor();
- }
- }
-
- @Override
- public void secondClick(final Click click) {
- if (isOverColumnBorder(click.getLocation())) {
- final int column = axis.getColumnBorderAt(click.getLocation().getX()) - 1;
- if (column == -1) {
- final View[] subviews = getSubviews();
- for (final View row : subviews) {
- axis.ensureOffset(((TableRowBorder) row).requiredTitleWidth());
- }
-
- } else {
- final View[] subviews = getSubviews();
- int max = 0;
- for (final View row : subviews) {
- final View cell = row.getSubviews()[column];
- max = Math.max(max, cell.getRequiredSize(new Size()).getWidth());
- }
- axis.setWidth(column, max);
- }
- axis.invalidateLayout();
- } else {
- super.secondClick(click);
- }
- }
-
- @Override
- public String toString() {
- return "TableHeader";
- }
-
- @Override
- public ViewAreaType viewAreaType(final Location at) {
- final int x = at.getX();
-
- if (axis.getColumnBorderAt(x) >= 0) {
- return ViewAreaType.INTERNAL;
- } else {
- return super.viewAreaType(at);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowBorder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowBorder.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowBorder.java
deleted file mode 100644
index 05810c1..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowBorder.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import 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.Location;
-import org.apache.isis.viewer.dnd.drawing.Offset;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.interaction.ViewDragImpl;
-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.DragEvent;
-import org.apache.isis.viewer.dnd.view.DragStart;
-import org.apache.isis.viewer.dnd.view.Placement;
-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.ViewAreaType;
-import org.apache.isis.viewer.dnd.view.ViewAxis;
-import org.apache.isis.viewer.dnd.view.ViewConstants;
-import org.apache.isis.viewer.dnd.view.base.AbstractBorder;
-import org.apache.isis.viewer.dnd.view.base.DragViewOutline;
-import org.apache.isis.viewer.dnd.view.base.IconGraphic;
-import org.apache.isis.viewer.dnd.view.collection.CollectionContent;
-import org.apache.isis.viewer.dnd.view.text.ObjectTitleText;
-import org.apache.isis.viewer.dnd.view.text.TitleText;
-
-// REVIEW can we use ObjectBorder to provide the basic functionality
-public class TableRowBorder extends AbstractBorder {
- public static class Factory implements SubviewDecorator {
- @Override
- public ViewAxis createAxis(final Content content) {
- final TableAxis axis = new TableAxisImpl((CollectionContent) content);
- return axis;
- }
-
- @Override
- public View decorate(final Axes axes, final View view) {
- return new TableRowBorder(axes, view);
- }
- }
-
- private static final int BORDER = 13;
-
- private final int baseline;
- private final IconGraphic icon;
- private final TitleText title;
-
- private final TableAxis axis;
-
- public TableRowBorder(final Axes axes, final View wrappedRow) {
- super(wrappedRow);
-
- final Text text = Toolkit.getText(ColorsAndFonts.TEXT_NORMAL);
- icon = new IconGraphic(this, text);
- title = new ObjectTitleText(this, text);
- baseline = icon.getBaseline();
-
- left = requiredTitleWidth() + BORDER;
-
- axis = axes.getAxis(TableAxis.class);
- axis.ensureOffset(left);
- }
-
- @Override
- public void debugDetails(final DebugBuilder debug) {
- debug.appendln("RowBorder " + left + " pixels");
- debug.appendln("Axis", axis);
- }
-
- @Override
- public DragEvent dragStart(final DragStart drag) {
- final int x = drag.getLocation().getX();
- final int left = axis.getHeaderOffset();
- ;
- if (x < left - BORDER) {
- return Toolkit.getViewFactory().createDragContentOutline(this, drag.getLocation());
- } else if (x < left) {
- final View dragOverlay = new DragViewOutline(getView());
- return new ViewDragImpl(this, new Offset(drag.getLocation()), dragOverlay);
- } else {
- return super.dragStart(drag);
- }
- }
-
- @Override
- public void draw(final Canvas canvas) {
- final int baseline = getBaseline();
-
- final int width = axis.getHeaderOffset();
- final Size s = getSize();
- final Canvas subcanvas = canvas.createSubcanvas(0, 0, width, s.getHeight());
- int offset = ViewConstants.HPADDING;
- icon.draw(subcanvas, offset, baseline);
- offset += icon.getSize().getWidth() + ViewConstants.HPADDING + 0 + ViewConstants.HPADDING;
- title.draw(subcanvas, offset, baseline, getLeft() - offset);
-
- final int columns = axis.getColumnCount();
- int x = -1;
- x += axis.getHeaderOffset();
- final Color secondary1 = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY1);
- canvas.drawLine(x - 1, 0, x - 1, s.getHeight() - 1, secondary1);
- canvas.drawLine(x, 0, x, s.getHeight() - 1, secondary1);
- for (int i = 0; i < columns; i++) {
- x += axis.getColumnWidth(i);
- canvas.drawLine(x, 0, x, s.getHeight() - 1, secondary1);
- }
- canvas.drawLine(0, 0, 0, s.getHeight() - 1, secondary1);
-
- final int y = s.getHeight() - 1;
- final Color secondary2 = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2);
- canvas.drawLine(0, y, s.getWidth(), y, secondary2);
-
- if (getState().isObjectIdentified()) {
- final int xExtent = width - 1;
- canvas.drawLine(xExtent - BORDER, top, xExtent - BORDER, top + s.getHeight() - 1, secondary2);
- canvas.drawSolidRectangle(xExtent - BORDER + 1, top, BORDER - 2, s.getHeight() - 2 * top - 1, Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3));
- }
-
- // components
- super.draw(canvas);
- }
-
- @Override
- public int getBaseline() {
- return baseline;
- }
-
- @Override
- protected int getLeft() {
- return axis.getHeaderOffset();
- }
-
- protected int requiredTitleWidth() {
- return ViewConstants.HPADDING + icon.getSize().getWidth() + ViewConstants.HPADDING + title.getSize().getWidth() + ViewConstants.HPADDING;
- }
-
- @Override
- public void entered() {
- getState().setContentIdentified();
- getState().setViewIdentified();
- wrappedView.entered();
- markDamaged();
- }
-
- @Override
- public void exited() {
- getState().clearObjectIdentified();
- getState().clearViewIdentified();
- wrappedView.exited();
- markDamaged();
- }
-
- @Override
- public void secondClick(final Click click) {
- final int left = axis.getHeaderOffset();
- ;
- final int x = click.getLocation().getX();
- if (x <= left) {
- final Location location = getAbsoluteLocation();
- location.translate(click.getLocation());
- getWorkspace().objectActionResult(getContent().getAdapter(), new Placement(this));
- } else {
- super.secondClick(click);
- }
- }
-
- @Override
- public String toString() {
- return "RowBorder/" + wrappedView;
- }
-
- @Override
- public ViewAreaType viewAreaType(final Location mouseLocation) {
- if (mouseLocation.getX() <= left) {
- return ViewAreaType.CONTENT;
- } else if (mouseLocation.getX() >= getSize().getWidth() - right) {
- return ViewAreaType.VIEW;
- } else {
- return super.viewAreaType(mouseLocation);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowLayout.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowLayout.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowLayout.java
deleted file mode 100644
index 9c4d26a..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowLayout.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-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;
-
-public class TableRowLayout implements Layout {
- private final TableAxis axis;
-
- public TableRowLayout(final TableAxis axis) {
- this.axis = axis;
- }
-
- @Override
- public Size getRequiredSize(final View row) {
- int maxHeight = 0;
- int totalWidth = 0;
- final View[] cells = row.getSubviews();
- final int maxBaseline = maxBaseline(cells);
-
- for (int i = 0; i < cells.length; i++) {
- totalWidth += axis.getColumnWidth(i);
-
- final Size s = cells[i].getRequiredSize(Size.createMax());// TODO
- // Need to
- // pass in
- // a max
- // size
- // (is 0
- // at the
- // moment)
- final int b = cells[i].getBaseline();
- final int baselineOffset = Math.max(0, maxBaseline - b);
- maxHeight = Math.max(maxHeight, s.getHeight() + baselineOffset);
- }
-
- return new Size(totalWidth, maxHeight);
- }
-
- @Override
- public void layout(final View row, final Size maximumSize) {
- final View[] cells = row.getSubviews();
- final int maxBaseline = maxBaseline(cells);
-
- int x = 0;
- for (int i = 0; i < cells.length; i++) {
- final View cell = cells[i];
- final Size s = cell.getRequiredSize(Size.createMax()); // TODO Need
- // to pass in
- // a max size
- // (is 0 at
- // the
- // moment)
- s.setWidth(axis.getColumnWidth(i));
- cell.setSize(s);
-
- final int b = cell.getBaseline();
- final int baselineOffset = Math.max(0, maxBaseline - b);
- cell.setLocation(new Location(x, baselineOffset));
-
- x += s.getWidth();
- }
- }
-
- private int maxBaseline(final View[] cells) {
- int maxBaseline = 0;
- for (final View cell : cells) {
- maxBaseline = Math.max(maxBaseline, cell.getBaseline());
- }
- return maxBaseline;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowSpecification.java
deleted file mode 100644
index 3e1ea41..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TableRowSpecification.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.table;
-
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.base.Layout;
-import org.apache.isis.viewer.dnd.view.composite.CompositeViewSpecification;
-
-public class TableRowSpecification extends CompositeViewSpecification {
- public TableRowSpecification() {
- builder = new TableCellBuilder();
- }
-
- @Override
- public Layout createLayout(final Content content, final Axes axes) {
- return new TableRowLayout(axes.getAxis(TableAxis.class));
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return requirement.isObject();
- }
-
- @Override
- public String getName() {
- return "Table Row";
- }
-
- @Override
- public boolean isReplaceable() {
- return false;
- }
-
- @Override
- public boolean isSubView() {
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TypeBasedColumnWidthStrategy.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TypeBasedColumnWidthStrategy.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TypeBasedColumnWidthStrategy.java
deleted file mode 100644
index 29cb6a5..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/TypeBasedColumnWidthStrategy.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import java.util.Hashtable;
-
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-public class TypeBasedColumnWidthStrategy implements ColumnWidthStrategy {
- private final Hashtable<ObjectSpecification, Integer> types = new Hashtable<ObjectSpecification, Integer>();
-
- public TypeBasedColumnWidthStrategy() {
- /*
- * ObjectSpecificationLoader loader = Isis.getSpecificationLoader();
- * addWidth(loader.loadSpecification(Logical.class), 25);
- * addWidth(loader.loadSpecification(Date.class), 65);
- * addWidth(loader.loadSpecification(Time.class), 38);
- * addWidth(loader.loadSpecification(DateTime.class), 100);
- * addWidth(loader.loadSpecification(TextString.class), 80);
- */
- }
-
- public void addWidth(final ObjectSpecification specification, final int width) {
- types.put(specification, new Integer(width));
- }
-
- @Override
- public int getMaximumWidth(final int i, final ObjectAssociation specification) {
- return 0;
- }
-
- @Override
- public int getMinimumWidth(final int i, final ObjectAssociation specification) {
- return 15;
- }
-
- // TODO improve the width determination
- @Override
- public int getPreferredWidth(final int i, final ObjectAssociation specification) {
- final ObjectSpecification type = specification.getSpecification();
- if (type == null) {
- return 200;
- }
- final Integer t = types.get(type);
- if (t != null) {
- return t.intValue();
- } else if (type.isNotCollection()) {
- return 120;
- } else {
- return 100;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/WindowTableSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/WindowTableSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/WindowTableSpecification.java
deleted file mode 100644
index 94a4d08..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/table/WindowTableSpecification.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.table;
-
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.border.ScrollBorder;
-import org.apache.isis.viewer.dnd.view.composite.CompositeViewDecorator;
-import org.apache.isis.viewer.dnd.viewer.basic.TableFocusManager;
-
-public class WindowTableSpecification extends AbstractTableSpecification {
- public WindowTableSpecification() {
- addViewDecorator(new CompositeViewDecorator() {
- @Override
- public View decorate(final View view, final Axes axes) {
- final ScrollBorder scrollingView = new ScrollBorder(view);
- final View viewWithWindowBorder = scrollingView;
- // note - the next call needs to be after the creation of the
- // window border so
- // that it exists when the header is set up
- scrollingView.setTopHeader(new TableHeader(view.getContent(), axes.getAxis(TableAxis.class)));
- viewWithWindowBorder.setFocusManager(new TableFocusManager(viewWithWindowBorder));
- return viewWithWindowBorder;
- }
- });
-
- }
-
- /*
- * @Override public View doCreateView(final View view, final Content
- * content, final ViewAxis axis) { if (true) return view;
- *
- * final ScrollBorder scrollingView = new ScrollBorder(view); View
- * viewWithWindowBorder = scrollingView; // note - the next call needs to be
- * after the creation of the window border so // that it exists when the
- * header is set up scrollingView.setTopHeader(new TableHeader(content,
- * view.getViewAxisForChildren())); viewWithWindowBorder.setFocusManager(new
- * TableFocusManager(viewWithWindowBorder)); return viewWithWindowBorder; }
- *
- * protected View decorateView(View view) { super.decorateView(view);
- *
- * final ScrollBorder scrollingView = new ScrollBorder(view); View
- * viewWithWindowBorder = scrollingView; // note - the next call needs to be
- * after the creation of the window border so // that it exists when the
- * header is set up scrollingView.setTopHeader(new
- * TableHeader(view.getContent(), view.getViewAxisForChildren()));
- * viewWithWindowBorder.setFocusManager(new
- * TableFocusManager(viewWithWindowBorder)); return viewWithWindowBorder; }
- */
- @Override
- public String getName() {
- return "Table";
- }
-
- @Override
- public boolean isReplaceable() {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/toolbar/ToolbarView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/toolbar/ToolbarView.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/toolbar/ToolbarView.java
deleted file mode 100644
index ad1b393..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/toolbar/ToolbarView.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.toolbar;
-
-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.ViewConstants;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.composite.CompositeView;
-
-public class ToolbarView extends CompositeView {
-
- public ToolbarView(final Content content, final ViewSpecification specification) {
- super(content, specification);
- }
-
- @Override
- protected void buildView() {
- }
-
- @Override
- protected void doLayout(final Size maximumSize) {
- int x = ViewConstants.HPADDING;
- int y = 0;
- int lineHeight = 0;
- for (final View button : getSubviews()) {
- final Size buttonSize = button.getRequiredSize(Size.createMax());
- if (x + buttonSize.getWidth() >= maximumSize.getWidth()) {
- x = ViewConstants.HPADDING;
- y += lineHeight + ViewConstants.VPADDING;
- lineHeight = 0;
- }
- button.setSize(buttonSize);
- button.setLocation(new Location(x, y));
- x += buttonSize.getWidth() + ViewConstants.HPADDING;
- lineHeight = Math.max(lineHeight, buttonSize.getHeight());
- }
- }
-
- @Override
- public Size requiredSize(final Size availableSpace) {
- int lineHeight = 0;
- int lineWidth = ViewConstants.HPADDING;
- final Size requiredSize = new Size();
- for (final View button : getSubviews()) {
- final Size buttonSize = button.getRequiredSize(availableSpace);
- lineWidth += buttonSize.getWidth() + ViewConstants.HPADDING;
- if (lineWidth >= availableSpace.getWidth()) {
- lineWidth = ViewConstants.HPADDING;
- requiredSize.extendHeight(lineHeight + ViewConstants.VPADDING);
- lineHeight = 0;
- }
- lineHeight = Math.max(lineHeight, buttonSize.getHeight());
- requiredSize.ensureWidth(lineWidth);
- }
- requiredSize.extendHeight(lineHeight + ViewConstants.VPADDING);
- return requiredSize;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedCollectionNodeSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedCollectionNodeSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedCollectionNodeSpecification.java
deleted file mode 100644
index 152ea53..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedCollectionNodeSpecification.java
+++ /dev/null
@@ -1,65 +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.tree;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetUtils;
-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.collection.CollectionContent;
-
-/**
- * Specification for a tree node that will display a closed collection as a root
- * node or within an object.
- *
- * @see org.apache.isis.viewer.dnd.tree.OpenCollectionNodeSpecification for
- * displaying an open collection within an object.
- */
-public class ClosedCollectionNodeSpecification extends NodeSpecification {
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return requirement.isCollection() && requirement.hasReference();
- }
-
- @Override
- public int canOpen(final Content content) {
- final ObjectAdapter collection = ((CollectionContent) content).getCollection();
- if (collection.isGhost()) {
- return UNKNOWN;
- } else {
- final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
- return facet.size(collection) > 0 ? CAN_OPEN : CANT_OPEN;
- }
- }
-
- @Override
- protected View createNodeView(final Content content, final Axes axes) {
- final View treeLeafNode = new LeafNodeView(content, this);
- return treeLeafNode;
- }
-
- @Override
- public String getName() {
- return "Collection tree node - closed";
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedObjectNodeSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedObjectNodeSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedObjectNodeSpecification.java
deleted file mode 100644
index 4a59069..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedObjectNodeSpecification.java
+++ /dev/null
@@ -1,97 +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.tree;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.bounded.ChoicesFacetUtils;
-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.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.border.SelectObjectBorder;
-
-/**
- * Specification for a tree node that will display a closed object as a root
- * node or within an object. This will indicate that the created view can be
- * opened if: one of it fields is a collection; it is set up to show objects
- * within objects and one of the fields is an object but it is not a lookup.
- *
- * @see org.apache.isis.viewer.dnd.tree.OpenObjectNodeSpecification for
- * displaying an open collection as part of an object.
- */
-class ClosedObjectNodeSpecification extends NodeSpecification {
- private final boolean showObjectContents;
- private final SubviewDecorator decorator = new SelectObjectBorder.Factory();
-
- // 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
- private final Where where = Where.ANYWHERE;
-
- public ClosedObjectNodeSpecification(final boolean showObjectContents) {
- this.showObjectContents = showObjectContents;
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return requirement.isObject() && requirement.hasReference();
- }
-
- @Override
- public int canOpen(final Content content) {
- final ObjectAdapter object = ((ObjectContent) content).getObject();
- final List<ObjectAssociation> fields = object.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object, where));
- for (int i = 0; i < fields.size(); i++) {
- if (fields.get(i).isOneToManyAssociation()) {
- return CAN_OPEN;
- }
-
- // TODO: rather than looking for the ChoicesFacet on the type,
- // should look for the appropriate PropertyChoicesFacet, ActionParameterChoicesFacet or
- // PropertyAutoCompleteFacet or ActionParameterAutoCompleteFacet
- if (showObjectContents && fields.get(i).isOneToOneAssociation() && !(ChoicesFacetUtils.hasChoices(object.getSpecification()))) {
- return CAN_OPEN;
- }
- }
- return CANT_OPEN;
- }
-
- @Override
- protected View createNodeView(final Content content, final Axes axes) {
- View treeLeafNode = new LeafNodeView(content, this);
- treeLeafNode = decorator.decorate(axes, treeLeafNode);
- return treeLeafNode;
- }
-
- @Override
- public String getName() {
- return "Object tree node - closed";
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/CompositeNodeSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/CompositeNodeSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/CompositeNodeSpecification.java
deleted file mode 100644
index d824cbf..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/CompositeNodeSpecification.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.tree;
-
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.CompositeViewSpecification;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.base.Layout;
-import org.apache.isis.viewer.dnd.view.composite.CompositeViewUsingBuilder;
-import org.apache.isis.viewer.dnd.view.composite.ViewBuilder;
-
-public abstract class CompositeNodeSpecification extends NodeSpecification implements CompositeViewSpecification {
- protected ViewBuilder builder;
- private NodeSpecification collectionLeafNodeSpecification;
- private NodeSpecification objectLeafNodeSpecification;
-
- public void setCollectionSubNodeSpecification(final NodeSpecification collectionLeafNodeSpecification) {
- this.collectionLeafNodeSpecification = collectionLeafNodeSpecification;
- }
-
- public void setObjectSubNodeSpecification(final NodeSpecification objectLeafNodeSpecification) {
- this.objectLeafNodeSpecification = objectLeafNodeSpecification;
- }
-
- public void createAxes(final Content content, final Axes axes) {
- }
-
- @Override
- protected View createNodeView(final Content content, final Axes axes) {
- final CompositeViewUsingBuilder view = new CompositeViewUsingBuilder(content, this, axes, createLayout(content, axes), builder);
- return view;
- }
-
- protected abstract Layout createLayout(Content content, Axes axes);
-
- /*
- * public View createView(final Content content, Axes axes, int fieldNumber)
- * { ViewRequirement requirement = new ViewRequirement(content,
- * ViewRequirement.CLOSED); if
- * (collectionLeafNodeSpecification.canDisplay(content, requirement )) {
- * return collectionLeafNodeSpecification.createView(content, axes, -1); }
- *
- * if (objectLeafNodeSpecification.canDisplay(content, requirement)) {
- * return objectLeafNodeSpecification.createView(content, axes, -1); }
- *
- * return null; }
- */
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/EmptyNodeSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/EmptyNodeSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/EmptyNodeSpecification.java
deleted file mode 100644
index 98349b5..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/EmptyNodeSpecification.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.dnd.tree;
-
-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;
-
-/**
- * A simple specification that always returns false when asked if it can display
- * any content.
- *
- * @see #canDisplay(ViewRequirement)
- */
-public class EmptyNodeSpecification extends NodeSpecification {
-
- @Override
- public int canOpen(final Content content) {
- return CANT_OPEN;
- }
-
- @Override
- protected View createNodeView(final Content content, final Axes axes) {
- return null;
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return false;
- }
-
- @Override
- public String getName() {
- return "Empty tree node";
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/LeafNodeView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/LeafNodeView.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/LeafNodeView.java
deleted file mode 100644
index f461111..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/LeafNodeView.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.tree;
-
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.FocusManager;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.base.ObjectView;
-
-class LeafNodeView extends ObjectView {
-
- private FocusManager focusManager;
-
- public LeafNodeView(final Content content, final ViewSpecification design) {
- super(content, design);
- }
-
- @Override
- public FocusManager getFocusManager() {
- return focusManager;
- }
-
- @Override
- public void setFocusManager(final FocusManager focusManager) {
- this.focusManager = focusManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ListWithDetailSpecification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ListWithDetailSpecification.java b/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ListWithDetailSpecification.java
deleted file mode 100644
index 2fdb08c..0000000
--- a/mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/tree/ListWithDetailSpecification.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.tree;
-
-import org.apache.isis.viewer.dnd.list.SimpleListSpecification;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.Content;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.border.SelectObjectBorder;
-import org.apache.isis.viewer.dnd.view.composite.MasterDetailPanel;
-
-public class ListWithDetailSpecification implements ViewSpecification {
- private final SimpleListSpecification leftHandSideSpecification;
-
- public ListWithDetailSpecification() {
- leftHandSideSpecification = new SimpleListSpecification();
- leftHandSideSpecification.addSubviewDecorator(new SelectObjectBorder.Factory());
- }
-
- @Override
- public boolean canDisplay(final ViewRequirement requirement) {
- return requirement.isCollection() && requirement.isOpen();
- }
-
- @Override
- public View createView(final Content content, final Axes axes, final int sequence) {
- return new MasterDetailPanel(content, this, leftHandSideSpecification);
- }
-
- @Override
- public String getName() {
- return "List and details";
- }
-
- @Override
- public boolean isAligned() {
- return false;
- }
-
- @Override
- public boolean isOpen() {
- return true;
- }
-
- @Override
- public boolean isReplaceable() {
- return true;
- }
-
- @Override
- public boolean isResizeable() {
- return false;
- }
-
- @Override
- public boolean isSubView() {
- return false;
- }
-
-}