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


Java GeneProduct类代码示例

本文整理汇总了Java中org.pathvisio.core.view.GeneProduct的典型用法代码示例。如果您正苦于以下问题:Java GeneProduct类的具体用法?Java GeneProduct怎么用?Java GeneProduct使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: highlightResults

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
private void highlightResults(MatchResult mr) {
	Rectangle2D interestingRect = null;

	VPathway vpy = engine.getActiveVPathway();
	for (VPathwayElement velt : vpy.getDrawingObjects())
	{
		if (velt instanceof GeneProduct)
		{
			GeneProduct gp = (GeneProduct)velt;
			for (XrefWithSymbol id : mr.getMatches())
			{
				XrefWithSymbol ref = new XrefWithSymbol(
						gp.getPathwayElement().getXref(),
						gp.getPathwayElement().getTextLabel());
				if (id.equals(ref))
				{
					gp.highlight();
					Logger.log.info ("Highlighted " + ref);
					//scroll to first item found
					if (interestingRect == null)
					{
						interestingRect = gp.getVBounds();
					}
					break;
				}
			}
		}
	}
	if (interestingRect != null)
		vpy.getWrapper().scrollTo (interestingRect.getBounds());
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:32,代码来源:SearchPane.java

示例2: getLabelText

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
private String getLabelText(GeneProduct g) {
	String text = g.getPathwayElement().getTextLabel();
	if(display != null) {
		if(DISPLAY_LABEL.equals(display)) {
			text = g.getPathwayElement().getTextLabel();
		} else if(DISPLAY_ID.equals(display)){
			text = g.getPathwayElement().getElementID();
		}
	}
	return text;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:12,代码来源:DataNodeLabel.java

示例3: visualizeOnDrawing

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
public void visualizeOnDrawing(Graphics g, Graphics2D g2d) {
	if(g instanceof GeneProduct) {
		GeneProduct gp = (GeneProduct) g;

		CachedData  cache = gexManager.getCachedData();
		if (cache == null) return;

		String id = gp.getPathwayElement().getElementID();
		DataSource ds = gp.getPathwayElement().getDataSource();
		Xref idc = new Xref(id, ds);

		if(cache == null || !cache.hasData(idc)|| useSamples.size() == 0) {
			return;
		}

		g2d = (Graphics2D)g2d.create();
		g2d.setClip(null);

		int startx = (int)(g.getVLeft() + g.getVWidth() + SPACING);
		int starty = (int)(g.getVTop() + g.getVHeight() / 2);
		Font f = getFont(true);
		g2d.setFont(f);
		int th = g2d.getFontMetrics().getHeight();
		int w = 0, i = 0;
		for(ISample s : useSamples) {
			String str = getDataString(s, cache.getData(idc), SEP + "\n") +
				(++i == useSamples.size() ? "" : SEP);
			if (str.length() == 0) continue;
			TextLayout tl = new TextLayout(str, f, g2d.getFontRenderContext());
			Rectangle2D tb = tl.getBounds();
			g2d.drawString(str, startx + w, starty + th / 2);
			w += tb.getWidth() + SPACING;
		}
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:36,代码来源:TextByExpression.java

示例4: visualizeOnToolTip

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
public Component visualizeOnToolTip(Graphics g) {
	if(g instanceof GeneProduct) {
		GeneProduct gp = (GeneProduct) g;
		CachedData  cache = gexManager.getCachedData();

		Xref idc = new Xref(
				gp.getPathwayElement().getElementID(),
				gp.getPathwayElement().getDataSource());

		if(!cache.hasData(idc)|| useSamples.size() == 0) {
			return null;
		}

		JPanel panel = new JPanel();
		panel.setBorder(BorderFactory.createTitledBorder("Expression data"));
		panel.setLayout(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.gridy = -1;
		for(ISample s : useSamples) {
			gbc.gridy++;
			gbc.gridx = 0;
			panel.add(new JLabel(getLabelLeftText(s)), gbc);
			gbc.gridx = 1;
			panel.add(new JLabel(getLabelRightText(s, cache.getData(idc))), gbc);
		}
		return panel;
	} else return null;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:29,代码来源:TextByExpression.java

示例5: visualizeOnDrawing

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
public void visualizeOnDrawing(Graphics g, Graphics2D g2d) {
	if(g instanceof GeneProduct)
	{
		if(useSamples.size() == 0) return; //Nothing to draw

		GeneProduct gp = (GeneProduct) g;

		Shape da = getVisualization().provideDrawArea(this, g);
		Rectangle area = da.getBounds();

		drawArea(gp, area, g2d);
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:14,代码来源:ColorByExpression.java

示例6: actionPerformed

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent arg0) {
	if (element instanceof GeneProduct) {
		PathwayElement orig = element.getPathwayElement();
		PathwayElement elt = PathwayElement.createPathwayElement(ObjectType.DATANODE);
		
		for (Object key : orig.getPropertyKeys()) {
			if (elt.getPropertyKeys().contains(key))
				elt.setPropertyEx(key, orig.getPropertyEx(key));
		}
		VPathway vPathway = element.getDrawing();
		Pathway pwy = vPathway.getPathwayModel();
		elt.setDataNodeType(dnType);
		if(dnType.equals(DataNodeType.PATHWAY)) {
			elt.setColor(DefaultTemplates.COLOR_PATHWAY);
			elt.setBold(true);
		} else if (dnType.equals(DataNodeType.METABOLITE)) {
			elt.setColor(DefaultTemplates.COLOR_METABOLITE);
		} else {
			elt.setColor(Color.BLACK);
		}

		elt.setShapeType(ShapeType.RECTANGLE);
		elt.setGraphId(pwy.getUniqueGraphId());

		vPathway.getUndoManager().newAction("Change element type");
		pwy.add(elt);
		for (GraphRefContainer r : pwy.getReferringObjects(orig.getGraphId())) {
			r.linkTo(elt, r.getRelX(), r.getRelY());
		}
		vPathway.removeDrawingObjects(Arrays.asList((VPathwayElement)element), true);
		
	}
}
 
开发者ID:PathVisio,项目名称:org.pathvisio.typeconverter,代码行数:35,代码来源:DataNodeToDataNode.java

示例7: visualizeOnDrawing

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
public void visualizeOnDrawing(Graphics g, Graphics2D g2d) {
	if(g instanceof GeneProduct) {
		String label = getLabelText((GeneProduct) g);
		if(label == null || label.length() == 0) {
			return;
		}

		Font f = getFont();

		Shape region;

		if(isUseProvidedArea()) {
			region = getVisualization().provideDrawArea(this, g);
		} else {
			region = g.createVisualizationRegion();
		}

		Rectangle area = region.getBounds();

		if(!getOverlay()) {
			g2d.setColor(Color.WHITE);
			g2d.fill(area);
		}
		g2d.setColor(Color.BLACK);

		g2d.clip(region);

		if(adaptFontSize) {
			//TODO: adapt font size for awt
			//f = SwtUtils.adjustFontSize(f, new Dimension(area.width, area.height), label, g2d);
		}
		g2d.setFont(f);

		g2d.setColor(getFontColor());

		TextLayout tl = new TextLayout(label, g2d.getFont(), g2d.getFontRenderContext());
		Rectangle2D tb = tl.getBounds();

		switch(align) {
		case ALIGN_LEFT:
			area.x -= area.width / 2 - tb.getWidth() / 2 - 1;
			break;
		case ALIGN_RIGHT:
			area.x += area.width / 2 - tb.getWidth() / 2 - 1;
		}

		tl.draw(g2d, 	(int)area.getX() + (int)(area.getWidth() / 2) - (int)(tb.getWidth() / 2),
				(int)area.getY() + (int)(area.getHeight() / 2) + (int)(tb.getHeight() / 2));
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:51,代码来源:DataNodeLabel.java

示例8: drawArea

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
void drawArea(final GeneProduct gp, Rectangle area, Graphics2D g2d) {
	int nr = useSamples.size();
	java.awt.Shape origClip = g2d.getClip();
	g2d.clip(gp.getShape());
	double xf = area.x;
	double wf = (double)area.width / nr;
	for(int i = 0; i < nr; i++) 
	{
		Rectangle r = new Rectangle(
				(int)xf, area.y,
				(int)(xf + wf), area.height);
		xf += wf;
		ConfiguredSample s = useSamples.get(i);
		Xref idc = new Xref(gp.getPathwayElement().getElementID(), gp.getPathwayElement().getDataSource());
		CachedData cache = gexManager.getCachedData();
		if(cache == null) continue;

		if(s.getColorSet() == null) {
			Logger.log.trace("No colorset for sample " + s);
			continue; //No ColorSet for this sample
		}
		if(cache.hasData(idc))
		{
			List<? extends IRow> data = cache.getData(idc);
			if (data.size() > 0)
			{
				drawSample(s, data, r, g2d);
			}
			else
			{
				drawNoDataFound(s, area, g2d);
			}
		}
		else
		{
			drawWaitingForData(area, g2d);
			cache.asyncGet(idc, new Callback()
			{
				public void callback()
				{
					gp.markDirty();
				}
			});
		}
	}
	g2d.setClip(origClip);
	g2d.setColor(Color.BLACK);
	g2d.draw (gp.getShape());
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:50,代码来源:ColorByExpression.java

示例9: actionPerformed

import org.pathvisio.core.view.GeneProduct; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent arg0) {
	if (element instanceof GeneProduct) {
		PathwayElement orig = ((GeneProduct) element).getPathwayElement();
		PathwayElement elt = PathwayElement.createPathwayElement(ObjectType.LABEL);
		boolean convert = true;
		for (Object key : orig.getPropertyKeys()) {
			if (key.toString().equals("GENEID") && (!orig.getPropertyEx(key).equals(""))){
					int dialogButton = JOptionPane.YES_NO_OPTION;
					int dialogResult = JOptionPane.showConfirmDialog(null,
							"During the convertion, you will lose your identifier annotation.\n"
							+ "Are you sure you want to continue?",
							"Confirm",
							dialogButton);
					if(dialogResult!=0)
						convert = false;	
			}
			if (elt.getPropertyKeys().contains(key))
				elt.setPropertyEx(key, orig.getPropertyEx(key));
		}
		if (convert){
			VPathway vPathway = element.getDrawing();
			Pathway pwy = vPathway.getPathwayModel();

			elt.setGraphId(pwy.getUniqueGraphId());

			if(orig.getDataNodeType().equals(DataNodeType.PATHWAY.toString())) {
				elt.setColor(Color.BLACK);
				elt.setBold(false);
			} else if (orig.getDataNodeType().equals(DataNodeType.METABOLITE.toString())) {
				elt.setColor(Color.BLACK);
			} 

			elt.setShapeType(ShapeType.RECTANGLE);
			elt.setGraphId(pwy.getUniqueGraphId());

			vPathway.getUndoManager().newAction("Change element type");
			pwy.add(elt);
			for (GraphRefContainer r : pwy.getReferringObjects(orig.getGraphId())) {
				r.linkTo(elt, r.getRelX(), r.getRelY());
			}
			vPathway.removeDrawingObjects(Arrays.asList((VPathwayElement)element), true);
		}
	}
}
 
开发者ID:PathVisio,项目名称:org.pathvisio.typeconverter,代码行数:46,代码来源:DataNodeToLabel.java


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