-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from alexkogon/addTextBasedVerify
Enhanced XPath generation for better text based verification
- Loading branch information
Showing
6 changed files
with
489 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.synthuse; | ||
|
||
import javax.swing.JDialog; | ||
import javax.swing.JFrame; | ||
import javax.swing.SwingUtilities; | ||
|
||
import org.synthuse.controllers.SynthuseConfigDialogControllers; | ||
import org.synthuse.views.SynthuseConfigPanel; | ||
|
||
public class SynthuseConfigDialog extends JDialog { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = -4877764256323621418L; | ||
|
||
private Config theConfig; //Model | ||
private final SynthuseConfigPanel theSynthuseConfigPanel; //View | ||
|
||
public SynthuseConfigDialog(JFrame aParentFrame, Config aConfig) { | ||
super(aParentFrame); | ||
|
||
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() { | ||
SynthuseConfigDialogControllers.initializeUI(theSynthuseConfigPanel,theConfig); | ||
} | ||
}); | ||
} | ||
|
||
synchronized private void setConfig(Config aConfig) { | ||
theConfig = aConfig; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
src/org/synthuse/controllers/SynthuseConfigDialogControllers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
package org.synthuse.controllers; | ||
|
||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
|
||
import javax.swing.JOptionPane; | ||
|
||
import org.synthuse.Config; | ||
import org.synthuse.views.SynthuseConfigPanel; | ||
|
||
public class SynthuseConfigDialogControllers { | ||
|
||
public static void initializeUI(SynthuseConfigPanel aSynthuseConfigPanel, Config aConfig) { | ||
aSynthuseConfigPanel.getAlwaysOnTopCheckBox().setSelected(aConfig.isAlwaysOnTop()); | ||
aSynthuseConfigPanel.getDisableFiltersUiaCheckBox().setSelected(aConfig.isFilterUiaDisabled()); | ||
aSynthuseConfigPanel.getDisableUiaBridgeCheckBox().setSelected(aConfig.isUiaBridgeDisabled()); | ||
aSynthuseConfigPanel.getRefreshKeyTextField().setText(Integer.toString(aConfig.getRefreshKeyCode())); | ||
aSynthuseConfigPanel.getStrongTextMatchingCheckBox().setSelected(aConfig.isUseStrongTextMatching()); | ||
aSynthuseConfigPanel.getTargetKeyTextField().setText(Integer.toString(aConfig.getTargetKeyCode())); | ||
aSynthuseConfigPanel.getXPathHighlightTextField().setText(aConfig.getXpathHighlight()); | ||
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()); | ||
JOptionPane.showMessageDialog(aSynthuseConfigPanel, "May require restart to be effective"); | ||
} | ||
}; | ||
} | ||
|
||
private static ActionListener xpathHighlightTextFieldActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel, | ||
final Config aConfig) { | ||
return new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent aE) { | ||
aConfig.setXPathHighlight(aSynthuseConfigPanel.getXPathHighlightTextField().getText()); | ||
JOptionPane.showMessageDialog(aSynthuseConfigPanel, "May require restart to be effective"); | ||
} | ||
}; | ||
} | ||
|
||
private static ActionListener targetKeyCodeTextFieldActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel, | ||
final Config aConfig) { | ||
return new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent aE) { | ||
aConfig.setTargetKeyCode(aSynthuseConfigPanel.getTargetKeyTextField().getText()); | ||
JOptionPane.showMessageDialog(aSynthuseConfigPanel, "May require restart to be effective"); | ||
} | ||
}; | ||
} | ||
|
||
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()); | ||
JOptionPane.showMessageDialog(aSynthuseConfigPanel, "May require restart to be effective"); | ||
} | ||
}; | ||
} | ||
|
||
private static ActionListener disableUiaBridgeCheckboxActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel, | ||
final Config aConfig) { | ||
return new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent aE) { | ||
aConfig.setDisableUiaBridge(aSynthuseConfigPanel.getDisableUiaBridgeCheckBox().isSelected()); | ||
JOptionPane.showMessageDialog(aSynthuseConfigPanel, "May require restart to be effective"); | ||
} | ||
}; | ||
} | ||
|
||
private static ActionListener disableFiltersUiaCheckboxActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel, | ||
final Config aConfig) { | ||
return new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent aE) { | ||
aConfig.setDisableFiltersUia(aSynthuseConfigPanel.getDisableFiltersUiaCheckBox().isSelected()); | ||
JOptionPane.showMessageDialog(aSynthuseConfigPanel, "May require restart to be effective"); | ||
} | ||
}; | ||
} | ||
|
||
private static ActionListener alwaysOnTopCheckboxActionHandler(final SynthuseConfigPanel aSynthuseConfigPanel, | ||
final Config aConfig) { | ||
return new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent aE) { | ||
aConfig.setAlwaysOnTop(aSynthuseConfigPanel.getAlwaysOnTopCheckBox().isSelected()); | ||
JOptionPane.showMessageDialog(aSynthuseConfigPanel, "May require restart to be effective"); | ||
} | ||
}; | ||
} | ||
} |
Oops, something went wrong.