@Deprecated public static NodeLabel configAnnotationLabel(NodeLabel annotationLabel, boolean isPeptide) { annotationLabel.setModel(NodeLabel.EIGHT_POS); if (isPeptide) { annotationLabel.setPosition(NodeLabel.N); } else { annotationLabel.setPosition(NodeLabel.NW); } annotationLabel.setTextColor(ANOTATION_COLOR); return annotationLabel; }
private Node createChemNode(String label, Graph2D graph) { Node chem = createNode(label, graph); NodeRealizer nodeRealizer = graph.getRealizer(chem); nodeRealizer.setTransparent(false); NodeLabel nl = nodeRealizer.getLabel(0); // nodeRealizer.setSize(_layoutMetrics.getChemNodeSize(), // _layoutMetrics.getChemNodeSize()); nodeRealizer.setSize(nl.getBox().getWidth() + 10, nl.getBox().getHeight()); nl.setFontSize(_layoutMetrics.getChemNodeFontSize()); nl.setFontStyle(Font.BOLD); nl.setModel(NodeLabel.INTERNAL); nl.setPosition(NodeLabel.CENTER); nl.setAlignment(NodeLabel.ALIGN_CENTER); nl.setTextColor(Color.BLACK); return chem; }
private Node createErrorNode(String label, Graph2D graph) { Node node = createNode(label, graph); NodeRealizer nodeRealizer = graph.getRealizer(node); nodeRealizer.setTransparent(true); nodeRealizer.setLineColor(Color.white); NodeLabel nl = nodeRealizer.getLabel(0); nl.setFontSize(_layoutMetrics.getLabelFontSize() + 15); nl.setFontStyle(Font.PLAIN); nl.setModel(NodeLabel.INTERNAL); nl.setPosition(NodeLabel.CENTER); nl.setAlignment(NodeLabel.ALIGN_LEFT); nl.setTextColor(Color.cyan); nodeRealizer.setSize(nl.getBox().getWidth(), nl.getBox().getHeight()); return node; }
/** * a dummy base node with no monomer attached to it * * @param monomerID * @return dummy nucleic acid base node graph */ public static Graph2D createDummyNucleicAcidBaseNode(String monomerID) { Graph2D graph = new Graph2D(); MonomerNodeRealizer baseNodeRealizer = new MonomerNodeRealizer(MonomerNodeRealizer.DIAMOND); graph.setDefaultNodeRealizer(baseNodeRealizer); final int size = 30; baseNodeRealizer.setSize(size, size); MonomerInfo monomerKeys = new MonomerInfo(Monomer.NUCLIEC_ACID_POLYMER_TYPE, monomerID); Node baseNode = graph.createNode(); Color fillColor = ColorMap.getNucleotidesColor("X"); baseNodeRealizer.setFillColor(fillColor); Color textColor = new Color(23 - fillColor.getRGB()); baseNodeRealizer.setLabelText(monomerID); baseNodeRealizer.getLabel().setTextColor(textColor); baseNodeRealizer.getLabel().setFontSize(14); graph.setRealizer(baseNode, baseNodeRealizer); NodeMap nodePropertiesNodeMap = graph.createNodeMap(); graph.addDataProvider(NodeMapKeys.MONOMER_REF, nodePropertiesNodeMap); nodePropertiesNodeMap.set(baseNode, monomerKeys); NodeLabel anotationLabel = new NodeLabel(""); anotationLabel.setModel(NodeLabel.FREE); anotationLabel.setFreeOffset( -baseNodeRealizer.getHeight() / 2, -baseNodeRealizer.getWidth() / 4); anotationLabel.setTextColor(ANOTATION_COLOR); anotationLabel.setFontSize(baseNodeRealizer.getLabel().getFontSize() + 2); baseNodeRealizer.addLabel(anotationLabel); return graph; }