GreyTheme.java
Go to the documentation of this file.
00001 package edu.tum.cs.ias.knowrob.vis.themes;
00002 
00003 import processing.core.PFont;
00004 import controlP5.Button;
00005 import controlP5.ControlFont;
00006 import controlP5.ControlP5;
00007 import controlP5.Group;
00008 import controlP5.Knob;
00009 import controlP5.ListBox;
00010 import controlP5.MultiList;
00011 import controlP5.MultiListButton;
00012 import controlP5.Tab;
00013 import controlP5.Textfield;
00014 import controlP5.Textlabel;
00015 
00016 
00017 
00025 public class GreyTheme {
00026 
00027         
00031         private static PFont dejavuFont = null;
00032 
00036         public static ControlFont cfont = null;
00037         
00038         
00039         public static int colorBackground = color(80);
00040         public static int colorForeground = color(180);
00041         public static int colorActive = color(200);
00042         public static int colorGroupBackground = color(50);
00043         
00044         
00045         public static ControlP5 applyStyle(ControlP5 controlP5) {
00046 
00047                 controlP5.setColorBackground(color(80))
00048                 .setColorForeground(color(180))
00049                 .setColorActive(color(200));
00050 
00051                 dejavuFont = controlP5.papplet.createFont("DejaVu Sans",12);
00052                 cfont = new ControlFont(dejavuFont);
00053 
00054                 return controlP5;
00055         }
00056 
00057         public static Tab applyStyle(Tab tab) {
00058                 
00059                 tab.activateEvent(true)
00060                         .setColorLabel(color(255))
00061                         .setHeight(20);
00062                 return tab;
00063         }
00064 
00065 
00066         public static Textfield applyStyle(Textfield t) {
00067                  t.setAutoClear(false);
00068                  return t;
00069         }
00070                 
00071         public static Button applyStyle(Button b) {
00072                  return b;
00073         }
00074 
00075         public static Group applyStyle(Group g) {
00076                 g.setBackgroundColor(color(50));
00077                 g.setBarHeight(15);
00078                 g.getCaptionLabel().getStyle().marginTop=3;
00079                 return g;
00080         }
00081 
00082         public static Knob applyStyle(Knob k) {
00083                 k.setViewStyle(Knob.ARC)
00084                  .setShowAngleRange(false)
00085                  .setAngleRange((float) (2*Math.PI));
00086                 return k;
00087         }
00088 
00089         public static ListBox applyStyle(ListBox lb, int itemHeight) {
00090                 
00091         lb.setItemHeight(itemHeight)
00092           .setBarHeight(itemHeight);
00093 
00094                 lb.getCaptionLabel().getStyle().marginTop = itemHeight/4;
00095                 lb.getValueLabel().getStyle().marginTop = itemHeight/4;
00096                 lb.getCaptionLabel().getStyle().marginBottom = itemHeight/4;
00097                 lb.getValueLabel().getStyle().marginBottom = itemHeight/4;
00098                 return lb;
00099         }
00100         
00101         public static Textlabel applyStyle(Textlabel l) {
00102                 return l;
00103         }
00104         
00105         
00106 
00113         public static MultiListButton applyStyle(MultiListButton b) {
00114                 b.getCaptionLabel().toUpperCase(false).setFont(cfont);
00115                 b.setHeight(20);
00116                 return b;
00117         }
00118 
00119         
00126         public static MultiList applyStyle(MultiList lb) {
00127 
00128                 lb.setHeight(20);
00129                 lb.getCaptionLabel().setFont(cfont);
00130                 
00131                 return lb;
00132         }
00133 
00134         
00135         
00136         // utility methods
00137         public static final int color(int gray) {
00138                 if (gray > 255) gray = 255; else if (gray < 0) gray = 0;
00139                 return 0xff000000 | (gray << 16) | (gray << 8) | gray;
00140         }
00141         
00142         public static final int color(int r, int g, int b) {
00143                 
00144                 if (r > 255) r = 255; else if (r < 0) r = 0;
00145                 if (g > 255) g = 255; else if (g < 0) g = 0;
00146                 if (b > 255) b = 255; else if (b < 0) b = 0;
00147 
00148                 return 0xff000000 | (r << 16) | (g << 8) | b;
00149         }
00150 
00151 }


mod_vis
Author(s): Moritz Tenorth, Jakob Engel
autogenerated on Sat Dec 28 2013 17:09:49