Package CH.ifa.draw.framework

Examples of CH.ifa.draw.framework.Figure


   private String[] getAssociatedTexts(Figure fig) {
      if (fig == null) return null;
      ArrayList list = new ArrayList();
      FigureEnumeration enumer = fig.figures();
      while (enumer.hasNextFigure()) {
         Figure fig1 = enumer.nextFigure();
         if (fig1.getTextHolder() != null) {
            String txt = fig1.getTextHolder().getText();
            if (isCommand(txt)) list.add(txt);
         }
      }
      if (list.size() < 1) return null;
      return (String[])list.toArray(new String[list.size()]);
View Full Code Here


   private boolean prepareClient(Drawing drawing) {
      FigureEnumeration enumer = drawing.figures();
      boolean ret = false;
      while (enumer.hasNextFigure()) {
         Figure fig = enumer.nextFigure();
         String[] txt = getAssociatedTexts(fig);
         if (txt != null) {
            for (int i=0; i < txt.length; i++) {
               try {
                  MonitorCommand cmd = new MonitorCommand(this.global, txt[i], fig);
View Full Code Here

      if (log.isLoggable(Level.FINER)) this.log.finer("figureChanged " + e.getFigure());
   }

   protected void addToTable(StorableFigureHolder figureHolder) {
      String figureId = figureHolder.getFigureId();
      Figure figure = figureHolder.getFigure();
      synchronized (this.timestampFigureTable) {
         this.figureTimestampTable.put(figure, figureHolder);
         this.timestampFigureTable.put(figureId, figureHolder);
      }
   }  
View Full Code Here

   }  

   protected void removeFromTable(StorableFigureHolder figureHolder) {
      if (log.isLoggable(Level.FINER)) this.log.finer("remove");
      String figureId = figureHolder.getFigureId();
      Figure figure = figureHolder.getFigure();
      synchronized (this.timestampFigureTable) {
         if (figure != null) {
            this.figureTimestampTable.remove(figure);
         }
         if (figureId != null) {
View Full Code Here

      if (figureId == null) return;
      // String figureId = msgContent.getFigureId();
      log.info("update figure: '" + figureId  + "' changed or added");
      StorableFigureHolder oldFigureHolder = (StorableFigureHolder)this.timestampFigureTable.get(figureId);

      Figure fig = figureHolder.getFigure();
      if (oldFigureHolder == null) {
         addToTable(figureHolder);
         super.add(fig);
      }
      else {
         Figure oldFigure = oldFigureHolder.getFigure();
         super.replace(oldFigure, fig);
         removeFromTable(oldFigureHolder);
         addToTable(figureHolder);
         FigureChangeEvent ev = new FigureChangeEvent(oldFigure);
         figureRequestUpdate(ev);
View Full Code Here

            log.info("Message '" + updateKey.getOid() + "' is erased");
            String figureId = updateKey.getOid();
            StorableFigureHolder figHolder = (StorableFigureHolder)this.timestampFigureTable.get(figureId);
            if (figHolder != null) {
               removeFromTable(figHolder);
               Figure fig = figHolder.getFigure();
               Figure figToRelease = super.orphan(fig);
               FigureChangeEvent ev = new FigureChangeEvent(fig);
               figureRequestUpdate(ev);
               figToRelease.release();
            }
            return "OK";
         }

         StorableFigureHolder figureHolder = StorableFigureHolder.fromBytes(content);
View Full Code Here

    * @param oid the oid to give to the new instance
    * @return
    */
   public MonitorCommand createInstance(String oid) {
      if (!this.isTemplate()) return null;
      Figure fig = (Figure)this.figure.clone();
      return new MonitorCommand(this.global, oid, this.action, fig);
   }
View Full Code Here

    }

    boolean rightButton = InputState.isRightButtonDown();
    if (rightButton)
    {
      Figure f = null;

      ProcessElementContainer pec = (ProcessElementContainer) FigureUtil.findInnermostFigure(((ProcessDrawing) drawing()), x, y, ProcessElementContainer.class);
      if (pec != null && pec != drawing())
      {
        f = pec;
      }
      else
      {
        f = FigureUtil.findInnermostFigure(((ProcessDrawing) drawing()), x, y, VisualElement.class);
      }

      if (f != null && f != drawing())
      {
        view.displayPopupMenu(f, e);

        lastFigure = (ProcessDrawing) drawing();
      }
    }
    else if (e.getClickCount() == 2)
    {
      // Double click caught, cancel pending in place editor timer
      if (inPlaceEditorDelayTimer != null)
      {
        inPlaceEditorDelayTimer.cancel();
        inPlaceEditorDelayTimer = null;
      }

      Figure figure = drawing().findFigure(x, y);

      if (figure instanceof VisualElement)
      {
        // Let the figure itself handle the doubleclick
        if (((VisualElement) figure).handleEvent(new VisualElementEvent(VisualElementEvent.DOUBLE_CLICK, editor, e, x, y)))
View Full Code Here

      currentTool.keyUp(e, key);
    }

    else if (key == KeyEvent.VK_ENTER && InputState.isAltDown())
    {
      Figure selectedFigure = null;
      Iterator it = getView().selection().iterator();
      if (it.hasNext())
      {
        selectedFigure = (Figure) it.next();
      }
View Full Code Here

    int selSize = selection.size();
    if (selSize == 1)
    {
      // Single element selected, show it in the property browser.
      Figure figure = (Figure) selection.get(0);

      if (figure instanceof ProcessElementContainer)
      {
        ModelObject mo = ((ProcessElementContainer) figure).getReferredProcessElement();
        Object originalObject = null;
View Full Code Here

TOP

Related Classes of CH.ifa.draw.framework.Figure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.