|
@@ -5,6 +5,9 @@ import java.awt.BorderLayout;
|
|
|
import javax.swing.JDialog;
|
|
|
import javax.swing.JPanel;
|
|
|
import javax.swing.border.EmptyBorder;
|
|
|
+
|
|
|
+import classes.CpsObject;
|
|
|
+
|
|
|
import javax.swing.JLabel;
|
|
|
|
|
|
import java.awt.Font;
|
|
@@ -14,6 +17,7 @@ import javax.swing.JTextField;
|
|
|
import javax.swing.JRadioButton;
|
|
|
import javax.swing.JButton;
|
|
|
|
|
|
+import ui.controller.Control;
|
|
|
import ui.controller.MultiPurposeController;
|
|
|
|
|
|
import java.awt.event.ActionListener;
|
|
@@ -23,9 +27,10 @@ public class searchPopUp extends JDialog {
|
|
|
private final JPanel contentPanel = new JPanel();
|
|
|
private JTextField replaceTextField;
|
|
|
private JTextField findTextField;
|
|
|
- private MultiPurposeController multiController;
|
|
|
+ private Control controller;
|
|
|
+ private MyCanvas canvas;
|
|
|
|
|
|
- searchPopUp(MultiPurposeController multiCont){
|
|
|
+ searchPopUp(Control controller, MyCanvas canvas){
|
|
|
super((java.awt.Frame) null, true);
|
|
|
setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
|
|
|
this.setTitle("Search for Objects");
|
|
@@ -35,7 +40,8 @@ public class searchPopUp extends JDialog {
|
|
|
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
|
|
contentPanel.setLayout(null);
|
|
|
|
|
|
- multiController = multiCont;
|
|
|
+ this.controller = controller;
|
|
|
+ this.canvas = canvas;
|
|
|
|
|
|
JLabel lblFind = new JLabel("Find:");
|
|
|
lblFind.setFont(new Font("Tahoma", Font.PLAIN, 13));
|
|
@@ -47,11 +53,13 @@ public class searchPopUp extends JDialog {
|
|
|
lblReplace.setBounds(10, 41, 56, 14);
|
|
|
contentPanel.add(lblReplace);
|
|
|
|
|
|
+ //ReplaceTest
|
|
|
replaceTextField = new JTextField();
|
|
|
replaceTextField.setBounds(76, 39, 101, 20);
|
|
|
contentPanel.add(replaceTextField);
|
|
|
replaceTextField.setColumns(10);
|
|
|
|
|
|
+ //FindText
|
|
|
findTextField = new JTextField();
|
|
|
findTextField.setBounds(76, 11, 101, 20);
|
|
|
contentPanel.add(findTextField);
|
|
@@ -66,6 +74,7 @@ public class searchPopUp extends JDialog {
|
|
|
rdbtnForward.setFont(new Font("Tahoma", Font.PLAIN, 13));
|
|
|
rdbtnForward.setBounds(10, 111, 109, 23);
|
|
|
contentPanel.add(rdbtnForward);
|
|
|
+ rdbtnForward.setSelected(true);
|
|
|
|
|
|
JRadioButton rdbtnBackward = new JRadioButton("Backward");
|
|
|
rdbtnBackward.setFont(new Font("Tahoma", Font.PLAIN, 13));
|
|
@@ -81,27 +90,63 @@ public class searchPopUp extends JDialog {
|
|
|
rdbtnAll.setFont(new Font("Tahoma", Font.PLAIN, 13));
|
|
|
rdbtnAll.setBounds(121, 112, 109, 23);
|
|
|
contentPanel.add(rdbtnAll);
|
|
|
+ rdbtnAll.setSelected(true);
|
|
|
|
|
|
JRadioButton rdbtnSingle = new JRadioButton("Single");
|
|
|
rdbtnSingle.setFont(new Font("Tahoma", Font.PLAIN, 13));
|
|
|
rdbtnSingle.setBounds(121, 138, 109, 23);
|
|
|
contentPanel.add(rdbtnSingle);
|
|
|
|
|
|
+ //FindButton
|
|
|
JButton btnFind = new JButton("Find");
|
|
|
+ btnFind.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ CpsObject cps = null;
|
|
|
+ if(rdbtnAll.isSelected()) {
|
|
|
+
|
|
|
+ }
|
|
|
+ if(rdbtnSingle.isSelected()) {
|
|
|
+
|
|
|
+ if(rdbtnForward.isSelected()) {
|
|
|
+
|
|
|
+ }
|
|
|
+ if(rdbtnBackward.isSelected()) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
btnFind.setFont(new Font("Tahoma", Font.PLAIN, 13));
|
|
|
btnFind.setBounds(10, 186, 89, 23);
|
|
|
contentPanel.add(btnFind);
|
|
|
|
|
|
+ //ReplaceButton
|
|
|
JButton btnReplace = new JButton("Replace");
|
|
|
+ btnReplace.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
btnReplace.setFont(new Font("Tahoma", Font.PLAIN, 13));
|
|
|
btnReplace.setBounds(110, 187, 89, 23);
|
|
|
contentPanel.add(btnReplace);
|
|
|
|
|
|
+ //ReplaceAllButton
|
|
|
JButton btnReplaceAll = new JButton("Replace All");
|
|
|
+ btnReplaceAll.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ for (CpsObject cps : controller.getModel().getObjectsOnCanvas()) {
|
|
|
+
|
|
|
+ if(cps.getName().equals(findTextField.getText()))
|
|
|
+ cps.setName(replaceTextField.getText());
|
|
|
+ }
|
|
|
+ canvas.repaint();
|
|
|
+ }
|
|
|
+ });
|
|
|
btnReplaceAll.setFont(new Font("Tahoma", Font.PLAIN, 11));
|
|
|
btnReplaceAll.setBounds(110, 218, 89, 23);
|
|
|
contentPanel.add(btnReplaceAll);
|
|
|
|
|
|
+ //CloseButton
|
|
|
JButton btnClose = new JButton("Close");
|
|
|
btnClose.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent arg0) {
|