public void redrawTree(boolean doRepaint) {
   displayText = false;
   if (argument == null) return;
   if (argument.isMultiRoots()) {
     argument.deleteDummyRoot();
     argument.setMultiRoots(false);
   }
   TreeVertex root = null;
   Vector roots = argument.getTree().getRoots();
   if (roots.size() > 1) {
     if (argument.getDummyRoot() == null) {
       argument.addDummyRoot(roots);
     }
     root = argument.getDummyRoot();
   } else if (roots.size() == 1) {
     root = (TreeVertex) roots.firstElement();
   }
   // if root == null, the entire tree has been erased,
   // so call emptyTree() to clean things up and
   // clear the display
   if (root == null) {
     argument.emptyTree(false);
   } else {
     calcTreeShape(root);
   }
   if (doRepaint) {
     repaint();
   }
   /*
   if (displayFrame.getMainDiagramPanel() == this)
   {
     searchFrame.updateDisplays(false);
   }
    */
 }
Beispiel #2
1
  @Override
  public void run() {
    // TODO Auto-generated method stub
    while (true) {
      try {
        Thread.sleep(100);
      } catch (Exception e) {
        // TODO: handle exception
      }
      //			判断每一粒子弹和每一辆敌人的坦克都是否有重合(击中)
      for (int i = 0; i < hero.bombs.size(); i++) {
        //				取出每个子弹
        Bomb myBomb = hero.bombs.get(i);
        //				子弹必须得存活才有判断的意义
        if (myBomb.isLive) {
          for (int j = 0; j < ets.size(); j++) {
            //						取出每辆坦克
            EnemyTank et = ets.get(j);
            if (et.isLive) {
              this.isHit(myBomb, et);
            }
          }
        }
      }

      this.repaint();
    }
  }
  /**
   * Adds nodes to the specified parent node recurrsively.
   *
   * @param parent_node the parent node.
   * @param list the list of child node names.
   */
  protected void addNode(DefaultMutableTreeNode parent_node, Vector list) {
    SortableArray array = null;

    if (mode == DATE_ORIENTED && parent_node.getLevel() <= 2) {
      array = new Array(list.size());

      for (int i = 0; i < list.size(); i++)
        ((Array) array).set(i, Integer.parseInt((String) list.elementAt(i)));
    } else {
      array = new StringArray(list.size());

      for (int i = 0; i < list.size(); i++)
        ((StringArray) array).set(i, (String) list.elementAt(i));
    }

    ArrayIndex index = array.sortAscendant();

    for (int i = 0; i < array.getArraySize(); i++) {
      String name = (String) list.elementAt(index.get(i));

      // Converts 1...12 to January...December.
      if (mode == DATE_ORIENTED && parent_node.getLevel() == 1) {
        int month = Integer.parseInt(name);
        name = JulianDay.getFullSpellMonthString(month);
      }

      DefaultMutableTreeNode node = new DefaultMutableTreeNode(name);
      parent_node.add(node);
    }
  }
  /**
   * Constructs a <code>VariabilityRecordTable</code> with a list of variability records.
   *
   * @param record_list the list of variability records.
   * @param desktop the parent desktop.
   */
  public VariabilityRecordTable(Vector record_list, net.aerith.misao.gui.Desktop desktop) {
    this.record_list = record_list;
    this.desktop = desktop;

    index = new ArrayIndex(record_list.size());

    model = new DefaultTableModel(column_names, 0);
    Object[] objects = new Object[column_names.length];
    objects[0] = new Boolean(true);
    for (int i = 1; i < column_names.length; i++) objects[i] = "";
    for (int i = 0; i < record_list.size(); i++) model.addRow(objects);
    setModel(model);

    column_model = (DefaultTableColumnModel) getColumnModel();
    for (int i = 1; i < column_names.length; i++)
      column_model
          .getColumn(i)
          .setCellRenderer(
              new StringRenderer(column_names[i], LabelTableCellRenderer.MODE_MULTIPLE_SELECTION));

    initializeCheckColumn();

    setTableHeader(new TableHeader(column_model));

    setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    initializeColumnWidth();

    pane = this;

    initPopupMenu();
  }
