Example #1
0
 private static void renderSelectionBackgroundGradient(CTabFolder folder) {
   ICTabFolderAdapter adapter = getCTabFolderAdapter(folder);
   IWidgetGraphicsAdapter gfxAdapter = adapter.getUserSelectionBackgroundGradient();
   Color[] bgGradientColors = gfxAdapter.getBackgroundGradientColors();
   int[] bgGradientPercents = gfxAdapter.getBackgroundGradientPercents();
   Boolean bgGradientVertical = Boolean.valueOf(gfxAdapter.isBackgroundGradientVertical());
   boolean hasChanged =
       WidgetLCAUtil.hasChanged(folder, PROP_SELECTION_BG_GRADIENT_COLORS, bgGradientColors, null)
           || WidgetLCAUtil.hasChanged(
               folder, PROP_SELECTION_BG_GRADIENT_PERCENTS, bgGradientPercents, null)
           || WidgetLCAUtil.hasChanged(
               folder, PROP_SELECTION_BG_GRADIENT_VERTICAL, bgGradientVertical, Boolean.FALSE);
   if (hasChanged) {
     JsonValue gradient = JsonValue.NULL;
     if (bgGradientColors != null) {
       JsonArray colors = new JsonArray();
       for (int i = 0; i < bgGradientColors.length; i++) {
         colors.add(toJson(bgGradientColors[i]));
       }
       JsonValue percents = createJsonArray(bgGradientPercents);
       gradient = new JsonArray().add(colors).add(percents).add(bgGradientVertical.booleanValue());
     }
     getRemoteObject(folder).set(PROP_SELECTION_BG_GRADIENT, gradient);
   }
 }
Example #2
0
 private static void preserveSelectionBgGradient(CTabFolder folder) {
   ICTabFolderAdapter adapter = getCTabFolderAdapter(folder);
   IWidgetGraphicsAdapter gfxAdapter = adapter.getUserSelectionBackgroundGradient();
   Color[] bgGradientColors = gfxAdapter.getBackgroundGradientColors();
   int[] bgGradientPercents = gfxAdapter.getBackgroundGradientPercents();
   Boolean bgGradientVertical = Boolean.valueOf(gfxAdapter.isBackgroundGradientVertical());
   preserveProperty(folder, PROP_SELECTION_BG_GRADIENT_COLORS, bgGradientColors);
   preserveProperty(folder, PROP_SELECTION_BG_GRADIENT_PERCENTS, bgGradientPercents);
   preserveProperty(folder, PROP_SELECTION_BG_GRADIENT_VERTICAL, bgGradientVertical);
 }
 private void updateRoundedBorder(
     final int width,
     final Color color,
     final int topLeft,
     final int topRight,
     final int bottomRight,
     final int bottomLeft) {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     Object adapter = control.getAdapter(IWidgetGraphicsAdapter.class);
     IWidgetGraphicsAdapter gfxAdapter = (IWidgetGraphicsAdapter) adapter;
     gfxAdapter.setRoundedBorder(width, color, topLeft, topRight, bottomRight, bottomLeft);
   }
 }
 private void updateBgGradient() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     Object adapter = control.getAdapter(IWidgetGraphicsAdapter.class);
     IWidgetGraphicsAdapter gfxAdapter = (IWidgetGraphicsAdapter) adapter;
     if (showBgGradient) {
       Color[] gradientColors =
           new Color[] {
             BGG_COLOR_BLUE, BGG_COLOR_GREEN, BGG_COLOR_BLUE, BGG_COLOR_GREEN, BGG_COLOR_BLUE
           };
       int[] percents = new int[] {0, 25, 50, 75, 100};
       gfxAdapter.setBackgroundGradient(gradientColors, percents);
     } else {
       gfxAdapter.setBackgroundGradient(null, null);
     }
   }
 }