コード例 #1
0
 @Override
 public void process(CompactCheckBox t, DeclarationSet ds) {
   Property p;
   p = stroke;
   if (ds.contains(p)) t.setStroke(ds.getValue(p, Paint.class));
   p = fill;
   if (ds.contains(p)) t.setFill(ds.getValue(p, Paint.class));
 }
コード例 #2
0
  public static void processWidget(StandardWidget t, DeclarationSet ds) {
    if (t.getAppearance() instanceof DecoratorAppearance) {
      DecoratorAppearance appearance = (DecoratorAppearance) t.getAppearance();

      if (ds.contains(FengGUIProperties.background) && StyleUtils.applyStates) {
        List<Object> params = ds.getValue(FengGUIProperties.background);
        Background background = (Background) FengGUIFunctions.backgroundColor.process(params);
        if (background == null) {
          background = (Background) FengGUIFunctions.backgroundImage.process(params);
        }

        appearance.add(StyleUtils.state, background);
      }

      if (ds.contains(FengGUIProperties.border) && StyleUtils.applyStates) {
        Border border =
            ds.getValue(FengGUIProperties.border, Border.class, FengGUIFunctions.border);
        if (border instanceof PlainBorder && ds.contains(FengGUIProperties.borderRadius)) {
          int radius = ds.getValue(FengGUIProperties.borderRadius, Integer.class);
          int size = border.getTop();
          Color c = ((PlainBorder) border).getColor();

          border = new RoundedBorder(c, size, radius);
        }
        appearance.add(StyleUtils.state, border);
      }

      if (!StyleUtils.state.equals(StatefullWidget.STATE_DEFAULT) && StyleUtils.applyStates) {
        appearance.setEnabled(StyleUtils.state, false);
      }
    }
  }