use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class XYPlotFactoryService method createPlot.
// PlotFactoryのJavaDoc
public Plot createPlot(PlotCondition[] plotConditions) throws PlotCreateException {
// 複数のプロット条件を1つにマージ
XYPlotConditionImpl xyPlotCondition = mergeXYPlotCondition(plotConditions);
if (xyPlotCondition == null) {
return new XYPlot(null, new NumberAxis(), new NumberAxis(), new XYLineAndShapeRenderer(true, false));
}
// テンプレートのプロットから値をコピーしたプロット作成
XYPlot xyPlot = copyXYPlot();
// データセットリスト
List dsFactoryList = new ArrayList();
// 有効なデータセット名を取得
String[] enableDsNames = xyPlotCondition.getEnableDatasetNames();
// 設定順のデータセット名を取得
String[] dsNamesOrder = xyPlotCondition.getDatasetNameOrder();
// データセット条件に設定されたときのみ適用
if (dsNamesOrder != null && dsNamesOrder.length > 0) {
for (int j = 0; j < dsNamesOrder.length; j++) {
// データセット名
String dsName = dsNamesOrder[j];
boolean isEnabled = false;
if (enableDsNames != null && enableDsNames.length > 0) {
for (int k = 0; k < enableDsNames.length; k++) {
if (dsName.equals(enableDsNames[k])) {
isEnabled = true;
break;
}
}
if (isEnabled) {
if (dsFactoryMap.containsKey(dsName)) {
// 有効なデータセット
dsFactoryList.add(dsFactoryMap.get(dsName));
}
}
}
}
} else {
/*
* データセット条件にデータセット順序、有効データセット名が
* 設定されなかった場合は、サービス定義の順序でデータセットを設定
*/
dsFactoryList.addAll(dsFactoryMap.values());
}
for (int j = 0; j < dsFactoryList.size(); j++) {
DatasetFactory dsFactory = (DatasetFactory) dsFactoryList.get(j);
String dsName = dsFactory.getName();
DatasetCondition[] dsConditions = xyPlotCondition.getDatasetConditions();
Dataset ds = null;
try {
ds = dsFactory.createDataset(dsConditions);
} catch (DatasetCreateException e) {
// データセット生成失敗
throw new PlotCreateException(e);
}
// サービス名エディタ
ServiceNameEditor editor = new ServiceNameEditor();
editor.setServiceManagerName(getServiceManagerName());
// データセットのループ
if (ds != null && (ds instanceof XYDataset)) {
// データセット
xyPlot.setDataset(j, (XYDataset) ds);
// このデータセットが所属する横軸名
if (dsDomainAxisNames != null && dsDomainAxisNames.size() > 0) {
String domainAxisName = dsDomainAxisNames.getProperty(dsName);
if (domainAxisName != null && domainAxisIndexMap.containsKey(domainAxisName)) {
Integer domainAxisIndex = (Integer) domainAxisIndexMap.get(domainAxisName);
xyPlot.mapDatasetToDomainAxis(j, domainAxisIndex.intValue());
}
}
// このデータセットが所属する縦軸名
if (dsRangeAxisNames != null && dsRangeAxisNames.size() > 0) {
String rangeAxisName = dsRangeAxisNames.getProperty(dsName);
if (rangeAxisName != null && rangeAxisIndexMap.containsKey(rangeAxisName)) {
Integer rangeAxisIndex = (Integer) rangeAxisIndexMap.get(rangeAxisName);
xyPlot.mapDatasetToRangeAxis(j, rangeAxisIndex.intValue());
}
}
// レンダラー
XYItemRenderer renderer = null;
if (dsRendererNames != null && dsRendererNames.size() > 0) {
String rendererNameStr = dsRendererNames.getProperty(dsName);
editor.setAsText(rendererNameStr);
ServiceName rendererName = (ServiceName) editor.getValue();
renderer = (XYItemRenderer) ServiceManagerFactory.getServiceObject(rendererName);
}
if (renderer != null) {
xyPlot.setRenderer(j, renderer);
} else {
xyPlot.setRenderer(j, new XYLineAndShapeRenderer(true, false));
}
}
}
// 横軸
if (domainAxisServiceNames != null && domainAxisServiceNames.length > 0) {
for (int j = 0; j < domainAxisServiceNames.length; j++) {
ValueAxis domainAxis = (ValueAxis) ServiceManagerFactory.getServiceObject(domainAxisServiceNames[j]);
// 横軸ラベルフォント
if (xyPlotCondition.getDefaultDomainAxisLabelFontName() != null || xyPlotCondition.getDefaultDomainAxisLabelFontStyle() != Integer.MIN_VALUE || xyPlotCondition.getDefaultDomainAxisLabelFontSize() != Integer.MIN_VALUE) {
domainAxis.setLabelFont(mergeFont(domainAxis.getLabelFont(), xyPlotCondition.getDefaultDomainAxisLabelFontName(), xyPlotCondition.getDefaultDomainAxisLabelFontStyle(), xyPlotCondition.getDefaultDomainAxisLabelFontSize()));
} else if (xyPlotCondition.getDomainAxisLabelFontName(j) != null || xyPlotCondition.getDomainAxisLabelFontStyle(j) != Integer.MIN_VALUE || xyPlotCondition.getDomainAxisLabelFontSize(j) != Integer.MIN_VALUE) {
domainAxis.setLabelFont(mergeFont(domainAxis.getLabelFont(), xyPlotCondition.getDomainAxisLabelFontName(j), xyPlotCondition.getDomainAxisLabelFontStyle(j), xyPlotCondition.getDomainAxisLabelFontSize(j)));
}
// 横軸Tickラベルフォント
if (xyPlotCondition.getDefaultDomainAxisTickLabelFontName() != null || xyPlotCondition.getDefaultDomainAxisTickLabelFontStyle() != Integer.MIN_VALUE || xyPlotCondition.getDefaultDomainAxisTickLabelFontSize() != Integer.MIN_VALUE) {
domainAxis.setTickLabelFont(mergeFont(domainAxis.getTickLabelFont(), xyPlotCondition.getDefaultDomainAxisTickLabelFontName(), xyPlotCondition.getDefaultDomainAxisTickLabelFontStyle(), xyPlotCondition.getDefaultDomainAxisTickLabelFontSize()));
} else if (xyPlotCondition.getDomainAxisTickLabelFontName(j) != null || xyPlotCondition.getDomainAxisTickLabelFontStyle(j) != Integer.MIN_VALUE || xyPlotCondition.getDomainAxisTickLabelFontSize(j) != Integer.MIN_VALUE) {
domainAxis.setTickLabelFont(mergeFont(domainAxis.getTickLabelFont(), xyPlotCondition.getDomainAxisTickLabelFontName(j), xyPlotCondition.getDomainAxisTickLabelFontStyle(j), xyPlotCondition.getDomainAxisTickLabelFontSize(j)));
}
xyPlot.setDomainAxis(j, domainAxis);
}
}
// 縦軸
if (rangeAxisServiceNames != null && rangeAxisServiceNames.length > 0) {
for (int j = 0; j < rangeAxisServiceNames.length; j++) {
ValueAxis rangeAxis = (ValueAxis) ServiceManagerFactory.getServiceObject(rangeAxisServiceNames[j]);
// 縦軸ラベルフォント
if (xyPlotCondition.getDefaultRangeAxisLabelFontName() != null || xyPlotCondition.getDefaultRangeAxisLabelFontStyle() != Integer.MIN_VALUE || xyPlotCondition.getDefaultRangeAxisLabelFontSize() != Integer.MIN_VALUE) {
rangeAxis.setLabelFont(mergeFont(rangeAxis.getLabelFont(), xyPlotCondition.getDefaultRangeAxisLabelFontName(), xyPlotCondition.getDefaultRangeAxisLabelFontStyle(), xyPlotCondition.getDefaultRangeAxisLabelFontSize()));
} else if (xyPlotCondition.getRangeAxisLabelFontName(j) != null || xyPlotCondition.getRangeAxisLabelFontStyle(j) != Integer.MIN_VALUE || xyPlotCondition.getRangeAxisLabelFontSize(j) != Integer.MIN_VALUE) {
rangeAxis.setLabelFont(mergeFont(rangeAxis.getLabelFont(), xyPlotCondition.getRangeAxisLabelFontName(j), xyPlotCondition.getRangeAxisLabelFontStyle(j), xyPlotCondition.getRangeAxisLabelFontSize(j)));
}
// 縦軸Tickラベルフォント
if (xyPlotCondition.getDefaultRangeAxisTickLabelFontName() != null || xyPlotCondition.getDefaultRangeAxisTickLabelFontStyle() != Integer.MIN_VALUE || xyPlotCondition.getDefaultRangeAxisTickLabelFontSize() != Integer.MIN_VALUE) {
rangeAxis.setTickLabelFont(mergeFont(rangeAxis.getTickLabelFont(), xyPlotCondition.getDefaultRangeAxisTickLabelFontName(), xyPlotCondition.getDefaultRangeAxisTickLabelFontStyle(), xyPlotCondition.getDefaultRangeAxisTickLabelFontSize()));
} else if (xyPlotCondition.getRangeAxisTickLabelFontName(j) != null || xyPlotCondition.getRangeAxisTickLabelFontStyle(j) != Integer.MIN_VALUE || xyPlotCondition.getRangeAxisTickLabelFontSize(j) != Integer.MIN_VALUE) {
rangeAxis.setTickLabelFont(mergeFont(rangeAxis.getTickLabelFont(), xyPlotCondition.getRangeAxisTickLabelFontName(j), xyPlotCondition.getRangeAxisTickLabelFontStyle(j), xyPlotCondition.getRangeAxisTickLabelFontSize(j)));
}
// 縦軸の可視状態設定
if (xyPlotCondition.isRangeAxisVisible(j) != null) {
rangeAxis.setVisible(xyPlotCondition.isRangeAxisVisible(j).booleanValue());
}
xyPlot.setRangeAxis(j, rangeAxis);
}
}
if (adjusters != null) {
// 目盛り調節
for (int i = 0; i < adjusters.length; i++) {
adjusters[i].adjust(xyPlot);
}
}
return xyPlot;
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class RestServlet method init.
public void init() throws ServletException {
final ServiceName restServerServiceName = getRestServerServiceName();
if (restServerServiceName == null) {
throw new ServletException("RestServerServiceName is null.");
}
restServer = (RestServer) ServiceManagerFactory.getServiceObject(restServerServiceName);
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class RestServlet method getRestServerServiceName.
/**
* 初期化パラメータ{@link #INIT_PARAM_NAME_REST_SERVER_SERVICE_NAME}で指定された{@link RestServer}サービスのサービス名を取得する。<p>
*
* @return RestServerサービスのサービス名
*/
protected ServiceName getRestServerServiceName() {
final ServletConfig config = getServletConfig();
final String serviceNameStr = config.getInitParameter(INIT_PARAM_NAME_REST_SERVER_SERVICE_NAME);
if (serviceNameStr == null) {
return null;
}
final ServiceNameEditor editor = new ServiceNameEditor();
editor.setAsText(serviceNameStr);
return (ServiceName) editor.getValue();
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ScheduleManagerServlet method getScheduleManagerServiceName.
private ServiceName getScheduleManagerServiceName() {
final ServletConfig config = getServletConfig();
final String serviceNameStr = config.getInitParameter(INIT_PARAM_NAME_SCHEDULE_MANAGER_SERVICE_NAME);
if (serviceNameStr == null) {
return null;
}
final ServiceNameEditor editor = new ServiceNameEditor();
editor.setAsText(serviceNameStr);
return (ServiceName) editor.getValue();
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ScheduleManagerServlet method getJSONConverterServiceName.
private ServiceName getJSONConverterServiceName() {
final ServletConfig config = getServletConfig();
final String serviceNameStr = config.getInitParameter(INIT_PARAM_NAME_JSON_CONVERTER_SERVICE_NAME);
if (serviceNameStr == null) {
return null;
}
final ServiceNameEditor editor = new ServiceNameEditor();
editor.setAsText(serviceNameStr);
return (ServiceName) editor.getValue();
}
Aggregations