Search in sources :

Example 1 with DateFormat

use of io.jmix.charts.model.date.DateFormat in project jmix by jmix-framework.

the class ChartModelLoader method loadGraph.

protected void loadGraph(AbstractGraph graph, Element graphElement) {
    String accessibleLabel = graphElement.attributeValue("accessibleLabel");
    if (StringUtils.isNotEmpty(accessibleLabel)) {
        graph.setAccessibleLabel(loadResourceString(accessibleLabel));
    }
    String alphaField = graphElement.attributeValue("alphaField");
    if (StringUtils.isNotEmpty(alphaField)) {
        graph.setAlphaField(alphaField);
    }
    String animationPlayed = graphElement.attributeValue("animationPlayed");
    if (StringUtils.isNotEmpty(animationPlayed)) {
        graph.setAnimationPlayed(Boolean.valueOf(animationPlayed));
    }
    Element balloonElement = graphElement.element("balloon");
    if (balloonElement != null) {
        graph.setBalloon(loadBalloon(balloonElement));
    }
    String balloonColor = graphElement.attributeValue("balloonColor");
    if (StringUtils.isNotEmpty(balloonColor)) {
        graph.setBalloonColor(Color.valueOf(balloonColor));
    }
    String balloonFunction = graphElement.elementText("balloonFunction");
    if (StringUtils.isNotEmpty(balloonFunction)) {
        graph.setBalloonFunction(new JsFunction(balloonFunction));
    }
    String balloonText = graphElement.attributeValue("balloonText");
    if (StringUtils.isNotEmpty(balloonText)) {
        graph.setBalloonText(loadResourceString(balloonText));
    }
    String behindColumns = graphElement.attributeValue("behindColumns");
    if (StringUtils.isNotEmpty(behindColumns)) {
        graph.setBehindColumns(Boolean.valueOf(behindColumns));
    }
    String bullet = graphElement.attributeValue("bullet");
    if (StringUtils.isNotEmpty(bullet)) {
        graph.setBullet(BulletType.valueOf(bullet));
    }
    String bulletAlpha = graphElement.attributeValue("bulletAlpha");
    if (StringUtils.isNotEmpty(bulletAlpha)) {
        graph.setBulletAlpha(Double.valueOf(bulletAlpha));
    }
    String bulletAxis = graphElement.attributeValue("bulletAxis");
    if (StringUtils.isNotEmpty(bulletAxis)) {
        graph.setBulletAxis(bulletAxis);
    }
    String bulletBorderAlpha = graphElement.attributeValue("bulletBorderAlpha");
    if (StringUtils.isNotEmpty(bulletBorderAlpha)) {
        graph.setBulletBorderAlpha(Double.valueOf(bulletBorderAlpha));
    }
    String bulletBorderColor = graphElement.attributeValue("bulletBorderColor");
    if (StringUtils.isNotEmpty(bulletBorderColor)) {
        graph.setBulletBorderColor(Color.valueOf(bulletBorderColor));
    }
    String bulletBorderThickness = graphElement.attributeValue("bulletBorderThickness");
    if (StringUtils.isNotEmpty(bulletBorderThickness)) {
        graph.setBulletBorderThickness(Integer.valueOf(bulletBorderThickness));
    }
    String bulletColor = graphElement.attributeValue("bulletColor");
    if (StringUtils.isNotEmpty(bulletColor)) {
        graph.setBulletColor(Color.valueOf(bulletColor));
    }
    String bulletField = graphElement.attributeValue("bulletField");
    if (StringUtils.isNotEmpty(bulletField)) {
        graph.setBulletField(bulletField);
    }
    String bulletHitAreaSize = graphElement.attributeValue("bulletHitAreaSize");
    if (StringUtils.isNotEmpty(bulletHitAreaSize)) {
        graph.setBulletHitAreaSize(Integer.valueOf(bulletHitAreaSize));
    }
    String bulletOffset = graphElement.attributeValue("bulletOffset");
    if (StringUtils.isNotEmpty(bulletOffset)) {
        graph.setBulletOffset(Integer.valueOf(bulletOffset));
    }
    String bulletSize = graphElement.attributeValue("bulletSize");
    if (StringUtils.isNotEmpty(bulletSize)) {
        graph.setBulletSize(Integer.valueOf(bulletSize));
    }
    String classNameField = graphElement.attributeValue("classNameField");
    if (StringUtils.isNotEmpty(classNameField)) {
        graph.setClassNameField(classNameField);
    }
    String bulletSizeField = graphElement.attributeValue("bulletSizeField");
    if (StringUtils.isNotEmpty(bulletSizeField)) {
        graph.setBulletSizeField(bulletSizeField);
    }
    String closeField = graphElement.attributeValue("closeField");
    if (StringUtils.isNotEmpty(closeField)) {
        graph.setCloseField(closeField);
    }
    String clustered = graphElement.attributeValue("clustered");
    if (StringUtils.isNotEmpty(clustered)) {
        graph.setClustered(Boolean.valueOf(clustered));
    }
    String color = graphElement.attributeValue("color");
    if (StringUtils.isNotEmpty(color)) {
        graph.setColor(Color.valueOf(color));
    }
    String colorField = graphElement.attributeValue("colorField");
    if (StringUtils.isNotEmpty(colorField)) {
        graph.setColorField(colorField);
    }
    String columnIndexField = graphElement.attributeValue("columnIndexField");
    if (StringUtils.isNotEmpty(columnIndexField)) {
        graph.setColumnIndexField(columnIndexField);
    }
    String columnWidth = graphElement.attributeValue("columnWidth");
    if (StringUtils.isNotEmpty(columnWidth)) {
        graph.setColumnWidth(Double.valueOf(columnWidth));
    }
    String connect = graphElement.attributeValue("connect");
    if (StringUtils.isNotEmpty(connect)) {
        graph.setConnect(Boolean.valueOf(connect));
    }
    String cornerRadiusTop = graphElement.attributeValue("cornerRadiusTop");
    if (StringUtils.isNotEmpty(cornerRadiusTop)) {
        graph.setCornerRadiusTop(Integer.valueOf(cornerRadiusTop));
    }
    String cursorBulletAlpha = graphElement.attributeValue("cursorBulletAlpha");
    if (StringUtils.isNotEmpty(cursorBulletAlpha)) {
        graph.setCursorBulletAlpha(Double.valueOf(cursorBulletAlpha));
    }
    String customBullet = graphElement.attributeValue("customBullet");
    if (StringUtils.isNotEmpty(customBullet)) {
        graph.setCustomBullet(customBullet);
    }
    String customBulletField = graphElement.attributeValue("customBulletField");
    if (StringUtils.isNotEmpty(customBulletField)) {
        graph.setCustomBulletField(customBulletField);
    }
    String customMarker = graphElement.attributeValue("customMarker");
    if (StringUtils.isNotEmpty(customMarker)) {
        graph.setCustomMarker(customMarker);
    }
    String dashLength = graphElement.attributeValue("dashLength");
    if (StringUtils.isNotEmpty(dashLength)) {
        graph.setDashLength(Integer.valueOf(dashLength));
    }
    String dashLengthField = graphElement.attributeValue("dashLengthField");
    if (StringUtils.isNotEmpty(dashLengthField)) {
        graph.setDashLengthField(dashLengthField);
    }
    Element dateFormatElement = graphElement.element("dateFormat");
    if (dateFormatElement != null) {
        DateFormat dateFormat = new DateFormat();
        loadDateFormat(dateFormat, dateFormatElement);
        graph.setDateFormat(dateFormat);
    }
    String descriptionField = graphElement.attributeValue("descriptionField");
    if (StringUtils.isNotEmpty(descriptionField)) {
        graph.setDescriptionField(descriptionField);
    }
    String errorField = graphElement.attributeValue("errorField");
    if (StringUtils.isNotEmpty(errorField)) {
        graph.setErrorField(errorField);
    }
    String fillAlphas = graphElement.attributeValue("fillAlphas");
    if (StringUtils.isNotEmpty(fillAlphas)) {
        graph.setFillAlphas(Double.valueOf(fillAlphas));
    }
    Element fillColorsElement = graphElement.element("fillColors");
    if (fillColorsElement != null) {
        List<Color> colors = loadColors(fillColorsElement);
        if (CollectionUtils.isNotEmpty(colors)) {
            graph.setFillColors(colors);
        }
    }
    String fillColorsField = graphElement.attributeValue("fillColorsField");
    if (StringUtils.isNotEmpty(fillColorsField)) {
        graph.setFillColorsField(fillColorsField);
    }
    String fillToAxis = graphElement.attributeValue("fillToAxis");
    if (StringUtils.isNotEmpty(fillToAxis)) {
        graph.setFillToAxis(fillToAxis);
    }
    String fillToGraph = graphElement.attributeValue("fillToGraph");
    if (StringUtils.isNotEmpty(fillToGraph)) {
        graph.setFillToGraph(fillToGraph);
    }
    String fixedColumnWidth = graphElement.attributeValue("fixedColumnWidth");
    if (StringUtils.isNotEmpty(fixedColumnWidth)) {
        graph.setFixedColumnWidth(Integer.valueOf(fixedColumnWidth));
    }
    String fontSize = graphElement.attributeValue("fontSize");
    if (StringUtils.isNotEmpty(fontSize)) {
        graph.setFontSize(Integer.valueOf(fontSize));
    }
    String forceGap = graphElement.attributeValue("forceGap");
    if (StringUtils.isNotEmpty(forceGap)) {
        graph.setForceGap(Boolean.valueOf(forceGap));
    }
    String gapField = graphElement.attributeValue("gapField");
    if (StringUtils.isNotEmpty(gapField)) {
        graph.setGapField(gapField);
    }
    String gapPeriod = graphElement.attributeValue("gapPeriod");
    if (StringUtils.isNotEmpty(gapPeriod)) {
        graph.setGapPeriod(Double.valueOf(gapPeriod));
    }
    String gradientOrientation = graphElement.attributeValue("gradientOrientation");
    if (StringUtils.isNotEmpty(gradientOrientation)) {
        graph.setGradientOrientation(GradientOrientation.valueOf(gradientOrientation));
    }
    String hidden = graphElement.attributeValue("hidden");
    if (StringUtils.isNotEmpty(hidden)) {
        graph.setHidden(Boolean.valueOf(hidden));
    }
    String hideBulletsCount = graphElement.attributeValue("hideBulletsCount");
    if (StringUtils.isNotEmpty(hideBulletsCount)) {
        graph.setHideBulletsCount(Integer.valueOf(hideBulletsCount));
    }
    String highField = graphElement.attributeValue("highField");
    if (StringUtils.isNotEmpty(highField)) {
        graph.setHighField(highField);
    }
    String id = graphElement.attributeValue("id");
    if (StringUtils.isNotEmpty(id)) {
        graph.setId(id);
    }
    String includeInMinMax = graphElement.attributeValue("includeInMinMax");
    if (StringUtils.isNotEmpty(includeInMinMax)) {
        graph.setIncludeInMinMax(Boolean.valueOf(includeInMinMax));
    }
    String labelAnchor = graphElement.attributeValue("labelAnchor");
    if (StringUtils.isNotEmpty(labelAnchor)) {
        graph.setLabelAnchor(labelAnchor);
    }
    String labelColorField = graphElement.attributeValue("labelColorField");
    if (StringUtils.isNotEmpty(labelColorField)) {
        graph.setLabelColorField(labelColorField);
    }
    String labelFunction = graphElement.elementText("labelFunction");
    if (StringUtils.isNotBlank(labelFunction)) {
        graph.setLabelFunction(new JsFunction(labelFunction));
    }
    String labelOffset = graphElement.attributeValue("labelOffset");
    if (StringUtils.isNotEmpty(labelOffset)) {
        graph.setLabelOffset(Integer.valueOf(labelOffset));
    }
    String labelPosition = graphElement.attributeValue("labelPosition");
    if (StringUtils.isNotEmpty(labelPosition)) {
        graph.setLabelPosition(ValueLabelPosition.valueOf(labelPosition));
    }
    String labelRotation = graphElement.attributeValue("labelRotation");
    if (StringUtils.isNotEmpty(labelRotation)) {
        graph.setLabelRotation(Integer.valueOf(labelRotation));
    }
    String labelText = graphElement.attributeValue("labelText");
    if (StringUtils.isNotEmpty(labelText)) {
        graph.setLabelText(loadResourceString(labelText));
    }
    String legendAlpha = graphElement.attributeValue("legendAlpha");
    if (StringUtils.isNotEmpty(legendAlpha)) {
        graph.setLegendAlpha(Double.valueOf(legendAlpha));
    }
    String legendColor = graphElement.attributeValue("legendColor");
    if (StringUtils.isNotEmpty(legendColor)) {
        graph.setLegendColor(Color.valueOf(legendColor));
    }
    String legendColorFunction = graphElement.elementText("legendColorFunction");
    if (StringUtils.isNotBlank(legendColorFunction)) {
        graph.setLegendColorFunction(new JsFunction(legendColorFunction));
    }
    String legendPeriodValueText = graphElement.attributeValue("legendPeriodValueText");
    if (StringUtils.isNotEmpty(legendPeriodValueText)) {
        graph.setLegendPeriodValueText(loadResourceString(legendPeriodValueText));
    }
    String legendValueText = graphElement.attributeValue("legendValueText");
    if (StringUtils.isNotEmpty(legendValueText)) {
        graph.setLegendValueText(loadResourceString(legendValueText));
    }
    String lineAlpha = graphElement.attributeValue("lineAlpha");
    if (StringUtils.isNotEmpty(lineAlpha)) {
        graph.setLineAlpha(Double.valueOf(lineAlpha));
    }
    String lineColor = graphElement.attributeValue("lineColor");
    if (StringUtils.isNotEmpty(lineColor)) {
        graph.setLineColor(Color.valueOf(lineColor));
    }
    String lineColorField = graphElement.attributeValue("lineColorField");
    if (StringUtils.isNotEmpty("lineColorField")) {
        graph.setLineColorField(lineColorField);
    }
    String lineThickness = graphElement.attributeValue("lineThickness");
    if (StringUtils.isNotEmpty(lineThickness)) {
        graph.setLineThickness(Integer.valueOf(lineThickness));
    }
    String lowField = graphElement.attributeValue("lowField");
    if (StringUtils.isNotEmpty(lowField)) {
        graph.setLowField(lowField);
    }
    String markerType = graphElement.attributeValue("markerType");
    if (StringUtils.isNotEmpty(markerType)) {
        graph.setMarkerType(MarkerType.valueOf(markerType));
    }
    String maxBulletSize = graphElement.attributeValue("maxBulletSize");
    if (StringUtils.isNotEmpty(maxBulletSize)) {
        graph.setMaxBulletSize(Integer.valueOf(maxBulletSize));
    }
    String minBulletSize = graphElement.attributeValue("minBulletSize");
    if (StringUtils.isNotEmpty(minBulletSize)) {
        graph.setMinBulletSize(Integer.valueOf(minBulletSize));
    }
    String minDistance = graphElement.attributeValue("minDistance");
    if (StringUtils.isNotEmpty(minDistance)) {
        graph.setMinDistance(Integer.valueOf(minDistance));
    }
    String negativeBase = graphElement.attributeValue("negativeBase");
    if (StringUtils.isNotEmpty(negativeBase)) {
        graph.setNegativeBase(Double.valueOf(negativeBase));
    }
    String negativeFillAlphas = graphElement.attributeValue("negativeFillAlphas");
    if (StringUtils.isNotEmpty(negativeFillAlphas)) {
        graph.setNegativeFillAlphas(Double.valueOf(negativeFillAlphas));
    }
    Element negativeFillColors = graphElement.element("negativeFillColors");
    if (negativeFillColors != null) {
        List<Color> colors = loadColors(negativeFillColors);
        if (CollectionUtils.isNotEmpty(colors)) {
            graph.setNegativeFillColors(colors);
        }
    }
    String negativeLineAlpha = graphElement.attributeValue("negativeLineAlpha");
    if (StringUtils.isNotEmpty(negativeLineAlpha)) {
        graph.setNegativeLineAlpha(Double.valueOf(negativeLineAlpha));
    }
    String negativeLineColor = graphElement.attributeValue("negativeLineColor");
    if (StringUtils.isNotEmpty(negativeLineColor)) {
        graph.setNegativeLineColor(Color.valueOf(negativeLineColor));
    }
    String newStack = graphElement.attributeValue("newStack");
    if (StringUtils.isNotEmpty(newStack)) {
        graph.setNewStack(Boolean.valueOf(newStack));
    }
    String noStepRisers = graphElement.attributeValue("noStepRisers");
    if (StringUtils.isNotEmpty(noStepRisers)) {
        graph.setNoStepRisers(Boolean.valueOf(noStepRisers));
    }
    String openField = graphElement.attributeValue("openField");
    if (StringUtils.isNotEmpty(openField)) {
        graph.setOpenField(openField);
    }
    Element patternElement = graphElement.element("pattern");
    if (patternElement != null) {
        graph.setPattern(loadPattern(patternElement));
    }
    String patternField = graphElement.attributeValue("patternField");
    if (StringUtils.isNotEmpty(patternField)) {
        graph.setPatternField(patternField);
    }
    String periodSpan = graphElement.attributeValue("periodSpan");
    if (StringUtils.isNotEmpty(periodSpan)) {
        graph.setPeriodSpan(Integer.valueOf(periodSpan));
    }
    String pointPosition = graphElement.attributeValue("pointPosition");
    if (StringUtils.isNotEmpty(pointPosition)) {
        graph.setPointPosition(PointPosition.valueOf(pointPosition));
    }
    String precision = graphElement.attributeValue("precision");
    if (StringUtils.isNotEmpty(precision)) {
        graph.setPrecision(Integer.valueOf(precision));
    }
    String proCandlesticks = graphElement.attributeValue("proCandlesticks");
    if (StringUtils.isNotEmpty(proCandlesticks)) {
        graph.setProCandlesticks(Boolean.valueOf(proCandlesticks));
    }
    String showAllValueLabels = graphElement.attributeValue("showAllValueLabels");
    if (StringUtils.isNotEmpty(showAllValueLabels)) {
        graph.setShowAllValueLabels(Boolean.valueOf(showAllValueLabels));
    }
    String showBalloon = graphElement.attributeValue("showBalloon");
    if (StringUtils.isNotEmpty(showBalloon)) {
        graph.setShowBalloon(Boolean.valueOf(showBalloon));
    }
    String showBalloonAt = graphElement.attributeValue("showBalloonAt");
    if (StringUtils.isNotEmpty(showBalloonAt)) {
        graph.setShowBalloonAt(ShowPositionOnCandle.valueOf(showBalloonAt));
    }
    String showBulletsAt = graphElement.attributeValue("showBulletsAt");
    if (StringUtils.isNotEmpty(showBulletsAt)) {
        graph.setShowBulletsAt(ShowPositionOnCandle.valueOf(showBulletsAt));
    }
    String showHandOnHover = graphElement.attributeValue("showHandOnHover");
    if (StringUtils.isNotEmpty(showHandOnHover)) {
        graph.setShowHandOnHover(Boolean.valueOf(showHandOnHover));
    }
    String showOnAxis = graphElement.attributeValue("showOnAxis");
    if (StringUtils.isNotEmpty(showOnAxis)) {
        graph.setShowOnAxis(Boolean.valueOf(showOnAxis));
    }
    String stackable = graphElement.attributeValue("stackable");
    if (StringUtils.isNotEmpty(stackable)) {
        graph.setStackable(Boolean.valueOf(stackable));
    }
    String stepDirection = graphElement.attributeValue("stepDirection");
    if (StringUtils.isNotEmpty(stepDirection)) {
        graph.setStepDirection(StepDirection.valueOf(stepDirection));
    }
    String switchable = graphElement.attributeValue("switchable");
    if (StringUtils.isNotEmpty(switchable)) {
        graph.setSwitchable(Boolean.valueOf(switchable));
    }
    String tabIndex = graphElement.attributeValue("tabIndex");
    if (StringUtils.isNotEmpty(tabIndex)) {
        graph.setTabIndex(Integer.valueOf(tabIndex));
    }
    String title = graphElement.attributeValue("title");
    if (StringUtils.isNotEmpty(title)) {
        graph.setTitle(loadResourceString(title));
    }
    String topRadius = graphElement.attributeValue("topRadius");
    if (StringUtils.isNotEmpty(topRadius)) {
        graph.setTopRadius(Integer.valueOf(topRadius));
    }
    String type = graphElement.attributeValue("type");
    if (StringUtils.isNotEmpty(type)) {
        graph.setType(GraphType.valueOf(type));
    }
    String urlField = graphElement.attributeValue("urlField");
    if (StringUtils.isNotEmpty(urlField)) {
        graph.setUrlField(urlField);
    }
    String urlTarget = graphElement.attributeValue("urlTarget");
    if (StringUtils.isNotEmpty(urlTarget)) {
        graph.setUrlTarget(urlTarget);
    }
    String useLineColorForBulletBorder = graphElement.attributeValue("useLineColorForBulletBorder");
    if (StringUtils.isNotEmpty(useLineColorForBulletBorder)) {
        graph.setUseLineColorForBulletBorder(Boolean.valueOf(useLineColorForBulletBorder));
    }
    String useNegativeColorIfDown = graphElement.attributeValue("useNegativeColorIfDown");
    if (StringUtils.isNotEmpty(useNegativeColorIfDown)) {
        graph.setUseNegativeColorIfDown(Boolean.valueOf(useNegativeColorIfDown));
    }
    String valueAxis = graphElement.attributeValue("valueAxis");
    if (StringUtils.isNotEmpty(valueAxis)) {
        graph.setValueAxis(valueAxis);
    }
    String valueField = graphElement.attributeValue("valueField");
    if (StringUtils.isNotEmpty(valueField)) {
        graph.setValueField(valueField);
    }
    String visibleInLegend = graphElement.attributeValue("visibleInLegend");
    if (StringUtils.isNotEmpty(visibleInLegend)) {
        graph.setVisibleInLegend(Boolean.valueOf(visibleInLegend));
    }
    String xAxis = graphElement.attributeValue("xAxis");
    if (StringUtils.isNotEmpty(xAxis)) {
        graph.setXAxis(xAxis);
    }
    String xField = graphElement.attributeValue("xField");
    if (StringUtils.isNotEmpty(xField)) {
        graph.setXField(xField);
    }
    String yAxis = graphElement.attributeValue("yAxis");
    if (StringUtils.isNotEmpty(yAxis)) {
        graph.setYAxis(yAxis);
    }
    String yField = graphElement.attributeValue("yField");
    if (StringUtils.isNotEmpty(yField)) {
        graph.setYField(yField);
    }
}
Also used : JsFunction(io.jmix.charts.model.JsFunction) Element(org.dom4j.Element) FastDateFormat(org.apache.commons.lang3.time.FastDateFormat) DateFormat(io.jmix.charts.model.date.DateFormat)

Example 2 with DateFormat

use of io.jmix.charts.model.date.DateFormat in project jmix by jmix-framework.

the class ChartModelLoader method loadDateFormats.

protected List<DateFormat> loadDateFormats(Element dateFormatsElement) {
    List<DateFormat> dateFormats = new ArrayList<>();
    for (Object dateFormatItem : dateFormatsElement.elements("dateFormat")) {
        Element dateFormatElement = (Element) dateFormatItem;
        DateFormat dateFormat = new DateFormat();
        loadDateFormat(dateFormat, dateFormatElement);
        dateFormats.add(dateFormat);
    }
    return dateFormats;
}
Also used : FastDateFormat(org.apache.commons.lang3.time.FastDateFormat) DateFormat(io.jmix.charts.model.date.DateFormat) Element(org.dom4j.Element) ArrayList(java.util.ArrayList)

Aggregations

DateFormat (io.jmix.charts.model.date.DateFormat)2 FastDateFormat (org.apache.commons.lang3.time.FastDateFormat)2 Element (org.dom4j.Element)2 JsFunction (io.jmix.charts.model.JsFunction)1 ArrayList (java.util.ArrayList)1