add switch to turn strong text matching on and off

This commit is contained in:
Alex Kogon
2015-09-11 14:41:36 +02:00
parent acc70c67c6
commit b97109c3ec
3 changed files with 30 additions and 6 deletions

View File

@@ -20,6 +20,9 @@ public class Config extends PropertiesSerializer {
public String xpathList = ""; public String xpathList = "";
public String xpathHightlight = ".*process=\"([^\"]*)\".*"; public String xpathHightlight = ".*process=\"([^\"]*)\".*";
private boolean useStrongTextMatching = false;
public Config() //needed for cloning public Config() //needed for cloning
{ {
} }
@@ -74,4 +77,12 @@ public class Config extends PropertiesSerializer {
keyStr = this.targetKey; keyStr = this.targetKey;
return RobotMacro.getKeyCode(keyStr.charAt(0))[0]; return RobotMacro.getKeyCode(keyStr.charAt(0))[0];
} }
public boolean isUseStrongTextMatching() {
return useStrongTextMatching;
}
public void setUseStrongTextMatching(boolean useStrongTextMatching) {
this.useStrongTextMatching = useStrongTextMatching;
}
} }

View File

@@ -283,7 +283,7 @@ public class SynthuseDlg extends JFrame {
GridBagConstraints c = new GridBagConstraints(); GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL; c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0.5; c.weightx = 0.5;
c.gridwidth = 1; c.gridwidth = 2;
c.gridx = 0; c.gridx = 0;
c.gridy = 0; c.gridy = 0;
c.insets = new Insets(3,3,3,3); // add padding around objects c.insets = new Insets(3,3,3,3); // add padding around objects
@@ -291,9 +291,23 @@ public class SynthuseDlg extends JFrame {
final DragTarget lblTarget = new DragTarget(); final DragTarget lblTarget = new DragTarget();
lblTarget.setHorizontalAlignment(SwingConstants.CENTER); lblTarget.setHorizontalAlignment(SwingConstants.CENTER);
lblTarget.setIcon(new ImageIcon(SynthuseDlg.class.getResource(RES_STR_TARGET_IMG))); final ImageIcon imageIcon = new ImageIcon(SynthuseDlg.class.getResource(RES_STR_TARGET_IMG));
lblTarget.setMinimumSize(new Dimension(imageIcon.getIconWidth(), imageIcon.getIconHeight()));
lblTarget.setIcon(imageIcon);
panel.add(lblTarget, c); panel.add(lblTarget, c);
final JButton btnConfig = new JButton("Cfg");
btnConfig.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SynthuseDlg.config.setUseStrongTextMatching(!SynthuseDlg.config.isUseStrongTextMatching());
}
});
c.gridx = 2;
c.gridwidth = 1;
panel.add(btnConfig, c);
btnFind = new JButton("Find"); btnFind = new JButton("Find");
btnFind.addActionListener(new ActionListener() { btnFind.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
@@ -323,8 +337,8 @@ public class SynthuseDlg extends JFrame {
} }
} }
}); });
c.gridwidth = 3; c.gridwidth = 1;
c.gridx = 1; c.gridx = 3;
panel.add(cmbXpath, c); panel.add(cmbXpath, c);
btnFind.setIcon(new ImageIcon(SynthuseDlg.class.getResource(RES_STR_FIND_IMG))); btnFind.setIcon(new ImageIcon(SynthuseDlg.class.getResource(RES_STR_FIND_IMG)));
c.gridwidth = 1; c.gridwidth = 1;

View File

@@ -52,8 +52,7 @@ public class XpathManager implements Runnable{
@Override @Override
public void run() { public void run() {
//@TODO (AJK) create separate action to use text mathing String results = SynthuseDlg.config.isUseStrongTextMatching()?buildXpathStatement(true,50,50):buildXpathStatement();
String results = buildXpathStatement(true,50,50);
events.executionCompleted(hwnd, results); events.executionCompleted(hwnd, results);
} }