/** * Default constructor for the message list. */ public MessageList() { elements = new SortedList(); listeners = new ArrayList(); }
/** * Appends the given element to the end of this list. (Identical in * function to the <tt>add</tt> method; included only for consistency.) * * @param o the element to be inserted at the end of this list. */ public void addLast(T o) { insertElement(size(), o); }
if(orderby) orders = new SortedList(order==ASC); results = new LinkedList(); int index = orders.insertElement( order==ASC ? orders.size() : 0, orderexp.getValue(f2)); results.add(index, result);
/** * Insert an element into the list. * @param index The index where to start insertion. * @param obj The element to insert. * @return The index where the element was actually inserted. */ public int insertElement(int index, T obj) { while(index>0 && compare(get(index-1), obj)>0) { index--; } while(index<size() && compare(get(index), obj)<0) { index++; } super.add(index, obj); return index; }
/** * Returns the number of rows in the model. * @return the number of rows in the model */ public int getRowCount() { return messages != null ? messages.size() : 0; }
/** * Inserts the given element at the beginning of this list. * * @param o the element to be inserted at the beginning of this list. */ public void addFirst(T o) { insertElement(0, o); }
/** * Adds the component. * @param component The component to add. */ public void addComponent(Component component) { visible_components.add(component); }
/** * Add an array of message to the table. * @param messages The Array of messages to add. */ public void addMessages(Message[] messages) { this.messages.addAll(SUtil.arrayToList(messages)); fireTableDataChanged(); }
/** * Set the preffered size according to component and message count. */ public void setPreferredSize() { Dimension preferredSize = new Dimension(); preferredSize.width = (panelcan.visible_components.size() * DiagramConstants.xDistTimeline); preferredSize.height = DiagramConstants.yDistTimeline + (panelcan.visible_messages.size() * DiagramConstants.yDistTimeline); setPreferredSize(preferredSize); // important for scrollbars setSize(preferredSize); }
/** * Inserts the specified element at the specified position in this list. * Shifts the element currently at that position (if any) and any * subsequent elements to the right (adds one to their indices). * * @param index index at which the specified element is to be inserted. * @param element element to be inserted. * * @throws IndexOutOfBoundsException if the specified index is out of * range (<tt>index < 0 || index > size()</tt>). */ public void add(int index, T element) { insertElement(index, element); }
public void customResultAvailable(Object result) { Collection files = (Collection)result; List nodes = new SortedList(DirNode.FILENODE_COMPARATOR, true); // List nodes = new ArrayList(); for(Iterator it=files.iterator(); it.hasNext();) { File file = (File)it.next(); ISwingTreeNode node = getModel().getNode(file);//.getAbsolutePath()); if(node!=null) { // lis.resultAvailable(node); nodes.add(node); } else { // lis.resultAvailable(ModelTreePanel.createNode(DirNode.this, model, tree, file, iconcache, filter, null)); nodes.add(factory.createNode(RIDNode.this, getModel(), tree, file, iconcache, null, factory)); } } setChildren(nodes); } });
/** * Return the component for a given x- and y-coordinate. * * @param x The x-coordinate. * @param y The y-coordinate. * @return The component or <code>null</code> if there is no component at the * given point. */ public Component getComponent(int x, int y) { int x1, x2; int y1 = DiagramConstants.yOffsetComponentbox; int y2 = y1 + DiagramConstants.heightComponentbox; for (int i = 0; i < panelcan.visible_components.size(); i++) { Component component = (Component) panelcan.visible_components.get(i); x1 = DiagramConstants.yOffsetComponentbox + i * DiagramConstants.xDistTimeline; x2 = x1 + DiagramConstants.widthComponentbox; if ((x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)) { return component; } } return null; }
/** * Sets the prefferred size for this component. */ public void setPreferredSize() { Dimension preferredSize = new Dimension(); preferredSize.width = (panelcan.visible_components.size() * DiagramConstants.xDistTimeline); preferredSize.height = DiagramConstants.heightComponentbox + DiagramConstants.yOffsetComponentbox + DiagramConstants.heigtComponentboxTimeline; setPreferredSize(preferredSize); // importent fore scrollbars setSize(preferredSize); // setMaximumSize(preferredSize); // setMinimumSize(preferredSize); }
/** * Inserts all of the elements in the specified collection into this * list, starting at the specified position. * * @param index index at which to insert first element * from the specified collection. * @param c elements to be inserted into this list. * @return <tt>true</tt> if this list changed as a result of the call. * @throws IndexOutOfBoundsException if the specified index is out of * range (<tt>index < 0 || index > size()</tt>). * @throws NullPointerException if the specified collection is null. */ public boolean addAll(int index, Collection<? extends T> c) { for(Iterator<? extends T> it=c.iterator(); it.hasNext(); ) { int idx = insertElement(index, it.next()); if(idx<=index) index++; } return true; }
List nodes = new SortedList(FILENODE_COMPARATOR, true);
/** * Returns the value for the cell at <code>columnIndex</code> and * <code>rowIndex</code>. * * @param rowIndex the row whose value is to be queried * @param columnIndex the column whose value is to be queried * @return the value Object at the specified cell */ public Object getValueAt(int rowIndex, int columnIndex) { if(messages == null || rowIndex < 0 || rowIndex >= messages.size()) { return null; } Message me = (Message)messages.get(rowIndex); ColumnHeader header = (ColumnHeader)COLUMN_HEADERS.get(columnIndex); return me.getParameter(header.getParamName()); }
List nodes = new SortedList(DirNode.FILENODE_COMPARATOR, true);