/** * Fills a SubtreeFrame with info about the subtree. Used to display info when user right clicks * on an existing subtree. */ public void buildSubtreeFrame(SubtreeFrame sFrame) { // Clear visited flag on all vertices in the tree // and determine the layer number of the root node int highestLayer = 100; Enumeration edges = m_edgeList.elements(); while (edges.hasMoreElements()) { TreeEdge edge = (TreeEdge) edges.nextElement(); edge.getDestVertex().setVisited(false); edge.getSourceVertex().setVisited(false); if (edge.getSourceVertex().getLayer() < highestLayer) { highestLayer = edge.getSourceVertex().getLayer(); } } // Create list of premises and conclusion and assign // to text areas in the dialog Vector premiseList = new Vector(); String conclusion = ""; String criticalQuestions = ""; edges = m_edgeList.elements(); while (edges.hasMoreElements()) { TreeEdge edge = (TreeEdge) edges.nextElement(); TreeVertex source = edge.getSourceVertex(); TreeVertex dest = edge.getDestVertex(); if (!source.getVisited()) { if (source.getLayer() == highestLayer) { conclusion += (String) source.getLabel(); } else { premiseList.add((String) source.getLabel()); } source.setVisited(true); } if (!dest.getVisited()) { premiseList.add((String) dest.getLabel()); dest.setVisited(true); } } sFrame.setPremisesText(premiseList); sFrame.setConclusionText(conclusion); sFrame.loadArgTypeCombo(); // Assign the correct argument type to the combo box for (int index = 0; index < sFrame.selectArgumentCombo.getItemCount(); index++) { if (m_argumentType.getName().equals(sFrame.selectArgumentCombo.getItemAt(index))) { sFrame.selectArgumentCombo.setSelectedIndex(index); sFrame.selectArgumentCombo.setEditable(false); break; } } // Construct list of critical questions // Enumeration quesList = m_argumentType.getCriticalQuestions().elements(); // while (quesList.hasMoreElements()) { // criticalQuestions += (String)quesList.nextElement() + // "\r\n _____________________________ \r\n"; // } sFrame.updateTextBoxes(); }
void drawboard(Graphics g) { g.setColor(Color.black); g.fillRect(0, 0, getWidth(), getHeight()); sqw = getWidth() / xdim; sqh = getHeight() / ydim; // draw background panels if (def != null) { for (int y = 0; y < ydim; y++) { for (int x = 0; x < xdim; x++) def.drawObject(g, x, y, sqw, sqh, this); } } if (USEVEC) { // draw each element in the vector for (Enumeration e = boardVec.elements(); e.hasMoreElements(); ) { boardContainer c = (boardContainer) e.nextElement(); c.o.drawObject(g, c.d.width, c.d.height, sqw, sqh, this); } } else { // draw from grid for (int y = 0; y < ydim; y++) { for (int x = 0; x < xdim; x++) if (board[x][y] != null) board[x][y].drawObject(g, x, y, sqw, sqh, this); } } }
public void setColor(Color _color) { myColor = _color; tabbedPanel.setForeground(_color); firstButton.setForeground(_color); for (java.util.Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); ) e.nextElement().setColor(_color); }
public StringBuffer saveStringBuffer() { StringBuffer save = new StringBuffer(); for (java.util.Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); ) { Editor page = e.nextElement(); save.append( "<" + name + ".Page>\n" + "<Type>" + typeOfPage(page) + "</Type>\n" + "<Name>" + page.getName() + "</Name>\n" + "<Active>" + page.isActive() + "</Active>\n" + "<" + contentDelim + ">\n"); save.append(page.saveStringBuffer()); save.append("</" + contentDelim + ">\n" + "</" + name + ".Page>\n"); } return save; }
/** * notify listeners of a popup selection * * @param popStr popup selection string */ void popNotify(String popStr) { Enumeration en = popListeners.elements(); for (; en.hasMoreElements(); ) { PopListener listener = (PopListener) en.nextElement(); listener.popHappened(popStr); } } // popNotify()
/** * Build a shape for the entire subtree by joining together the shapes for each of its edges. * Vertices included since needed for FullTextPanel. */ public Shape constructInternalShape(DiagramBase diagram, boolean includeVertices) { GeneralPath shape = new GeneralPath(); Enumeration edges = m_edgeList.elements(); while (edges.hasMoreElements()) { TreeEdge edge = (TreeEdge) edges.nextElement(); Shape edgeShape = edge.getSchemeShape(diagram); PathIterator path = edgeShape.getPathIterator(null); shape.append(path, false); if (includeVertices) { Shape vertexShape; if (!edge.getSourceVertex().isVirtual()) { vertexShape = edge.getSourceVertex().getShape(diagram); path = vertexShape.getPathIterator(null); shape.append(path, false); } if (!edge.getDestVertex().isVirtual()) { vertexShape = edge.getDestVertex().getShape(diagram); path = vertexShape.getPathIterator(null); shape.append(path, false); } } } BasicStroke stroke = new BasicStroke( diagram.getSubtreeLineWidth() - DiagramBase.EDGE_OUTLINE_WIDTH + 1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER); internalShapeTable.put(diagram, stroke.createStrokedShape(shape)); return (Shape) internalShapeTable.get(diagram); }
/** Mthis method perform equals based on string rapresentation of objects */ public static void updateStringComboBox( javax.swing.JComboBox comboBox, Vector newItems, boolean addNullEntry) { Object itemSelected = null; if (comboBox.getSelectedIndex() >= 0) { itemSelected = comboBox.getSelectedItem() + ""; } comboBox.removeAllItems(); boolean selected = false; boolean foundNullItem = false; Enumeration e = newItems.elements(); while (e.hasMoreElements()) { String item = "" + e.nextElement(); comboBox.addItem(item); if (item.equals(itemSelected)) { selected = true; comboBox.setSelectedItem(itemSelected); } if (item.equals("")) { foundNullItem = true; } } if (addNullEntry) { if (!foundNullItem) comboBox.insertItemAt("", 0); if (!selected) comboBox.setSelectedItem(""); } }
public java.util.List<SearchResult> search(String _info, String _searchString, int _mode) { String passName = getName(); if (passName.startsWith("Osejs.")) passName = passName.substring(6); java.util.List<SearchResult> list = new ArrayList<SearchResult>(); for (java.util.Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); ) list.addAll(e.nextElement().search(passName, _searchString, _mode)); return list; }
/** * Paint each <code>Lite</code> object in turn after testing if it is inside the clip of the * Graphics. This is the right way to do it if the repainting time of <code>Lite</code> objects is * much greater than the time required to compute its bounds. * * @see excentric.LiteGroup#paintAll(java.awt.Graphics) */ public void paint(Graphics g) { Rectangle clip = g.getClipBounds(); for (Enumeration e = lites.elements(); e.hasMoreElements(); ) { Lite l = (Lite) e.nextElement(); // if (l.getBounds().intersects(clip)) l.paint(g); } }
public void clear() { for (java.util.Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); ) e.nextElement().clear(); pageList.clear(); tabbedPanel.removeAll(); showFirstPage(); updatePageCounterField(pageList.size()); changed = false; }
public String getInfo() { String info = "Edges: "; Enumeration edges = m_edgeList.elements(); while (edges.hasMoreElements()) { TreeEdge edge = (TreeEdge) edges.nextElement(); info += edge.getSourceVertex().getLabel() + " => " + edge.getDestVertex().getLabel() + "; "; } return info; }
/* * Applet is no longer displayed */ public void stop() { // Tell all pages to stop talking to the server Enumeration e = pages.elements(); while (e.hasMoreElements()) { SOAPMonitorPage pg = (SOAPMonitorPage) e.nextElement(); if (pg != null) { pg.stop(); } } }
/** Check if soap data matches filter */ public boolean filterMatch(SOAPMonitorData soap) { boolean match = true; if (filter_include != null) { // Check for service match Enumeration e = filter_include.elements(); match = false; while (e.hasMoreElements() && !match) { String service = (String) e.nextElement(); if (service.equals(soap.getTargetService())) { match = true; } } } if (filter_exclude != null) { // Check for service match Enumeration e = filter_exclude.elements(); while (e.hasMoreElements() && match) { String service = (String) e.nextElement(); if (service.equals(soap.getTargetService())) { match = false; } } } if (filter_active) { // Check for active status match if (soap.getSOAPResponse() != null) { match = false; } } if (filter_complete) { // Check for complete status match if (soap.getSOAPResponse() == null) { match = false; } } // The "most recent" is always a match if (soap.getId() == null) { match = true; } return match; }
/** * 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(); }
/** * prepare for transforming Data into scene graph depictions, including possible auto-scaling of * ScalarMaps * * @param temp Vector of DataRenderers * @param tmap Vector of ScalarMaps * @param go flag indicating whether Data transforms are requested * @param initialize flag indicating whether auto-scaling is requested * @throws VisADException a VisAD error occurred * @throws RemoteException an RMI error occurred */ public void prepareAction(Vector temp, Vector tmap, boolean go, boolean initialize) throws VisADException, RemoteException { DataShadow shadow = null; Enumeration renderers = temp.elements(); while (renderers.hasMoreElements()) { DataRenderer renderer = (DataRenderer) renderers.nextElement(); shadow = renderer.prepareAction(go, initialize, shadow); } if (shadow != null) { // apply RealType ranges and animationSampling Enumeration maps = tmap.elements(); while (maps.hasMoreElements()) { ScalarMap map = ((ScalarMap) maps.nextElement()); map.setRange(shadow); } } ScalarMap.equalizeFlow(tmap, Display.DisplayFlow1Tuple); ScalarMap.equalizeFlow(tmap, Display.DisplayFlow2Tuple); }
/** * List results by date * * @param reslist result list * @param ldisp */ private void listByDateRun(ResultList reslist, boolean ldisp) { StringTokenizer tokenizer = new StringTokenizer((String) reslist.get("list"), "\n"); Vector vdata = new Vector(); while (tokenizer.hasMoreTokens()) { String data = convertToPretty(tokenizer.nextToken()); if (datasets.contains(data) || ldisp) vdata.add(data); } datasets.removeAllElements(); Enumeration en = vdata.elements(); while (en.hasMoreElements()) datasets.addElement(en.nextElement()); }
public java.util.Enumeration gen(Object o) { MClass c = (MClass) o; Vector specs = new Vector(c.getSpecializations()); if (specs == null) { return EnumerationEmpty.theInstance(); } // TODO: it would be nice to have a EnumerationXform // and a Functor object in uci.util Vector specClasses = new Vector(specs.size()); java.util.Enumeration enum = specs.elements(); while (enum.hasMoreElements()) { MGeneralization g = (MGeneralization) enum.nextElement(); MGeneralizableElement ge = g.getChild(); // assert: ge != null if (ge != null) specClasses.addElement(ge); } return specClasses.elements(); }
/** Build a shape for the entire subtree by joining together the shapes for each of its edges. */ public Shape constructShape(DiagramBase diagram) { GeneralPath shape = new GeneralPath(); Enumeration edges = m_edgeList.elements(); while (edges.hasMoreElements()) { TreeEdge edge = (TreeEdge) edges.nextElement(); if (!edge.visible) { continue; } Shape edgeShape = edge.getSchemeShape(diagram); PathIterator path = edgeShape.getPathIterator(null); shape.append(path, false); } BasicStroke stroke = new BasicStroke( diagram.getSubtreeLineWidth(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER); shapeTable.put(diagram, stroke.createStrokedShape(shape)); return (Shape) shapeTable.get(diagram); }
/** Refilter the list of messages */ public void applyFilter() { // Re-filter using new criteria filter_data = null; if ((filter_include != null) || (filter_exclude != null) || filter_active || filter_complete) { filter_data = new Vector(); Enumeration e = data.elements(); SOAPMonitorData soap; while (e.hasMoreElements()) { soap = (SOAPMonitorData) e.nextElement(); if (filterMatch(soap)) { filter_data.addElement(soap); } } } fireTableDataChanged(); }
/** * get the value of a named RealType if it is included in the cursor location * * @param name String name of RealType whose value to get * @return value of named RealType, or NaN if it is not included in the cursor location */ public double getDirectAxisValue(String name) { synchronized (cursorStringVector) { if (cursorStringVector != null) { Enumeration strings = cursorStringVector.elements(); while (strings.hasMoreElements()) { String s = (String) strings.nextElement(); if (s.startsWith(name)) { String t = s.substring(s.indexOf("=") + 2); int i = t.indexOf(" "); if (i >= 0) t = t.substring(0, i); try { double v = Double.valueOf(t).doubleValue(); return v; } catch (NumberFormatException e) { return Double.NaN; } } } } } return Double.NaN; }
/** Build a shape for the entire subtree by joining together the shapes for each of its edges. */ public Shape constructFullTextShape(DiagramBase diagram) { GeneralPath shape = new GeneralPath(); Enumeration edges = m_edgeList.elements(); while (edges.hasMoreElements()) { TreeEdge edge = (TreeEdge) edges.nextElement(); if (!edge.visible) { continue; } Shape edgeShape = edge.getSchemeShape(diagram); PathIterator path = edgeShape.getPathIterator(null); shape.append(path, false); TreeVertex vertex = edge.getSourceVertex(); if (!vertex.isVirtual()) { shape.append(vertex.getShape(diagram).getPathIterator(null), false); } vertex = edge.getDestVertex(); if (!vertex.isVirtual()) { shape.append(vertex.getShape(diagram).getPathIterator(null), false); } } BasicStroke stroke = new BasicStroke(20, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER); shapeTable.put(diagram, stroke.createStrokedShape(shape)); return (Shape) shapeTable.get(diagram); }
public Enumeration elements() { return lites.elements(); }
/** * This method is called when the focused component (and none of its ancestors) want the key * event. This will look up the keystroke to see if any chidren (or subchildren) of the specified * container want a crack at the event. If one of them wants it, then it will "DO-THE-RIGHT-THING" */ public boolean fireKeyboardAction(KeyEvent e, boolean pressed, Container topAncestor) { if (e.isConsumed()) { System.out.println("Acquired pre-used event!"); Thread.dumpStack(); } // There may be two keystrokes associated with a low-level key event; // in this case a keystroke made of an extended key code has a priority. KeyStroke ks; KeyStroke ksE = null; if (e.getID() == KeyEvent.KEY_TYPED) { ks = KeyStroke.getKeyStroke(e.getKeyChar()); } else { if (e.getKeyCode() != e.getExtendedKeyCode()) { ksE = KeyStroke.getKeyStroke(e.getExtendedKeyCode(), e.getModifiers(), !pressed); } ks = KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers(), !pressed); } Hashtable keyMap = containerMap.get(topAncestor); if (keyMap != null) { // this container isn't registered, so bail Object tmp = null; // extended code has priority if (ksE != null) { tmp = keyMap.get(ksE); if (tmp != null) { ks = ksE; } } if (tmp == null) { tmp = keyMap.get(ks); } if (tmp == null) { // don't do anything } else if (tmp instanceof JComponent) { JComponent c = (JComponent) tmp; if (c.isShowing() && c.isEnabled()) { // only give it out if enabled and visible fireBinding(c, ks, e, pressed); } } else if (tmp instanceof Vector) { // more than one comp registered for this Vector v = (Vector) tmp; // There is no well defined order for WHEN_IN_FOCUSED_WINDOW // bindings, but we give precedence to those bindings just // added. This is done so that JMenus WHEN_IN_FOCUSED_WINDOW // bindings are accessed before those of the JRootPane (they // both have a WHEN_IN_FOCUSED_WINDOW binding for enter). for (int counter = v.size() - 1; counter >= 0; counter--) { JComponent c = (JComponent) v.elementAt(counter); // System.out.println("Trying collision: " + c + " vector = "+ v.size()); if (c.isShowing() && c.isEnabled()) { // don't want to give these out fireBinding(c, ks, e, pressed); if (e.isConsumed()) return true; } } } else { System.out.println("Unexpected condition in fireKeyboardAction " + tmp); // This means that tmp wasn't null, a JComponent, or a Vector. What is it? Thread.dumpStack(); } } if (e.isConsumed()) { return true; } // if no one else handled it, then give the menus a crack // The're handled differently. The key is to let any JMenuBars // process the event if (keyMap != null) { Vector v = (Vector) keyMap.get(JMenuBar.class); if (v != null) { Enumeration iter = v.elements(); while (iter.hasMoreElements()) { JMenuBar mb = (JMenuBar) iter.nextElement(); if (mb.isShowing() && mb.isEnabled()) { // don't want to give these out boolean extended = (ksE != null) && !ksE.equals(ks); if (extended) { fireBinding(mb, ksE, e, pressed); } if (!extended || !e.isConsumed()) { fireBinding(mb, ks, e, pressed); } if (e.isConsumed()) { return true; } } } } } return e.isConsumed(); }
private boolean nameExists(String _name) { for (Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); ) if (_name.equals(e.nextElement().getName())) return true; return false; }
/** * Paint each <code>Lite</code> object . * * @see excentric.LiteGroup#paint(java.awt.Graphics) */ public void paintAll(Graphics g) { for (Enumeration e = lites.elements(); e.hasMoreElements(); ) { Lite l = (Lite) e.nextElement(); l.paint(g); } }
/** * Sets the position of each of the <code>Lite</code> objects to the specified Point. * * @param p The new position point. */ public void setPosition(Point p) { for (Enumeration e = lites.elements(); e.hasMoreElements(); ) { Lite l = (Lite) e.nextElement(); l.setPosition(p); } }
/** * Removes a vector of figures. * * @see #remove */ public void removeAll(Vector figures) { Enumeration k = figures.elements(); while (k.hasMoreElements()) remove((Figure) k.nextElement()); }
/** * Adds a vector of figures. * * @see #add */ public void addAll(Vector newFigures) { Enumeration k = newFigures.elements(); while (k.hasMoreElements()) add((Figure) k.nextElement()); }
public String getMap() { String areas = ""; Enumeration k = fFigures.elements(); while (k.hasMoreElements()) areas += ((Storable) k.nextElement()).getMap(); return areas; }
/** Writes the contained figures to the StorableOutput. */ public void write(StorableOutput dw) { super.write(dw); dw.writeInt(fFigures.size()); Enumeration k = fFigures.elements(); while (k.hasMoreElements()) dw.writeStorable((Storable) k.nextElement()); }