コード例 #1
0
 @Override
 public void applyStyle(final ElementMap item, final DocumentParser doc, final Widget widget) {
   this.doc = doc;
   this.elementMaps.push(item);
   final ElementMap elementMap = this.elementMaps.peek();
   final DecoratorAppearance appearance = widget.getAppearance();
   appearance.setElementMap(elementMap);
   ((TextWidgetAppearance) appearance).setAlignment(Alignment9.CENTER);
   widget.addBasicElement(appearance);
   appearance.onAttributesInitialized();
   final FontElement checkOut = FontElement.checkOut();
   checkOut.setRenderer(Xulor.getInstance().getDocumentParser().getFont("defaultFontBordered30"));
   checkOut.setElementMap(elementMap);
   appearance.addBasicElement(checkOut);
   checkOut.onAttributesInitialized();
   checkOut.onChildrenAdded();
   final String id = "defaultLightColor";
   final ColorElement checkOut2 = ColorElement.checkOut();
   checkOut2.setElementMap(elementMap);
   if (elementMap != null && id != null) {
     elementMap.add(id, checkOut2);
   }
   checkOut2.setColor(new Color(1.0f, 1.0f, 1.0f, 1.0f));
   appearance.addBasicElement(checkOut2);
   checkOut2.onAttributesInitialized();
   checkOut2.onChildrenAdded();
   appearance.onChildrenAdded();
 }
コード例 #2
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 public void mousemove(Coord c) {
   for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
     if (!wdg.visible) continue;
     Coord cc = xlate(wdg.c, true);
     wdg.mousemove(c.add(cc.inv()));
   }
 }
コード例 #3
0
 public void destroy(Widget wdg) {
   if ((mousegrab != null) && mousegrab.hasparent(wdg)) mousegrab = null;
   if ((keygrab != null) && keygrab.hasparent(wdg)) keygrab = null;
   wdg.destroy();
   wdg.unlink();
   removeid(wdg);
 }
コード例 #4
0
  /**
   * Determines if the selection was on the dropdown affordance and, if so, opens the drop down menu
   * (populated using the same id as this item...
   *
   * @param event The <code>SWT.Selection</code> event to be tested
   * @return <code>true</code> iff a drop down menu was opened
   */
  private boolean openDropDownMenu(Event event) {
    Widget item = event.widget;
    if (item != null) {
      int style = item.getStyle();
      if ((style & SWT.DROP_DOWN) != 0) {
        if (event.detail == 4) { // on drop-down button
          ToolItem ti = (ToolItem) item;

          final MenuManager menuManager = new MenuManager();
          Menu menu = menuManager.createContextMenu(ti.getParent());
          menuManager.addMenuListener(
              new IMenuListener() {
                public void menuAboutToShow(IMenuManager manager) {
                  String id = getId();
                  if (dropDownMenuOverride != null) {
                    id = dropDownMenuOverride;
                  }
                  menuService.populateContributionManager(menuManager, "menu:" + id); // $NON-NLS-1$
                }
              });
          // position the menu below the drop down item
          Rectangle b = ti.getBounds();
          Point p = ti.getParent().toDisplay(new Point(b.x, b.y + b.height));
          menu.setLocation(p.x, p.y); // waiting for SWT
          // 0.42
          menu.setVisible(true);
          return true; // we don't fire the action
        }
      }
    }

    return false;
  }
コード例 #5
0
 public void newwidget(int id, String type, Coord c, int parent, Object... args)
     throws InterruptedException {
   WidgetFactory f;
   if (type.indexOf('/') >= 0) {
     int ver = -1, p;
     if ((p = type.indexOf(':')) > 0) {
       ver = Integer.parseInt(type.substring(p + 1));
       type = type.substring(0, p);
     }
     Resource res = Resource.load(type, ver);
     res.loadwaitint();
     f = res.layer(Resource.CodeEntry.class).get(WidgetFactory.class);
   } else {
     f = Widget.gettype(type);
   }
   synchronized (this) {
     Widget pwdg = widgets.get(parent);
     if (pwdg == null)
       throw (new UIException("Null parent widget " + parent + " for " + id, type, args));
     Widget wdg = f.create(c, pwdg, args);
     bind(wdg, id);
     wdg.binded();
     if (wdg instanceof MapView) mainview = (MapView) wdg;
   }
 }