Beispiel #5
0
 public Buffer getUV() {
   float v[] = new float[uv.size()];
   for (int i = 0; i < uv.size(); i++) {
     v[i] = (uv.elementAt(i)).floatValue();
   }
   return FloatBuffer.wrap(v);
 }
Beispiel #6
0
 public Buffer getVertices() {
   float v[] = new float[points.size()];
   for (int i = 0; i < points.size(); i++) {
     v[i] = (points.elementAt(i)).floatValue();
   }
   return FloatBuffer.wrap(v);
 }
Beispiel #7
0
 public Buffer getNormals() {
   float v[] = new float[normals.size()];
   for (int i = 0; i < normals.size(); i++) {
     v[i] = (normals.elementAt(i)).floatValue();
   }
   return FloatBuffer.wrap(v);
 }
Beispiel #8
0
 /**
  * Return the graph items for this graph.
  *
  * @return the graph items for this graph.
  */
 public GraphItem[] getGraphItems() {
   GraphItem gia[] = new GraphItem[graphItems.size()];
   for (int i = 0; i < graphItems.size(); i++) {
     gia[i] = (GraphItem) graphItems.elementAt(i);
   }
   return gia;
 }
 /** Get row count (part of table model interface) */
 public int getRowCount() {
   int count = data.size();
   if (filter_data != null) {
     count = filter_data.size();
   }
   return count;
 }
  private void doSave() {
    ObjectOutputStream objectStream = getObjectOutputStream();

    if (objectStream != null) {
      try {
        System.out.println("Saving " + selectedChildrenPaths.size() + " Selected Generations...");

        for (int i = 0; i < selectedChildrenPaths.size(); i++) {
          // Get the userObject at the supplied path
          Object selectedPath =
              ((TreePath) selectedChildrenPaths.elementAt(i)).getLastPathComponent();
          DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) selectedPath;

          objectStream.writeObject(selectedNode.getUserObject());
        }

        objectStream.close();
        System.out.println("Save completed successfully.");
      } catch (IOException e) {
        System.err.println(e);
      }
    } else {
      System.out.println("Save Selected Files has been aborted!");
    }
  }
Beispiel #11
0
  public Buffer getElements() {
    short e[] = new short[elements.size()];
    for (int i = 0; i < elements.size(); i++) {
      e[i] = (elements.elementAt(i)).shortValue();
    }

    return ShortBuffer.wrap(e);
  }
 public XmlUIElement getXmlElement(UserInput uiArg) {
   String type = "textfield";
   Qualifier qual = uiArg.getQualifier();
   String enumNames[] = null;
   String enumValues[] = null;
   if (qual != null) {
     type = qual.getType();
     Vector enumVec = qual.getEnums();
     if (enumVec.size() > 0) {
       enumNames = new String[enumVec.size()];
       enumValues = new String[enumVec.size()];
       for (int i = 0; i < enumNames.length; i++) {
         com.adventnet.management.config.xml.Enum e =
             (com.adventnet.management.config.xml.Enum) enumVec.elementAt(i);
         enumNames[i] = e.getName();
         enumValues[i] = e.getValue();
         if (enumNames[i] == null) {
           enumNames[i] = enumValues[i];
         }
       }
     }
   }
   XmlUIElement el = getXmlUIElementFor(type);
   if (el == null) {
     return null;
   }
   el.setDescription(uiArg.getDescription());
   if (enumNames != null) {
     el.setEnumeratedValues(enumNames, enumValues);
   }
   if ((qual != null) && (qual.getRange() != null) && (!(qual.getRange().equals("")))) {
     el.setRange(qual.getRange());
   }
   if (uiArg.getDefaultValue() != null) {
     el.setValue(uiArg.getDefaultValue());
   }
   String isEditable = uiArg.getAttribute("editable");
   if (isEditable != null) {
     if (isEditable.trim().equals("false")) {
       el.setEditable(false);
     } else {
       el.setEditable(true);
     }
   }
   String required = uiArg.getAttribute("required");
   {
     if (required.trim().equals("true")) {
       el.setRequired(true);
       numberOfRequiredFields++;
     } else {
       el.setRequired(false);
     }
   }
   el.setLabelName(uiArg.getLabel());
   return el;
 }
 /** Sets the pins list's contents with the given vector of PartPinInfo objects. */
 public void setContents(Vector newPins) {
   partPins = new PartPinInfo[newPins.size()];
   valuesStr = new String[newPins.size()];
   newPins.toArray(partPins);
   for (int i = 0; i < partPins.length; i++)
     valuesStr[i] = Format.translateValueToString(partPins[i].value, dataFormat);
   pinsTable.clearSelection();
   pinsTable.revalidate();
   repaint();
 }
