creating dialog box to set synthuse properties
This commit is contained in:
@@ -85,4 +85,12 @@ public class Config extends PropertiesSerializer {
|
|||||||
public void setUseStrongTextMatching(boolean useStrongTextMatching) {
|
public void setUseStrongTextMatching(boolean useStrongTextMatching) {
|
||||||
this.useStrongTextMatching = useStrongTextMatching;
|
this.useStrongTextMatching = useStrongTextMatching;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getXpathList() {
|
||||||
|
return xpathList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getXpathHighlight() {
|
||||||
|
return xpathHightlight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
49
src/org/synthuse/SynthuseConfigDialog.java
Executable file
49
src/org/synthuse/SynthuseConfigDialog.java
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
package org.synthuse;
|
||||||
|
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
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.setTitle("Synthuse Properties");
|
||||||
|
theSynthuseConfigPanel = new SynthuseConfigPanel();
|
||||||
|
this.setConfig(aConfig);
|
||||||
|
this.getContentPane().add(theSynthuseConfigPanel);
|
||||||
|
this.setSize(492, 260);
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
SynthuseConfigDialog.this.initializeUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized private void initializeUI() {
|
||||||
|
theSynthuseConfigPanel.getAlwaysOnTopCheckBox().setSelected(theConfig.isAlwaysOnTop());
|
||||||
|
theSynthuseConfigPanel.getDisableFiltersUiaCheckBox().setSelected(theConfig.isFilterUiaDisabled());
|
||||||
|
theSynthuseConfigPanel.getDisableUiaBridgeCheckBox().setSelected(theConfig.isUiaBridgeDisabled());
|
||||||
|
theSynthuseConfigPanel.getRefreshKeyTextField().setText(Integer.toString(theConfig.getRefreshKeyCode()));
|
||||||
|
theSynthuseConfigPanel.getStrongTextMatchingCheckBox().setSelected(theConfig.isUseStrongTextMatching());
|
||||||
|
theSynthuseConfigPanel.getTargetKeyTextField().setText(Integer.toString(theConfig.getTargetKeyCode()));
|
||||||
|
theSynthuseConfigPanel.getXPathHighlightTextField().setText(theConfig.getXpathHighlight());
|
||||||
|
theSynthuseConfigPanel.getXPathListTextField().setText(theConfig.getXpathList());
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized private void setConfig(Config aConfig) {
|
||||||
|
theConfig = aConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -43,6 +43,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.synthuse.Api.User32Ex;
|
import org.synthuse.Api.User32Ex;
|
||||||
import org.synthuse.DragTarget.dragEvents;
|
import org.synthuse.DragTarget.dragEvents;
|
||||||
|
import org.synthuse.views.SynthuseConfigPanel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -85,6 +86,7 @@ public class SynthuseDlg extends JFrame {
|
|||||||
private JButton btnAdvanced;
|
private JButton btnAdvanced;
|
||||||
|
|
||||||
private TestIdeFrame testIde = null;
|
private TestIdeFrame testIde = null;
|
||||||
|
protected SynthuseConfigDialog configDialog=null;
|
||||||
//private MessageHookFrame msgHook = null;
|
//private MessageHookFrame msgHook = null;
|
||||||
private int targetX;
|
private int targetX;
|
||||||
private int targetY;
|
private int targetY;
|
||||||
@@ -301,8 +303,12 @@ public class SynthuseDlg extends JFrame {
|
|||||||
btnConfig.addActionListener(new ActionListener() {
|
btnConfig.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
SynthuseDlg.config.setUseStrongTextMatching(!SynthuseDlg.config.isUseStrongTextMatching());
|
if(configDialog==null) {
|
||||||
|
createConfigDialog();
|
||||||
}
|
}
|
||||||
|
configDialog.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
c.gridx = 2;
|
c.gridx = 2;
|
||||||
c.gridwidth = 1;
|
c.gridwidth = 1;
|
||||||
@@ -576,4 +582,9 @@ public class SynthuseDlg extends JFrame {
|
|||||||
WindowEvent closingEvent = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
|
WindowEvent closingEvent = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
|
||||||
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(closingEvent);
|
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(closingEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createConfigDialog() {
|
||||||
|
configDialog=new SynthuseConfigDialog(this, config);
|
||||||
|
configDialog.setLocationRelativeTo(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class SynthuseConfigPanel extends javax.swing.JPanel {
|
|||||||
* regenerated by the Form Editor.
|
* regenerated by the Form Editor.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
java.awt.GridBagConstraints gridBagConstraints;
|
java.awt.GridBagConstraints gridBagConstraints;
|
||||||
|
|
||||||
@@ -165,10 +165,10 @@ public class SynthuseConfigPanel extends javax.swing.JPanel {
|
|||||||
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
||||||
gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 6);
|
gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 6);
|
||||||
add(theXPathHighlightTextField, gridBagConstraints);
|
add(theXPathHighlightTextField, gridBagConstraints);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>
|
||||||
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify
|
||||||
private javax.swing.Box.Filler filler1;
|
private javax.swing.Box.Filler filler1;
|
||||||
private javax.swing.Box.Filler filler2;
|
private javax.swing.Box.Filler filler2;
|
||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JLabel jLabel1;
|
||||||
@@ -183,37 +183,37 @@ public class SynthuseConfigPanel extends javax.swing.JPanel {
|
|||||||
private javax.swing.JTextField theTargetKeyTextField;
|
private javax.swing.JTextField theTargetKeyTextField;
|
||||||
private javax.swing.JTextField theXPathHighlightTextField;
|
private javax.swing.JTextField theXPathHighlightTextField;
|
||||||
private javax.swing.JTextField theXPathListTextField;
|
private javax.swing.JTextField theXPathListTextField;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration
|
||||||
|
|
||||||
public JCheckBox getTheAlwaysOnTopCheckBox() {
|
public JCheckBox getAlwaysOnTopCheckBox() {
|
||||||
return theAlwaysOnTopCheckBox;
|
return theAlwaysOnTopCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JCheckBox getTheDisableFiltersUiaCheckBox() {
|
public JCheckBox getDisableFiltersUiaCheckBox() {
|
||||||
return theDisableFiltersUiaCheckBox;
|
return theDisableFiltersUiaCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JCheckBox getTheDisableUiaBridgeCheckBox() {
|
public JCheckBox getDisableUiaBridgeCheckBox() {
|
||||||
return theDisableUiaBridgeCheckBox;
|
return theDisableUiaBridgeCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JTextField getTheRefreshKeyTextField() {
|
public JTextField getRefreshKeyTextField() {
|
||||||
return theRefreshKeyTextField;
|
return theRefreshKeyTextField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JCheckBox getTheStrongTextMatchingCheckBox() {
|
public JCheckBox getStrongTextMatchingCheckBox() {
|
||||||
return theStrongTextMatchingCheckBox;
|
return theStrongTextMatchingCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JTextField getTheTargetKeyTextField() {
|
public JTextField getTargetKeyTextField() {
|
||||||
return theTargetKeyTextField;
|
return theTargetKeyTextField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JTextField getTheXPathHighlightTextField() {
|
public JTextField getXPathHighlightTextField() {
|
||||||
return theXPathHighlightTextField;
|
return theXPathHighlightTextField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JTextField getTheXPathListTextField() {
|
public JTextField getXPathListTextField() {
|
||||||
return theXPathListTextField;
|
return theXPathListTextField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user