summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/ui/table')
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/CellComparator.java45
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/CellFormatter.java33
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableModel.java304
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableRequestHandler.java111
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableUtils.java58
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellComparator.java60
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellFormatter.java41
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AppIdFormatter.java41
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/ConnectPointFormatter.java40
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellComparator.java51
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellFormatter.java38
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/EnumFormatter.java40
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/HexFormatter.java38
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/HostLocationFormatter.java40
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java50
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/TimeFormatter.java71
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/package-info.java20
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/package-info.java20
18 files changed, 0 insertions, 1101 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/CellComparator.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/CellComparator.java
deleted file mode 100644
index 1c42c97a..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/CellComparator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table;
-
-/**
- * Defines a comparator for cell values.
- */
-public interface CellComparator {
-
- /**
- * Compares its two arguments for order. Returns a negative integer,
- * zero, or a positive integer as the first argument is less than, equal
- * to, or greater than the second.<p>
- *
- * Note that nulls are permitted, and should be sorted to the beginning
- * of an ascending sort; i.e. null is considered to be "smaller" than
- * non-null values.
- *
- * @see java.util.Comparator#compare(Object, Object)
- *
- * @param o1 the first object to be compared.
- * @param o2 the second object to be compared.
- * @return a negative integer, zero, or a positive integer as the
- * first argument is less than, equal to, or greater than the
- * second.
- * @throws ClassCastException if the arguments' types prevent them from
- * being compared by this comparator.
- */
- int compare(Object o1, Object o2);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/CellFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/CellFormatter.java
deleted file mode 100644
index 895c9d93..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/CellFormatter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table;
-
-/**
- * Defines a formatter for cell values.
- */
-public interface CellFormatter {
-
- /**
- * Formats the specified value into a string appropriate for displaying
- * in a table cell. Note that null values are acceptable, and will result
- * in the empty string.
- *
- * @param value the value
- * @return the formatted string
- */
- String format(Object value);
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableModel.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableModel.java
deleted file mode 100644
index d0fccb65..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableModel.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table;
-
-import com.google.common.collect.Sets;
-import org.onosproject.ui.table.cell.DefaultCellComparator;
-import org.onosproject.ui.table.cell.DefaultCellFormatter;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * A simple model of table data.
- * <p>
- * Note that this is not a full MVC type model; the expected usage pattern
- * is to create an empty table, add rows (by consulting the business model),
- * sort rows (based on client request parameters), and finally produce the
- * sorted list of rows.
- * <p>
- * The table also provides a mechanism for defining how cell values for a
- * particular column should be formatted into strings, to help facilitate
- * the encoding of the table data into a JSON structure.
- * <p>
- * Note that it is expected that all values for a particular column will
- * be the same class.
- */
-public class TableModel {
-
- private static final CellComparator DEF_CMP = DefaultCellComparator.INSTANCE;
- private static final CellFormatter DEF_FMT = DefaultCellFormatter.INSTANCE;
-
- private final String[] columnIds;
- private final Set<String> idSet;
- private final Map<String, CellComparator> comparators = new HashMap<>();
- private final Map<String, CellFormatter> formatters = new HashMap<>();
- private final List<Row> rows = new ArrayList<>();
-
-
- /**
- * Constructs a table (devoid of data) with the given column IDs.
- *
- * @param columnIds column identifiers
- */
- public TableModel(String... columnIds) {
- checkNotNull(columnIds, "columnIds cannot be null");
- checkArgument(columnIds.length > 0, "must be at least one column");
-
- idSet = Sets.newHashSet(columnIds);
- if (idSet.size() != columnIds.length) {
- throw new IllegalArgumentException("duplicate column ID(s) detected");
- }
-
- this.columnIds = Arrays.copyOf(columnIds, columnIds.length);
- }
-
- private void checkId(String id) {
- checkNotNull(id, "must provide a column ID");
- if (!idSet.contains(id)) {
- throw new IllegalArgumentException("unknown column id: " + id);
- }
- }
-
- /**
- * Returns the number of rows in this table model.
- *
- * @return number of rows
- */
- public int rowCount() {
- return rows.size();
- }
-
- /**
- * Returns the number of columns in this table model.
- *
- * @return number of columns
- */
- public int columnCount() {
- return columnIds.length;
- }
-
- /**
- * Returns the array of column IDs for this table model.
- * <p>
- * Implementation note: we are knowingly passing you a reference to
- * our internal array to avoid copying. Don't mess with it. It's your
- * table you'll break if you do!
- *
- * @return the column identifiers
- */
- public String[] getColumnIds() {
- return columnIds;
- }
-
- /**
- * Returns the raw {@link Row} representation of the rows in this table.
- *
- * @return raw table rows
- */
- public Row[] getRows() {
- return rows.toArray(new Row[rows.size()]);
- }
-
- /**
- * Sets a cell comparator for the specified column.
- *
- * @param columnId column identifier
- * @param comparator comparator to use
- */
- public void setComparator(String columnId, CellComparator comparator) {
- checkNotNull(comparator, "must provide a comparator");
- checkId(columnId);
- comparators.put(columnId, comparator);
- }
-
- /**
- * Returns the cell comparator to use on values in the specified column.
- *
- * @param columnId column identifier
- * @return an appropriate cell comparator
- */
- private CellComparator getComparator(String columnId) {
- checkId(columnId);
- CellComparator cmp = comparators.get(columnId);
- return cmp == null ? DEF_CMP : cmp;
- }
-
- /**
- * Sets a cell formatter for the specified column.
- *
- * @param columnId column identifier
- * @param formatter formatter to use
- */
- public void setFormatter(String columnId, CellFormatter formatter) {
- checkNotNull(formatter, "must provide a formatter");
- checkId(columnId);
- formatters.put(columnId, formatter);
- }
-
- /**
- * Returns the cell formatter to use on values in the specified column.
- *
- * @param columnId column identifier
- * @return an appropriate cell formatter
- */
- public CellFormatter getFormatter(String columnId) {
- checkId(columnId);
- CellFormatter fmt = formatters.get(columnId);
- return fmt == null ? DEF_FMT : fmt;
- }
-
- /**
- * Adds a row to the table model.
- *
- * @return the row, for chaining
- */
- public Row addRow() {
- Row r = new Row();
- rows.add(r);
- return r;
- }
-
- /**
- * Sorts the table rows based on the specified column, in the
- * specified direction.
- *
- * @param columnId column identifier
- * @param dir sort direction
- */
- public void sort(String columnId, SortDir dir) {
- Collections.sort(rows, new RowComparator(columnId, dir));
- }
-
-
- /** Designates sorting direction. */
- public enum SortDir {
- /** Designates an ascending sort. */
- ASC,
- /** Designates a descending sort. */
- DESC
- }
-
- /**
- * Row comparator.
- */
- private class RowComparator implements Comparator<Row> {
- private final String columnId;
- private final SortDir dir;
- private final CellComparator cellComparator;
-
- /**
- * Constructs a row comparator based on the specified
- * column identifier and sort direction.
- *
- * @param columnId column identifier
- * @param dir sort direction
- */
- public RowComparator(String columnId, SortDir dir) {
- this.columnId = columnId;
- this.dir = dir;
- cellComparator = getComparator(columnId);
- }
-
- @Override
- public int compare(Row a, Row b) {
- Object cellA = a.get(columnId);
- Object cellB = b.get(columnId);
- int result = cellComparator.compare(cellA, cellB);
- return dir == SortDir.ASC ? result : -result;
- }
- }
-
- /**
- * Model of a row.
- */
- public class Row {
- private final Map<String, Object> cells = new HashMap<>();
-
- /**
- * Sets the cell value for the given column of this row.
- *
- * @param columnId column identifier
- * @param value value to set
- * @return self, for chaining
- */
- public Row cell(String columnId, Object value) {
- checkId(columnId);
- cells.put(columnId, value);
- return this;
- }
-
- /**
- * Returns the value of the cell in the given column for this row.
- *
- * @param columnId column identifier
- * @return cell value
- */
- public Object get(String columnId) {
- return cells.get(columnId);
- }
-
- /**
- * Returns the value of the cell as a string, using the
- * formatter appropriate for the column.
- *
- * @param columnId column identifier
- * @return formatted cell value
- */
- String getAsString(String columnId) {
- return getFormatter(columnId).format(get(columnId));
- }
-
- /**
- * Returns the row as an array of formatted strings.
- *
- * @return the formatted row data
- */
- public String[] getAsFormattedStrings() {
- List<String> formatted = new ArrayList<>(columnCount());
- for (String c : columnIds) {
- formatted.add(getAsString(c));
- }
- return formatted.toArray(new String[formatted.size()]);
- }
- }
-
- private static final String DESC = "desc";
-
- /**
- * Returns the appropriate sort direction for the given string.
- * <p>
- * The expected strings are "asc" for {@link SortDir#ASC ascending} and
- * "desc" for {@link SortDir#DESC descending}. Any other value will
- * default to ascending.
- *
- * @param s sort direction string encoding
- * @return sort direction
- */
- public static SortDir sortDir(String s) {
- return !DESC.equals(s) ? SortDir.ASC : SortDir.DESC;
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableRequestHandler.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableRequestHandler.java
deleted file mode 100644
index b8d48575..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableRequestHandler.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.onosproject.ui.JsonUtils;
-import org.onosproject.ui.RequestHandler;
-
-/**
- * Message handler specifically for table views.
- */
-public abstract class TableRequestHandler extends RequestHandler {
-
- private final String respType;
- private final String nodeName;
-
- /**
- * Constructs a table request handler for a specific table view. When
- * table requests come in, the handler will generate the appropriate
- * table rows, sort them according the the request sort parameters, and
- * send back the response to the client.
- *
- * @param reqType type of the request event
- * @param respType type of the response event
- * @param nodeName name of JSON node holding row data
- */
- public TableRequestHandler(String reqType, String respType, String nodeName) {
- super(reqType);
- this.respType = respType;
- this.nodeName = nodeName;
- }
-
- @Override
- public void process(long sid, ObjectNode payload) {
- TableModel tm = createTableModel();
- populateTable(tm, payload);
-
- String sortCol = JsonUtils.string(payload, "sortCol", defaultColumnId());
- String sortDir = JsonUtils.string(payload, "sortDir", "asc");
- tm.sort(sortCol, TableModel.sortDir(sortDir));
-
- ObjectNode rootNode = MAPPER.createObjectNode();
- rootNode.set(nodeName, TableUtils.generateArrayNode(tm));
- sendMessage(respType, 0, rootNode);
- }
-
- /**
- * Creates the table model (devoid of data) using {@link #getColumnIds()}
- * to initialize it, ready to be populated.
- * <p>
- * This default implementation returns a table model with default
- * formatters and comparators for all columns.
- *
- * @return an empty table model
- */
- protected TableModel createTableModel() {
- return new TableModel(getColumnIds());
- }
-
- /**
- * Returns the default column ID to be used when one is not supplied in
- * the payload as the column on which to sort.
- * <p>
- * This default implementation returns "id".
- *
- * @return default sort column identifier
- */
- protected String defaultColumnId() {
- return "id";
- }
-
- /**
- * Subclasses should return the array of column IDs with which
- * to initialize their table model.
- *
- * @return the column IDs
- */
- protected abstract String[] getColumnIds();
-
- /**
- * Subclasses should populate the table model by adding
- * {@link TableModel.Row rows}.
- * <pre>
- * tm.addRow()
- * .cell(COL_ONE, ...)
- * .cell(COL_TWO, ...)
- * ... ;
- * </pre>
- * The request payload is provided in case there are request filtering
- * parameters (other than sort column and sort direction) that are required
- * to generate the appropriate data.
- *
- * @param tm the table model
- * @param payload request payload
- */
- protected abstract void populateTable(TableModel tm, ObjectNode payload);
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableUtils.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableUtils.java
deleted file mode 100644
index eb2dff78..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/TableUtils.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Provides static utility methods for dealing with tables.
- */
-public final class TableUtils {
-
- private static final ObjectMapper MAPPER = new ObjectMapper();
-
- // non-instantiable
- private TableUtils() { }
-
- /**
- * Generates a JSON array node from a table model.
- *
- * @param tm the table model
- * @return the array node representation
- */
- public static ArrayNode generateArrayNode(TableModel tm) {
- ArrayNode array = MAPPER.createArrayNode();
- for (TableModel.Row r : tm.getRows()) {
- array.add(toJsonNode(r, tm));
- }
- return array;
- }
-
- private static JsonNode toJsonNode(TableModel.Row row, TableModel tm) {
- ObjectNode result = MAPPER.createObjectNode();
- String[] keys = tm.getColumnIds();
- String[] cells = row.getAsFormattedStrings();
- int n = keys.length;
- for (int i = 0; i < n; i++) {
- result.put(keys[i], cells[i]);
- }
- return result;
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellComparator.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellComparator.java
deleted file mode 100644
index 31d9f634..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellComparator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.ui.table.CellComparator;
-
-/**
- * Base implementation of a {@link CellComparator}. This class takes care
- * of dealing with null inputs; subclasses should implement their comparison
- * knowing that both inputs are guaranteed to be non-null.
- */
-public abstract class AbstractCellComparator implements CellComparator {
-
- @Override
- public int compare(Object o1, Object o2) {
- if (o1 == null && o2 == null) {
- return 0; // o1 == o2
- }
- if (o1 == null) {
- return -1; // o1 < o2
- }
- if (o2 == null) {
- return 1; // o1 > o2
- }
- return nonNullCompare(o1, o2);
- }
-
- /**
- * Compares its two arguments for order. Returns a negative integer,
- * zero, or a positive integer as the first argument is less than, equal
- * to, or greater than the second.<p>
- *
- * Note that both objects are guaranteed to be non-null.
- *
- * @see java.util.Comparator#compare(Object, Object)
- *
- * @param o1 the first object to be compared.
- * @param o2 the second object to be compared.
- * @return a negative integer, zero, or a positive integer as the
- * first argument is less than, equal to, or greater than the
- * second.
- * @throws ClassCastException if the arguments' types prevent them from
- * being compared by this comparator.
- */
- protected abstract int nonNullCompare(Object o1, Object o2);
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellFormatter.java
deleted file mode 100644
index 08822b7b..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellFormatter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.ui.table.CellFormatter;
-
-/**
- * Base implementation of a {@link CellFormatter}. This class takes care of
- * dealing with null inputs; subclasses should implement their format method
- * knowing that the input is guaranteed to be non-null.
- */
-public abstract class AbstractCellFormatter implements CellFormatter {
-
- @Override
- public String format(Object value) {
- return value == null ? "" : nonNullFormat(value);
- }
-
- /**
- * Formats the specified value into a string appropriate for displaying
- * in a table cell. Note that value is guaranteed to be non-null.
- *
- * @param value the value
- * @return the formatted string
- */
- protected abstract String nonNullFormat(Object value);
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AppIdFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AppIdFormatter.java
deleted file mode 100644
index f7947a75..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/AppIdFormatter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.core.ApplicationId;
-import org.onosproject.ui.table.CellFormatter;
-
-/**
- * Formats an application identifier as "(app-id) : (app-name)".
- */
-public final class AppIdFormatter extends AbstractCellFormatter {
-
- // non-instantiable
- private AppIdFormatter() { }
-
- // NOTE: do not change this format; we parse it on the client side.
- @Override
- protected String nonNullFormat(Object value) {
- ApplicationId appId = (ApplicationId) value;
- return appId.id() + " : " + appId.name();
- }
-
- /**
- * An instance of this class.
- */
- public static final CellFormatter INSTANCE = new AppIdFormatter();
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/ConnectPointFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/ConnectPointFormatter.java
deleted file mode 100644
index 4af6fe2f..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/ConnectPointFormatter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.ui.table.CellFormatter;
-
-/**
- * Formats a connect point as "(element-id)/(port)".
- */
-public final class ConnectPointFormatter extends AbstractCellFormatter {
-
- // non-instantiable
- private ConnectPointFormatter() { }
-
- @Override
- protected String nonNullFormat(Object value) {
- ConnectPoint cp = (ConnectPoint) value;
- return cp.elementId() + "/" + cp.port();
- }
-
- /**
- * An instance of this class.
- */
- public static final CellFormatter INSTANCE = new ConnectPointFormatter();
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellComparator.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellComparator.java
deleted file mode 100644
index 2386f8f3..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellComparator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.ui.table.CellComparator;
-
-/**
- * A default cell comparator.
- * <p>
- * Verifies that the objects being compared are the same class.
- * Looks to see if the objects being compared implement comparable and, if so,
- * delegates to that; otherwise, implements a lexicographical compare function
- * (i.e. string sorting). Uses the objects' toString() method and then
- * compares the resulting strings. Note that null values are acceptable and
- * are considered "smaller" than any non-null value.
- */
-public final class DefaultCellComparator extends AbstractCellComparator {
-
- // non-instantiable
- private DefaultCellComparator() { }
-
- @Override
- @SuppressWarnings("unchecked")
- protected int nonNullCompare(Object o1, Object o2) {
- if (o1 instanceof Comparable) {
- // if o2 is not the same class as o1, then compareTo will
- // throw ClassCastException for us
- return ((Comparable) o1).compareTo(o2);
- }
- return o1.toString().compareTo(o2.toString());
- }
-
- /**
- * An instance of this class.
- */
- public static final CellComparator INSTANCE = new DefaultCellComparator();
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellFormatter.java
deleted file mode 100644
index 8309c545..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/DefaultCellFormatter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.ui.table.CellFormatter;
-
-/**
- * A default cell formatter. Uses the object's toString() method.
- */
-public final class DefaultCellFormatter extends AbstractCellFormatter {
-
- // non-instantiable
- private DefaultCellFormatter() { }
-
- @Override
- public String nonNullFormat(Object value) {
- return value.toString();
- }
-
- /**
- * An instance of this class.
- */
- public static final CellFormatter INSTANCE = new DefaultCellFormatter();
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/EnumFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/EnumFormatter.java
deleted file mode 100644
index 5b89a0b7..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/EnumFormatter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.ui.table.CellFormatter;
-
-import static org.apache.commons.lang.WordUtils.capitalizeFully;
-
-/**
- * Formats enum types to be readable strings.
- */
-public final class EnumFormatter extends AbstractCellFormatter {
-
- // non-instantiable
- private EnumFormatter() { }
-
- @Override
- protected String nonNullFormat(Object value) {
- return capitalizeFully(value.toString().replace("_", " "));
- }
-
- /**
- * An instance of this class.
- */
- public static final CellFormatter INSTANCE = new EnumFormatter();
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/HexFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/HexFormatter.java
deleted file mode 100644
index 981a81bb..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/HexFormatter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.ui.table.CellFormatter;
-
-/**
- * Formats integer values as hex strings with a "0x" prefix.
- */
-public final class HexFormatter extends AbstractCellFormatter {
-
- // non-instantiable
- private HexFormatter() { }
-
- @Override
- protected String nonNullFormat(Object value) {
- return "0x" + Integer.toHexString((Integer) value);
- }
-
- /**
- * An instance of this class.
- */
- public static final CellFormatter INSTANCE = new HexFormatter();
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/HostLocationFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/HostLocationFormatter.java
deleted file mode 100644
index 95a7cc23..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/HostLocationFormatter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.onosproject.net.HostLocation;
-import org.onosproject.ui.table.CellFormatter;
-
-/**
- * Formats a host location as "(device-id)/(port)".
- */
-public final class HostLocationFormatter extends AbstractCellFormatter {
-
- // non-instantiable
- private HostLocationFormatter() { }
-
- @Override
- protected String nonNullFormat(Object value) {
- HostLocation loc = (HostLocation) value;
- return loc.deviceId() + "/" + loc.port();
- }
-
- /**
- * An instance of this class.
- */
- public static final CellFormatter INSTANCE = new HostLocationFormatter();
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java
deleted file mode 100644
index 76f42466..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-/**
- * Formats number using the specified format string".
- */
-public final class NumberFormatter extends AbstractCellFormatter {
-
- private final NumberFormat format;
-
- /**
- * Creates a formatter using a default decimal format.
- */
- public NumberFormatter() {
- this(new DecimalFormat("#,##0.00000"));
- }
-
- /**
- * Creates a formatter using the specified format.
- *
- * @param format number format
- */
- public NumberFormatter(NumberFormat format) {
- this.format = format;
- }
-
- @Override
- protected String nonNullFormat(Object value) {
- return format.format(value);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/TimeFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/TimeFormatter.java
deleted file mode 100644
index 58c70930..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/TimeFormatter.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.onosproject.ui.table.cell;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
-import java.util.Locale;
-
-/**
- * Formats time values using {@link DateTimeFormatter}.
- */
-public final class TimeFormatter extends AbstractCellFormatter {
-
- private DateTimeFormatter dtf;
-
- // NOTE: Unlike other formatters in this package, this one is not
- // implemented as a Singleton, because instances may be
- // decorated with alternate locale and/or timezone.
-
- /**
- * Constructs a time formatter that uses the default locale and timezone.
- */
- public TimeFormatter() {
- dtf = DateTimeFormat.longTime();
- }
-
- /**
- * Sets the locale to use for formatting the time.
- *
- * @param locale locale to use for formatting
- * @return self, for chaining
- */
- public TimeFormatter withLocale(Locale locale) {
- dtf = dtf.withLocale(locale);
- return this;
- }
-
- /**
- * Sets the time zone to use for formatting the time.
- *
- * @param zone time zone to use
- * @return self, for chaining
- */
- public TimeFormatter withZone(DateTimeZone zone) {
- dtf = dtf.withZone(zone);
- return this;
- }
-
- @Override
- protected String nonNullFormat(Object value) {
- return dtf.print((DateTime) value);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/package-info.java
deleted file mode 100644
index c25bcb06..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.
- */
-
-/**
- * Set of table cell renderers and comparators for use by GUI apps.
- */
-package org.onosproject.ui.table.cell; \ No newline at end of file
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/package-info.java
deleted file mode 100644
index ee975d11..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed 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.
- */
-
-/**
- * Facilities for creating tabular models of data for the GUI.
- */
-package org.onosproject.ui.table; \ No newline at end of file