org.wicketstuff.gchart.gchart.options.builder.IOptionBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wicket-gchart Show documentation
Show all versions of wicket-gchart Show documentation
Integrate Google Charts API (v45) with wicket.
The API tries not to hide all details of the Google API,
but makes use of the JSON lib of wicket to mix Java, JavaScript and JSON in a transparent way..
/*
* 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.wicketstuff.gchart.gchart.options.builder;
import org.wicketstuff.gchart.gchart.options.ChartOptions;
import org.wicketstuff.gchart.gchart.options.OptionModifier;
import org.apache.wicket.model.IModel;
import org.wicketstuff.gchart.Chart;
/**
*
* @author Dieter Tremel
*/
public interface IOptionBuilder {
/**
* Helper function to build resource base key for a chart and it's id
* according to a convention. This should be used as left part for all keys
* for i18n of charts. Takes the chart id from the chart field.
*
* @return Base key with trailing dot, eg. {@code "Chart.myChart."} if param
* is {@code "myChart"}.
*/
public String getChartBaseResourceKey();
/**
* Generate a wrapped ResourceModel for the {@link Chart} component.
*
* @param subKey Subkey as suffix of {@link #getChartBaseResourceKey() }.
* @return ResourceModel for the complete key. There is no default defined,
* so missing properties can be easyly detected.
*/
public IModel getChartLabelResourceModel(String subKey);
/**
* Add a title of the chart from i18n. The key of the ResourceModel is
* constructed by convention.
*
* @return IOptionbuilder for fluent api.
* @see OptionBuilder#getChartBaseResourceKey(java.lang.String)
* @see IOptionBuilder#getChartBaseResourceKey()
*/
public IOptionBuilder title();
/**
* Add a title of the chart direct from String. Convenient function to wrap
* String in a model.
*
* @param title Text of title.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder title(String title);
/**
* Give the model for the title of the chart.
*
* @param titleModel Model for title.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder title(IModel titleModel);
/**
* Add a subTitle of the chart from i18n. The key of the ResourceModel is
* constructed by convention.
*
* @return IOptionbuilder for fluent api.
* @see OptionBuilder#getChartBaseResourceKey(java.lang.String)
* @see IOptionBuilder#getChartBaseResourceKey()
*/
public IOptionBuilder subTitle();
/**
* Add a subTitle of the chart direct from String. Convenient function to wrap
* String in a model.
*
* @param subTitle Text of subTitle.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder subTitle(String subTitle);
/**
* Give the model for the subTitle of the chart.
*
* @param subTitleModel Model for subTitle.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder subTitle(IModel subTitleModel);
/**
* Add a axis with a title from i18n. The key of the ResourceModel is
* constructed by convention by
* {@link IOptionBuilder#getChartBaseResourceKey()} + {@code "axis.name.title"}.
*
* @param name Uniq name for the axis.
* @return IOptionbuilder for fluent api.
* @see OptionBuilder#getChartBaseResourceKey(java.lang.String)
* @see IOptionBuilder#getChartBaseResourceKey()
*/
public IOptionBuilder axis(String name);
/**
* Add a axis title direct from String. Convenient function to wrap String
* in a model.
*
* @param name Uniq name for the axis.
* @param title Text of title.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder axis(String name, String title);
/**
* Add a axis, give the model for the title of the axis.
*
* @param name Uniq name for the axis.
* @param titleModel Model for title.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder axis(String name, IModel titleModel);
/**
* Add a modifier to configure options for the axis.
*
* @param name Name to refer to an axis.
* @param axisModifier Modifier to handle axis options.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder modifyAxis(String name, OptionModifier axisModifier);
/**
* Map a serie to an axis by the axisname.
*
* @param axisName Name of a previous defined axis.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder mapSeries(String axisName);
/**
* Map a serie to an axis by the axisname. Aply a modifier to the options of
* this series.
*
* @param axisName Name of a previous defined axis.
* @param seriesModifier Modifierer for the opts of this series.
* @return IOptionbuilder for fluent api.
*/
public IOptionBuilder mapSeries(String axisName, OptionModifier seriesModifier);
/**
* Return the ChartOptions defined by previous fluent calls.
*
* @return ChartOptions as defined.
*/
public ChartOptions build();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy