mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 17:04:42 -04:00
The table dialog opens the AllSolutionsDialog in a more convenient way.
This commit is contained in:
parent
f35f93e0a1
commit
dff4700bcd
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user