mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-15 07:48:29 -04:00
reenables keyboard table input
This commit is contained in:
parent
73e05bb828
commit
61a22aa057
@ -8,9 +8,11 @@ package de.neemann.digital.gui.components.table;
|
|||||||
import de.neemann.digital.analyse.expression.Expression;
|
import de.neemann.digital.analyse.expression.Expression;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.gui.Screen;
|
import de.neemann.gui.Screen;
|
||||||
|
import de.neemann.gui.ToolTipAction;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -22,6 +24,7 @@ public class AllSolutionsDialog extends JDialog {
|
|||||||
private final ExpressionComponent expressionComponent;
|
private final ExpressionComponent expressionComponent;
|
||||||
private boolean userHasClosed = false;
|
private boolean userHasClosed = false;
|
||||||
private boolean needed;
|
private boolean needed;
|
||||||
|
private ToolTipAction reopenAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Frame.
|
* Creates a new Frame.
|
||||||
@ -29,7 +32,7 @@ public class AllSolutionsDialog extends JDialog {
|
|||||||
* @param owner the owner frame
|
* @param owner the owner frame
|
||||||
* @param font the font to use
|
* @param font the font to use
|
||||||
*/
|
*/
|
||||||
public AllSolutionsDialog(JDialog owner, Font font) {
|
AllSolutionsDialog(JDialog owner, Font font) {
|
||||||
super(owner, Lang.get("win_allSolutions"), false);
|
super(owner, Lang.get("win_allSolutions"), false);
|
||||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||||
|
|
||||||
@ -45,6 +48,8 @@ public class AllSolutionsDialog extends JDialog {
|
|||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent windowEvent) {
|
public void windowClosing(WindowEvent windowEvent) {
|
||||||
userHasClosed = true;
|
userHasClosed = true;
|
||||||
|
if (reopenAction != null)
|
||||||
|
reopenAction.setEnabled(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -59,8 +64,11 @@ public class AllSolutionsDialog extends JDialog {
|
|||||||
*/
|
*/
|
||||||
public void setNeeded(boolean needed) {
|
public void setNeeded(boolean needed) {
|
||||||
this.needed = needed;
|
this.needed = needed;
|
||||||
if (!userHasClosed)
|
if (!userHasClosed) {
|
||||||
setVisible(needed);
|
setVisible(needed);
|
||||||
|
if (needed && reopenAction != null)
|
||||||
|
reopenAction.setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,13 +80,18 @@ public class AllSolutionsDialog extends JDialog {
|
|||||||
expressionComponent.setExpressions(expressions);
|
expressionComponent.setExpressions(expressions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ToolTipAction getReopenAction() {
|
||||||
/**
|
if (reopenAction == null) {
|
||||||
* reenables this dialog
|
reopenAction = new ToolTipAction(Lang.get("menu_table_showAllSolutions")) {
|
||||||
*/
|
@Override
|
||||||
public void enforceVisible() {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
userHasClosed = false;
|
userHasClosed = false;
|
||||||
if (needed)
|
reopenAction.setEnabled(false);
|
||||||
setVisible(true);
|
if (needed)
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
}.setToolTip(Lang.get("menu_table_showAllSolutions_tt")).setEnabledChain(false);
|
||||||
|
}
|
||||||
|
return reopenAction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,12 +349,7 @@ public class TableDialog extends JDialog {
|
|||||||
createJK.addActionListener(e -> calculateExpressions());
|
createJK.addActionListener(e -> calculateExpressions());
|
||||||
fileMenu.add(createJK);
|
fileMenu.add(createJK);
|
||||||
|
|
||||||
fileMenu.add(new ToolTipAction(Lang.get("menu_table_showAllSolutions")) {
|
fileMenu.add(allSolutionsDialog.getReopenAction());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
|
||||||
allSolutionsDialog.enforceVisible();
|
|
||||||
}
|
|
||||||
}.setToolTip(Lang.get("menu_table_showAllSolutions_tt")).createJMenuItem());
|
|
||||||
|
|
||||||
return fileMenu;
|
return fileMenu;
|
||||||
}
|
}
|
||||||
@ -790,6 +785,7 @@ public class TableDialog extends JDialog {
|
|||||||
statusBar.setVisible(false);
|
statusBar.setVisible(false);
|
||||||
allSolutionsDialog.setExpressions(expressions);
|
allSolutionsDialog.setExpressions(expressions);
|
||||||
allSolutionsDialog.setNeeded(true);
|
allSolutionsDialog.setNeeded(true);
|
||||||
|
toFront();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user