/** * Returns the text to draw. Subclasses can override this class to * perform custom text selection. * @param item the item to represent as a <code>String</code> * @return a <code>String</code> to draw */ protected String getText(VisualItem item) { String s = null; if ( item.canGetString(m_labelName) ) { return item.getString(m_labelName); } return s; }
/** * Returns a location string for the image to draw. Subclasses can override * this class to perform custom image selection beyond looking up the value * from a data field. * @param item the item for which to select an image to draw * @return the location string for the image to use, or null for no image */ protected String getImageLocation(VisualItem item) { return item.canGetString(m_imageName) ? item.getString(m_imageName) : null; }
/** * @see prefuse.controls.Control#itemEntered(prefuse.visual.VisualItem, java.awt.event.MouseEvent) */ public void itemEntered(VisualItem item, MouseEvent e) { Display d = (Display)e.getSource(); if ( label.length == 1 ) { // optimize the simple case if ( item.canGetString(label[0]) ) { d.setToolTipText(item.getString(label[0])); } } else { sBuf.delete(0, sBuf.length()); for ( int i=0; i<label.length; ++i ) { if ( item.canGetString(label[i]) ) { if ( sBuf.length() > 0 ) sBuf.append("; "); sBuf.append(item.getString(label[i])); } } // show tool tip only, if at least one field is available if (sBuf.length() > 0) { d.setToolTipText(sBuf.toString()); } } }
/** * @see prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem) */ public void render(Graphics2D g, VisualItem item) { Shape s = getShape(item); GraphicsLib.paint(g, item, m_line, getStroke(item), getRenderType(item)); // check if we have a text label, if so, render it if ( item.canGetString(VisualItem.LABEL) ) { float x = (float)m_box.getMinX(); float y = (float)m_box.getMinY() + m_ascent; // draw label background GraphicsLib.paint(g, item, s, null, RENDER_TYPE_FILL); String str = item.getString(VisualItem.LABEL); AffineTransform origTransform = g.getTransform(); AffineTransform transform = this.getTransform(item); if ( transform != null ) g.setTransform(transform); g.setFont(item.getFont()); g.setColor(ColorLib.getColor(item.getTextColor())); g.drawString(str, x, y); if ( transform != null ) g.setTransform(origTransform); } }
m_line.setLine(x1,y1,x2,y2); if ( !item.canGetString(VisualItem.LABEL) ) return m_line;
if (item.canGetString(AnalysisConstants.XML_FILENAME)){ fileName = item.getString(AnalysisConstants.XML_FILENAME);