当前位置: 首页>>代码示例>>Java>>正文


Java Section类代码示例

本文整理汇总了Java中eu.hansolo.medusa.Section的典型用法代码示例。如果您正苦于以下问题:Java Section类的具体用法?Java Section怎么用?Java Section使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Section类属于eu.hansolo.medusa包,在下文中一共展示了Section类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setBar

import eu.hansolo.medusa.Section; //导入依赖的package包/类
private void setBar(final double VALUE) {
    if (model.getMinValue() > 0) {
        bar.setLength((model.getMinValue() - VALUE) * model.getAngleStep());
    } else {
        bar.setLength(-VALUE * model.getAngleStep());
    }
    if (model.getSectionsVisible() && !sections.isEmpty()) {
        for (Section section : sections) {
            if (section.contains(VALUE)) {
                bar.setStroke(section.getColor());
                break;
            }
        }
    }

    valueText.setText(String.format(model.getLocale(), formatString, VALUE));
    valueText.setLayoutX((size - valueText.getLayoutBounds().getWidth()) * 0.5);
}
 
开发者ID:HanSolo,项目名称:SimpleSectionGauge,代码行数:19,代码来源:SimpleSectionGauge.java

示例2: init

import eu.hansolo.medusa.Section; //导入依赖的package包/类
@Override public void init() {
    gauge = GaugeBuilder.create()
                        .prefSize(250, 250)
                        .minValue(0)
                        .maxValue(100)
                        .animated(false)
                        .title("Title")
                        .unit("\u00B0C")
                        .subTitle("SubTitle")
                        .interactive(true)
                        .onButtonPressed(o -> System.out.println("Button pressed"))
                        .title("Title")
                        .sections(new Section(0, 33, Color.RED),
                                  new Section(33, 66, Color.YELLOW),
                                  new Section(66, 100, Color.LIME))
                        .sectionsVisible(true)
                        .build();
    gauge.setSkin(new InteractiveGaugeSkin(gauge));
}
 
开发者ID:HanSolo,项目名称:medusademo,代码行数:20,代码来源:InteractiveDemo.java

示例3: init

import eu.hansolo.medusa.Section; //导入依赖的package包/类
@Override public void init() {
    Label title = new Label("December 2015");
    title.setFont(Font.font(24));

    revenue = getBulletChart("Revenue", "($'000)", 600, 500, new Section(0, 200, RED), new Section(200, 400, YELLOW), new Section(400, 600, GREEN));
    profit  = getBulletChart("Profit", "($'000)", 100, 70, new Section(0, 20, RED), new Section(20, 60, YELLOW), new Section(60, 100, GREEN));
    sales   = getBulletChart("Sales", "(unit)", 1000, 700, new Section(0, 300, RED), new Section(300, 500, YELLOW), new Section(500, 1000, GREEN));

    HBox legend = new HBox(getLegendBox(RED, "Poor", 10),
                           getLegendBox(YELLOW, "Average", 10),
                           getLegendBox(GREEN, "Good", 10),
                           getLegendBox(GRAY, "Target", 5));
    legend.setSpacing(20);
    legend.setAlignment(Pos.CENTER);

    pane = new VBox(title, revenue, profit, sales, legend);
    pane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(20, 20, 20, 20));
    pane.setSpacing(10);
}
 
开发者ID:HanSolo,项目名称:medusademo,代码行数:21,代码来源:KpiDashboard.java

示例4: drawBackground

import eu.hansolo.medusa.Section; //导入依赖的package包/类
private void drawBackground() {
    backgroundCtx.clearRect(0, 0, width, height);
    backgroundCtx.setFill(barBackgroundColor);
    int listSize  = sections.size();
    Section currentSection;
    for (int i = 0 ; i < NO_OF_LEDS ; i++) {
        if (sectionsVisible) {
            double value = (i + 1) / stepSize;
            for (int j = 0 ; j < listSize ; j++) {
                currentSection = sections.get(j);
                if (currentSection.contains(value)) {
                    backgroundCtx.setFill(currentSection.getColor().darker().darker());
                    break;
                } else {
                    backgroundCtx.setFill(barBackgroundColor);
                }
            }
        }
        backgroundCtx.save();
        backgroundCtx.setEffect(ledInnerShadow);
        backgroundCtx.fillOval(ledBorder, height - ledSize - (i * (ledSpacer + ledSize)) - ledBorder, ledSize, ledSize);
        backgroundCtx.restore();
    }
}
 
