Package org.gephi.data.attributes.type

Examples of org.gephi.data.attributes.type.TimeInterval


     *
     * @return the valid visible interval, or <code>null</code>.
     */
    public static TimeInterval getVisibleInterval(DynamicModel dynamicModel) {
        if (dynamicModel != null) {
            TimeInterval ti = dynamicModel.getVisibleInterval();
            if (ti != null && !(Double.isInfinite(ti.getLow()) && Double.isInfinite(ti.getHigh()))) {
                return ti;
            }
        }
        return null;
    }
View Full Code Here


        begin += ":" + (beginSecond < 10 ? "0" + beginSecond : beginSecond);
        end += "T" + (endHour < 10 ? "0" + endHour : endHour);
        end += ":" + (endMinute < 10 ? "0" + endMinute : endMinute);
        end += ":" + (endSecond < 10 ? "0" + endSecond : endSecond);

        return new TimeInterval(
                DynamicUtilities.getDoubleFromXMLDateString(begin),
                DynamicUtilities.getDoubleFromXMLDateString(end));
    }
View Full Code Here

                DynamicUtilities.getDoubleFromXMLDateString(begin),
                DynamicUtilities.getDoubleFromXMLDateString(end));
    }

    public double getWindow() {
        TimeInterval timeInterval = getTimeInterval();
        return windowSlider.getValue() / 100.0 * (timeInterval.getHigh() - timeInterval.getLow());
    }
View Full Code Here

            endSecondSpinner.setValue(59);
        }
    }

    public void setWindow(double window) {
        TimeInterval timeInterval = getTimeInterval();
        if (window > timeInterval.getHigh() - timeInterval.getLow() || Double.compare(window, 0.0) == 0) {
            windowSlider.setValue(100);
        } else {
            windowSlider.setValue((int) Math.round(window / (timeInterval.getHigh() - timeInterval.getLow()) * 100));
        }
    }
View Full Code Here

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        if (value == null) {
            //Render empty string when null
            return super.getTableCellRendererComponent(table, null, isSelected, hasFocus, row, column);
        }
        TimeInterval timeInterval = (TimeInterval) value;
        String stringRepresentation = timeInterval.toString(timeFormat==TimeFormat.DOUBLE);
        if (drawGraphics) {
            JLabel label = new JLabel();
            Color background;
            if (isSelected) {
                background = SELECTED_BACKGROUND;
            } else {
                background = UNSELECTED_BACKGROUND;
            }

            final BufferedImage i = timeIntervalGraphics.createTimeIntervalImage(timeInterval.getLow(), timeInterval.getHigh(), table.getColumnModel().getColumn(column).getWidth() - 1, table.getRowHeight(row) - 1, FILL_COLOR, BORDER_COLOR, background);
            label.setIcon(new ImageIcon(i));
            label.setToolTipText(stringRepresentation);//String representation as tooltip
            return label;
        } else {
            return super.getTableCellRendererComponent(table, stringRepresentation, isSelected, hasFocus, row, column);
View Full Code Here

            DynamicType dynamicValue = (DynamicType) attributeValue;
            Estimator estimator = dynamicModel == null ? Estimator.FIRST : dynamicModel.getEstimator();
            if (Number.class.isAssignableFrom(dynamicValue.getUnderlyingType())) {
                estimator = dynamicModel == null ? Estimator.AVERAGE : dynamicModel.getNumberEstimator();
            }
            TimeInterval timeInterval = new TimeInterval(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
            if (dynamic) {
                timeInterval = dynamicModel.getVisibleInterval();
            }
            return dynamicValue.getValue(timeInterval.getLow(), timeInterval.getHigh(), estimator);
        }
        return attributeValue;
    }
View Full Code Here

        return attributeValue;
    }

    public float getEdgeWeight(Edge edge) {
        if (dynamic) {
            TimeInterval timeInterval = dynamicModel.getVisibleInterval();
            return edge.getWeight(timeInterval.getLow(), timeInterval.getHigh());
        }
        return edge.getWeight();
    }
View Full Code Here

        public boolean evaluate(Graph graph, Node node) {
            if (nodeColumn != null) {
                Object obj = node.getNodeData().getAttributes().getValue(nodeColumn.getIndex());
                if (obj != null) {
                    TimeInterval timeInterval = (TimeInterval) obj;
                    return timeInterval.isInRange(visibleInterval.getLow(), visibleInterval.getHigh());
                }
                return keepNull;
            }
            return true;
        }
View Full Code Here

        public boolean evaluate(Graph graph, Edge edge) {
            if (edgeColumn != null) {
                Object obj = edge.getEdgeData().getAttributes().getValue(edgeColumn.getIndex());
                if (obj != null) {
                    TimeInterval timeInterval = (TimeInterval) obj;
                    return timeInterval.isInRange(visibleInterval.getLow(), visibleInterval.getHigh());
                }
                return keepNull;
            }
            return true;
        }
View Full Code Here

            if (nodeColumn != null) {
                for (Node n : graph.getNodes()) {
                    Object obj = n.getNodeData().getAttributes().getValue(nodeColumn.getIndex());
                    if (obj != null) {
                        TimeInterval timeInterval = (TimeInterval) obj;
                        min = Math.min(min, Double.isInfinite(timeInterval.getLow()) ? min : timeInterval.getLow());
                        max = Math.max(max, Double.isInfinite(timeInterval.getHigh()) ? max : timeInterval.getHigh());
                    }
                }
            }
            if (edgeColumn != null) {
                for (Edge e : graph.getEdgesAndMetaEdges()) {
                    Object obj = e.getEdgeData().getAttributes().getValue(nodeColumn.getIndex());
                    if (obj != null) {
                        TimeInterval timeInterval = (TimeInterval) obj;
                        min = Math.min(min, Double.isInfinite(timeInterval.getLow()) ? min : timeInterval.getLow());
                        max = Math.max(max, Double.isInfinite(timeInterval.getHigh()) ? max : timeInterval.getHigh());
                    }
                }
            }
            if (range == null) {
                range = new Range(visibleInterval.getLow(), visibleInterval.getHigh(), min, max);
View Full Code Here

TOP

Related Classes of org.gephi.data.attributes.type.TimeInterval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.