本文整理匯總了Java中org.pathvisio.core.view.VPathwayElement類的典型用法代碼示例。如果您正苦於以下問題:Java VPathwayElement類的具體用法?Java VPathwayElement怎麽用?Java VPathwayElement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VPathwayElement類屬於org.pathvisio.core.view包,在下文中一共展示了VPathwayElement類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: selectionEvent
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public void selectionEvent(SelectionEvent e) {
switch (e.type) {
case SelectionEvent.OBJECT_ADDED:
// Just take the first DataNode in the selection
Iterator<VPathwayElement> it = e.selection.iterator();
while (it.hasNext()) {
VPathwayElement o = it.next();
// works for all Graphics object
// the backpage checks and gives the correct error if
// it's not a datanode or line
if (o instanceof Graphics) {
setInput(((Graphics) o).getPathwayElement());
break;
}
}
break;
case SelectionEvent.OBJECT_REMOVED:
if (e.selection.size() != 0)
break;
case SelectionEvent.SELECTION_CLEARED:
setInput(null);
break;
}
}
示例2: insert
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public void insert(PathwayElement newElt)
{
VPathwayElement velt = findElt (newElt, vpwy[PWY_NEW]);
//assert (velt != null || newElt.getObjectType () == ObjectType.INFOBOX);
if (velt == null)
{
Logger.log.warn (Utils.summary(newElt) + " doesn't have a corresponding view element");
}
else
{
velt.highlight (Color.GREEN);
Map <String, String> hint = new HashMap<String, String>();
hint.put ("element", "Element added");
Rectangle2D r = velt.getVBounds();
ModData mod = new ModData (
0,
0,
(int)vpwy[PWY_NEW].mFromV(r.getX() + r.getWidth() / 2),
(int)vpwy[PWY_NEW].mFromV(r.getY() + r.getHeight() / 2),
hint, ModData.ModType.ADDED);
modifications.add (mod);
modsByElt.put (velt, mod);
}
}
示例3: delete
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public void delete(PathwayElement oldElt)
{
VPathwayElement velt = findElt (oldElt, vpwy[PWY_OLD]);
//assert (velt != null || oldElt.getObjectType () == ObjectType.INFOBOX);
if (velt == null)
{
Logger.log.warn (Utils.summary(oldElt) + " doesn't have a corresponding view element");
}
else
{
velt.highlight (Color.RED);
Map <String, String> hint = new HashMap<String, String>();
hint.put ("element", "Element removed");
Rectangle2D r = velt.getVBounds();
ModData mod = new ModData (
(int)vpwy[PWY_NEW].mFromV(r.getX() + r.getWidth() / 2),
(int)vpwy[PWY_NEW].mFromV(r.getY() + r.getHeight() / 2),
0,
0,
hint, ModData.ModType.REMOVED);
modifications.add (mod);
modsByElt.put (velt, mod);
}
}
示例4: findElt
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
/**
helper to find a VPathwayElt that corresponds to a certain PathwayElement
*/
private VPathwayElement findElt (PathwayElement target, VPathway vpwy)
{
for (VPathwayElement velt : vpwy.getDrawingObjects())
{
if (velt instanceof Graphics)
{
Graphics g = (Graphics)velt;
if (g.getPathwayElement() == target)
{
return velt;
}
}
}
return null;
}
示例5: modifyEnd
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public void modifyEnd ()
{
VPathwayElement veltOld = findElt (curOldElt, vpwy[PWY_OLD]);
assert (veltOld != null);
veltOld.highlight (Color.YELLOW);
Rectangle2D r1 = veltOld.getVBounds();
VPathwayElement veltNew = findElt (curNewElt, vpwy[PWY_NEW]);
assert (veltNew != null);
veltNew.highlight (Color.YELLOW);
Rectangle2D r2 = veltNew.getVBounds();
ModData mod = new ModData (
(int)vpwy[PWY_OLD].mFromV(r1.getX() + r1.getWidth() / 2),
(int)vpwy[PWY_OLD].mFromV(r1.getY() + r1.getHeight() / 2),
(int)vpwy[PWY_NEW].mFromV(r2.getX() + r2.getWidth() / 2),
(int)vpwy[PWY_NEW].mFromV(r2.getY() + r2.getHeight() / 2),
curHint, ModData.ModType.CHANGED);
modifications.add (mod);
modsByElt.put (veltOld, mod);
modsByElt.put (veltNew, mod);
curOldElt = null;
curNewElt = null;
}
示例6: vPathwayEvent
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public void vPathwayEvent(VPathwayEvent e) {
if(e.getType() == VPathwayEventType.ELEMENT_DRAWN) {
VPathwayElement vpwe = e.getAffectedElement();
if(vpwe instanceof Graphics) {
PathwayElement pwe = ((Graphics)vpwe).getPathwayElement();
List<Color> elmColors = colors.get(pwe);
if(elmColors != null && elmColors.size() > 0) {
Logger.log.info("Coloring " + pwe + " with " + elmColors);
switch(pwe.getObjectType()) {
case DATANODE:
doColor(e.getGraphics2D(), (Graphics)vpwe, elmColors);
drawLabel(e.getGraphics2D(), (Graphics)vpwe);
break;
case GROUP:
doColor(e.getGraphics2D(), (Graphics)vpwe, elmColors);
break;
}
}
}
}
}
示例7: PathwayToolTip
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public PathwayToolTip(List<VPathwayElement> elements) {
applyToolTipStyle(this);
setLayout(new BorderLayout());
DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout("pref"));
for(ToolTipProvider p : toolTipProviders) {
Component c = p.createToolTipComponent(this, elements);
if(c != null) {
hasContent = true;
builder.append(c);
builder.nextLine();
}
}
JPanel contents = builder.getPanel();
applyToolTipStyle(contents);
JScrollPane scroll = new JScrollPane(contents, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
int w = contents.getPreferredSize().width +
scroll.getVerticalScrollBar().getPreferredSize().width + 5;
int h = contents.getPreferredSize().height +
scroll.getHorizontalScrollBar().getPreferredSize().height + 5;
w = Math.min(400, w);
h = Math.min(500, h);
setPreferredSize(new Dimension(w, h));
add(scroll, BorderLayout.CENTER);
}
示例8: PathwayElementDialogAction
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public PathwayElementDialogAction(SwingEngine swingEngine, Component parent, VPathwayElement e) {
super();
this.parent = parent;
this.swingEngine = swingEngine;
element = e;
//If the element is an empty selectionbox,
//the an empty space on the drawing is clicked
//Set element to mappinfo so the pathway properties
//will show up
if(element instanceof SelectionBox) {
SelectionBox s = (SelectionBox)element;
if(s.getSelection().size() == 0) {
element = element.getDrawing().getMappInfo();
}
}
//If handle, select parent
if (element instanceof Handle)
{
element = ((Handle)element).getParent();
}
}
示例9: selectionEvent
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public void selectionEvent(SelectionEvent e) {
switch(e.type) {
case SelectionEvent.OBJECT_ADDED:
//Just take the first DataNode in the selection
Iterator<VPathwayElement> it = e.selection.iterator();
while(it.hasNext()) {
VPathwayElement o = it.next();
// works for all Graphics object
// the backpage checks and gives the correct error if
// it's not a datanode or line
if(o instanceof Graphics) {
setInput(((Graphics)o).getPathwayElement());
break;
}
}
break;
case SelectionEvent.OBJECT_REMOVED:
if(e.selection.size() != 0) break;
case SelectionEvent.SELECTION_CLEARED:
setInput(null);
break;
}
}
示例10: vPathwayEvent
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
public void vPathwayEvent(VPathwayEvent e) {
if(e.getType() == VPathwayEventType.ELEMENT_DRAWN) {
Visualization v = getActiveVisualization();
VPathwayElement elm = e.getAffectedElement();
if(v != null && elm instanceof Graphics) {
v.visualizeDrawing((Graphics)elm, e.getGraphics2D());
}
}
}
示例11: highlightResults
import org.pathvisio.core.view.VPathwayElement; //導入依賴的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());
}
示例12: doHighlight
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
/**
* Highlight all object but DataNodes and Groups. Only the first color
* from the hashmap will be used.
*/
private void doHighlight() {
for(VPathwayElement vpe : vPathway.getDrawingObjects()) {
if(vpe instanceof Graphics) {
PathwayElement pwe = ((Graphics)vpe).getPathwayElement();
List<Color> elmColors = colors.get(pwe);
if(elmColors != null && elmColors.size() > 0) {
ObjectType ot = pwe.getObjectType();
if(ot != ObjectType.DATANODE && ot != ObjectType.GROUP) {
vpe.highlight(elmColors.get(0));
}
}
}
}
}
示例13: actionPerformed
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent arg0) {
if (element instanceof Line) {
PathwayElement orig = element.getPathwayElement();
PathwayElement elt = null;
if(lineType.equals(ObjectType.GRAPHLINE)) {
elt = PathwayElement.createPathwayElement(ObjectType.GRAPHLINE);
} else if(lineType.equals(ObjectType.LINE)) {
elt = PathwayElement.createPathwayElement(ObjectType.LINE);
}
if(elt != null) {
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.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);
}
}
}
示例14: actionPerformed
import org.pathvisio.core.view.VPathwayElement; //導入依賴的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);
}
}
示例15: actionPerformed
import org.pathvisio.core.view.VPathwayElement; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent arg0) {
if (element instanceof Label) {
PathwayElement orig = ((Label) 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);
}
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);
}
}