Beispiel #1
0
  private void setUIStyle(Element elem, GColor color) {
    GColor c = color.deriveWithAlpha(102);
    Style style = Dom.querySelectorForElement(elem, "ui-state-default").getStyle();
    style.setBackgroundColor(GColor.getColorString(color));

    style.setBorderColor(GColor.getColorString(c));
  }
Beispiel #2
0
  public void updateColor(GColor color) {
    GColor c = color.deriveWithAlpha(102);

    // String sColor = GColor.getColorString(color);
    // minLabel.getElement().getStyle().setColor(sColor);
    // maxLabel.getElement().getStyle().setColor(sColor);
    // slider.asWidget().getElement().getStyle()
    // .setBackgroundColor(GColor.getColorString(c));
    Style uiStyle = Dom.querySelectorForElement(getElement(), "ui-slider").getStyle();
    uiStyle.setBackgroundColor(GColor.getColorString(c));
    setUIStyle(getElement(), color);
  }
Beispiel #3
0
  @Override
  public void draw(org.geogebra.common.awt.GGraphics2D g2) {
    // Save fill, color and alfa of object
    GColor color = geo.getSelColor();
    FillType fillType = geo.getFillType();
    int hatchingDistance = geo.getHatchingDistance();
    String symbol = geo.getFillSymbol();
    double hatchingAngle = geo.getHatchingAngle();
    String fileName = geo.getImageFileName();
    float alpha = geo.getAlphaValue();
    AlgoBarChart algop = (AlgoBarChart) geo.getParentAlgorithm();
    int k;
    if (isVisible) {
      try {
        if (geo.doHighlighting()) {
          g2.setPaint(sum.getSelColor());
          g2.setStroke(selStroke);
          for (int i = 0; i < gp.length; i++) {
            k = i + 1;
            if (algop.getBarColor(k) != null) {
              GColor col = algop.getBarColor(k);
              g2.setPaint(
                  AwtFactory.prototype.newColor(
                      col.getRed(), col.getGreen(),
                      col.getBlue(), col.getAlpha()));
            }
            g2.draw(gp[i]);
          }
          g2.setPaint(color);
        }
      } catch (Exception e) {
        App.debug(e.getMessage());
      }

      try {
        if (algo.getDrawType() != DrawType.STEP_GRAPH_CONTINUOUS) {
          /*
           * Use tags for draw if there are
           */
          for (int i = 0; i < gp.length; i++) {
            k = i + 1;
            if (algop.getBarColor(k) != null) {
              GColor col = algop.getBarColor(k);
              geo.setObjColor(col);
              geo.setAlphaValue(col.getAlpha());
            }
            if (algop.getBarAlpha(k) != -1.0) {
              geo.setAlphaValue(algop.getBarAlpha(k));
            }

            geo.setFillType(algop.getBarFillType(k));

            if (algop.getBarSymbol(k) != null) {
              geo.setFillSymbol(algop.getBarSymbol(k));
            }
            if (algop.getBarImage(k) != null) {
              geo.setImageFileName(algop.getBarImage(k));
            }
            if (algop.getBarHatchDistance(k) != -1) {
              geo.setHatchingDistance(algop.getBarHatchDistance(k));
            }
            if (algop.getBarHatchAngle(k) != -1) {
              geo.setHatchingAngle(algop.getBarHatchAngle(k));
            }

            fill(g2, gp[i], false); // fill using
            // default/hatching/image as
            // appropriate
            // Restore values
            geo.setObjColor(color);
            geo.setFillType(fillType);
            geo.setHatchingAngle((int) hatchingAngle);
            geo.setHatchingDistance(hatchingDistance);
            geo.setFillSymbol(symbol);
            geo.setImageFileName(fileName);
            geo.setAlphaValue(alpha);
          }
        }

      } catch (Exception e) {
        e.printStackTrace();
      }

      try {
        if (geo.getLineThickness() > 0) {
          g2.setPaint(getObjectColor());
          g2.setStroke(objStroke);
          for (int i = 0; i < gp.length; i++) {
            k = i + 1;
            if (algop.getBarColor(k) != null) {
              GColor col = algop.getBarColor(k);
              g2.setPaint(
                  AwtFactory.prototype.newColor(
                      col.getRed(), col.getGreen(),
                      col.getBlue(), geo.getLineOpacity()));
            }
            g2.draw(gp[i]);
          }
          g2.setPaint(color);
        }
      } catch (Exception e) {
        App.debug(e.getMessage());
      }
      if (labelVisible) {
        g2.setFont(view.getFontConic());
        g2.setPaint(geo.getLabelColor());
        drawLabel(g2);
      }

      // point
      if (algo.hasPoints()) {
        for (int i = 0; i < drawPoints.size(); i++) {
          drawPoints.get(i).draw(g2);
        }
      }
    }
  }