21import java.awt.BorderLayout;
22import java.awt.CardLayout;
23import java.awt.Dimension;
24import java.beans.PropertyChangeEvent;
25import java.beans.PropertyChangeListener;
26import java.beans.PropertyChangeListenerProxy;
27import java.util.ArrayList;
28import java.util.logging.Logger;
30import javax.swing.JLabel;
31import javax.swing.JPanel;
32import javax.swing.JSplitPane;
34import org.openscience.cdk.interfaces.IAtomContainer;
35import org.openscience.cdk.interfaces.IChemObjectBuilder;
36import org.openscience.cdk.silent.SilentChemObjectBuilder;
38import denoptim.graph.AttachmentPoint;
39import denoptim.graph.DGraph;
40import denoptim.graph.EmptyVertex;
41import denoptim.graph.Fragment;
42import denoptim.graph.Template;
43import denoptim.graph.Vertex;
44import denoptim.gui.GraphViewerPanel.JVertex;
45import denoptim.gui.GraphViewerPanel.JVertexType;
46import denoptim.gui.GraphViewerPanel.LabelType;
47import denoptim.molecularmodeling.ThreeDimTreeBuilder;
48import denoptim.utils.MoleculeUtils;
49import edu.uci.ics.jung.visualization.control.ModalGraphMouse;
109 private static final IChemObjectBuilder
builder =
110 SilentChemObjectBuilder.getInstance();
129 setOrientation(JSplitPane.HORIZONTAL_SPLIT);
130 setOneTouchExpandable(
true);
134 setResizeWeight(0.5);
138 leftPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
139 leftPane.setOneTouchExpandable(
true);
146 new PropertyChangeListenerProxy(
150 new PropertyChangeListenerProxy(
157 String fragViewerToolTip =
"<html>This viewer shows the "
158 +
"content of the selected vertex.<br>"
159 +
"Click on a node to select it and display its "
160 +
"content here.</html>";
168 String txt =
"<html><body width='%1s'><center>No chosen node.</center>"
175 String txtn =
"<html><body width='%1s'><center>Content not visualizable"
176 +
"</center></html>";
182 String txtb =
"<html><body width='%1s'><center>To inspect the content "
183 +
"of nodes, please load a space of building blocks, "
184 +
"and re-open this tab.</center></html>";
202 String molViewerToolTip =
"<html>This viewer shows the chemical "
203 +
"structure associated with the current graph.</html>";
211 String txt2 =
"<html><body width='%1s'><center>No chemical "
212 +
"structure.</center>"
219 String txt2b =
"<html><body width='%1s'><center>Save changes to "
220 +
"update the molecular representation.</center>"
252 }
catch (Exception e) {
254 System.out.println(
"Could not read molecular data: "+
255 e.getCause() +
" " + e.getMessage());
322 IAtomContainer mol =
builder.newAtomContainer();
334 }
catch (Throwable t) {
336 System.out.println(
"Couldn't make 3D-tree representation: "
340 if (mol.getAtomCount() > 0)
345 }
catch (Exception e) {
347 System.out.println(
"Could not read molecular data: "+
348 e.getCause() +
" " + e.getMessage());
441 if (evt.getNewValue() ==
null)
466 }
else if (bb instanceof
Template) {
476 Dimension d =
new Dimension();
495 System.out.println(
"WARNING: Visualization of "
496 +
"EmptyVertex is not implemented yet");
517 switch ((Integer)evt.getNewValue())
528 System.out.println(
"WARNING: invalid mouse mode request!");
576 ArrayList<AttachmentPoint> aps =
577 new ArrayList<AttachmentPoint>();
596 ArrayList<Vertex> selected =
new ArrayList<Vertex>();
603 selected.add(jv.dnpVertex);
Container for the list of vertices and the edges that connect them.
Vertex getVertexAtPosition(int pos)
Returns the vertex that is in the given position of the list of vertices belonging to this graph.
boolean containsAtoms()
Returns true if this graph has any vertex that contains atoms.
An empty vertex has the behaviors of a vertex, but has no molecular structure.
Class representing a continuously connected portion of chemical object holding attachment points.
IAtomContainer getIAtomContainer()
The molecular representation, if any, is generated by this method and stored until further changes in...
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
abstract Vertex clone()
Returns a deep-copy of this vertex.
A panel with a molecular viewer and attachment point table.
void clearAll(boolean dataIsComing)
Removes the currently visualized molecule and AP table.
void loadFragmentToViewer(Fragment frag)
Loads the given fragments to this viewer.
Graphical User Interface of the DENOPTIM package.
static final Randomizer PRNG
Random number generator specific for the GUI, and any of its tasks.
static final String GUILOGGER
Name of logger for the GUI.
Listener for identifying the node on which the user has clicked and load the corresponding fragment i...
void propertyChange(PropertyChangeEvent evt)
Listener for identifying the node on which the user has clicked and load the corresponding fragment i...
void propertyChange(PropertyChangeEvent evt)
A panel that collects three viewers:
void bringCardToTopOfVertexViewer(String cardName)
Allows to show the given card in the vertex viewer panel.
static final long serialVersionUID
Version UID.
final String NOFSCARDNAME
JPanel molViewerNeedUpdateCard
final String UPDATETOVIEW
JPanel fragViewerNoFSCard
JPanel fragViewerNotDuableCard
void removeNestedGraphViewer()
JUNGGraphSnapshot oldGSStatus
The snapshot of the old (removed) visualized GraphStrem system.
JPanel molViewerCardHolder
DGraph dnGraph
The unsaved version of the currently loaded graph.
ArrayList< AttachmentPoint > getAPsSelectedInViewer()
Identifies which attachment points are selected in the graph viewer.
final String MOLVIEWERCARDNAME
FragmentViewPanel fragViewer
void clearMolecularViewer()
Clears the molecular viewer and hides it behind the empty card.
JPanel molViewerEmptyCard
void visualizeVertexInNestedViewer(Vertex v)
Makes a clone of the given vertex and loads that clone into the nested visualization frame.
void setMouseMode(ModalGraphMouse.Mode mode)
Alters the functionality of mouse in the graph visualization panel.
final String EMPTYCARDNAME
ArrayList< Vertex > getSelectedNodesInViewer()
Identifies which vertices are selected in the graph viewer.
void bringCardToTopOfMolViewer(String cardName)
Allows to show the given card in the molecular structure viewer.
GraphViewerPanel graphViewer
void initialize()
Initialize the panel and add buttons.
GraphVertexMolViewerPanel fragViewerTmplViewerCard
void moveDividerLocation()
Moved the divider to the location configured by some content-based reasoning.
JPanel fragViewerEmptyCard
final String TMPLVIEWERCARDNAME
void clearCurrentSystem()
Clears the current graph viewer but keeps track of the latest graph loaded.
void clearVertexViewer()
Clears the molecular viewer and hides it behind the empty card.
void renderMolVieverToNeedUpdate()
Triggers the generation of the molecular representation of the loaded graph.
MoleculeViewPanel molViewer
void loadDnGraphToViewer(DGraph dnGraph, boolean keepLabels)
Loads the given graph into the graph viewer.
boolean hasSelectedNodes()
void resetFragViewerCardDeck()
Changes the appearance of the vertex visualisation panel to an empty card that is consistent with the...
GraphVertexMolViewerPanel()
Constructor.
void loadDnGraphToViewer(DGraph dnGraph, IAtomContainer mol, boolean keepSprites)
Loads the given graph into the graph viewer.
void alterLabels(LabelType labelName, boolean show)
Adds/Removes labels to the graph components that are presently selected.
static final IChemObjectBuilder builder
JPanel fragViewerCardHolder
final String NOTDUABLECARDNAME
final String FRAGVIEWERCARDNAME
IAtomContainer updateMolevularViewer()
Updates the molecular representation of the loaded graph.
a vertex in the JUNG Graph.
Vertex dnpVertex
The reference to the corresponding Vertex or null.
A Panel that holds the JUNG representation of a graph.
void loadGraphToViewer(DGraph dnGraph)
Load the given DGraph to this graph viewer.
JUNGGraphSnapshot getGraphStatusSnapshot()
Returns a copy of the graph loaded into the viewer.
void cleanup()
Removes the currently loaded graph viewer.
Set< JVertex > getSelectedNodes()
Finds selected nodes from the viewer.
void setMouseMode(ModalGraphMouse.Mode mode)
static final String PROPERTYMOUSEMODE
static final String PROPERTYNODECLICKED
void alterLabels(LabelType labelType, boolean show)
Adds or removes labels from the elements selected in the graph view.
boolean hasSelected()
Check is there is any node selected in the viewer.
This class collects information on how a graph was displayed in a JUNG visialisation server (i....
A panel with a molecular viewer and data table.
void enablePartialData(boolean enable)
Sets the behavior in case of request to visualize partial data.
void clearAll(boolean dataIsComing)
Removes the currently visualized molecule and AP table.
void loadChemicalStructure(IAtomContainer mol)
Loads a structure in the Jmol viewer.
Tool to build build three-dimensional (3D) tree-like molecular structures from DGraph.
IAtomContainer convertGraphTo3DAtomContainer(DGraph graph)
Created a three-dimensional molecular representation from a given DGraph.
Utilities for molecule conversion.
static void removeUsedRCA(IAtomContainer mol, DGraph graph, Logger logger)
Replace used RCAs (i.e., those involved in Rings) while adding the ring closing bonds.