当前位置: 首页>>代码示例>>Java>>正文


Java VisualItem.canGetString方法代码示例

本文整理汇总了Java中prefuse.visual.VisualItem.canGetString方法的典型用法代码示例。如果您正苦于以下问题:Java VisualItem.canGetString方法的具体用法?Java VisualItem.canGetString怎么用?Java VisualItem.canGetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在prefuse.visual.VisualItem的用法示例。


在下文中一共展示了VisualItem.canGetString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
public void render(Graphics2D g, VisualItem item) {
	// render the edge line
	super.render(g, item);
	
	// Add label:
	Shape s = getShape(item);
	if (s != null) {
		Rectangle2D r = s.getBounds2D();
		boolean useInt = 1.5 > Math.max(g.getTransform().getScaleX(), g.getTransform().getScaleY());
		if (m_font == null)
			m_font = item.getFont();
		// scale the font as needed
		FontMetrics fm = DEFAULT_GRAPHICS.getFontMetrics(m_font);
		if (item.canGetString("name")) {
			g.setFont(m_font);
			g.setPaint(ColorLib.getColor(item.getTextColor()));
			drawString(g, fm, item.getString("name"), useInt, r.getX(), r.getY(), r.getWidth(), r.getHeight());
		}

	}
}
 
开发者ID:santiontanon,项目名称:RHOG,代码行数:22,代码来源:LabelEdgeRenderer.java

示例2: storeLayout

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
    * Stores current positions of the tables.
    */
   @SuppressWarnings("unchecked")
public void storeLayout() {
   	if (root != null && layoutHasBeenSet) {
    	synchronized (visualization) {
    		LayoutStorage.removeAll(root.getName());
	        Iterator items = visualization.items(BooleanLiteral.TRUE);
	        for (int m_visibleCount=0; items.hasNext(); ++m_visibleCount ) {
	            VisualItem item = (VisualItem)items.next();
	            if (item.canGetString("label") ) {
	            	String tableName;
               		tableName = item.getString("label");
               		if (tableName != null) {
               			LayoutStorage.setPosition(root.getName(), tableName, new double[] { item.getX(), item.getY(), item.isFixed()? 1.0:0.0 });
               		}
	            }
	        }
	        LayoutStorage.checkSignificance(root.getName());
        }
   	}
   }
 
开发者ID:P15,项目名称:jailer,代码行数:24,代码来源:GraphicalDataModelView.java

示例3: visibleItems

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
public Set<String> visibleItems() {
	Set<String> result = new HashSet<String>();
       synchronized (visualization) {
        Iterator items = visualization.items(BooleanLiteral.TRUE);
        while (items.hasNext()) {
            VisualItem item = (VisualItem)items.next();
            if (item.canGetString("label") ) {
            	String tableName;
            	tableName = item.getString("label");
            	if (tableName != null) {
            		result.add(tableName);
            	}
            }
        }
       }
       return result;
}
 
开发者ID:P15,项目名称:jailer,代码行数:18,代码来源:GraphicalDataModelView.java

示例4: render

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
    * @see prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem)
    */
   public synchronized void render(AndroidGraphics2D 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); 
   	}
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:28,代码来源:AxisRenderer.java

示例5: getText

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:14,代码来源:LabelRenderer.java

示例6: showLabel

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private void showLabel(VisualItem item, MotionEvent event)
{
	if (label.length == 1)
	{
		// optimize the simple case
		if (item.canGetString(label[0]))
		{
			String str = item.getString(label[0]);
			Toast.makeText(this.display.getContext(), str , Toast.LENGTH_SHORT).show();
		}
	} 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)
		{
			Toast.makeText(this.display.getContext(), sbuf.toString(), Toast.LENGTH_LONG).show();
		}
	}
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:30,代码来源:ToolTipControl.java

示例7: getText

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
   * 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) {
  	if (textCacheVersion != model.version) {
  		textCacheVersion = model.version;
  		textCache.clear();
  	}
m_color = IN_CLOSURE_COLOR;
  	if (item.canGetString(m_labelName) ) {
      	String tableName = item.getString(m_labelName);
      	Table table = model.getTable(tableName);
      	if (table != null) {
      		tableName = model.getDisplayName(table);
      	}
      	if (table != null && !graphicalDataModelView.modelEditor.getCurrentSubjectClosure().contains(table)) {
      		m_color = NOT_IN_CLOSURE_COLOR;
      	}
          if (table != null && graphicalDataModelView.showDetails(table)) {
      		if (textCache.containsKey(table.getName())) {
      			return textCache.get(table.getName());
      		}
      		StringBuilder sb = new StringBuilder(tableName + " \n-\n");
      		for (Column c: table.getColumns()) {
      			if (c.getFilterExpression() != null) {
      				sb.append("!");
      			}
      			for (Column pk: table.primaryKey.getColumns()) {
      				if (pk.name.equals(c.name)) {
      					sb.append("+");
      					break;
      				}
      			}
      			String sql = c.toSQL(null);
      			sb.append(c.name).append("  \t").append(sql.substring(c.name.length()).trim()).append(" \n");
      		}
      		textCache.put(table.getName(), sb.toString());
      		return sb.toString();
      	}
          return tableName + " ";
      }
      return " ";
  }
 
开发者ID:P15,项目名称:jailer,代码行数:47,代码来源:TableRenderer.java

示例8: getRawShape

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.render.AbstractShapeRenderer#getRawShape(prefuse.visual.VisualItem)
 */
protected Shape getRawShape(VisualItem item) {
    double x1 = item.getDouble(VisualItem.X);
    double y1 = item.getDouble(VisualItem.Y);
    double x2 = item.getDouble(VisualItem.X2);
    double y2 = item.getDouble(VisualItem.Y2);
    m_line.setLine(x1,y1,x2,y2);
    
    if ( !item.canGetString(VisualItem.LABEL) )
        return m_line;
    
    String label = item.getString(VisualItem.LABEL);
    if ( label == null ) return m_line;
    
    AwtFontMetrics fm = new AwtFontMetrics( item.getFont()) ;
    m_ascent = fm.getAscent() + 1; // TODO for Dritan: check why is it necesary to add 1 pixel to the ascent?
    int h = fm.getHeight();
    int w = fm.stringWidth(label);
    double tx, ty;
    
    // get text x-coord
    switch ( m_xalign ) {
    case Constants.FAR_RIGHT:
        tx = x2 + 2;
        break;
    case Constants.FAR_LEFT:
        tx = x1 - w - 2;
        break;
    case Constants.CENTER:
        tx = x1 + (x2-x1)/2 - w/2;
        break;
    case Constants.RIGHT:
        tx = x2 - w;
        break;
    case Constants.LEFT:
    default:
        tx = x1;
    }
    // get text y-coord
    switch ( m_yalign ) {
    case Constants.FAR_TOP:
        ty = y1-h;
        break;
    case Constants.FAR_BOTTOM:
        ty = y2;
        break;
    case Constants.CENTER:
        ty = y1 + (y2-y1)/2 - h/2;
        break;
    case Constants.TOP:
        ty = y1;
        break;
    case Constants.BOTTOM:
    default:
        ty = y2-h; 
    }
    m_box.setFrame(tx,ty,w,h);
    return m_box;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:62,代码来源:AxisRenderer.java

示例9: getText

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * 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 )
{
	if ( item.canGetString( m_labelName ) ) {
		return item.getString( m_labelName );
	}
	return null;
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:16,代码来源:StringRenderer.java

示例10: getImageLocation

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:P15,项目名称:jailer,代码行数:13,代码来源:TableRenderer.java


注:本文中的prefuse.visual.VisualItem.canGetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。