/** Remove all messages from the table (but leave "most recent") */
 public void clearAll() {
   int last_row = data.size() - 1;
   if (last_row > 0) {
     data.removeAllElements();
     SOAPMonitorData soap = new SOAPMonitorData(null, null, null);
     data.addElement(soap);
     if (filter_data != null) {
       filter_data.removeAllElements();
       filter_data.addElement(soap);
     }
     fireTableDataChanged();
   }
 }
  /**
   * Set <CODE>Vector</CODE> of <CODE>String</CODE>s describing the cursor location from the cursor
   * location; this is invoked when the cursor location changes or the cursor display status changes
   */
  public void setCursorStringVector() {
    synchronized (cursorStringVector) {
      cursorStringVector.removeAllElements();
      float[][] cursor = new float[3][1];
      double[] cur = getCursor();
      cursor[0][0] = (float) cur[0];
      cursor[1][0] = (float) cur[1];
      cursor[2][0] = (float) cur[2];
      Enumeration maps = display.getMapVector().elements();
      while (maps.hasMoreElements()) {
        try {
          ScalarMap map = (ScalarMap) maps.nextElement();
          DisplayRealType dreal = map.getDisplayScalar();
          DisplayTupleType tuple = dreal.getTuple();
          int index = dreal.getTupleIndex();
          if (tuple != null
              && (tuple.equals(Display.DisplaySpatialCartesianTuple)
                  || (tuple.getCoordinateSystem() != null
                      && tuple
                          .getCoordinateSystem()
                          .getReference()
                          .equals(Display.DisplaySpatialCartesianTuple)))) {
            float[] fval = new float[1];
            if (tuple.equals(Display.DisplaySpatialCartesianTuple)) {
              fval[0] = cursor[index][0];
            } else {
              float[][] new_cursor = tuple.getCoordinateSystem().fromReference(cursor);
              fval[0] = new_cursor[index][0];
            }
            float[] dval = map.inverseScaleValues(fval);
            RealType real = (RealType) map.getScalar();

            // WLH 31 Aug 2000
            Real r = new Real(real, dval[0]);
            Unit overrideUnit = map.getOverrideUnit();
            Unit rtunit = real.getDefaultUnit();
            // units not part of Time string
            // DRM 2003-08-19: don't check for equality since toString
            // may be different
            if (overrideUnit != null
                && // !overrideUnit.equals(rtunit) &&
                (!Unit.canConvert(rtunit, CommonUnit.secondsSinceTheEpoch)
                    || rtunit.getAbsoluteUnit().equals(rtunit))) {
              dval[0] = (float) overrideUnit.toThis((double) dval[0], rtunit);
              r = new Real(real, dval[0], overrideUnit);
            }
            String valueString = r.toValueString();

            // WLH 27 Oct 2000
            String s = map.getScalarName() + " = " + valueString;
            // String s = real.getName() + " = " + valueString;

            cursorStringVector.addElement(s);
          } // end if (tuple != null && ...)
        } catch (VisADException e) {
        }
      } // end while(maps.hasMoreElements())
    } // end synchronized (cursorStringVector)
    render_trigger();
  }
Beispiel #3
0
 /**
  * Removes all children.
  *
  * @see #remove
  */
 public void removeAll() {
   FigureEnumeration k = figures();
   while (k.hasMoreElements()) {
     Figure figure = k.nextFigure();
     figure.removeFromContainer(this);
   }
   fFigures.removeAllElements();
 }
 // TODO: figure this out...
 public void clearEditors() {
   removeAll();
   activeEditors.removeAllElements();
   templateDisplay.setToDefault();
   addEditor(templateDisplay);
   tableDisplay.displayEntry(null, null);
   addEditor(tableDisplay);
 }
