/** * Returns an object which represents the data to be transferred. The class of the object returned * is defined by the representation class of the flavor. * * @param flavor the requested flavor for the data * @exception IOException if the data is no longer available in the requested flavor. * @exception UnsupportedFlavorException if the requested data flavor is not supported. * @see DataFlavor#getRepresentationClass */ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { Object result = null; if (flavor.equals(flavors[0])) { StringBuffer buffer = new StringBuffer(); if (this.types != null) { for (int i = 0; i < this.types.size(); i++) { SibType current = this.types.get(i); if (i > 0) { buffer.append(", "); } if (current == null) { buffer.append("null"); } else { buffer.append(current.toString()); } } } result = buffer.toString(); } else if (flavor.equals(flavors[1])) { result = this.types; } if (result == null) { throw new UnsupportedFlavorException(flavor); } return result; }
/** * add an item at a specified position * * @param position an integer * @param object the object to add */ public void add(int position, Object object) { if (this.itemAllowed(object) && object instanceof SibType) { SibType item = (SibType) object; this.addChildElement(item); item.setParent(this); if (this.collection == null) this.collection = this.initCollection(); ((List) this.collection).add(position, item); this.firePropertyChange( new ContentChangeEvent(this, PROPERTY_CONTENT, ContentChangeEvent.ADD, position, item)); } }