Comment some DynamicAPI code and update UIUtils to new attributes API

Esse commit está contido em:
Mathieu Bastian
2013-04-15 17:37:17 -07:00
commit 7b36dbfe02
8 arquivos alterados com 1337 adições e 1378 exclusões
-4
Ver Arquivo
@@ -20,10 +20,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>project-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data-attributes-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>graph-api</artifactId>
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
@@ -3,9 +3,9 @@
* Authors : Cezary Bartosiak
* Mathieu Bastian <mathieu.bastian@gephi.org>
* Website : http://www.gephi.org
*
*
* This file is part of Gephi.
*
*
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
@@ -42,8 +42,6 @@
*/
package org.gephi.dynamic.api;
import org.gephi.data.attributes.api.Estimator;
import org.gephi.data.attributes.type.TimeInterval;
import org.gephi.project.api.Workspace;
/**
@@ -81,8 +79,7 @@ public interface DynamicController {
*
* @param interval an object to get endpoints from
*/
public void setVisibleInterval(TimeInterval interval);
// public void setVisibleInterval(TimeInterval interval);
/**
* Sets the time interval wrapped by the {@code DynamicGraph} of the current
* workspace.
@@ -112,41 +109,41 @@ public interface DynamicController {
/**
* Sets the current
* <code>ESTIMATOR</code> used to get values from
* {@link org.gephi.data.attributes.type.DynamicType}. Default is <b><code>Estimator.FIRST</code></b>.
* {@link org.gephi.data.attributes.type.DynamicType}. Default is
* <b><code>Estimator.FIRST</code></b>.
*
* @param estimator the estimator that is to be set
*/
public void setEstimator(Estimator estimator);
// public void setEstimator(Estimator estimator);
/**
* Sets the current
* <code>ESTIMATOR</code> used to get values from
* {@link org.gephi.data.attributes.type.DynamicType}. Default is <b><code>Estimator.FIRST</code></b>.
* {@link org.gephi.data.attributes.type.DynamicType}. Default is
* <b><code>Estimator.FIRST</code></b>.
*
* @param estimator the estimator that is to be set
* @param workspace the workspace to get the model
*/
public void setEstimator(Estimator estimator, Workspace workspace);
// public void setEstimator(Estimator estimator, Workspace workspace);
/**
* Sets the current number
* <code>ESTIMATOR</code> used to get values from
* {@link org.gephi.data.attributes.type.DynamicType}. Default is <b><code>Estimator.AVERAGE</code></b>.
* {@link org.gephi.data.attributes.type.DynamicType}. Default is
* <b><code>Estimator.AVERAGE</code></b>.
*
* @param estimator the number estimator that is to be set
*/
public void setNumberEstimator(Estimator estimator);
// public void setNumberEstimator(Estimator estimator);
/**
* Sets the current number
* <code>ESTIMATOR</code> used to get values from
* {@link org.gephi.data.attributes.type.DynamicType}. Default is <b><code>Estimator.AVERAGE</code></b>.
* {@link org.gephi.data.attributes.type.DynamicType}. Default is
* <b><code>Estimator.AVERAGE</code></b>.
*
* @param estimator the number estimator that is to be set
* @param workspace the workspace to get the model
*/
public void setNumberEstimator(Estimator estimator, Workspace workspace);
// public void setNumberEstimator(Estimator estimator, Workspace workspace);
/**
* Adds
* <code>listener</code> to the listeners of this model. It receives events
@@ -2,493 +2,487 @@
* Copyright 2008-2010 Gephi
* Authors : Cezary Bartosiak
* Website : http://www.gephi.org
*
*
* This file is part of Gephi.
*
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.dynamic.api;
import org.gephi.data.attributes.api.Estimator;
import org.gephi.data.attributes.type.Interval;
import org.gephi.data.attributes.type.TimeInterval;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.Node;
/**
* The wrapper for graph and time interval.
*
* @author Cezary Bartosiak
*/
public interface DynamicGraph {
/**
* Returns values of attributes of the given {@code Node} in the given
* {@code point} of time using {@code Estimator.FIRST} for each dynamic
* attribute.
*
* @param node the given {@code Node}
* @param point the given point of time
*
* @return values of attributes of the given {@code Node} in the given
* {@code point} of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @throws IllegalArgumentException if {@code point} is out of range
* wrapped by this {@code DynamicGraph}.
*/
public Object[] getAttributesValues(Node node, double point);
/**
* Returns values of attributes of the given {@code Node} in the given
* {@code point} of time using given {@code Estimators}. The length of the
* {@code estimators} table must be the same as the count of attributes.
* Otherwise an {@code IllegalArgumentException} will be thrown.
*
* <p>Note that it doesn't matter what estimators you give for 'static'
* attributes.
*
* @param node the given {@code Node}
* @param point the given point of time
* @param estimators determine how to estimate individual values
*
* @return values of attributes of the given {@code Node} in the given
* {@code point} of time using given {@code Estimators}.
*
* @throws IllegalArgumentException if {@code point} is out of range
* wrapped by this {@code DynamicGraph}.
* @throws IllegalArgumentException if the length of the {@code estimators}
* table differ from the count of attributes.
*/
public Object[] getAttributesValues(Node node, double point, Estimator[] estimators);
/**
* Returns values of attributes of the given {@code Node} in the given
* time interval of time using {@code Estimator.FIRST} for
* each dynamic attribute. Both bounds are included by default.
*
* @param node the given {@code Node}
* @param low the left endpoint of the given time interval
* @param high the right endpoint of the given time interval
*
* @return values of attributes of the given {@code Node} in the given
* time interval of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @throws IllegalArgumentException if {@code low} > {@code high} or the
* time interval [{@code low}, {@code high}]
* is out of range wrapped by this DynamicGraph.
*/
public Object[] getAttributesValues(Node node, double low, double high);
/**
* Returns values of attributes of the given {@code Node} in the given
* time interval of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @param node the given {@code Node}
* @param interval the given time interval
*
* @return values of attributes of the given {@code Node} in the given
* time interval of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @throws IllegalArgumentException if the given time interval is out of
* range wrapped by this DynamicGraph.
*/
public Object[] getAttributesValues(Node node, Interval interval);
/**
* Returns values of attributes of the given {@code Node} in the given
* time interval of time using given {@code Estimators}. The length of the
* {@code estimators} table must be the same as the count of attributes.
* Otherwise an {@code IllegalArgumentException} will be thrown.
* Both bounds are included by default.
*
* <p>Note that it doesn't matter what estimators you give for 'static'
* attributes.
*
* @param node the given {@code Node}
* @param low the left endpoint of the given time interval
* @param high the right endpoint of the given time interval
* @param estimators determine how to estimate individual values
*
* @return values of attributes of the given {@code Node} in the given
* time interval of time using given {@code Estimators}.
*
* @throws IllegalArgumentException if {@code low} > {@code high} or the
* time interval [{@code low}, {@code high}]
* is out of range wrapped by this DynamicGraph.
* @throws IllegalArgumentException if the length of the {@code estimators}
* table differ from the count of attributes.
*/
public Object[] getAttributesValues(Node node, double low, double high, Estimator[] estimators);
/**
* Returns values of attributes of the given {@code Node} in the given
* time interval of time using given {@code Estimators}. The length of the
* {@code estimators} table must be the same as the count of attributes.
* Otherwise an {@code IllegalArgumentException} will be thrown.
*
* <p>Note that it doesn't matter what estimators you give for 'static'
* attributes.
*
* @param node the given {@code Node}
* @param interval the given time interval
* @param estimators determine how to estimate individual values
*
* @return values of attributes of the given {@code Node} in the given
* time interval of time using given {@code Estimators}.
*
* @throws IllegalArgumentException if the given time interval is out of
* range wrapped by this DynamicGraph.
* @throws IllegalArgumentException if the length of the {@code estimators}
* table differ from the count of attributes.
*/
public Object[] getAttributesValues(Node node, Interval interval, Estimator[] estimators);
/**
* Returns values of attributes of the given {@code Edge} in the given
* {@code point} of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @param edge the given {@code Edge}
* @param point the given point of time
*
* @return values of attributes of the given {@code Edge} in the given
* {@code point} of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @throws IllegalArgumentException if {@code point} is out of range
* wrapped by this {@code DynamicGraph}.
*/
public Object[] getAttributesValues(Edge edge, double point);
/**
* Returns values of attributes of the given {@code Edge} in the given
* {@code point} of time using given {@code Estimators}. The length of the
* {@code estimators} table must be the same as the count of attributes.
* Otherwise an {@code IllegalArgumentException} will be thrown.
*
* <p>Note that it doesn't matter what estimators you give for 'static'
* attributes.
*
* @param edge the given {@code Edge}
* @param point the given point of time
* @param estimators determine how to estimate individual values
*
* @return values of attributes of the given {@code Edge} in the given
* {@code point} of time using given {@code Estimators}.
*
* @throws IllegalArgumentException if {@code point} is out of range
* wrapped by this {@code DynamicGraph}.
* @throws IllegalArgumentException if the length of the {@code estimators}
* table differ from the count of attributes.
*/
public Object[] getAttributesValues(Edge edge, double point, Estimator[] estimators);
/**
* Returns values of attributes of the given {@code Edge} in the given
* time interval of time using {@code Estimator.FIRST} for
* each dynamic attribute. Both bounds are included by default.
*
* @param edge the given {@code Edge}
* @param low the left endpoint of the given time interval
* @param high the right endpoint of the given time interval
*
* @return values of attributes of the given {@code Edge} in the given
* time interval of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @throws IllegalArgumentException if {@code low} > {@code high} or the
* time interval [{@code low}, {@code high}]
* is out of range wrapped by this DynamicGraph.
*/
public Object[] getAttributesValues(Edge edge, double low, double high);
/**
* Returns values of attributes of the given {@code Edge} in the given
* time interval of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @param edge the given {@code Edge}
* @param interval the given time interval
*
* @return values of attributes of the given {@code Edge} in the given
* time interval of time using {@code Estimator.FIRST} for
* each dynamic attribute.
*
* @throws IllegalArgumentException if the given time interval is out of
* range wrapped by this DynamicGraph.
*/
public Object[] getAttributesValues(Edge edge, Interval interval);
/**
* Returns values of attributes of the given {@code Edge} in the given
* time interval of time using given {@code Estimators}. The length of the
* {@code estimators} table must be the same as the count of attributes.
* Otherwise an {@code IllegalArgumentException} will be thrown.
*
* <p>Note that it doesn't matter what estimators you give for 'static'
* attributes.
*
* @param edge the given {@code Edge}
* @param low the left endpoint of the given time interval
* @param high the right endpoint of the given time interval
* @param estimators determine how to estimate individual values
*
* @return values of attributes of the given {@code Edge} in the given
* time interval of time using given {@code Estimators}.
*
* @throws IllegalArgumentException if {@code low} > {@code high} or the
* time interval [{@code low}, {@code high}]
* is out of range wrapped by this DynamicGraph.
* @throws IllegalArgumentException if the length of the {@code estimators}
* table differ from the count of attributes.
*/
public Object[] getAttributesValues(Edge edge, double low, double high, Estimator[] estimators);
/**
* Returns values of attributes of the given {@code Edge} in the given
* time interval of time using given {@code Estimators}. The length of the
* {@code estimators} table must be the same as the count of attributes.
* Otherwise an {@code IllegalArgumentException} will be thrown.
*
* <p>Note that it doesn't matter what estimators you give for 'static'
* attributes.
*
* @param edge the given {@code Edge}
* @param interval the given time interval
* @param estimators determine how to estimate individual values
*
* @return values of attributes of the given {@code Edge} in the given
* time interval of time using given {@code Estimators}.
*
* @throws IllegalArgumentException if the given time interval is out of
* range wrapped by this DynamicGraph.
* @throws IllegalArgumentException if the length of the {@code estimators}
* table differ from the count of attributes.
*/
public Object[] getAttributesValues(Edge edge, Interval interval, Estimator[] estimators);
/**
* Returns the left endpoint of the time interval wrapped by this
* {@code DynamicGraph}.
*
* @return the left endpoint of the time interval wrapped by this
* {@code DynamicGraph}.
*/
public double getLow();
/**
* Returns the right endpoint of the time interval wrapped by this
* {@code DynamicGraph}.
*
* @return the right endpoint of the time interval wrapped by this
* {@code DynamicGraph}.
*/
public double getHigh();
/**
* Returns a "snapshot graph", i.e. a graph for the given point of time.
* The default estimator is used ({@code Estimator.FIRST}). It means
* that the first time intervals of nodes/edges are checked for
* overlapping with the {@code point}.
*
* @param point the given point of time
*
* @return a "snapshot graph", i.e. a graph for the given point of time.
*
* @throws IllegalArgumentException if {@code point} is out of range
* wrapped by this {@code DynamicGraph}.
*/
public Graph getSnapshotGraph(double point);
/**
* Returns a "snapshot graph", i.e. a graph for the given point of time
* using the given {@code Estimator}. It means that time intervals of
* nodes/edges determined by the {@code Estimator} are checked for
* overlapping with the {@code point}.
*
* @param point the given point of time
* @param estimator determines how to estimate a snapshot
*
* @return a "snapshot graph", i.e. a graph for the given point of time.
*
* @throws IllegalArgumentException if {@code point} is out of range
* wrapped by this {@code DynamicGraph}.
*/
public Graph getSnapshotGraph(double point, Estimator estimator);
/**
* Returns a "snapshot graph", i.e. a graph for the given time interval.
* The default estimator is used ({@code Estimator.FIRST}). It means
* that the first time intervals of nodes/edges are checked for
* overlapping with the time interval [{@code low}, {@code high}].
*
* @param low the left endpoint of the given time interval
* @param high the right endpoint of the given time interval
*
* @return a "snapshot graph", i.e. a graph for the given time interval.
*
* @throws IllegalArgumentException if {@code low} > {@code high} or the
* time interval [{@code low}, {@code high}]
* is out of range wrapped by this DynamicGraph.
*/
public Graph getSnapshotGraph(double low, double high);
/**
* Returns a "snapshot graph", i.e. a graph for the given time interval.
* The default estimator is used ({@code Estimator.FIRST}). It means
* that the first time intervals of nodes/edges are checked for
* overlapping with the given time interval.
*
* @param interval the given time interval
*
* @return a "snapshot graph", i.e. a graph for the given time interval.
*
* @throws IllegalArgumentException if the given time interval is out of
* range wrapped by this DynamicGraph.
*/
public Graph getSnapshotGraph(Interval interval);
/**
* Returns a "snapshot graph", i.e. a graph for the given time interval
* using the given {@code Estimator}. It means that time intervals of
* nodes/edges determined by the {@code Estimator} are checked for
* overlapping with the time interval [{@code low}, {@code high}].
*
* @param low the left endpoint of the given time interval
* @param high the right endpoint of the given time interval
* @param estimator determines how to estimate a snapshot
*
* @return a "snapshot graph", i.e. a graph for the given time interval.
*
* @throws IllegalArgumentException if {@code low} > {@code high} or the
* time interval [{@code low}, {@code high}]
* is out of range wrapped by this DynamicGraph.
*/
public Graph getSnapshotGraph(double low, double high, Estimator estimator);
/**
* Returns a "snapshot graph", i.e. a graph for the given time interval
* using the given {@code Estimator}. It means that time intervals of
* nodes/edges determined by the {@code Estimator} are checked for
* overlapping with the given time interval.
*
* @param interval the given time interval
* @param estimator determines how to estimate a snapshot
*
* @return a "snapshot graph", i.e. a graph for the given time interval.
*
* @throws IllegalArgumentException if the given time interval is out of
* range wrapped by this DynamicGraph.
*/
public Graph getSnapshotGraph(Interval interval, Estimator estimator);
/**
* Returns a "strong snapshot graph", i.e. a graph for the given point of
* time. "Strong" means that if EVERY time interval of considered node/edge
* overlaps with the {@code point} it is considered as a part of snapshot.
*
* @param point the given point of time
*
* @return a "snapshot graph", i.e. a graph for the given point of time.
*
* @throws IllegalArgumentException if {@code point} is out of range
* wrapped by this {@code DynamicGraph}.
*/
public Graph getStrongSnapshotGraph(double point);
/**
* Returns a "strong snapshot graph", i.e. a graph for the given time interval.
* "Strong" means that if EVERY time interval of considered node/edge overlaps
* with the time interval [{@code low}, {@code high}] it is considered as
* a part of snapshot.
*
* @param low the left endpoint of the given time interval
* @param high the right endpoint of the given time interval
*
* @return a "snapshot graph", i.e. a graph for the given time interval.
*
* @throws IllegalArgumentException if {@code low} > {@code high} or the
* time interval [{@code low}, {@code high}]
* is out of range wrapped by this DynamicGraph.
*/
public Graph getStrongSnapshotGraph(double low, double high);
/**
* Returns a "strong snapshot graph", i.e. a graph for the given time interval.
* "Strong" means that if EVERY time interval of considered node/edge overlaps
* with the given time interval it is considered as a part of snapshot.
*
* @param interval the given time interval
*
* @return a "snapshot graph", i.e. a graph for the given time interval.
*
* @throws IllegalArgumentException if the given time interval is out of
* range wrapped by this DynamicGraph.
*/
public Graph getStrongSnapshotGraph(Interval interval);
/**
* Returns the wrapped graph.
*
* @return the wrapped graph.
*/
public Graph getUnderlyingGraph();
/**
* Returns the time interval wrapped by this {@code DynamicGraph}.
*
* @return the time interval wrapped by this {@code DynamicGraph}.
*/
public TimeInterval getInterval();
/**
* Sets the time interval wrapped by this {@code DynamicGraph}.
*
* @param interval an object to get endpoints from
*/
public void setInterval(TimeInterval interval);
/**
* Sets the time interval wrapped by this {@code DynamicGraph}.
*
* @param low the left endpoint
* @param high the right endpoint
*/
public void setInterval(double low, double high);
// /**
// * Returns values of attributes of the given {@code Node} in the given
// * {@code point} of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @param node the given {@code Node}
// * @param point the given point of time
// *
// * @return values of attributes of the given {@code Node} in the given
// * {@code point} of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @throws IllegalArgumentException if {@code point} is out of range wrapped
// * by this {@code DynamicGraph}.
// */
// public Object[] getAttributesValues(Node node, double point);
//
// /**
// * Returns values of attributes of the given {@code Node} in the given
// * {@code point} of time using given {@code Estimators}. The length of the
// * {@code estimators} table must be the same as the count of attributes.
// * Otherwise an {@code IllegalArgumentException} will be thrown.
// *
// * <p>Note that it doesn't matter what estimators you give for 'static'
// * attributes.
// *
// * @param node the given {@code Node}
// * @param point the given point of time
// * @param estimators determine how to estimate individual values
// *
// * @return values of attributes of the given {@code Node} in the given
// * {@code point} of time using given {@code Estimators}.
// *
// * @throws IllegalArgumentException if {@code point} is out of range wrapped
// * by this {@code DynamicGraph}.
// * @throws IllegalArgumentException if the length of the {@code estimators}
// * table differ from the count of attributes.
// */
// public Object[] getAttributesValues(Node node, double point, Estimator[] estimators);
//
// /**
// * Returns values of attributes of the given {@code Node} in the given time
// * interval of time using {@code Estimator.FIRST} for each dynamic
// * attribute. Both bounds are included by default.
// *
// * @param node the given {@code Node}
// * @param low the left endpoint of the given time interval
// * @param high the right endpoint of the given time interval
// *
// * @return values of attributes of the given {@code Node} in the given time
// * interval of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @throws IllegalArgumentException if {@code low} > {@code high} or the
// * time interval [{@code low}, {@code high}] is out of range wrapped by this
// * DynamicGraph.
// */
// public Object[] getAttributesValues(Node node, double low, double high);
//
// /**
// * Returns values of attributes of the given {@code Node} in the given time
// * interval of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @param node the given {@code Node}
// * @param interval the given time interval
// *
// * @return values of attributes of the given {@code Node} in the given time
// * interval of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @throws IllegalArgumentException if the given time interval is out of
// * range wrapped by this DynamicGraph.
// */
// public Object[] getAttributesValues(Node node, Interval interval);
//
// /**
// * Returns values of attributes of the given {@code Node} in the given time
// * interval of time using given {@code Estimators}. The length of the
// * {@code estimators} table must be the same as the count of attributes.
// * Otherwise an {@code IllegalArgumentException} will be thrown. Both bounds
// * are included by default.
// *
// * <p>Note that it doesn't matter what estimators you give for 'static'
// * attributes.
// *
// * @param node the given {@code Node}
// * @param low the left endpoint of the given time interval
// * @param high the right endpoint of the given time interval
// * @param estimators determine how to estimate individual values
// *
// * @return values of attributes of the given {@code Node} in the given time
// * interval of time using given {@code Estimators}.
// *
// * @throws IllegalArgumentException if {@code low} > {@code high} or the
// * time interval [{@code low}, {@code high}] is out of range wrapped by this
// * DynamicGraph.
// * @throws IllegalArgumentException if the length of the {@code estimators}
// * table differ from the count of attributes.
// */
// public Object[] getAttributesValues(Node node, double low, double high, Estimator[] estimators);
//
// /**
// * Returns values of attributes of the given {@code Node} in the given time
// * interval of time using given {@code Estimators}. The length of the
// * {@code estimators} table must be the same as the count of attributes.
// * Otherwise an {@code IllegalArgumentException} will be thrown.
// *
// * <p>Note that it doesn't matter what estimators you give for 'static'
// * attributes.
// *
// * @param node the given {@code Node}
// * @param interval the given time interval
// * @param estimators determine how to estimate individual values
// *
// * @return values of attributes of the given {@code Node} in the given time
// * interval of time using given {@code Estimators}.
// *
// * @throws IllegalArgumentException if the given time interval is out of
// * range wrapped by this DynamicGraph.
// * @throws IllegalArgumentException if the length of the {@code estimators}
// * table differ from the count of attributes.
// */
// public Object[] getAttributesValues(Node node, Interval interval, Estimator[] estimators);
//
// /**
// * Returns values of attributes of the given {@code Edge} in the given
// * {@code point} of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @param edge the given {@code Edge}
// * @param point the given point of time
// *
// * @return values of attributes of the given {@code Edge} in the given
// * {@code point} of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @throws IllegalArgumentException if {@code point} is out of range wrapped
// * by this {@code DynamicGraph}.
// */
// public Object[] getAttributesValues(Edge edge, double point);
//
// /**
// * Returns values of attributes of the given {@code Edge} in the given
// * {@code point} of time using given {@code Estimators}. The length of the
// * {@code estimators} table must be the same as the count of attributes.
// * Otherwise an {@code IllegalArgumentException} will be thrown.
// *
// * <p>Note that it doesn't matter what estimators you give for 'static'
// * attributes.
// *
// * @param edge the given {@code Edge}
// * @param point the given point of time
// * @param estimators determine how to estimate individual values
// *
// * @return values of attributes of the given {@code Edge} in the given
// * {@code point} of time using given {@code Estimators}.
// *
// * @throws IllegalArgumentException if {@code point} is out of range wrapped
// * by this {@code DynamicGraph}.
// * @throws IllegalArgumentException if the length of the {@code estimators}
// * table differ from the count of attributes.
// */
// public Object[] getAttributesValues(Edge edge, double point, Estimator[] estimators);
//
// /**
// * Returns values of attributes of the given {@code Edge} in the given time
// * interval of time using {@code Estimator.FIRST} for each dynamic
// * attribute. Both bounds are included by default.
// *
// * @param edge the given {@code Edge}
// * @param low the left endpoint of the given time interval
// * @param high the right endpoint of the given time interval
// *
// * @return values of attributes of the given {@code Edge} in the given time
// * interval of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @throws IllegalArgumentException if {@code low} > {@code high} or the
// * time interval [{@code low}, {@code high}] is out of range wrapped by this
// * DynamicGraph.
// */
// public Object[] getAttributesValues(Edge edge, double low, double high);
//
// /**
// * Returns values of attributes of the given {@code Edge} in the given time
// * interval of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @param edge the given {@code Edge}
// * @param interval the given time interval
// *
// * @return values of attributes of the given {@code Edge} in the given time
// * interval of time using {@code Estimator.FIRST} for each dynamic
// * attribute.
// *
// * @throws IllegalArgumentException if the given time interval is out of
// * range wrapped by this DynamicGraph.
// */
// public Object[] getAttributesValues(Edge edge, Interval interval);
//
// /**
// * Returns values of attributes of the given {@code Edge} in the given time
// * interval of time using given {@code Estimators}. The length of the
// * {@code estimators} table must be the same as the count of attributes.
// * Otherwise an {@code IllegalArgumentException} will be thrown.
// *
// * <p>Note that it doesn't matter what estimators you give for 'static'
// * attributes.
// *
// * @param edge the given {@code Edge}
// * @param low the left endpoint of the given time interval
// * @param high the right endpoint of the given time interval
// * @param estimators determine how to estimate individual values
// *
// * @return values of attributes of the given {@code Edge} in the given time
// * interval of time using given {@code Estimators}.
// *
// * @throws IllegalArgumentException if {@code low} > {@code high} or the
// * time interval [{@code low}, {@code high}] is out of range wrapped by this
// * DynamicGraph.
// * @throws IllegalArgumentException if the length of the {@code estimators}
// * table differ from the count of attributes.
// */
// public Object[] getAttributesValues(Edge edge, double low, double high, Estimator[] estimators);
//
// /**
// * Returns values of attributes of the given {@code Edge} in the given time
// * interval of time using given {@code Estimators}. The length of the
// * {@code estimators} table must be the same as the count of attributes.
// * Otherwise an {@code IllegalArgumentException} will be thrown.
// *
// * <p>Note that it doesn't matter what estimators you give for 'static'
// * attributes.
// *
// * @param edge the given {@code Edge}
// * @param interval the given time interval
// * @param estimators determine how to estimate individual values
// *
// * @return values of attributes of the given {@code Edge} in the given time
// * interval of time using given {@code Estimators}.
// *
// * @throws IllegalArgumentException if the given time interval is out of
// * range wrapped by this DynamicGraph.
// * @throws IllegalArgumentException if the length of the {@code estimators}
// * table differ from the count of attributes.
// */
// public Object[] getAttributesValues(Edge edge, Interval interval, Estimator[] estimators);
//
// /**
// * Returns the left endpoint of the time interval wrapped by this
// * {@code DynamicGraph}.
// *
// * @return the left endpoint of the time interval wrapped by this
// * {@code DynamicGraph}.
// */
// public double getLow();
//
// /**
// * Returns the right endpoint of the time interval wrapped by this
// * {@code DynamicGraph}.
// *
// * @return the right endpoint of the time interval wrapped by this
// * {@code DynamicGraph}.
// */
// public double getHigh();
//
// /**
// * Returns a "snapshot graph", i.e. a graph for the given point of time. The
// * default estimator is used ({@code Estimator.FIRST}). It means that the
// * first time intervals of nodes/edges are checked for overlapping with the
// * {@code point}.
// *
// * @param point the given point of time
// *
// * @return a "snapshot graph", i.e. a graph for the given point of time.
// *
// * @throws IllegalArgumentException if {@code point} is out of range wrapped
// * by this {@code DynamicGraph}.
// */
// public Graph getSnapshotGraph(double point);
//
// /**
// * Returns a "snapshot graph", i.e. a graph for the given point of time
// * using the given {@code Estimator}. It means that time intervals of
// * nodes/edges determined by the {@code Estimator} are checked for
// * overlapping with the {@code point}.
// *
// * @param point the given point of time
// * @param estimator determines how to estimate a snapshot
// *
// * @return a "snapshot graph", i.e. a graph for the given point of time.
// *
// * @throws IllegalArgumentException if {@code point} is out of range wrapped
// * by this {@code DynamicGraph}.
// */
// public Graph getSnapshotGraph(double point, Estimator estimator);
//
// /**
// * Returns a "snapshot graph", i.e. a graph for the given time interval. The
// * default estimator is used ({@code Estimator.FIRST}). It means that the
// * first time intervals of nodes/edges are checked for overlapping with the
// * time interval [{@code low}, {@code high}].
// *
// * @param low the left endpoint of the given time interval
// * @param high the right endpoint of the given time interval
// *
// * @return a "snapshot graph", i.e. a graph for the given time interval.
// *
// * @throws IllegalArgumentException if {@code low} > {@code high} or the
// * time interval [{@code low}, {@code high}] is out of range wrapped by this
// * DynamicGraph.
// */
// public Graph getSnapshotGraph(double low, double high);
//
// /**
// * Returns a "snapshot graph", i.e. a graph for the given time interval. The
// * default estimator is used ({@code Estimator.FIRST}). It means that the
// * first time intervals of nodes/edges are checked for overlapping with the
// * given time interval.
// *
// * @param interval the given time interval
// *
// * @return a "snapshot graph", i.e. a graph for the given time interval.
// *
// * @throws IllegalArgumentException if the given time interval is out of
// * range wrapped by this DynamicGraph.
// */
// public Graph getSnapshotGraph(Interval interval);
//
// /**
// * Returns a "snapshot graph", i.e. a graph for the given time interval
// * using the given {@code Estimator}. It means that time intervals of
// * nodes/edges determined by the {@code Estimator} are checked for
// * overlapping with the time interval [{@code low}, {@code high}].
// *
// * @param low the left endpoint of the given time interval
// * @param high the right endpoint of the given time interval
// * @param estimator determines how to estimate a snapshot
// *
// * @return a "snapshot graph", i.e. a graph for the given time interval.
// *
// * @throws IllegalArgumentException if {@code low} > {@code high} or the
// * time interval [{@code low}, {@code high}] is out of range wrapped by this
// * DynamicGraph.
// */
// public Graph getSnapshotGraph(double low, double high, Estimator estimator);
//
// /**
// * Returns a "snapshot graph", i.e. a graph for the given time interval
// * using the given {@code Estimator}. It means that time intervals of
// * nodes/edges determined by the {@code Estimator} are checked for
// * overlapping with the given time interval.
// *
// * @param interval the given time interval
// * @param estimator determines how to estimate a snapshot
// *
// * @return a "snapshot graph", i.e. a graph for the given time interval.
// *
// * @throws IllegalArgumentException if the given time interval is out of
// * range wrapped by this DynamicGraph.
// */
// public Graph getSnapshotGraph(Interval interval, Estimator estimator);
//
// /**
// * Returns a "strong snapshot graph", i.e. a graph for the given point of
// * time. "Strong" means that if EVERY time interval of considered node/edge
// * overlaps with the {@code point} it is considered as a part of snapshot.
// *
// * @param point the given point of time
// *
// * @return a "snapshot graph", i.e. a graph for the given point of time.
// *
// * @throws IllegalArgumentException if {@code point} is out of range wrapped
// * by this {@code DynamicGraph}.
// */
// public Graph getStrongSnapshotGraph(double point);
//
// /**
// * Returns a "strong snapshot graph", i.e. a graph for the given time
// * interval. "Strong" means that if EVERY time interval of considered
// * node/edge overlaps with the time interval [{@code low}, {@code high}] it
// * is considered as a part of snapshot.
// *
// * @param low the left endpoint of the given time interval
// * @param high the right endpoint of the given time interval
// *
// * @return a "snapshot graph", i.e. a graph for the given time interval.
// *
// * @throws IllegalArgumentException if {@code low} > {@code high} or the
// * time interval [{@code low}, {@code high}] is out of range wrapped by this
// * DynamicGraph.
// */
// public Graph getStrongSnapshotGraph(double low, double high);
//
// /**
// * Returns a "strong snapshot graph", i.e. a graph for the given time
// * interval. "Strong" means that if EVERY time interval of considered
// * node/edge overlaps with the given time interval it is considered as a
// * part of snapshot.
// *
// * @param interval the given time interval
// *
// * @return a "snapshot graph", i.e. a graph for the given time interval.
// *
// * @throws IllegalArgumentException if the given time interval is out of
// * range wrapped by this DynamicGraph.
// */
// public Graph getStrongSnapshotGraph(Interval interval);
//
// /**
// * Returns the wrapped graph.
// *
// * @return the wrapped graph.
// */
// public Graph getUnderlyingGraph();
//
// /**
// * Returns the time interval wrapped by this {@code DynamicGraph}.
// *
// * @return the time interval wrapped by this {@code DynamicGraph}.
// */
// public TimeInterval getInterval();
//
// /**
// * Sets the time interval wrapped by this {@code DynamicGraph}.
// *
// * @param interval an object to get endpoints from
// */
// public void setInterval(TimeInterval interval);
//
// /**
// * Sets the time interval wrapped by this {@code DynamicGraph}.
// *
// * @param low the left endpoint
// * @param high the right endpoint
// */
// public void setInterval(double low, double high);
}
@@ -3,50 +3,45 @@
* Authors : Cezary Bartosiak
* Mathieu Bastian <mathieu.bastian@gephi.org>
* Website : http://www.gephi.org
*
*
* This file is part of Gephi.
*
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.dynamic.api;
import org.gephi.data.attributes.api.Estimator;
import org.gephi.data.attributes.type.DynamicInteger;
import org.gephi.data.attributes.type.DynamicType;
import org.gephi.data.attributes.type.Interval;
import org.gephi.data.attributes.type.TimeInterval;
import org.gephi.graph.api.Graph;
/**
@@ -56,18 +51,20 @@ import org.gephi.graph.api.Graph;
* The min and the max are used to know what are the limits of the time in the
* current data. The visible interval is typically configured by a timeline
* component to select a range of time. The model also maintains what is the
* current time format, either <code>DOUBLE</code> or <code>DATE</code>. Internally,
* all times are double, but it can be converted to dates for user display. In
* addition the model stores the current estimators used to compute dynamic
* values.
* current time format, either
* <code>DOUBLE</code> or
* <code>DATE</code>. Internally, all times are double, but it can be converted
* to dates for user display. In addition the model stores the current
* estimators used to compute dynamic values.
* <p>
* The model is listening to graph and attributes events to track all intervals and
* deduce minimum and maximum. It thows <code>MIN_CHANGED</code> or
* The model is listening to graph and attributes events to track all intervals
* and deduce minimum and maximum. It thows
* <code>MIN_CHANGED</code> or
* <code>MAX_CHANGED</code> events when these values are changed.
* <p>
* The model can also build {@link DynamicGraph} objets on demand. These objects
* can work independently to states of this model.
*
*
* @author Cezary Bartosiak
* @author Mathieu Bastian
*
@@ -81,8 +78,8 @@ public interface DynamicModel {
public static final String TIMEINTERVAL_COLUMN = "time_interval";
/**
* The way the time is represented, either a simple real value (DOUBLE),
* a unix timestamp, a date or a datetime.
* The way the time is represented, either a simple real value (DOUBLE), a
* unix timestamp, a date or a datetime.
*/
public enum TimeFormat {
@@ -107,21 +104,20 @@ public interface DynamicModel {
*
* @return a new a new {@code DynamicGraph}.
*/
public DynamicGraph createDynamicGraph(Graph graph, Interval interval);
// public DynamicGraph createDynamicGraph(Graph graph, Interval interval);
/**
* Returns the time interval wrapped by the {@code DynamicGraph} of
* the current workspace.
* Returns the time interval wrapped by the {@code DynamicGraph} of the
* current workspace.
*
* @return the time interval wrapped by the {@code DynamicGraph} of
* the current workspace.
* @return the time interval wrapped by the {@code DynamicGraph} of the
* current workspace.
*/
public TimeInterval getVisibleInterval();
// public TimeInterval getVisibleInterval();
/**
* Returns the minimum of the time intervals defined in elements (i.e. nodes
* and edges) in the current workspace. This minimum is updated when data
* change and excludes <code>Double.NEGATIVE_INFINITY</code>.
* change and excludes
* <code>Double.NEGATIVE_INFINITY</code>.
*
* @return the minimum time in the current workspace
*/
@@ -130,57 +126,67 @@ public interface DynamicModel {
/**
* Returns the maximum of the time intervals defined in elements (i.e. nodes
* and edges) in the current workspace. This maximum is updated when data
* change and excludes <code>Double.POSITIVE_INFINITY</code>.
* change and excludes
* <code>Double.POSITIVE_INFINITY</code>.
*
* @return the maximum time in the current workspace
*/
public double getMax();
/**
* Gets the current time format for this model. Though all time values are stored
* in double numbers, the time format inform how this values should be
* converted to display to users.
* Gets the current time format for this model. Though all time values are
* stored in double numbers, the time format inform how this values should
* be converted to display to users.
*
* @return the current time format
*/
public TimeFormat getTimeFormat();
/**
* Returns the current <code>ESTIMATOR</code>, used to get values from
* {@link DynamicType}. Default is <b><code>Estimator.FIRST</code></b>.
* Returns the current
* <code>ESTIMATOR</code>, used to get values from {@link DynamicType}.
* Default is <b><code>Estimator.FIRST</code></b>.
* <p>
* See the {@link #getNumberEstimator()} method for number types.
*
* @return the current estimator
*/
public Estimator getEstimator();
// public Estimator getEstimator();
/**
* Returns the current number <code>ESTIMATOR</code>, used to get values
* from number {@link DynamicType}, like {@link DynamicInteger}. Default is
* Returns the current number
* <code>ESTIMATOR</code>, used to get values from number
* {@link DynamicType}, like {@link DynamicInteger}. Default is
* <b><code>Estimator.AVERAGE</code></b>.
* <p>
* See the {@link #getEstimator()} method for non-number types.
*
* @return the current number estimator
*/
public Estimator getNumberEstimator();
// public Estimator getNumberEstimator();
/**
* Returns <code>true</code> if the graph in the current workspace is dynamic,
* i.e. when the graph has either dynamic topology, attributes or both.
* Returns
* <code>true</code> if the graph in the current workspace is dynamic, i.e.
* when the graph has either dynamic topology, attributes or both.
*
* @return <code>true</code> if the graph is dynamic, <code>false</code>
* otherwise
*/
public boolean isDynamicGraph();
/**
* Returns <code>true</code> if the graph in the current workspace has dynamic
* Returns
* <code>true</code> if the graph in the current workspace has dynamic
* nodes. In other words if nodes are added or removed dynamically.
*
* @return <code>true</code> if the graph has dynamic nodes
*/
public boolean hasDynamicNodes();
/**
* Returns <code>true</code> if the graph in the current workspace has dynamic
* Returns
* <code>true</code> if the graph in the current workspace has dynamic
* edges. In other words if edges are added or removed dynamically.
*
* @return <code>true</code> if the graph has dynamic edges
*/
public boolean hasDynamicEdges();
+1 -1
Ver Arquivo
@@ -26,7 +26,7 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data-attributes-api</artifactId>
<artifactId>graph-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -1,69 +1,73 @@
/*
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Eduardo Ramos <eduramiba@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.ui.utils;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.attribute.api.Table;
import org.netbeans.validation.api.Problems;
import org.netbeans.validation.api.Validator;
import org.openide.util.NbBundle;
/**
* Utils class to validate a string that contains a valid title for a column of a <code>AttributeTable</code>.
* Utils class to validate a string that contains a valid title for a column of
* a
* <code>AttributeTable</code>.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
*/
public class ColumnTitleValidator implements Validator<String> {
private AttributeTable table;
private Table table;
private boolean allowNoTitle;
public ColumnTitleValidator(AttributeTable table) {
public ColumnTitleValidator(Table table) {
this(table, false);
}
public ColumnTitleValidator(AttributeTable table, boolean allowNoTitle) {
public ColumnTitleValidator(Table table, boolean allowNoTitle) {
this.table = table;
this.allowNoTitle = allowNoTitle;
}
@Override
public boolean validate(Problems prblms, String string, String t) {
if (!allowNoTitle && (t == null || t.isEmpty())) {
prblms.add(NbBundle.getMessage(ColumnTitleValidator.class, "ColumnTitleValidator.title.empty"));
@@ -84,11 +88,11 @@ public class ColumnTitleValidator implements Validator<String> {
this.allowNoTitle = allowNoTitle;
}
public AttributeTable getTable() {
public Table getTable() {
return table;
}
public void setTable(AttributeTable table) {
public void setTable(Table table) {
this.table = table;
}
}
@@ -41,16 +41,13 @@
*/
package org.gephi.ui.utils;
import java.text.ParseException;
import javax.swing.JTextField;
import javax.swing.text.JTextComponent;
import org.gephi.data.attributes.type.DynamicParser;
import org.netbeans.validation.api.Problems;
import org.netbeans.validation.api.Validator;
import org.openide.util.NbBundle;
/**
* Utils class to validate a string that contains a valid title for a column of a
* Utils class to validate a string that contains a valid title for a column of
* a
* <code>AttributeTable</code>.
*
* @author Eduardo Ramos <eduramiba@gmail.com>
@@ -66,28 +63,30 @@ public class IntervalBoundValidator implements Validator<String> {
this.intervalStartTextField = intervalStartTextField;
}
@Override
public boolean validate(Problems prblms, String componentName, String value) {
try {
double time = DynamicParser.parseTime(value);
if (intervalStartTextField != null) {
//Also validate that this (end time) is greater or equal than start time.
try {
double startTime = DynamicParser.parseTime(intervalStartTextField.getText());
if (time < startTime) {
prblms.add(NbBundle.getMessage(IntervalBoundValidator.class, "IntervalBoundValidator.invalid.interval.message"));
return false;
} else {
return true;
}
} catch (ParseException parseException) {
return true;
}
} else {
return true;
}
} catch (ParseException ex) {
prblms.add(NbBundle.getMessage(IntervalBoundValidator.class, "IntervalBoundValidator.invalid.bound.message"));
return false;
}
return false;
// try {
// double time = DynamicParser.parseTime(value);
// if (intervalStartTextField != null) {
// //Also validate that this (end time) is greater or equal than start time.
// try {
// double startTime = DynamicParser.parseTime(intervalStartTextField.getText());
// if (time < startTime) {
// prblms.add(NbBundle.getMessage(IntervalBoundValidator.class, "IntervalBoundValidator.invalid.interval.message"));
// return false;
// } else {
// return true;
// }
// } catch (ParseException parseException) {
// return true;
// }
// } else {
// return true;
// }
// } catch (ParseException ex) {
// prblms.add(NbBundle.getMessage(IntervalBoundValidator.class, "IntervalBoundValidator.invalid.bound.message"));
// return false;
// }
}
}