Beispiel #5
0
  /** Detach All attached Axes. */
  public void detachAxes() {
    int i;

    if (axis == null | axis.isEmpty()) return;

    for (i = 0; i < axis.size(); i++) {
      ((Axis) axis.elementAt(i)).detachAll();
      ((Axis) axis.elementAt(i)).g2d = null;
    }

    axis.removeAllElements();
  }
 public void updateTableData() {
   // we need to get the stored filters
   Object[] row_data;
   rowData.removeAllElements();
   for (Iterator it = m_filters.keySet().iterator(); it.hasNext(); ) {
     row_data = new Object[2];
     row_data[0] = it.next();
     row_data[1] = m_filters.get(row_data[0]);
     rowData.add(row_data);
   }
   fireTableDataChanged();
 }
 /**
  * Set <CODE>Vector</CODE> of <CODE>String</CODE>s describing the cursor location by copy; this is
  * invoked by direct manipulation renderers.
  *
  * @param vect String descriptions of cursor location.
  */
 public void setCursorStringVector(Vector vect) {
   synchronized (cursorStringVector) {
     cursorStringVector.removeAllElements();
     if (vect != null) {
       Enumeration strings = vect.elements();
       while (strings.hasMoreElements()) {
         cursorStringVector.addElement(strings.nextElement());
       }
     }
   }
   render_trigger();
 }
Beispiel #8
0
  /** Detach All the DataSets from the class. */
  public void detachDataSets() {
    DataSet d;
    int i;

    if (dataset == null | dataset.isEmpty()) return;

    for (i = 0; i < dataset.size(); i++) {
      d = ((DataSet) dataset.elementAt(i));
      if (d.xaxis != null) d.xaxis.detachDataSet(d);
      if (d.yaxis != null) d.yaxis.detachDataSet(d);
    }

    dataset.removeAllElements();
  }
Beispiel #9
0
 /** Remove all the elements from the vector. */
 public void removeAllElements() {
   lites.removeAllElements();
 }
Beispiel #10
0
  /**
   * parse the text. When the text is parsed the width, height, leading are all calculated. The text
   * will only be truly parsed if the graphics context has changed or the text has changed or the
   * font has changed. Otherwise nothing is done when this method is called.
   *
   * @param g Graphics context.
   */
  public void parseText(Graphics g) {
    FontMetrics fm;
    TextState current = new TextState();
    char ch;
    Stack state = new Stack();
    int w = 0;

    if (lg != g) parse = true;
    lg = g;

    if (!parse) return;

    parse = false;
    width = 0;
    leading = 0;
    ascent = 0;
    descent = 0;
    height = 0;
    maxAscent = 0;
    maxDescent = 0;

    if (text == null || g == null) return;

    list.removeAllElements();

    if (font == null) current.f = g.getFont();
    else current.f = font;

    state.push(current);
    list.addElement(current);

    fm = g.getFontMetrics(current.f);

    for (int i = 0; i < text.length(); i++) {
      ch = text.charAt(i);

      switch (ch) {
        case '$':
          i++;
          if (i < text.length()) current.s.append(text.charAt(i));
          break;
          /*
           **                    Push the current state onto the state stack
           **                    and start a new storage string
           */
        case '{':
          w = current.getWidth(g);
          if (!current.isEmpty()) {
            current = current.copyState();
            list.addElement(current);
          }

          state.push(current);
          current.x += w;
          break;
          /*
           **                    Pop the state off the state stack and set the current
           **                    state to the top of the state stack
           */
        case '}':
          w = current.x + current.getWidth(g);
          state.pop();
          current = ((TextState) state.peek()).copyState();
          list.addElement(current);
          current.x = w;
          break;
        case '^':
          w = current.getWidth(g);
          if (!current.isEmpty()) {
            current = current.copyState();
            list.addElement(current);
          }
          current.f = getScriptFont(current.f);
          current.x += w;
          current.y -= (int) ((double) (current.getAscent(g)) * sup_offset + 0.5);
          break;
        case '_':
          w = current.getWidth(g);
          if (!current.isEmpty()) {
            current = current.copyState();
            list.addElement(current);
          }
          current.f = getScriptFont(current.f);
          current.x += w;
          current.y += (int) ((double) (current.getDescent(g)) * sub_offset + 0.5);
          break;

        default:
          current.s.append(ch);
          break;
      }
    }

    for (int i = 0; i < list.size(); i++) {
      current = ((TextState) (list.elementAt(i)));

      if (!current.isEmpty()) {
        width += current.getWidth(g);
        ascent = Math.max(ascent, Math.abs(current.y) + current.getAscent(g));
        descent = Math.max(descent, Math.abs(current.y) + current.getDescent(g));
        leading = Math.max(leading, current.getLeading(g));

        maxDescent = Math.max(maxDescent, Math.abs(current.y) + current.getMaxDescent(g));
        maxAscent = Math.max(maxAscent, Math.abs(current.y) + current.getMaxAscent(g));
      }
    }

    height = ascent + descent + leading;

    return;
  }
