コード例 #1
0
ファイル: CanvasCmd.java プロジェクト: qwert2003/hecl
  public void cset(Interp ip, Object target, String optname, Thing optval) throws HeclException {
    HeclCanvas c = (HeclCanvas) target;

    if (optname.equals("-fullscreen")) {
      c.setFullScreenMode(HeclUtils.thing2bool(optval));
      return;
    }
    if (optname.equals("-autoflush")) {
      c.setAutoFlushMode(HeclUtils.thing2bool(optval));
      return;
    }
    if (optname.equals("-cmdbg")) {
      c.setCmdBgColor(new Color(WidgetInfo.toColor(optval)));
      return;
    }
    if (optname.equals("-cmdfg")) {
      c.setCmdFgColor(new Color(WidgetInfo.toColor(optval)));
      return;
    }
    if (optname.equals("-eventhandler")) {
      EventHandler h = null;
      if (optval.toString().length() > 0) h = new WidgetListener(ip, optval, c);
      c.setEventHandler(h);
      return;
    }
    super.cset(ip, target, optname, optval);
  }
コード例 #2
0
ファイル: WidgetInfo.java プロジェクト: wm806/hecl
 public static int toColor(Thing t) throws HeclException {
   String s = t.toString();
   try {
     return s2int(s.toLowerCase(), colornames, colorvals, "");
   } catch (Exception e) {
   }
   return Integer.parseInt(s, 16);
 }
コード例 #3
0
ファイル: WidgetInfo.java プロジェクト: wm806/hecl
 public static Object asWidget(Thing thing, Class clazz, String clazzname, boolean allownull)
     throws HeclException {
   if (allownull && thing.toString().length() == 0) return null;
   RealThing rt = thing.getVal();
   if (rt instanceof ObjectThing) {
     Object x = ((ObjectThing) rt).get();
     if (allownull && x == null) return null;
     if (clazz.isAssignableFrom(x.getClass())) return x;
   }
   if (clazzname != null) {
     throw HeclException.createInvalidParameter(
         thing, "parameter", clazzname + " widget required.");
   }
   return null;
 }
コード例 #4
0
ファイル: WidgetInfo.java プロジェクト: wm806/hecl
 public static AlertType toAlertType(Thing t) throws HeclException {
   String s = t.toString().toLowerCase();
   int l = alerttypenames.length;
   for (int i = 0; i < l; ++i) if (s.equals(alerttypenames[i])) return alerttypevals[i];
   throw new HeclException("Invalid alert type '" + s + "'!");
 }
コード例 #5
0
ファイル: WidgetInfo.java プロジェクト: wm806/hecl
 public static int toGaugeMax(Thing t) throws HeclException {
   if (Character.isDigit(t.toString().charAt(0))) {
     return HeclUtils.thing2int(t, true, 0);
   }
   return t2int(t, gaugemaxnames, gaugemaxvals, "gauge initval");
 }
コード例 #6
0
ファイル: WidgetInfo.java プロジェクト: wm806/hecl
 protected static int t2int(Thing t, String nametab[], int valtab[], String emsg)
     throws HeclException {
   return s2int(t.toString().toLowerCase(), nametab, valtab, emsg);
 }