Beispiel #14
0
 void accessTextFields() {
   if (stringField != null) {
     for (int i = 0; i < stringField.size(); i++)
       ((TextField) (stringField.elementAt(i))).getText();
   }
   if (numberField != null) {
     for (int i = 0; i < numberField.size(); i++)
       ((TextField) (numberField.elementAt(i))).getText();
   }
 }
Beispiel #15
0
  public DataSet loadDataSet(Vector<Integer> data) {
    int i;
    int j;
    double tempdata[] = new double[2 * data.size()];

    for (i = j = 0; i < data.size(); i++, j += 2) {
      tempdata[j] = i;
      tempdata[j + 1] = data.get(i);
    }

    return loadDataSet(tempdata, data.size());
  }
Beispiel #16
0
 /** Determines if this subtree contains the given vertex */
 public boolean containsTreeVertex(TreeVertex vertex) {
   if (vertex == null) return false;
   for (int i = 0; i < m_vertexList.size(); i++) {
     if ((TreeVertex) m_vertexList.elementAt(i) == vertex) return true;
   }
   for (int i = 0; i < m_edgeList.size(); i++) {
     TreeEdge edge = (TreeEdge) m_edgeList.elementAt(i);
     if (edge.getSourceVertex() == vertex || edge.getDestVertex() == vertex) {
       return true;
     }
   }
   return false;
 }
 /** Add data to the table as a new row */
 public void addData(SOAPMonitorData soap) {
   int row = data.size();
   data.addElement(soap);
   if (filter_data != null) {
     if (filterMatch(soap)) {
       row = filter_data.size();
       filter_data.addElement(soap);
       fireTableRowsInserted(row, row);
     }
   } else {
     fireTableRowsInserted(row, row);
   }
 }
Beispiel #18
0
 public void setScheme(Subtree scheme) {
   this.scheme = scheme;
   cbList = new CheckBoxList();
   Vector<CQCheck> cqChecks = scheme.getCqChecks();
   checkBoxes = new JCheckBox[cqChecks.size()];
   for (int cq = 0; cq < cqChecks.size(); cq++) {
     CQCheck cqCheck = cqChecks.elementAt(cq);
     checkBoxes[cq] = new JCheckBox(cqCheck.getCqText());
     checkBoxes[cq].setSelected(cqCheck.isCqAnswered());
   }
   cbList.setListData(checkBoxes);
   cqScrollPane.setViewportView(cbList);
 }
 public boolean action(Event e, Object arg) {
   System.out.println(e + " " + arg);
   if (e.target == bf.tf) {
     System.out.println("new page");
     String url = bf.tf.getText();
     pages.addElement(url);
     String page = split(url);
     System.out.println("Server = " + server);
     System.out.println("Port = " + port);
     System.out.println("Page = " + page);
     connect(page);
     position++;
     bf.back.enable();
     return true;
   } else if (e.target == bf.back) {
     System.out.println("pos " + position + " " + pages.size());
     if (position > 0) {
       position--;
       String page = split((String) pages.elementAt(position));
       bf.tf.setText((String) pages.elementAt(position));
       connect(page);
       if (position == 0) {
         bf.back.disable();
       }
       bf.forward.enable();
     }
     return true;
   } else if (e.target == bf.forward) {
     if (position != pages.size() - 1) {
       position++;
       bf.tf.setText((String) pages.elementAt(position));
       String page = split((String) pages.elementAt(position));
       if (position == pages.size() - 1) {
         bf.forward.disable();
       }
       bf.back.enable();
       connect(page);
     }
     return true;
   } else if (e.target == bf.b) {
     System.out.println("Disposing of browser frame");
     bf.hide();
     bf.dispose();
     bf = null;
     return true;
   } else {
     return false;
   }
 }