开发者ID:HanSolo,项目名称:medusademo,代码行数:25,代码来源:CustomGaugeSkin.java

示例5: createBar

import eu.hansolo.medusa.Section; //导入依赖的package包/类
private Gauge createBar() {
    Gauge gauge = GaugeBuilder.create()
                              .backgroundPaint(Gauge.DARK_COLOR)
                              .barBackgroundColor(Color.DARKRED)
                              .barColor(Color.RED)
                              .minValue(0)
                              .maxValue(100)
                              .sectionsVisible(true)
                              .sections(new Section(0, 70, Color.LIME),
                                        new Section(70,85, Color.YELLOW),
                                        new Section(85, 100, Color.RED))
                              .build();

    gauge.setSkin(new CustomGaugeSkin(gauge));
    return gauge;
}
 
开发者ID:HanSolo,项目名称:medusademo,代码行数:17,代码来源:CustomGaugeSkinDemo.java

示例6: TileKpiSkin

import eu.hansolo.medusa.Section; //导入依赖的package包/类
public TileKpiSkin(Gauge gauge) {
    super(gauge);
    if (gauge.isAutoScale()) gauge.calcAutoScale();
    angleRange           = Helper.clamp(90.0, 180.0, gauge.getAngleRange());
    oldValue             = gauge.getValue();
    minValue             = gauge.getMinValue();
    threshold            = gauge.getThreshold();
    thresholdColor       = gauge.getThresholdColor();
    range                = gauge.getRange();
    angleStep            = angleRange / range;
    formatString         = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();
    locale               = gauge.getLocale();
    sectionsVisible      = gauge.getSectionsVisible();
    highlightSections    = gauge.isHighlightSections();
    sections             = gauge.getSections();
    sectionMap           = new HashMap<>(sections.size());
    currentValueListener = o -> rotateNeedle(gauge.getCurrentValue());
    for(Section section : sections) { sectionMap.put(section, new Arc()); }

    initGraphics();
    registerListeners();

    rotateNeedle(gauge.getCurrentValue());
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:25,代码来源:TileKpiSkin.java

示例7: setBarColor

import eu.hansolo.medusa.Section; //导入依赖的package包/类
private void setBarColor(final double VALUE) {
    if (!gauge.getAreasVisible() && !gauge.isGradientBarEnabled()) {
        bar.setFill(gauge.getBarColor());
    } else if (gauge.isGradientBarEnabled() && gauge.getGradientBarStops().size() > 1) {
        bar.setFill(gauge.getGradientLookup().getColorAt((VALUE - gauge.getMinValue()) / gauge.getRange()));
    } else {
        bar.setFill(gauge.getBarColor());
        int listSize = areas.size();
        for (int i = 0 ; i < listSize ; i++) {
            Section area = areas.get(i);
            if (area.contains(VALUE)) {
                bar.setFill(area.getColor());
                break;
            }
        }
    }
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:18,代码来源:LinearSkin.java

示例8: drawSections

import eu.hansolo.medusa.Section; //导入依赖的package包/类
private void drawSections() {
    if (sections.isEmpty()) return;
    sectionLayer.getChildren().clear();

    double    centerX     = width * 0.5;
    double    centerY     = height * 0.85;
    double    barRadius   = height * 0.54210526;
    double    barWidth    = width * 0.28472222;
    List<Arc> sectionBars = new ArrayList<>(sections.size());
    for (Section section : sections) {
        Arc sectionBar = new Arc(centerX, centerY, barRadius, barRadius, angleRange * 0.5 + 90 - (section.getStart() * angleStep), -((section.getStop() - section.getStart()) - minValue) * angleStep);
        sectionBar.setType(ArcType.OPEN);
        sectionBar.setStroke(section.getColor());
        sectionBar.setStrokeWidth(barWidth);
        sectionBar.setStrokeLineCap(StrokeLineCap.BUTT);
        sectionBar.setFill(null);
        Tooltip sectionTooltip = new Tooltip(new StringBuilder(section.getText()).append("\n").append(String.format(Locale.US, "%.2f", section.getStart())).append(" - ").append(String.format(Locale.US, "%.2f", section.getStop())).toString());
        sectionTooltip.setTextAlignment(TextAlignment.CENTER);
        Tooltip.install(sectionBar, sectionTooltip);
        sectionBars.add(sectionBar);
    }
    sectionLayer.getChildren().addAll(sectionBars);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:24,代码来源:IndicatorSkin.java

示例9: setBarColor

import eu.hansolo.medusa.Section; //导入依赖的package包/类
private void setBarColor( final double VALUE ) {
    if (!sectionsVisible && !colorGradientEnabled) {
        bar.setStroke(gauge.getBarColor());
        colorRing.setStroke(gauge.getBarColor());
    } else if (colorGradientEnabled && noOfGradientStops > 1) {
        Color dynamicColor = gauge.getGradientLookup().getColorAt((VALUE - minValue) / range);
        bar.setStroke(dynamicColor);
        colorRing.setStroke(dynamicColor);
    } else {
        bar.setStroke(gauge.getBarColor());
        colorRing.setStroke(gauge.getBarColor());
        for (Section section : sections) {
            if (section.contains(VALUE)) {
                bar.setStroke(section.getColor());
                colorRing.setStroke(section.getColor());
                break;
            }
        }
    }
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:21,代码来源:FlatSkin.java

示例10: createZones

import eu.hansolo.medusa.Section; //导入依赖的package包/类
/**
 * Creates the zones.
 *
 * @return An array of {@link Section}s.
 */
protected final List<Section> createZones ( ) {

    boolean loloNaN = Double.isNaN(lolo);
    boolean hihiNaN = Double.isNaN(hihi);
    List<Section> sections = new ArrayList<>(4);

    if ( !loloNaN ) {
        sections.add(createZone(min, lolo, "LoLo", ALARM_MAJOR_COLOR));
    }

    if ( !Double.isNaN(low) ) {
        sections.add(createZone(loloNaN ? min : lolo, low, "Low", ALARM_MINOR_COLOR));
    }

    if ( !Double.isNaN(high) ) {
        sections.add(createZone(high, hihiNaN ? max : hihi, "High", ALARM_MAJOR_COLOR));
    }

    if ( !hihiNaN ) {
        sections.add(createZone(hihi, max, "HiHi", ALARM_MINOR_COLOR));
    }

    return sections;

}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:31,代码来源:BaseGaugeRepresentation.java

示例11: testGauge

import eu.hansolo.medusa.Section; //导入依赖的package包/类
@Test
public void testGauge() throws InterruptedException {
  GridPane pane = new GridPane();
  Gauge gauge = GaugeBuilder.create().minValue(0).maxValue(100)
      .tickLabelDecimals(0).decimals(1).autoScale(true).animated(true)
      // .backgroundPaint(Color.TRANSPARENT)
      // .borderPaint(Color.LIGHTGRAY)
      // .knobColor(Color.rgb(0, 90, 120))
      .shadowsEnabled(true)
      // .tickLabelColor(Color.rgb(0, 175, 248))
      // .ledColor(Color.rgb(0, 175, 248))
      .ledVisible(true).ledBlinking(true).sectionsVisible(true)
      .sections(new Section(75, 100, Color.rgb(139, 195, 102, 0.5)))
      .areasVisible(true)
      .areas(new Section(0.00, 25, Color.rgb(234, 83, 79, 0.5)))
      .majorTickMarkColor(Color.MAGENTA)
      // .minorTickMarkColor(Color.rgb(0, 175, 248))
      .majorTickMarkType(TickMarkType.TRAPEZOID)
      .mediumTickMarkType(TickMarkType.DOT)
      .minorTickMarkType(TickMarkType.LINE)
      .tickLabelOrientation(TickLabelOrientation.ORTHOGONAL)
      .tickMarkSections(new Section(0.25, 0.5, Color.rgb(241, 161, 71)))
      .tickMarkSectionsVisible(true)
      .markers(new Marker(0.5, "", Color.CYAN, MarkerType.TRIANGLE))
      .markersVisible(true)
      // .majorTickMarksVisible(true)
      // .minorTickMarksVisible(true)
      .tickLabelLocation(TickLabelLocation.INSIDE)
      // .tickLabelsVisible(true)
      .tickLabelSections(new Section(0.1, 0.3, Color.rgb(0, 175, 248)))
      // .tickLabelSectionsVisible(true)
      .title("SOC")
      // .titleColor(Color.rgb(223, 223, 223))
      .unit("%").lcdDesign(LcdDesign.SECTIONS).lcdVisible(true)
      .lcdFont(LcdFont.STANDARD)
      // .unitColor(Color.rgb(223, 223, 223))
      // .valueColor(Color.rgb(223, 223, 223))
      .needleSize(NeedleSize.THICK).build();
  FGauge framedGauge = new FGauge(gauge, GaugeDesign.ENZO,
      GaugeBackground.DARK_GRAY);

  pane.add(framedGauge, 0, 0);

  DoubleProperty dproperty = new SimpleDoubleProperty(85.0);

  SampleApp sampleApp = new SampleApp("Gauge", pane, 67, 2, 2);
  sampleApp.show();
  sampleApp.waitOpen();
  Stage stage = sampleApp.getStage();
  framedGauge.prefWidthProperty().bind(stage.widthProperty());
  framedGauge.prefHeightProperty().bind(stage.heightProperty());
  gauge.valueProperty().bind(dproperty);
  while (stage.isShowing()) {
    Thread.sleep(15);
    Platform.runLater(() -> dproperty.setValue(dproperty.getValue() - 0.1));
    if (dproperty.getValue() < 45)
      sampleApp.close();
  }
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:60,代码来源:TestAppGUI.java

示例12: SimpleSectionGauge

import eu.hansolo.medusa.Section; //导入依赖的package包/类
public SimpleSectionGauge(final String TITLE, final String UNIT,
                          final double MIN_VALUE, final double MAX_VALUE,
                          final Color BAR_COLOR, final Color BAR_BACKGROUND_COLOR,
                          final boolean SECTIONS_VISIBLE, final Section... SECTIONS) {
    backgroundPaint = Color.TRANSPARENT;
    borderPaint     = Color.TRANSPARENT;
    borderWidth     = 0d;
    model           = GaugeBuilder.create()
                                  .minValue(MIN_VALUE)
                                  .maxValue(MAX_VALUE)
                                  .title(TITLE)
                                  .unit(UNIT)
                                  .barBackgroundColor(BAR_BACKGROUND_COLOR)
                                  .barColor(BAR_COLOR)
                                  .animated(true)
                                  .startAngle(150)
                                  .angleRange(300)
                                  .sectionsVisible(SECTIONS_VISIBLE)
                                  .build();
    if (null != SECTIONS) {
        model.setSections(SECTIONS);
        sections = model.getSections();
    } else {
        sections = new ArrayList<>();
    }
    sectionsVisible = model.getSectionsVisible();
    formatString    = new StringBuilder("%.").append(Integer.toString(model.getDecimals())).append("f").toString();
    init();
    initGraphics();
    registerListeners();
}
 
开发者ID:HanSolo,项目名称:SimpleSectionGauge,代码行数:32,代码来源:SimpleSectionGauge.java

示例13: init

import eu.hansolo.medusa.Section; //导入依赖的package包/类
@Override public void init() {
    fuelIcon = new Region();
    fuelIcon.getStyleClass().setAll("fuel-icon");

    gauge = GaugeBuilder.create()
                        .skinType(SkinType.HORIZONTAL)
                        .prefSize(500, 250)
                        .knobColor(Color.rgb(0, 0, 0))
                        .foregroundBaseColor(Color.rgb(249, 249, 249))
                        .animated(true)
                        .shadowsEnabled(true)
                        .valueVisible(false)
                        //.title("FUEL")
                        .needleColor(Color.rgb(255, 10, 1))
                        .needleShape(NeedleShape.ROUND)
                        .needleSize(NeedleSize.THICK)
                        .minorTickMarksVisible(false)
                        .mediumTickMarksVisible(false)
                        //.majorTickMarkType(TickMarkType.TRIANGLE)
                        .sectionsVisible(true)
                        .sections(new Section(0, 0.2, Color.rgb(255, 10, 1)))
                        .minValue(0)
                        .maxValue(1)
                        .angleRange(90)
                        .customTickLabelsEnabled(true)
                        .customTickLabels("E", "", "", "", "", "1/2", "", "", "", "", "F")
                        .build();

    pane = new StackPane(fuelIcon, gauge);
    pane.setPadding(new Insets(10));
    LinearGradient gradient = new LinearGradient(0, 0, 0, pane.getLayoutBounds().getHeight(),
                                                 false, CycleMethod.NO_CYCLE,
                                                 new Stop(0.0, Color.rgb(38, 38, 38)),
                                                 new Stop(1.0, Color.rgb(15, 15, 15)));
    pane.setBackground(new Background(new BackgroundFill(gradient, CornerRadii.EMPTY, Insets.EMPTY)));
}
 
开发者ID:HanSolo,项目名称:medusademo,代码行数:37,代码来源:FuelGauge.java

示例14: getBulletChart

import eu.hansolo.medusa.Section; //导入依赖的package包/类
private Gauge getBulletChart(final String TITLE, final String UNIT,
                             final double MAX_VALUE, final double THRESHOLD,
                             final Section... SECTIONS) {
    return GaugeBuilder.create()
                       .skinType(SkinType.BULLET_CHART)
                       .animated(true)
                       .thresholdColor(GRAY)
                       .title(TITLE)
                       .unit(UNIT)
                       .maxValue(MAX_VALUE)
                       .threshold(THRESHOLD)
                       .sectionsVisible(true)
                       .sections(SECTIONS)
                       .build();
}
 
开发者ID:HanSolo,项目名称:medusademo,代码行数:16,代码来源:KpiDashboard.java

示例15: init

import eu.hansolo.medusa.Section; //导入依赖的package包/类
@Override public void init() {
    GaugeBuilder builder = GaugeBuilder.create()
                                       .skinType(SkinType.INDICATOR)
                                       .prefWidth(150)
                                       .animated(true)
                                       .decimals(0)
                                       .sectionsVisible(true)
                                       .sections(new Section(0, 33, Color.rgb(34, 180, 11)),
                                                 new Section(33, 66, Color.rgb(255, 146, 0)),
                                                 new Section(66, 100, Color.rgb(255, 0, 39)));
    ragweed  = builder.build();
    birch    = builder.build();
    grass    = builder.build();
    olive    = builder.build();
    combined = builder.build();

    HBox ragweedBox  = getHBox("RAGWEED", ragweed);
    HBox birchBox    = getHBox("BIRCH", birch);
    HBox grassBox    = getHBox("GRASS", grass);
    HBox oliveBox    = getHBox("OLIVE", olive);
    HBox combinedBox = getHBox("COMBINED", combined);

    pane = new VBox(ragweedBox, new Separator(Orientation.HORIZONTAL),
                    birchBox, new Separator(Orientation.HORIZONTAL),
                    grassBox, new Separator(Orientation.HORIZONTAL),
                    oliveBox, new Separator(Orientation.HORIZONTAL),
                    combinedBox);
    pane.setPadding(new Insets(20, 20, 0, 20));
    pane.setSpacing(10);
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(242, 242, 242), CornerRadii.EMPTY, Insets.EMPTY)));
}
 
开发者ID:HanSolo,项目名称:medusademo,代码行数:32,代码来源:PollenDashboard.java


注:本文中的eu.hansolo.medusa.Section类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。