コード例 #6
0
ファイル: FormContainer.java プロジェクト: KHGies/gavrog
 /**
  * Remove a child Widget from this container.
  *
  * @param index the index of the Widget to remove
  */
 public void remove(int index) {
   Widget w = child.get(index).widget;
   getComponent().remove(w.getComponent());
   child.remove(index);
   removeAsParent(w);
   invalidateSize();
 }
コード例 #7
0
 @Override
 public void applyStyle(final ElementMap item, final DocumentParser doc, final Widget widget) {
   this.doc = doc;
   this.elementMaps.push(item);
   final ElementMap elementMap = this.elementMaps.peek();
   final DecoratorAppearance appearance = widget.getAppearance();
   appearance.setElementMap(elementMap);
   ((ImageAppearance) appearance).setScaled(false);
   widget.addBasicElement(appearance);
   appearance.onAttributesInitialized();
   final String id = "pmLeftHandCell";
   final PixmapElement checkOut = PixmapElement.checkOut();
   checkOut.setElementMap(elementMap);
   if (elementMap != null && id != null) {
     elementMap.add(id, checkOut);
   }
   checkOut.setHeight(31);
   checkOut.setPosition(Alignment17.CENTER);
   checkOut.setTexture(this.doc.getTexture("default_1.tga"));
   checkOut.setWidth(31);
   checkOut.setX(412);
   checkOut.setY(480);
   appearance.addBasicElement(checkOut);
   checkOut.onAttributesInitialized();
   checkOut.onChildrenAdded();
   appearance.onChildrenAdded();
 }
コード例 #8
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 public void unlink() {
   if (next != null) next.prev = prev;
   if (prev != null) prev.next = next;
   if (parent.child == this) parent.child = next;
   if (parent.lchild == this) parent.lchild = prev;
   next = null;
   prev = null;
 }
コード例 #9
0
 public void uimsg(int id, String msg, Object... args) {
   Widget wdg;
   synchronized (this) {
     wdg = widgets.get(id);
   }
   if (wdg != null) wdg.uimsg(msg.intern(), args);
   else throw (new UIException("Uimsg to non-existent widget " + id, msg, args));
 }
コード例 #10
0
 private void handleWidgetDispose(Event event) {
   if (event.widget == widget) {
     widget.removeListener(SWT.Selection, getItemListener());
     widget.removeListener(SWT.Dispose, getItemListener());
     widget = null;
     disposeOldImages();
   }
 }
コード例 #11
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 @Deprecated
 public <T extends Widget> T findchild(Class<T> cl) {
   for (Widget wdg = child; wdg != null; wdg = wdg.next) {
     if (cl.isInstance(wdg)) return (cl.cast(wdg));
     T ret = wdg.findchild(cl);
     if (ret != null) return (ret);
   }
   return (null);
 }
コード例 #12
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 public void delfocusable(Widget w) {
   if (focusctl) {
     if ((focused != null) && focused.hasparent(w)) {
       findfocus();
     }
   } else {
     if (parent != null) parent.delfocusable(w);
   }
 }
コード例 #13
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 public void setcanfocus(boolean canfocus) {
   this.autofocus = this.canfocus = canfocus;
   if (parent != null) {
     if (canfocus) {
       parent.newfocusable(this);
     } else {
       parent.delfocusable(this);
     }
   }
 }
コード例 #14
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 public boolean mousewheel(Coord c, int amount) {
   for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
     if (!wdg.visible) continue;
     Coord cc = xlate(wdg.c, true);
     if (c.isect(cc, wdg.sz)) {
       if (wdg.mousewheel(c.add(cc.inv()), amount)) {
         return (true);
       }
     }
   }
   return (false);
 }
コード例 #15
0
ファイル: FormContainer.java プロジェクト: KHGies/gavrog
 /**
  * Add a Widget to this container. The Widget will occupy a rectangular block of cells.
  *
  * @param widget the Widget to add
  * @param col the first column the Widget will occupy
  * @param row the first row the Widget will occupy
  * @param width the number of columns the Widget will occupy
  * @param height the number of rows the Widget will occupy
  * @param layout the LayoutInfo to use for this Widget. If null, the default LayoutInfo will be
  *     used.
  */
 public void add(Widget widget, int col, int row, int width, int height, LayoutInfo layout) {
   if (col < 0
       || col + width > colWeight.length
       || row < 0
       || row + height > rowWeight.length
       || width < 1
       || height < 1) throw new IllegalArgumentException();
   if (widget.getParent() != null) widget.getParent().remove(widget);
   child.add(new ChildInfo(widget, layout, col, row, width, height));
   getComponent().add(widget.getComponent());
   setAsParent(widget);
   invalidateSize();
 }