Beispiel #20
0
 public void write() {
   filename = "open/" + filename;
   try {
     BufferedWriter br = new BufferedWriter(new FileWriter(new File(filename)));
     br.write(precode);
     for (int i = 0; i < classes.size(); i++) {
       System.out.println("Jooifying " + (i + 1) + " out of " + classes.size() + 1);
       br.write(((Class) classes.get(i)).toString());
     }
     br.close();
     System.out.println("Written file " + filename);
   } catch (Exception e) {
     System.out.println("Exception " + e + " occured");
   }
 }
Beispiel #21
0
  public void nick_name(String msg) {
    try {
      String name = msg.substring(13);
      this.setName(name);
      Vector v = father.onlineList;
      boolean isRepeatedName = false;
      int size = v.size();
      for (int i = 0; i < size; i++) {
        ServerAgentThread tempSat = (ServerAgentThread) v.get(i);
        if (tempSat.getName().equals(name)) {
          isRepeatedName = true;
          break;
        }
      }
      if (isRepeatedName == true) {
        dout.writeUTF("<#NAME_REPEATED#>");
        din.close();
        dout.close();
        sc.close();
        flag = false;
      } else {
        v.add(this);
        father.refreshList();
        String nickListMsg = "";
        StringBuilder nickListMsgSb = new StringBuilder();
        size = v.size();
        for (int i = 0; i < size; i++) {
          ServerAgentThread tempSat = (ServerAgentThread) v.get(i);
          nickListMsgSb.append("!");
          nickListMsgSb.append(tempSat.getName());
        }
        nickListMsgSb.append("<#NICK_LIST#>");
        nickListMsg = nickListMsgSb.toString();
        Vector tempv = father.onlineList;
        size = tempv.size();
        for (int i = 0; i < size; i++) {
          ServerAgentThread tempSat = (ServerAgentThread) tempv.get(i);
          tempSat.dout.writeUTF(nickListMsg);
          if (tempSat != this) {
            tempSat.dout.writeUTF("<#MSG#>" + this.getName() + "is now online....");
          }
        }
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
 public void removeUser(String strChannel) {
   Vector vtData = tblUser.getFilteredData();
   for (int iIndex = 0; iIndex < vtData.size(); iIndex++) {
     Vector vtRow = (Vector) vtData.elementAt(iIndex);
     if (vtRow.elementAt(0).equals(strChannel)) tblUser.deleteRow(iIndex);
   }
 }
Beispiel #23
0
  /** Calculate the rectangle occupied by the data */
  protected Rectangle getDataRectangle(Graphics g, Rectangle r) {
    Axis a;
    int waxis;
    int x = r.x;
    int y = r.y;
    int width = r.width;
    int height = r.height;

    for (int i = 0; i < axis.size(); i++) {
      a = ((Axis) axis.elementAt(i));

      waxis = a.getAxisWidth(g);

      switch (a.getAxisPos()) {
        case Axis.LEFT:
          x += waxis;
          width -= waxis;
          break;
        case Axis.RIGHT:
          width -= waxis;
          break;
        case Axis.TOP:
          y += waxis;
          height -= waxis;
          break;
        case Axis.BOTTOM:
          height -= waxis;
          break;
      }
    }

    return new Rectangle(x, y, width, height);
  }
  private void updateTabBar(Vector vtThread) {
    pnlThread.removeAll();
    for (int iThreadIndex = 0; iThreadIndex < vtThread.size(); iThreadIndex++) {
      try {
        Vector vtThreadInfo = (Vector) vtThread.elementAt(iThreadIndex);
        PanelThreadMonitor mntTemp = new PanelThreadMonitor(channel);

        String strThreadID = (String) vtThreadInfo.elementAt(0);
        String strThreadName = (String) vtThreadInfo.elementAt(1);
        int iThreadStatus = Integer.parseInt((String) vtThreadInfo.elementAt(2));
        mntTemp.setThreadID(strThreadID);
        mntTemp.setThreadName(strThreadName);
        mntTemp.setThreadStatus(iThreadStatus);
        showResult(mntTemp.txtMonitor, (String) vtThreadInfo.elementAt(3));
        mntTemp.addPropertyChangeListener(this);

        pnlThread.add(strThreadName, mntTemp);
        mntTemp.updateStatus();
      } catch (Exception e) {
        e.printStackTrace();
        MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
      }
    }
    Skin.applySkin(this);
  }
Beispiel #25
0
    public void actionPerformed(java.awt.event.ActionEvent arg0) {
      if (JTable1.getSelectedRowCount() != 1) {
        Utilities.errorMessage(resourceBundle.getString("Please select a view to delete"));
        return;
      }

      if (JOptionPane.showConfirmDialog(
              null,
              resourceBundle.getString("Are you sure you want to delete the selected view "),
              resourceBundle.getString("Warning!"),
              JOptionPane.YES_NO_OPTION,
              JOptionPane.WARNING_MESSAGE,
              null)
          == JOptionPane.NO_OPTION) return;

      Vector viewvec = model.getAllViews();
      for (int i = 0; i < viewvec.size(); i++) {
        String viewname = ((AuthViewWithOperations) viewvec.elementAt(i)).getAuthorizedViewName();
        if (JTable1.getValueAt(JTable1.getSelectedRow(), 0).toString().equals(viewname)) {
          AuthViewWithOperations avop = (AuthViewWithOperations) viewvec.elementAt(i);

          model.delViewOp(
              avop.getAuthorizedViewName(), avop.getViewProperties(), avop.getOperations());
        }
      }

      disableButtons();
    }
Beispiel #26
0
    public void actionPerformed(java.awt.event.ActionEvent arg0) {

      if (JTable1.getSelectedRowCount() != 1) {

        Utilities.errorMessage(resourceBundle.getString("Please select a view to edit"));
        return;
      }

      views = new ViewsWizard(ViewConfig.this, applet);
      views.setSecurityModel(model);
      Point p = JLabel1.getLocationOnScreen();
      views.setLocation(p);
      views.init();

      views.setState(false);
      Vector viewvec = model.getAllViews();
      for (int i = 0; i < viewvec.size(); i++) {
        String viewname = ((AuthViewWithOperations) viewvec.elementAt(i)).getAuthorizedViewName();
        if (JTable1.getValueAt(JTable1.getSelectedRow(), 0).toString().equals(viewname)) {
          views.setValues((AuthViewWithOperations) viewvec.elementAt(i));
        }
      }

      disableButtons();
      views.setVisible(true);
    }
Beispiel #27
0
 /**
  * Retrieve the <code>Lite</code> object visible under a point. This object should actually be
  * searched in reverse order in the <code>Lite</code> object list.
  */
 public Lite itemUnder(int x, int y) {
   for (int i = lites.size() - 1; i >= 0; i--) {
     Lite l = elementAt(i);
     if (l.getBounds().contains(x, y)) return l;
   }
   return null;
 }
Beispiel #28
0
  public String toString() {

    StringBuffer st = new StringBuffer();

    st.append(" Cut Panels: ");
    for (int i = 0; i < visibleViewIds.size(); i++) {
      st.append(" " + Constants.cpNames[((Integer) visibleViewIds.elementAt(i)).intValue()]);
    }
    st.append(" \nCutPanelSize: ");
    st.append(cutPanelSize);
    st.append(" \nlonReference: ");
    st.append(lonReference);
    st.append(" \ngeoDisplayFormat: ");
    st.append(geoDisplayFormat);
    st.append(" \nuseCenterWidthOrMinMax: ");
    st.append(useCenterWidthOrMinMax);
    st.append(" \ntimeDisplayFormat: ");
    st.append(timeDisplayFormat);
    st.append(" \ntimeAxisMode:  ");
    st.append(timeAxisMode);
    st.append(" \ntimeAxisReference:  ");
    st.append(timeAxisReference);
    st.append(" \ntimeSinceUnits:  ");
    st.append(timeSinceUnits);
    st.append(" \ndisplayPanelAxes:  ");
    st.append(displayPanelAxes);
    st.append(" \nindependentHandles:  ");
    st.append(independentHandles);
    return st.toString();
  }
Beispiel #29
0
    public void paintComponent(Graphics g) {
      g.setColor(new Color(96, 96, 96));
      image.paintIcon(this, g, 1, 1);

      FontMetrics fm = g.getFontMetrics();

      String[] args = {jEdit.getVersion()};
      String version = jEdit.getProperty("about.version", args);
      g.drawString(version, (getWidth() - fm.stringWidth(version)) / 2, getHeight() - 5);

      g = g.create((getWidth() - maxWidth) / 2, TOP, maxWidth, getHeight() - TOP - BOTTOM);

      int height = fm.getHeight();
      int firstLine = scrollPosition / height;

      int firstLineOffset = height - scrollPosition % height;
      int lines = (getHeight() - TOP - BOTTOM) / height;

      int y = firstLineOffset;

      for (int i = 0; i <= lines; i++) {
        if (i + firstLine >= 0 && i + firstLine < text.size()) {
          String line = (String) text.get(i + firstLine);
          g.drawString(line, (maxWidth - fm.stringWidth(line)) / 2, y);
        }
        y += fm.getHeight();
      }
    }
Beispiel #30
0
  public Properties internalToProperties() {
    Properties props = new Properties();

    StringBuffer st = new StringBuffer();
    st.append(" ");
    for (int i = 0; i < visibleViewIds.size(); i++) {
      st.append(" " + Constants.cpNames[((Integer) visibleViewIds.elementAt(i)).intValue()]);
    }
    // System.out.println(" visibleViewIds: " + st.toString());

    props.setProperty("ndedit.visibleViewIds", st.toString());

    props.setProperty("ndedit.cutPanelSizeW", (new Integer(cutPanelSize.width).toString()));
    props.setProperty("ndedit.cutPanelSizeH", (new Integer(cutPanelSize.height).toString()));
    props.setProperty("ndedit.cutPanelWMin", (new Integer(cutPanelMinSize.width).toString()));
    props.setProperty("ndedit.cutPanelHMin", (new Integer(cutPanelMinSize.height).toString()));
    props.setProperty("ndedit.cutPanelWMax", (new Integer(cutPanelMaxSize.width).toString()));
    props.setProperty("ndedit.cutPanelHMax", (new Integer(cutPanelMaxSize.height).toString()));
    props.setProperty("ndedit.lonReference", (new Double(lonReference).toString()));
    props.setProperty("ndedit.geoDisplayFormat", (new Integer(geoDisplayFormat).toString()));
    props.setProperty("ndedit.timeDisplayFormat", (new Integer(timeDisplayFormat).toString()));
    props.setProperty("ndedit.timeAxisMode", (new Integer(timeAxisMode).toString()));
    props.setProperty("ndedit.timeAxisReference", (new Double(timeAxisReference).toString()));
    String dpa = new Boolean(displayPanelAxes).toString();
    props.setProperty("ndedit.displayPanelAxes", dpa);
    dpa = new Boolean(independentHandles).toString();
    props.setProperty("ndedit.independentHandles", dpa);
    return props;
  }