Beispiel #11
0
 /** Resets the contents of this CallStackComponent. */
 public void reset() {
   methodNames.removeAllElements();
   callStackTable.revalidate();
   callStackTable.clearSelection();
 }
Beispiel #12
0
  public void actionPerformed(ActionEvent e) {
    System.out.println("actionPerformed");
    if (e.getSource() == pen) // 画笔
    {
      System.out.println("pen");
      toolFlag = 0;
    }

    if (e.getSource() == eraser) // 橡皮
    {
      System.out.println("eraser");
      toolFlag = 1;
    }

    if (e.getSource() == clear) // 清除
    {
      System.out.println("clear");
      toolFlag = 2;
      paintInfo.removeAllElements();
      repaint();
    }

    if (e.getSource() == drLine) // 画线
    {
      System.out.println("drLine");
      toolFlag = 3;
    }

    if (e.getSource() == drCircle) // 画圆
    {
      System.out.println("drCircle");
      toolFlag = 4;
    }

    if (e.getSource() == drRect) // 画矩形
    {
      System.out.println("drRect");
      toolFlag = 5;
    }

    if (e.getSource() == colchooser) // 调色板
    {
      System.out.println("colchooser");
      Color newColor = JColorChooser.showDialog(this, "我的调色板", c);
      c = newColor;
    }

    if (e.getSource() == openPic) // 打开图画
    {

      openPicture.setVisible(true);

      if (openPicture.getFile() != null) {
        int tempflag;
        tempflag = toolFlag;
        toolFlag = 2;
        repaint();

        try {
          paintInfo.removeAllElements();
          File filein = new File(openPicture.getDirectory(), openPicture.getFile());
          picIn = new FileInputStream(filein);
          VIn = new ObjectInputStream(picIn);
          paintInfo = (Vector) VIn.readObject();
          VIn.close();
          repaint();
          toolFlag = tempflag;

        } catch (ClassNotFoundException IOe2) {
          repaint();
          toolFlag = tempflag;
          System.out.println("can not read object");
        } catch (IOException IOe) {
          repaint();
          toolFlag = tempflag;
          System.out.println("can not read file");
        }
      }
    }

    if (e.getSource() == savePic) // 保存图画
    {
      savePicture.setVisible(true);
      try {
        File fileout = new File(savePicture.getDirectory(), savePicture.getFile());
        picOut = new FileOutputStream(fileout);
        VOut = new ObjectOutputStream(picOut);
        VOut.writeObject(paintInfo);
        VOut.close();
      } catch (IOException IOe) {
        System.out.println("can not write object");
      }
    }
  }
  /** Updates the FancyShape. */
  void update() { // don't update warning regions here, do it in GraphArea...

    if (getNeedsUpdate()) {

      if (lightSource == TOP) {
        paint =
            new GradientPaint(
                lightBounds.x,
                lightBounds.y,
                color.brighter(),
                lightBounds.x,
                lightBounds.y + lightBounds.height,
                color);
        if (outlineExistence) {
          outlinePaint =
              new GradientPaint(
                  lightBounds.x,
                  lightBounds.y,
                  outlineColor.brighter(),
                  lightBounds.x,
                  lightBounds.y + lightBounds.height,
                  outlineColor);
        }
        warningPaints.removeAllElements();
        if (warningRegions != null) {
          for (int i = 0; i < warningRegions.size(); ++i) {
            Color warningColor = ((WarningRegion) warningRegions.get(i)).getComponentColor();
            warningPaints.add(
                new GradientPaint(
                    lightBounds.x,
                    lightBounds.y,
                    warningColor.brighter(),
                    lightBounds.x,
                    lightBounds.y + lightBounds.height,
                    warningColor));
          }
        }
      } else if (lightSource == BOTTOM) {
        paint =
            new GradientPaint(
                lightBounds.x,
                lightBounds.y,
                color,
                lightBounds.x,
                lightBounds.y + lightBounds.height,
                color.brighter());
        if (outlineExistence) {
          outlinePaint =
              new GradientPaint(
                  lightBounds.x,
                  lightBounds.y,
                  outlineColor,
                  lightBounds.x,
                  lightBounds.y + lightBounds.height,
                  outlineColor.brighter());
        }
        warningPaints.removeAllElements();
        for (int i = 0; i < warningRegions.size(); ++i) {
          Color warningColor = ((WarningRegion) warningRegions.get(i)).getComponentColor();
          warningPaints.add(
              new GradientPaint(
                  lightBounds.x,
                  lightBounds.y,
                  warningColor,
                  lightBounds.x,
                  lightBounds.y + lightBounds.height,
                  warningColor.brighter()));
        }
      } else if (lightSource == LEFT) {

        paint =
            new GradientPaint(
                lightBounds.x,
                lightBounds.y,
                color.brighter(),
                lightBounds.x + lightBounds.width,
                lightBounds.y,
                color);
        if (outlineExistence) {
          outlinePaint =
              new GradientPaint(
                  lightBounds.x,
                  lightBounds.y,
                  outlineColor.brighter(),
                  lightBounds.x + lightBounds.width,
                  lightBounds.y,
                  outlineColor);
        }
        warningPaints.removeAllElements();
        if (warningRegions != null) {
          for (int i = 0; i < warningRegions.size(); ++i) {
            Color warningColor = ((WarningRegion) warningRegions.get(i)).getComponentColor();
            warningPaints.add(
                new GradientPaint(
                    lightBounds.x,
                    lightBounds.y,
                    warningColor.brighter(),
                    lightBounds.x + lightBounds.width,
                    lightBounds.y,
                    warningColor));
          }
        }
      } else if (lightSource == RIGHT) {
        paint =
            new GradientPaint(
                lightBounds.x,
                lightBounds.y,
                color,
                lightBounds.x + lightBounds.width,
                lightBounds.y,
                color.brighter());
        if (outlineExistence) {
          outlinePaint =
              new GradientPaint(
                  lightBounds.x,
                  lightBounds.y,
                  outlineColor,
                  lightBounds.x + lightBounds.width,
                  lightBounds.y,
                  outlineColor.brighter());
        }
        warningPaints.removeAllElements();
        if (warningRegions != null) {
          for (int i = 0; i < warningRegions.size(); ++i) {
            Color warningColor = ((WarningRegion) warningRegions.get(i)).getComponentColor();
            warningPaints.add(
                new GradientPaint(
                    lightBounds.x,
                    lightBounds.y,
                    warningColor,
                    lightBounds.x + lightBounds.width,
                    lightBounds.y,
                    warningColor.brighter()));
          }
        }
      } else {
        paint = color;
        outlinePaint = outlineColor;
        warningPaints.removeAllElements();
        if (warningRegions != null) {
          for (int i = 0; i < warningRegions.size(); ++i) {
            Color warningColor = ((WarningRegion) warningRegions.get(i)).getComponentColor();
            warningPaints.add(warningColor);
          }
        }
      }
      needsUpdate = false;
    }
  }
 /** Hides all highlightes. */
 public void hideHighlight() {
   highlightIndex.removeAllElements();
   repaint();
 }