mirror of
https://github.com/Wisser/Jailer.git
synced 2026-05-24 11:39:31 -05:00
PathFinder improvements
This commit is contained in:
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
@@ -198,29 +198,41 @@ public abstract class ClosureView extends javax.swing.JDialog {
|
||||
source = getDataModel().getTableByDisplayName((String) currentSelection);
|
||||
}
|
||||
final javax.swing.JComboBox comboBox = findPathComboBox;
|
||||
JButton stFindButtonButton = StringSearchPanel.createSearchButton(extractionModelEditor.extractionModelFrame, comboBox, "Select destination or choose from History", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
findPathButtonActionPerformed(null);
|
||||
}
|
||||
}, null, null, null, true, new AdditionalComponentFactory() {
|
||||
@Override
|
||||
public JComponent create(final StringSearchPanel searchPanel) {
|
||||
HistoryPanel historyPanel = new HistoryPanel(ClosureView.this.getSelectedTable(), getDataModel()) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void close() {
|
||||
searchPanel.close();
|
||||
JButton stFindButtonButton = StringSearchPanel.createSearchButton(extractionModelEditor.extractionModelFrame, comboBox,
|
||||
new Object() {
|
||||
public String toString() {
|
||||
Table source = null;
|
||||
Object currentSelection = ClosureView.this.rootTable.getSelectedItem();
|
||||
if (currentSelection instanceof String) {
|
||||
source = getDataModel().getTableByDisplayName((String) currentSelection);
|
||||
}
|
||||
@Override
|
||||
protected void apply(Table source, Table destination) {
|
||||
findPath(source, destination, true);
|
||||
}
|
||||
};
|
||||
return historyPanel;
|
||||
}
|
||||
});
|
||||
return (source != null? ("From " + getDataModel().getDisplayName(source) + " - ") : "") + "Select destination or choose from History";
|
||||
}
|
||||
},
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
findPathButtonActionPerformed(null);
|
||||
}
|
||||
}, null, null, null, true,
|
||||
new AdditionalComponentFactory() {
|
||||
@Override
|
||||
public JComponent create(final StringSearchPanel searchPanel) {
|
||||
HistoryPanel historyPanel = new HistoryPanel(ClosureView.this.getSelectedTable(), getDataModel()) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void close() {
|
||||
searchPanel.close();
|
||||
}
|
||||
@Override
|
||||
protected void apply(Table source, Table destination) {
|
||||
findPath(source, destination, true);
|
||||
}
|
||||
};
|
||||
return historyPanel;
|
||||
}
|
||||
});
|
||||
tablePanel.add(stFindButtonButton, gridBagConstraints);
|
||||
|
||||
findPathComboBox.setVisible(false);
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.awt.Frame;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Point;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
@@ -91,23 +90,23 @@ public class StringSearchPanel extends javax.swing.JPanel {
|
||||
JComponent create(StringSearchPanel searchPanel);
|
||||
}
|
||||
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final String titel, final Runnable onSuccess) {
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final Object titel, final Runnable onSuccess) {
|
||||
return createSearchButton(owner, comboBox, titel, onSuccess, false);
|
||||
}
|
||||
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final String titel, final Runnable onSuccess, boolean alternativeIcon) {
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final Object titel, final Runnable onSuccess, boolean alternativeIcon) {
|
||||
return createSearchButton(owner, comboBox, titel, onSuccess, null, alternativeIcon);
|
||||
}
|
||||
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final String titel, final Runnable onSuccess, final Prepare prepare, boolean alternativeIcon) {
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final Object titel, final Runnable onSuccess, final Prepare prepare, boolean alternativeIcon) {
|
||||
return createSearchButton(owner, comboBox, titel, onSuccess, null, null, null, alternativeIcon, null);
|
||||
}
|
||||
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final String titel, final Runnable onSuccess, final Prepare prepare, final MetaDataSource metaDataSource, final DataModel dataModel) {
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final Object titel, final Runnable onSuccess, final Prepare prepare, final MetaDataSource metaDataSource, final DataModel dataModel) {
|
||||
return createSearchButton(owner, comboBox, titel, onSuccess, prepare, metaDataSource, dataModel, false, null);
|
||||
}
|
||||
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final String titel, final Runnable onSuccess, final Prepare prepare, final MetaDataSource metaDataSource, final DataModel dataModel, boolean alternativeIcon, final AdditionalComponentFactory additionalComponentFactory) {
|
||||
public static JButton createSearchButton(final Frame owner, final javax.swing.JComboBox comboBox, final Object titel, final Runnable onSuccess, final Prepare prepare, final MetaDataSource metaDataSource, final DataModel dataModel, boolean alternativeIcon, final AdditionalComponentFactory additionalComponentFactory) {
|
||||
final JButton button = new JButton();
|
||||
button.setIcon(UIUtil.scaleIcon(button, alternativeIcon? icon2 : icon));
|
||||
button.setToolTipText("Find Table");
|
||||
@@ -170,8 +169,8 @@ public class StringSearchPanel extends javax.swing.JPanel {
|
||||
button.setEnabled(comboBox.getModel().getSize() > 1 || comboBox.getModel().getSize() == 1 && !"".equals(comboBox.getModel().getElementAt(0)));
|
||||
}
|
||||
|
||||
public String find(Frame owner, String titel, int x, int y) {
|
||||
dialog = new EscapableDialog(owner, titel, true) {
|
||||
public String find(Frame owner, Object titel, int x, int y) {
|
||||
dialog = new EscapableDialog(owner, String.valueOf(titel), true) {
|
||||
};
|
||||
dialog.getContentPane().add(this);
|
||||
dialog.pack();
|
||||
|
||||
@@ -4984,7 +4984,7 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void navigateTo(Association association, int rowIndex, Row row);
|
||||
protected abstract RowBrowser navigateTo(Association association, int rowIndex, Row row);
|
||||
|
||||
protected abstract void onContentChange(List<Row> rows, boolean reloadChildren);
|
||||
|
||||
|
||||
@@ -252,35 +252,24 @@ public abstract class DBClosureView extends javax.swing.JDialog {
|
||||
openPathFinder(table, false);
|
||||
}
|
||||
});
|
||||
|
||||
JMenuItem openPath = new JMenuItem("Open path to " + getDataModel().getDisplayName(table));
|
||||
if (rt == null || !rt.closure(false).contains(table)) {
|
||||
openPath.setEnabled(false);
|
||||
}
|
||||
openPath.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
expandPath();
|
||||
DBClosureView.this.select(selectedTable);
|
||||
}
|
||||
});
|
||||
|
||||
RowBrowser rb = getVisibleTables().get(table);
|
||||
if (rb == null) {
|
||||
if (!mainPath.isEmpty()) {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
JMenuItem open = new JMenuItem("Open path to " + getDataModel().getDisplayName(table));
|
||||
if (rt == null || !rt.closure(false).contains(table)) {
|
||||
open.setEnabled(false);
|
||||
}
|
||||
open.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
expandPath();
|
||||
DBClosureView.this.select(selectedTable);
|
||||
}
|
||||
});
|
||||
menu.add(open);
|
||||
// JMenuItem openAndSelect = new JMenuItem("Open path to and select " + selectedTable);
|
||||
// openAndSelect.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// expandPath();
|
||||
// DBClosureView.this.select(selectedTable);
|
||||
// }
|
||||
// });
|
||||
// menu.add(openAndSelect);
|
||||
// menu.add(new JSeparator());
|
||||
// menu.add(exclude);
|
||||
// menu.add(excludeAll);
|
||||
// menu.add(deselect);
|
||||
menu.add(openPath);
|
||||
menu.add(new JSeparator());
|
||||
menu.add(pathFinder);
|
||||
UIUtil.showPopup(e.getComponent(), e.getX(), e.getY(), menu);
|
||||
@@ -312,6 +301,7 @@ public abstract class DBClosureView extends javax.swing.JDialog {
|
||||
// menu.addSeparator();
|
||||
// menu.add(deselect);
|
||||
menu.addSeparator();
|
||||
menu.add(openPath);
|
||||
menu.add(pathFinder);
|
||||
}
|
||||
UIUtil.showPopup(e.getComponent(), e.getX(), e.getY(), menu);
|
||||
@@ -480,18 +470,26 @@ public abstract class DBClosureView extends javax.swing.JDialog {
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 2;
|
||||
gridBagConstraints.gridy = 20;
|
||||
JButton stFindPathButton = StringSearchPanel.createSearchButton(this.parent, findPathComboBox, "Select destination or choose from History", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Object toFind = findPathComboBox.getSelectedItem();
|
||||
if (toFind != null) {
|
||||
CellInfo cellInfo = DBClosureView.this.cellInfo.get(toFind);
|
||||
if (cellInfo != null) {
|
||||
tableMouseListener.openPathFinder(cellInfo.table, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, null, null, null, true, new AdditionalComponentFactory() {
|
||||
JButton stFindPathButton = StringSearchPanel.createSearchButton(
|
||||
this.parent, findPathComboBox,
|
||||
new Object() {
|
||||
public String toString() {
|
||||
Table rootTable = getRootTable();
|
||||
return (rootTable != null? ("From " + getDataModel().getDisplayName(rootTable) + " - ") : "") + "Select destination or choose from History";
|
||||
}
|
||||
},
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Object toFind = findPathComboBox.getSelectedItem();
|
||||
if (toFind != null) {
|
||||
CellInfo cellInfo = DBClosureView.this.cellInfo.get(toFind);
|
||||
if (cellInfo != null) {
|
||||
tableMouseListener.openPathFinder(cellInfo.table, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, null, null, null, true, new AdditionalComponentFactory() {
|
||||
@Override
|
||||
public JComponent create(final StringSearchPanel searchPanel) {
|
||||
HistoryPanel historyPanel = new HistoryPanel(getRootTable(), getDataModel()) {
|
||||
|
||||
@@ -3126,12 +3126,18 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
desktop.getiFrameStateChangeRenderer().startAtomic();
|
||||
disableBorderBrowserUpdates = true;
|
||||
suppressUpdateClosureBrowser = true;
|
||||
RowBrowser nextRb = null;
|
||||
while (i > 0) {
|
||||
Table table = path.get(i);
|
||||
RowBrowser rb = getVisibleTables().get(table);
|
||||
RowBrowser rb;
|
||||
if (nextRb != null && nextRb.association != null && nextRb.association.destination.equals(table)) {
|
||||
rb = nextRb;
|
||||
} else {
|
||||
rb = getVisibleTables().get(table);
|
||||
}
|
||||
Association association = associations[i - 1];
|
||||
if (association != null) {
|
||||
rb.browserContentPane.navigateTo(association, -1, null);
|
||||
nextRb = rb.browserContentPane.navigateTo(association, -1, null);
|
||||
visibleTables = null;
|
||||
} else {
|
||||
break;
|
||||
|
||||
@@ -638,8 +638,8 @@ public abstract class Desktop extends JDesktopPane {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void navigateTo(Association association, int rowIndex, Row row) {
|
||||
addTableBrowser(tableBrowser, tableBrowser, rowIndex, association.destination, association, "", null, true);
|
||||
protected RowBrowser navigateTo(Association association, int rowIndex, Row row) {
|
||||
return addTableBrowser(tableBrowser, tableBrowser, rowIndex, association.destination, association, "", null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -262,7 +262,8 @@ public abstract class MetaDataDetailsPanel extends javax.swing.JPanel {
|
||||
protected void onContentChange(List<Row> rows, boolean reloadChildren) {
|
||||
}
|
||||
@Override
|
||||
protected void navigateTo(Association association, int rowIndex, Row row) {
|
||||
protected RowBrowser navigateTo(Association association, int rowIndex, Row row) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected List<RowBrowser> getTableBrowser() {
|
||||
|
||||
@@ -174,7 +174,8 @@ public class ResultSetRenderer extends javax.swing.JPanel {
|
||||
protected void onContentChange(List<Row> rows, boolean reloadChildren) {
|
||||
}
|
||||
@Override
|
||||
protected void navigateTo(Association association, int rowIndex, Row row) {
|
||||
protected RowBrowser navigateTo(Association association, int rowIndex, Row row) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected List<RowBrowser> getTableBrowser() {
|
||||
|
||||
@@ -1645,7 +1645,8 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
protected void onContentChange(List<Row> rows, boolean reloadChildren) {
|
||||
}
|
||||
@Override
|
||||
protected void navigateTo(Association association, int rowIndex, Row row) {
|
||||
protected RowBrowser navigateTo(Association association, int rowIndex, Row row) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected List<RowBrowser> getTableBrowser() {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="1" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
|
||||
<GridBagConstraints gridX="0" gridY="1" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
@@ -112,7 +112,20 @@
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="2" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
<GridBagConstraints gridX="0" gridY="2" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="80" green="80" id="gray" palette="1" red="80" type="palette"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Open context menu (right mouse click on table) to define its direct successor."/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="2" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
|
||||
@@ -25,11 +25,14 @@ import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Shape;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.io.File;
|
||||
@@ -52,6 +55,7 @@ import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.DefaultCellEditor;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
@@ -68,6 +72,8 @@ import javax.swing.RowSorter.SortKey;
|
||||
import javax.swing.SortOrder;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
@@ -232,13 +238,40 @@ public abstract class PathFinderView extends javax.swing.JPanel {
|
||||
g2d.setStroke(stroke);
|
||||
|
||||
Path2D.Double path = new Path2D.Double();
|
||||
double border = 0.25;
|
||||
double border = 0.4;
|
||||
double f = (1.0 - 2.0 * border) / 20;
|
||||
int midX = (int) (start.getX() + ((end.getX() - start.getX()) * (border + f)));
|
||||
f = 0.25 * f * (end.getY() - start.getY());
|
||||
path.moveTo(end.getX(), end.getY());
|
||||
path.curveTo(midX, end.getY(), midX, start.getY() + f, start.getX(), start.getY());
|
||||
g2d.draw(path);
|
||||
|
||||
Polygon arrowHead = new Polygon();
|
||||
double ws = 0.4;
|
||||
double hs = 2.0 / 3.0;
|
||||
double w = 3, h = w;
|
||||
arrowHead.addPoint(0, 0);
|
||||
arrowHead.addPoint((int) (ws * -w), (int) (hs * (-h)));
|
||||
// m_arrowHead.addPoint(0, (int) (hs * (-2 * h)));
|
||||
arrowHead.addPoint((int) (ws * w), (int) (hs * (-h)));
|
||||
arrowHead.addPoint(0, 0);
|
||||
|
||||
AffineTransform at = getArrowTrans(new Point2D.Double(midX, start.getY()), new Point2D.Double(start.getX() + 4, start.getY()), 6);
|
||||
Shape m_curArrow = at.createTransformedShape(arrowHead);
|
||||
|
||||
g2d.fill(m_curArrow);
|
||||
g2d.draw(m_curArrow);
|
||||
}
|
||||
protected AffineTransform getArrowTrans(Point2D p1, Point2D p2, double width) {
|
||||
AffineTransform m_arrowTrans = new AffineTransform();
|
||||
int o = 1;
|
||||
m_arrowTrans.setToTranslation(p2.getX() + o, p2.getY());
|
||||
m_arrowTrans.rotate(-Math.PI / 2.0 + Math.atan2(p2.getY() - p1.getY(), p2.getX() + o - p1.getX()));
|
||||
if (width > 1) {
|
||||
double scalar = width / 2;
|
||||
m_arrowTrans.scale(scalar, scalar);
|
||||
}
|
||||
return m_arrowTrans;
|
||||
}
|
||||
};
|
||||
panel.setOpaque(false);
|
||||
@@ -585,10 +618,15 @@ public abstract class PathFinderView extends javax.swing.JPanel {
|
||||
disablesTables.add(dataModel.getDisplayName(a.destination));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JPopupMenu popupMenu = new JScrollPopupMenu();
|
||||
Border titleUnderline = BorderFactory.createMatteBorder(0, 0, 0, 0, popupMenu.getForeground());
|
||||
TitledBorder labelBorder = BorderFactory.createTitledBorder(
|
||||
titleUnderline, "Successor of " + dataModel.getDisplayName(node.table), TitledBorder.LEFT, TitledBorder.ABOVE_TOP, popupMenu.getFont(), popupMenu.getForeground());
|
||||
popupMenu.setBorder(BorderFactory.createCompoundBorder(popupMenu.getBorder(), labelBorder));
|
||||
|
||||
for (Entry<String, EdgeType> e: following.entrySet()) {
|
||||
JMenuItem item = new JMenuItem(e.getKey());
|
||||
JMenuItem item = new JMenuItem(e.getKey() + " ");
|
||||
final Table dest = dataModel.getTableByDisplayName(e.getKey());
|
||||
popupMenu.add(item);
|
||||
if (e.getValue() == EdgeType.PARENT) {
|
||||
@@ -698,6 +736,7 @@ public abstract class PathFinderView extends javax.swing.JPanel {
|
||||
okButton = new javax.swing.JButton();
|
||||
okExpandButton = new javax.swing.JButton();
|
||||
sepLabel = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
exclusionTable = new javax.swing.JTable();
|
||||
@@ -728,9 +767,9 @@ public abstract class PathFinderView extends javax.swing.JPanel {
|
||||
jScrollPane1.setViewportView(pathContainerPanel);
|
||||
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 1;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 1;
|
||||
gridBagConstraints.gridwidth = 2;
|
||||
gridBagConstraints.gridwidth = 3;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
@@ -763,11 +802,20 @@ public abstract class PathFinderView extends javax.swing.JPanel {
|
||||
|
||||
sepLabel.setText(" ");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 1;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.gridwidth = 2;
|
||||
gridBagConstraints.gridwidth = 3;
|
||||
jPanel2.add(sepLabel, gridBagConstraints);
|
||||
|
||||
jLabel2.setForeground(java.awt.Color.gray);
|
||||
jLabel2.setText("Open context menu (right mouse click on table) to define its direct successor.");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.gridwidth = 3;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
jPanel2.add(jLabel2, gridBagConstraints);
|
||||
|
||||
jSplitPane1.setLeftComponent(jPanel2);
|
||||
|
||||
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Excluded Tables"));
|
||||
@@ -993,6 +1041,7 @@ public abstract class PathFinderView extends javax.swing.JPanel {
|
||||
private javax.swing.JTable exclusionTable;
|
||||
private javax.swing.JButton historyButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
|
||||
@@ -177,6 +177,21 @@ public class PathGraph {
|
||||
private void createGraph(Set<Table> excluded, List<Table> pathStations, Set<Table> visitedExTables, boolean considerRestrictions) {
|
||||
reset();
|
||||
|
||||
Map<Table, Table> forcedSucc = new HashMap<Table, Table>();
|
||||
|
||||
for (int i = 1; i < pathStations.size(); ++i) {
|
||||
Table a = pathStations.get(i - 1);
|
||||
Table b = pathStations.get(i);
|
||||
for (Association as: a.associations) {
|
||||
if (!as.isIgnored() || !considerRestrictions) {
|
||||
if (as.destination.equals(b)) {
|
||||
forcedSucc.put(a, b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Set<Table> currentColumn = new HashSet<Table>();
|
||||
currentColumn.add(source);
|
||||
int column = 0;
|
||||
@@ -218,6 +233,9 @@ public class PathGraph {
|
||||
lastVisitedExTables.add(dest);
|
||||
continue;
|
||||
}
|
||||
if (forcedSucc.containsKey(table) && !forcedSucc.get(table).equals(dest)) {
|
||||
continue;
|
||||
}
|
||||
Node newNode = nodePerTable.get(dest);
|
||||
if (newNode != null && newNode.column != column + 1) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user