added action handlers for config dialog
This commit is contained in:
@@ -40,6 +40,12 @@ public class Config extends PropertiesSerializer {
|
|||||||
return disableUiaBridge.equals("true") || disableUiaBridge.equals("True");
|
return disableUiaBridge.equals("true") || disableUiaBridge.equals("True");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setDisableUiaBridge(boolean aNewValue) {
|
||||||
|
disableUiaBridge=aNewValue?"true":"false";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isFilterUiaDisabled()
|
public boolean isFilterUiaDisabled()
|
||||||
{
|
{
|
||||||
if (disableFiltersUia == null)
|
if (disableFiltersUia == null)
|
||||||
@@ -47,6 +53,11 @@ public class Config extends PropertiesSerializer {
|
|||||||
return disableFiltersUia.equals("true") || disableFiltersUia.equals("True");
|
return disableFiltersUia.equals("true") || disableFiltersUia.equals("True");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDisableFiltersUia(boolean aNewValue) {
|
||||||
|
disableFiltersUia=aNewValue?"true":"false";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isAlwaysOnTop()
|
public boolean isAlwaysOnTop()
|
||||||
{
|
{
|
||||||
if (alwaysOnTop == null)
|
if (alwaysOnTop == null)
|
||||||
@@ -54,6 +65,11 @@ public class Config extends PropertiesSerializer {
|
|||||||
return alwaysOnTop.equals("true") || alwaysOnTop.equals("True");
|
return alwaysOnTop.equals("true") || alwaysOnTop.equals("True");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAlwaysOnTop(boolean aNewValue)
|
||||||
|
{
|
||||||
|
alwaysOnTop=aNewValue?"true":"false";
|
||||||
|
}
|
||||||
|
|
||||||
public int getRefreshKeyCode()
|
public int getRefreshKeyCode()
|
||||||
{
|
{
|
||||||
String keyStr = "";
|
String keyStr = "";
|
||||||
@@ -65,6 +81,10 @@ public class Config extends PropertiesSerializer {
|
|||||||
keyStr = this.refreshKey;
|
keyStr = this.refreshKey;
|
||||||
return RobotMacro.getKeyCode(keyStr.charAt(0))[0];
|
return RobotMacro.getKeyCode(keyStr.charAt(0))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRefreshKeyCode(String aText) {
|
||||||
|
this.refreshKey=aText;
|
||||||
|
}
|
||||||
|
|
||||||
public int getTargetKeyCode()
|
public int getTargetKeyCode()
|
||||||
{
|
{
|
||||||
@@ -78,6 +98,10 @@ public class Config extends PropertiesSerializer {
|
|||||||
return RobotMacro.getKeyCode(keyStr.charAt(0))[0];
|
return RobotMacro.getKeyCode(keyStr.charAt(0))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTargetKeyCode(String aText) {
|
||||||
|
this.targetKey=aText;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isUseStrongTextMatching() {
|
public boolean isUseStrongTextMatching() {
|
||||||
return useStrongTextMatching;
|
return useStrongTextMatching;
|
||||||
}
|
}
|
||||||
@@ -90,7 +114,15 @@ public class Config extends PropertiesSerializer {
|
|||||||
return xpathList;
|
return xpathList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setXPathList(String aText) {
|
||||||
|
xpathList=aText;
|
||||||
|
}
|
||||||
|
|
||||||
public String getXpathHighlight() {
|
public String getXpathHighlight() {
|
||||||
return xpathHightlight;
|
return xpathHightlight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setXPathHighlight(String aText) {
|
||||||
|
xpathHightlight=aText;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,18 @@ public class SynthuseConfigDialog extends JDialog {
|
|||||||
|
|
||||||
public SynthuseConfigDialog(JFrame aParentFrame, Config aConfig) {
|
public SynthuseConfigDialog(JFrame aParentFrame, Config aConfig) {
|
||||||
super(aParentFrame);
|
super(aParentFrame);
|
||||||
this.setTitle("Synthuse Properties");
|
|
||||||
theSynthuseConfigPanel = new SynthuseConfigPanel();
|
|
||||||
this.setConfig(aConfig);
|
this.setConfig(aConfig);
|
||||||
|
|
||||||
|
this.setTitle("Synthuse Properties");
|
||||||
|
|
||||||
|
theSynthuseConfigPanel = new SynthuseConfigPanel();
|
||||||
|
|
||||||
|
SynthuseConfigDialogControllers.bindActionControllers(theSynthuseConfigPanel,theConfig);
|
||||||
|
|
||||||
this.getContentPane().add(theSynthuseConfigPanel);
|
this.getContentPane().add(theSynthuseConfigPanel);
|
||||||
this.setSize(492, 260);
|
this.setSize(492, 260);
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package org.synthuse.controllers;
|
package org.synthuse.controllers;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
import org.synthuse.Config;
|
import org.synthuse.Config;
|
||||||
import org.synthuse.views.SynthuseConfigPanel;
|
import org.synthuse.views.SynthuseConfigPanel;
|
||||||
|
|
||||||
@@ -16,4 +19,94 @@ public class SynthuseConfigDialogControllers {
|
|||||||
aSynthuseConfigPanel.getXPathListTextField().setText(aConfig.getXpathList());
|
aSynthuseConfigPanel.getXPathListTextField().setText(aConfig.getXpathList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void bindActionControllers(final SynthuseConfigPanel aSynthuseConfigPanel, final Config aConfig) {
|
||||||
|
aSynthuseConfigPanel.getAlwaysOnTopCheckBox().addActionListener(alwaysOnTopCheckboxActionHandler(aSynthuseConfigPanel, aConfig));
|
||||||
|
aSynthuseConfigPanel.getDisableFiltersUiaCheckBox().addActionListener(disableFiltersUiaCheckboxActionHandler(aSynthuseConfigPanel, aConfig));
|
||||||
|
aSynthuseConfigPanel.getDisableUiaBridgeCheckBox().addActionListener(disableUiaBridgeCheckboxActionHandler(aSynthuseConfigPanel, aConfig));
|
||||||
|
aSynthuseConfigPanel.getRefreshKeyTextField().addActionListener(refreshKeyCodeTextFieldActionHandler(aSynthuseConfigPanel, aConfig));
|
||||||
|
aSynthuseConfigPanel.getStrongTextMatchingCheckBox().addActionListener(strongTextMatchingCheckboxActionHandler(aSynthuseConfigPanel, aConfig));
|
||||||
|
aSynthuseConfigPanel.getTargetKeyTextField().addActionListener(targetKeyCodeTextFieldActionHandler(aSynthuseConfigPanel, aConfig));
|
||||||
|
aSynthuseConfigPanel.getXPathHighlightTextField().addActionListener(xpathHighlightTextFieldActionHandler(aSynthuseConfigPanel, aConfig));
|
||||||
|
aSynthuseConfigPanel.getXPathListTextField().addActionListener(xpathListTextFieldActionHandler(aSynthuseConfigPanel, aConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener xpathListTextFieldActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel,
|
||||||
|
final Config aConfig) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent aE) {
|
||||||
|
aConfig.setXPathList(aSynthuseConfigPanel.getXPathListTextField().getText());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener xpathHighlightTextFieldActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel,
|
||||||
|
final Config aConfig) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent aE) {
|
||||||
|
aConfig.setXPathHighlight(aSynthuseConfigPanel.getXPathHighlightTextField().getText());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener targetKeyCodeTextFieldActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel,
|
||||||
|
final Config aConfig) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent aE) {
|
||||||
|
aConfig.setTargetKeyCode(aSynthuseConfigPanel.getTargetKeyTextField().getText());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener strongTextMatchingCheckboxActionHandler(
|
||||||
|
final SynthuseConfigPanel aSynthuseConfigPanel, final Config aConfig) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent aE) {
|
||||||
|
aConfig.setUseStrongTextMatching(aSynthuseConfigPanel.getStrongTextMatchingCheckBox().isSelected());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener refreshKeyCodeTextFieldActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel,
|
||||||
|
final Config aConfig) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent aE) {
|
||||||
|
aConfig.setRefreshKeyCode(aSynthuseConfigPanel.getRefreshKeyTextField().getText());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener disableUiaBridgeCheckboxActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel,
|
||||||
|
final Config aConfig) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent aE) {
|
||||||
|
aConfig.setDisableUiaBridge(aSynthuseConfigPanel.getDisableUiaBridgeCheckBox().isSelected());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener disableFiltersUiaCheckboxActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel,
|
||||||
|
final Config aConfig) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent aE) {
|
||||||
|
aConfig.setDisableFiltersUia(aSynthuseConfigPanel.getDisableFiltersUiaCheckBox().isSelected());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener alwaysOnTopCheckboxActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel,
|
||||||
|
final Config aConfig) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent aE) {
|
||||||
|
aConfig.setAlwaysOnTop(aSynthuseConfigPanel.getAlwaysOnTopCheckBox().isSelected());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user