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");
|
||||
}
|
||||
|
||||
|
||||
public void setDisableUiaBridge(boolean aNewValue) {
|
||||
disableUiaBridge=aNewValue?"true":"false";
|
||||
}
|
||||
|
||||
|
||||
public boolean isFilterUiaDisabled()
|
||||
{
|
||||
if (disableFiltersUia == null)
|
||||
@@ -47,6 +53,11 @@ public class Config extends PropertiesSerializer {
|
||||
return disableFiltersUia.equals("true") || disableFiltersUia.equals("True");
|
||||
}
|
||||
|
||||
public void setDisableFiltersUia(boolean aNewValue) {
|
||||
disableFiltersUia=aNewValue?"true":"false";
|
||||
}
|
||||
|
||||
|
||||
public boolean isAlwaysOnTop()
|
||||
{
|
||||
if (alwaysOnTop == null)
|
||||
@@ -54,6 +65,11 @@ public class Config extends PropertiesSerializer {
|
||||
return alwaysOnTop.equals("true") || alwaysOnTop.equals("True");
|
||||
}
|
||||
|
||||
public void setAlwaysOnTop(boolean aNewValue)
|
||||
{
|
||||
alwaysOnTop=aNewValue?"true":"false";
|
||||
}
|
||||
|
||||
public int getRefreshKeyCode()
|
||||
{
|
||||
String keyStr = "";
|
||||
@@ -65,6 +81,10 @@ public class Config extends PropertiesSerializer {
|
||||
keyStr = this.refreshKey;
|
||||
return RobotMacro.getKeyCode(keyStr.charAt(0))[0];
|
||||
}
|
||||
|
||||
public void setRefreshKeyCode(String aText) {
|
||||
this.refreshKey=aText;
|
||||
}
|
||||
|
||||
public int getTargetKeyCode()
|
||||
{
|
||||
@@ -78,6 +98,10 @@ public class Config extends PropertiesSerializer {
|
||||
return RobotMacro.getKeyCode(keyStr.charAt(0))[0];
|
||||
}
|
||||
|
||||
public void setTargetKeyCode(String aText) {
|
||||
this.targetKey=aText;
|
||||
}
|
||||
|
||||
public boolean isUseStrongTextMatching() {
|
||||
return useStrongTextMatching;
|
||||
}
|
||||
@@ -90,7 +114,15 @@ public class Config extends PropertiesSerializer {
|
||||
return xpathList;
|
||||
}
|
||||
|
||||
public void setXPathList(String aText) {
|
||||
xpathList=aText;
|
||||
}
|
||||
|
||||
public String getXpathHighlight() {
|
||||
return xpathHightlight;
|
||||
}
|
||||
|
||||
public void setXPathHighlight(String aText) {
|
||||
xpathHightlight=aText;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,18 @@ public class SynthuseConfigDialog extends JDialog {
|
||||
|
||||
public SynthuseConfigDialog(JFrame aParentFrame, Config aConfig) {
|
||||
super(aParentFrame);
|
||||
this.setTitle("Synthuse Properties");
|
||||
theSynthuseConfigPanel = new SynthuseConfigPanel();
|
||||
|
||||
this.setConfig(aConfig);
|
||||
|
||||
this.setTitle("Synthuse Properties");
|
||||
|
||||
theSynthuseConfigPanel = new SynthuseConfigPanel();
|
||||
|
||||
SynthuseConfigDialogControllers.bindActionControllers(theSynthuseConfigPanel,theConfig);
|
||||
|
||||
this.getContentPane().add(theSynthuseConfigPanel);
|
||||
this.setSize(492, 260);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.synthuse.controllers;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import org.synthuse.Config;
|
||||
import org.synthuse.views.SynthuseConfigPanel;
|
||||
|
||||
@@ -16,4 +19,94 @@ public class SynthuseConfigDialogControllers {
|
||||
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