コード例 #16
0
ファイル: Widget.java プロジェクト: lcy03406/amber
  public void draw(GOut g, boolean strict) {
    Widget next;

    for (Widget wdg = child; wdg != null; wdg = next) {
      next = wdg.next;
      if (!wdg.visible) continue;
      Coord cc = xlate(wdg.c, true);
      GOut g2;
      if (strict) g2 = g.reclip(cc, wdg.sz);
      else g2 = g.reclipl(cc, wdg.sz);
      wdg.draw(g2);
    }
  }
コード例 #17
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 private void findfocus() {
   /* XXX: Might need to check subwidgets recursively */
   focused = null;
   for (Widget w = lchild; w != null; w = w.prev) {
     if (w.visible && w.autofocus) {
       focused = w;
       if (hasfocus) {
         focused.hasfocus = true;
         w.gotfocus();
       }
       break;
     }
   }
 }
コード例 #18
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 public boolean type(char key, KeyEvent ev) {
   if (canactivate) {
     if (key == 10) {
       wdgmsg("activate");
       return (true);
     }
   }
   if (cancancel) {
     if (key == 27) {
       wdgmsg("cancel");
       return (true);
     }
   }
   if (focusctl) {
     if (focused != null) {
       if (focused.type(key, ev)) return (true);
       if (focustab) {
         if (key == '\t' && !Config.agroclosest) {
           Widget f = focused;
           while (true) {
             if ((ev.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
               Widget n = f.rnext();
               f = ((n == null) || !n.hasparent(this)) ? child : n;
             } else {
               Widget p = f.rprev();
               f = ((p == null) || !p.hasparent(this)) ? lchild : p;
             }
             if (f.canfocus) break;
           }
           setfocus(f);
           return (true);
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     } else {
       return (false);
     }
   } else {
     for (Widget wdg = child; wdg != null; wdg = wdg.next) {
       if (wdg.visible) {
         if (wdg.type(key, ev)) return (true);
       }
     }
     return (false);
   }
 }
コード例 #19
0
ファイル: Widget.java プロジェクト: lcy03406/amber
  public void tick(double dt) throws InterruptedException {
    Widget next;

    for (Widget wdg = child; wdg != null; wdg = next) {
      next = wdg.next;
      wdg.tick(dt);
    }
    /* It would be very nice to do these things in harmless mix-in
     * classes, but alas, this is Java. */
    anims.addAll(nanims);
    nanims.clear();
    for (Iterator<Anim> i = anims.iterator(); i.hasNext(); ) {
      Anim anim = i.next();
      if (anim.tick(dt)) i.remove();
    }
  }
コード例 #20
0
ファイル: Window.java プロジェクト: RaynsAS/Custom-Salem
 public void mousemove(Coord c) {
   if (dm) {
     this.c = this.c.add(c.add(doff.inv()));
   } else {
     super.mousemove(c);
   }
 }
コード例 #21
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 public void newfocusable(Widget w) {
   if (focusctl) {
     if (focused == null) setfocus(w);
   } else {
     if (parent != null) parent.newfocusable(w);
   }
 }
コード例 #22
0
 public void uimsg(String msg, Object... args) {
   if (msg == "inpop") {
     List<Spec> inputs = new LinkedList<Spec>();
     for (int i = 0; i < args.length; ) {
       int resid = (Integer) args[i++];
       Message sdt =
           (args[i] instanceof byte[]) ? new MessageBuf((byte[]) args[i++]) : MessageBuf.nil;
       int num = (Integer) args[i++];
       inputs.add(new Spec(ui.sess.getres(resid), sdt, num));
     }
     this.inputs = inputs;
   } else if (msg == "opop") {
     List<Spec> outputs = new LinkedList<Spec>();
     for (int i = 0; i < args.length; ) {
       int resid = (Integer) args[i++];
       Message sdt =
           (args[i] instanceof byte[]) ? new MessageBuf((byte[]) args[i++]) : MessageBuf.nil;
       int num = (Integer) args[i++];
       outputs.add(new Spec(ui.sess.getres(resid), sdt, num));
     }
     this.outputs = outputs;
   } else if (msg == "qmod") {
     List<Indir<Resource>> qmod = new ArrayList<Indir<Resource>>();
     for (Object arg : args) qmod.add(ui.sess.getres((Integer) arg));
     this.qmod = qmod;
   } else {
     super.uimsg(msg, args);
   }
 }
コード例 #23
0
ファイル: Window.java プロジェクト: RaynsAS/Custom-Salem
 public void draw(GOut g) {
   g.chcolor(0, 0, 0, 160);
   if (ctl == null || csz == null) {
     return;
   }
   g.frect(ctl, csz);
   g.chcolor();
   cdraw(g.reclip(xlate(Coord.z, true), asz));
   if (cap != null) {
     topless.draw(g, new Coord(0, th), sz.sub(0, th));
     g.image(tleft, Coord.z);
     Coord tmul = new Coord(tleft.sz().x, tdh);
     Coord tmbr = new Coord(sz.x - tright.sz().x, th);
     for (int x = tmul.x; x < tmbr.x; x += tmain.sz().x) {
       g.image(tmain, new Coord(x, tdh), tmul, tmbr);
     }
     g.image(tright, new Coord(sz.x - tright.sz().x, tdh));
     g.image(cap.tex(), capc.sub(0, cap.sz().y));
   } else {
     wbox.draw(g, Coord.z, sz);
   }
   /*
   if(cap != null) {
       GOut cg = og.reclip(new Coord(0, -7), sz.add(0, 7));
       int w = cap.tex().sz().x;
       cg.image(cl, new Coord((sz.x / 2) - (w / 2) - cl.sz().x, 0));
       cg.image(cm, new Coord((sz.x / 2) - (w / 2), 0), new Coord(w, cm.sz().y));
       cg.image(cr, new Coord((sz.x / 2) + (w / 2), 0));
       cg.image(cap.tex(), new Coord((sz.x / 2) - (w / 2), 0));
   }
   */
   super.draw(g);
 }
コード例 #24
0
ファイル: Trends.java プロジェクト: Gorbush/jagger
    private void removeUncheckedPlots(Set<String> selectedTaskIds) {

      List<Widget> toRemove = new ArrayList<Widget>();
      for (int i = 0; i < plotPanel.getWidgetCount(); i++) {
        Widget widget = plotPanel.getWidget(i);
        String widgetId = widget.getElement().getId();
        if ((!isSessionScopePlotId(widgetId)) || selectedTaskIds.contains(widgetId)) {
          continue;
        }
        toRemove.add(widget);
      }
      for (Widget widget : toRemove) {
        plotPanel.remove(widget);
        chosenPlots.remove(widget.getElement().getId());
      }
    }
コード例 #25
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 public void wdgmsg(Widget sender, String msg, Object... args) {
   if (sender == cbtn) {
     wdgmsg("close");
   } else {
     super.wdgmsg(sender, msg, args);
   }
 }
コード例 #26
0
ファイル: Widget.java プロジェクト: lcy03406/amber
  public Resource getcurs(Coord c) {
    Resource ret;

    for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
      if (!wdg.visible) continue;
      Coord cc = xlate(wdg.c, true);
      if (c.isect(cc, wdg.sz)) {
        if ((ret = wdg.getcurs(c.add(cc.inv()))) != null) return (ret);
      }
    }
    try {
      return ((cursor == null) ? null : cursor.get());
    } catch (Loading l) {
      return (null);
    }
  }
コード例 #27
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 private <T extends Widget> T add0(T child) {
   if (this.ui != null) ((Widget) child).attach(this.ui);
   child.parent = this;
   child.link();
   child.added();
   if (((Widget) child).canfocus && child.visible) newfocusable(child);
   return (child);
 }
コード例 #28
0
ファイル: Widget.java プロジェクト: lcy03406/amber
 public boolean keyup(KeyEvent ev) {
   if (focusctl) {
     if (focused != null) {
       if (focused.keyup(ev)) return (true);
       return (false);
     } else {
       return (false);
     }
   } else {
     for (Widget wdg = child; wdg != null; wdg = wdg.next) {
       if (wdg.visible) {
         if (wdg.keyup(ev)) return (true);
       }
     }
   }
   return (false);
 }
コード例 #29
0
 public void type(KeyEvent ev) {
   setmods(ev);
   if (keygrab == null) {
     if (!root.type(ev.getKeyChar(), ev)) root.globtype(ev.getKeyChar(), ev);
   } else {
     keygrab.type(ev.getKeyChar(), ev);
   }
 }
コード例 #30
0
 public void keydown(KeyEvent ev) {
   setmods(ev);
   if (keygrab == null) {
     if (!root.keydown(ev)) root.globtype((char) 0, ev);
   } else {
     keygrab.keydown(ev);
   }
 }