All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.d3x.morpheus.viz.chart.ChartOptions Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
/*
 * Copyright (C) 2014-2018 D3X Systems - All Rights Reserved
 *
 * 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 com.d3x.morpheus.viz.chart;

import java.awt.*;
import java.util.Optional;

/**
 * An interface that allows for control of various additional options for a Chart.
 *
 * @author Xavier Witdouck
 *
 * 

This is open source software released under the Apache 2.0 License

*/ public interface ChartOptions { /** * Returns the id for this chart * @return the id for chart */ Optional getId(); /** * Returns the preferred size for this chart * @return the preferred size */ Optional getPreferredSize(); /** * Sets an id for this chart * @param id the id string for chart * @return these options */ ChartOptions withId(String id); /** * Sets the preferred size for the chart * @param width the preferred width in pixels * @param height the preferred heigth in pixels * @return these options */ ChartOptions withPreferredSize(int width, int height); /** * A default implementation of the ChartOptions */ class Default implements ChartOptions { private String id; private Dimension preferredSize = new Dimension(800, 500); @Override public Optional getId() { return Optional.ofNullable(id); } @Override public Optional getPreferredSize() { return Optional.ofNullable(preferredSize); } @Override public ChartOptions withId(String id) { this.id = id; return this; } @Override public ChartOptions withPreferredSize(int width, int height) { this.preferredSize = new Dimension(width, height); return this; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy