22import java.awt.Dimension;
23import java.util.ArrayList;
24import java.util.HashMap;
28import javax.swing.JScrollPane;
29import javax.swing.JSplitPane;
30import javax.swing.JTable;
31import javax.swing.event.TableModelEvent;
32import javax.swing.event.TableModelListener;
33import javax.swing.table.DefaultTableModel;
34import javax.swing.table.JTableHeader;
36import denoptim.exception.DENOPTIMException;
37import denoptim.graph.AttachmentPoint;
38import denoptim.graph.DGraph;
39import denoptim.graph.EmptyVertex;
40import denoptim.graph.Fragment;
41import denoptim.graph.Template;
42import denoptim.graph.Vertex;
67 protected Map<Integer,AttachmentPoint>
mapAPs =
null;
94 this(editableTable,340);
115 @SuppressWarnings(
"serial")
118 this.setOrientation(JSplitPane.VERTICAL_SPLIT);
119 this.setOneTouchExpandable(
true);
120 this.setDividerLocation(dividerPosition);
121 this.setResizeWeight(0.5);
130 public boolean isCellEditable(
int row,
int column) {
142 String column_names[]= {
"<html><b>AP#</b></html>",
143 "<html><b>APClass</b></html>"};
144 apTabModel.setColumnIdentifiers(column_names);
146 apTable.putClientProperty(
"terminateEditOnFocusLost",
true);
147 apTable.getColumnModel().getColumn(0).setMaxWidth(75);
148 apTable.setGridColor(Color.LIGHT_GRAY);
149 apTable.setPreferredScrollableViewportSize(
apTable.getPreferredSize());
150 JTableHeader apTabHeader =
apTable.getTableHeader();
151 apTabHeader.setPreferredSize(
new Dimension(100, 20));
235 mapAPs =
new HashMap<Integer,AttachmentPoint>();
238 if (lstAPs.size() == 0)
248 apTabModel.addRow(
new Object[]{arrId, ap.getAPClass()});
267 String[] parts =prop.split(PRESELPROPSEP);
270 for (
int i=0; i<parts.length; i++)
272 int apId = Integer.parseInt(parts[i]);
273 apTable.getSelectionModel().addSelectionInterval(apId, apId);
297 for (
int i=0; i<initRowCount; i++)
313 ArrayList<AttachmentPoint> selected =
314 new ArrayList<AttachmentPoint>();
316 for (
int rowId :
apTable.getSelectedRows())
331 ArrayList<Integer> selected =
new ArrayList<Integer>();
332 for (
int rowId :
apTable.getSelectedRows())
352 && e.getType() == TableModelEvent.UPDATE)
379 }
catch (Throwable t) {
381 System.out.println(
"Bad attempt to contro listener: "
383 System.out.println(t.getCause());
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
Container for the list of vertices and the edges that connect them.
void addVertex(Vertex vertex)
Appends a vertex to this graph without creating any edge.
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.
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.
abstract List< AttachmentPoint > getAttachmentPoints()
Object getProperty(Object property)
A modal dialog with a viewer that understands the different types of DENOPTIM vertex and allows to se...
static final String PRESELECTEDAPSFIELD
Property used to pre-select APs.
static final String PRESELECTEDAPSFIELDSEP
Separator in property used to pre-select APs.
A Panel that holds the JUNG representation of a graph.
void loadGraphToViewer(DGraph dnGraph)
Load the given DGraph to this graph viewer.
void cleanup()
Removes the currently loaded graph viewer.
void setActive(boolean var)
void tableChanged(TableModelEvent e)
PausableTableModelListener()
A panel to visualize a vertex as a graph component with attachment point table.
static final long serialVersionUID
Version UID.
VertexAsGraphViewPanel(boolean editableTable)
Constructor that allows to specify whether the AP table is editable or not.
boolean alteredAPData
Flag signalling that data about APs has been changed in the GUI.
ArrayList< AttachmentPoint > getSelectedAPs()
Identifies which attachment points are selected in the visualized table.
void setVertexSpecificEditableAPTable(boolean editable)
DefaultTableModel apTabModel
void loadVertexToViewer(Vertex v)
DefaultTableModel getAPTableModel()
GraphViewerPanel graphViewer
void deprotectEdits()
Overrides the flag signaling unsaved edits to saying that there are no altered data.
ArrayList< Integer > getSelectedAPIDs()
Identifies which attachment points are selected in the visualized table.
void activateTabEditsListener(boolean var)
Allows to activate and deactivate the listener.
Map< Integer, AttachmentPoint > getMapOfAPsInTable()
Vertex vertex
The currently loaded fragment.
boolean vertexSpecificAPTabEditable
void clearAll()
Removes the currently visualized molecule and AP table.
VertexAsGraphViewPanel(boolean editableTable, int dividerPosition)
Constructor that allows to specify whether the AP table is editable or not.
void loadVertexStructure()
Map< Integer, AttachmentPoint > mapAPs
Temporary list of attachment points of the current fragment.
void updateAPsMapAndTable()
Uses the AP of the Fragment to create a new map and table of APs.
boolean hasUnsavedAPEdits()
Check for unsaved edits to the AP data.
void clearAPTable()
Clears the table of attachment points.
void initialize(int dividerPosition)
Interface for all vertex viewers that intend to allow selection of attachment points.
final String APDATACHANGEEVENT