The table dialog opens the AllSolutionsDialog in a more convenient way.

This commit is contained in:
hneemann 2020-08-04 12:32:26 +02:00
parent f35f93e0a1
commit dff4700bcd
2 changed files with 12 additions and 5 deletions

View File

@ -61,12 +61,19 @@ public class AllSolutionsDialog extends JDialog {
/**
* Is called from table dialog if this dialog is needed.
*
* @param needed true if needed
* @param needed true if needed
* @param tableDialogBounds the table dialogs bounds
*/
public void setNeeded(boolean needed) {
public void setNeeded(boolean needed, Rectangle tableDialogBounds) {
this.needed = needed;
if (!userHasClosed) {
setVisible(needed);
int x = (int) (tableDialogBounds.x - (getWidth() - tableDialogBounds.getWidth()) / 2);
int y = tableDialogBounds.y + tableDialogBounds.height + 10;
if (getHeight() < tableDialogBounds.y - 10) {
y = tableDialogBounds.y - getHeight() - 10;
}
setLocation(x, y);
if (needed && reopenAction != null)
reopenAction.setEnabled(false);
}

View File

@ -909,17 +909,17 @@ public class TableDialog extends JDialog {
switch (expressions.size()) {
case 0:
statusBar.setVisible(false);
allSolutionsDialog.setNeeded(false);
allSolutionsDialog.setNeeded(false, TableDialog.this.getBounds());
break;
case 1:
statusBar.setVisible(true);
statusBar.setExpression(expressions.get(0));
allSolutionsDialog.setNeeded(false);
allSolutionsDialog.setNeeded(false, TableDialog.this.getBounds());
break;
default:
statusBar.setVisible(false);
allSolutionsDialog.setExpressions(expressions);
allSolutionsDialog.setNeeded(true);
allSolutionsDialog.setNeeded(true, TableDialog.this.getBounds());
toFront();
}
});