/** * 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; }
/** * Returns the message at row i. * @param i The row with the message. * @return The message at row i. */ public Message getMessage(int i) { return messages == null || i < 0 || i >= messages.size() ? null : (Message)messages.get(i); }
/** * 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); }
/** * 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; }
/** * 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); }
/** * 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); }
/** * Add a message to the table * @param message The message to add. * @return <code>true</code> if success */ public boolean addMessage(Message message) { messages.add(message); int row = messages.size(); fireTableRowsInserted(row, row); return 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()); }
for (int i = 0; i < panelcan.visible_components.size(); i++) { Component component = (Component) panelcan.visible_components.get(i);
/** * 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; }
order==ASC ? orders.size() : 0, orderexp.getValue(f2)); results.add(index, result);