浏览代码

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

jess 8 年之前
父节点
当前提交
48235d4d30

+ 3 - 11
src/classes/CpsEdge.java

@@ -5,7 +5,6 @@ public class CpsEdge {
 	float maxCapacity;
 	float flow;
 	boolean isWorking;
-	boolean infinite;
 	
 	CpsObject A;
 	CpsObject B;
@@ -57,10 +56,10 @@ public class CpsEdge {
 	 */
 	public void setFlow(float flow) {
 		this.flow = flow;
-		if(flow > maxCapacity){
-			isWorking = false;
-		}else{
+		if(flow <= maxCapacity || flow == -1){
 			isWorking = true;
+		}else{
+			isWorking = false;
 		}
 	}
 	
@@ -99,12 +98,5 @@ public class CpsEdge {
 		return isWorking;
 	}
 	
-	public void setInfinite(boolean inf){
-		infinite = inf;
-	}
-	
-	public boolean getInfinite(){
-		return infinite;
-	}
 
 }

+ 5 - 0
src/tests/praktikumHolonsTestObjectController.java

@@ -52,6 +52,7 @@ public class praktikumHolonsTestObjectController {
 		controller.addNewElementIntoCategoryObject("Building", "House", "A", 1, -10);
 		for (int i = 2; i < 27; i++) {
 			controller.addNewElementIntoCategoryObject("Building", "House", adapter.generate(i), i, -10);
+			// n(n+1) / 2 
 			assertTrue("Total Energy does not match",((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")).getCurrentEnergy() == -1800 + ((i* (i+1)) / 2) * -10);
 			assertTrue("Number of Elements does not Match", ((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")).getElements().size() == 6+i);
 		}
@@ -74,5 +75,9 @@ public class praktikumHolonsTestObjectController {
 		assertTrue("Element:TV was not Found", mp.searchEle((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House"), "TV") == null);
 	}
 	
+	@Test
+	public void testAddingAndDeletingInCanvas() {
+		
+	}
 	
 }

+ 8 - 4
src/ui/controller/Control.java

@@ -65,6 +65,10 @@ public class Control {
 	public CpsObject searchCategoryObject(String category, String object) {
 		return multiPurposeController.searchCatObj(multiPurposeController.searchCat(category), object);
 	}
+	
+	public Category searchCategory(String cat) {
+		return multiPurposeController.searchCat(cat);
+	}
 
 	/* Operations for Categories and Objects */
 	public void addCategory(String cat) {
@@ -83,10 +87,6 @@ public class Control {
 		categoryController.addNewHolonSwitch(cat, obj, "/Images/switch-off.png");
 	}
 
-	public Category searchCategory(String cat) {
-		return multiPurposeController.searchCat(cat);
-	}
-
 	public void deleteCategory(String cat) {
 		categoryController.deleteCategory(cat);
 	}
@@ -171,6 +171,10 @@ public class Control {
 	public void deleteElementCanvas(HolonObject obj, HolonElement ele) {
 		objectController.deleteElement(obj, ele);
 	}
+	
+	public void setClipboardObjects(ArrayList<CpsObject> list) {
+		MODEL.setClipboradObjects(list);
+	}
 
 	/* Global Operations */
 	public int getScale() {

+ 9 - 0
src/ui/controller/ObjectController.java

@@ -164,4 +164,13 @@ public class ObjectController {
 	public void setSelectedObjectID(int id) {
 		MODEL.setSelectedObjectID(id);
 	}
+	
+	/**
+	 * sets clipBoardObjects
+	 * 
+	 * @param ArrayList of CpsObjects
+	 */
+	public void setClipboardObjects(ArrayList<CpsObject> list) {
+		MODEL.setClipboradObjects(list);
+	}
 }

+ 9 - 0
src/ui/model/Model.java

@@ -26,6 +26,7 @@ public class Model {
 	private HolonElement selectedHolonElement;
 	private CpsEdge selectedEdge;
 	private ArrayList<CpsObject> selectedObjects = new ArrayList<CpsObject>();
+	private ArrayList<CpsObject> clipboardObjects = new ArrayList<CpsObject>();
 
 	private int selectedID = 0;
 	// number of the current autosave
@@ -77,6 +78,7 @@ public class Model {
 		setObjectListeners(new LinkedList<ObjectListener>());
 		setCgIdx(new HashMap<String,Integer>());
 		setCvsObjIdx(new HashMap<Integer,Integer>());
+		setClipboradObjects(new ArrayList<CpsObject>());
 	}
 
 	/**
@@ -347,4 +349,11 @@ public class Model {
 		this.numberOfSaves = numberOfSaves;
 	}
 
+	public void setClipboradObjects(ArrayList<CpsObject> c){
+		this.clipboardObjects = c;
+	}
+	
+	public ArrayList<CpsObject> getClipboradObjects(){
+		return clipboardObjects;
+	}
 }

+ 31 - 6
src/ui/view/EditEdgesPopUp.java

@@ -32,6 +32,7 @@ public class EditEdgesPopUp extends JDialog{
 	private JRadioButton rdbtnChangeForAll_1;
 	private Control controller;
 	private MyCanvas canvas;
+	private JLabel lblenterinfiniteFor;
 	
 	/**
 	 * Launch the application.
@@ -51,7 +52,7 @@ public class EditEdgesPopUp extends JDialog{
 		super((java.awt.Frame) null, true);
 		setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
 		this.setTitle("Edit Capacities of Edges");
-		setBounds(100, 100, 400, 220);
+		setBounds(100, 100, 438, 220);
 		getContentPane().setLayout(new BorderLayout());
 		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
 		getContentPane().add(contentPanel, BorderLayout.CENTER);
@@ -92,8 +93,8 @@ public class EditEdgesPopUp extends JDialog{
 		JButton btnOk_1 = new JButton("OK");
 		btnOk_1.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent e) {
-				try {
-					capacity = Float.parseFloat(capacityField.getText().toString());
+				if(capacityField.getText().equals("infinite")){
+					capacity = -1;
 					if(rdbtnChangeForAll.isSelected()){
 						changeForExisting(capacity);
 						dispose();
@@ -107,9 +108,29 @@ public class EditEdgesPopUp extends JDialog{
 						JOptionPane.showMessageDialog(new JFrame(),
 								"Please select one of the options");
 					}
-				} catch (NumberFormatException e1) {
-					JOptionPane.showMessageDialog(new JFrame(),
-							"Please enter a number in the Field for Maximum Capacity");
+				}else{
+					try {
+						capacity = Float.parseFloat(capacityField.getText().toString());
+						if(capacity < 0){
+							throw new NumberFormatException();
+						}
+						if(rdbtnChangeForAll.isSelected()){
+							changeForExisting(capacity);
+							dispose();
+						}else if (rdbtnChangeForNew.isSelected()){
+							changeForNew(capacity);
+							dispose();
+						}else if(rdbtnChangeForAll_1.isSelected()){
+							changeForExAndNew(capacity);
+							dispose();
+						}else{
+							JOptionPane.showMessageDialog(new JFrame(),
+									"Please select one of the options");
+						}
+					} catch (NumberFormatException e1) {
+						JOptionPane.showMessageDialog(new JFrame(),
+							"Please enter a number greater or equal 0 in the Field for Maximum Capacity");
+					}
 				}
 			}
 		});
@@ -120,6 +141,10 @@ public class EditEdgesPopUp extends JDialog{
 		bG.add(rdbtnChangeForAll_1);
 		bG.add(rdbtnChangeForNew);
 		bG.add(rdbtnChangeForAll);
+		
+		lblenterinfiniteFor = new JLabel("(enter \"infinite\" for infinite Capacity)");
+		lblenterinfiniteFor.setBounds(237, 11, 175, 14);
+		contentPanel.add(lblenterinfiniteFor);
 	}
 	
 	public void setCanvas(MyCanvas can){

+ 99 - 1
src/ui/view/GUI.java

@@ -34,6 +34,7 @@ import javax.swing.JButton;
 import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JComboBox;
 import javax.swing.JComponent;
+import javax.swing.JDialog;
 import javax.swing.JEditorPane;
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
@@ -71,7 +72,6 @@ import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
 import classes.HolonTransformer;
-import sun.nio.ch.SelChImpl;
 import ui.controller.Control;
 import ui.model.Model;;
 
@@ -195,6 +195,8 @@ public class GUI<E> implements CategoryListener {
 	private final JMenuItem mntmUndo = new JMenuItem("Undo");
 	private final JMenuItem mntmRedo = new JMenuItem("Redo");
 	private final JMenuItem mntmEditEdges = new JMenuItem("Edit Edges");
+	private final JMenuItem mntmFindReplace = new JMenuItem("Find/ Replace");
+	private final JMenuItem mntmEditShowedInformation = new JMenuItem("Edit showed Information");
 
 	/**
 	 * Create the application.
@@ -313,6 +315,75 @@ public class GUI<E> implements CategoryListener {
 			}
 		});
 
+		String delDown = "delete";
+		inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false), delDown);
+		actionMap.put(delDown, new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				for (CpsObject cps : model.getSelectedCpsObjects()) {
+					controller.delCanvasObject(cps);
+				}
+				model.getSelectedCpsObjects().clear();
+				// controller.setSelectedObjectID(0);
+				for (int i = tableModelHolonElementMulti.getRowCount() - 1; i > -1; i--) {
+					tableModelHolonElementMulti.removeRow(i);
+				}
+				for (int i = tableModelHolonElementSingle.getRowCount() - 1; i > -1; i--) {
+					tableModelHolonElementSingle.removeRow(i);
+				}
+				for (int i = tableModelProperties.getRowCount() - 1; i > -1; i--) {
+					tableModelProperties.removeRow(i);
+				}
+				canvas.repaint();
+				unitGraph.empty();
+			}
+		});
+
+		String cntrlCDown = "controlC";
+		inputMap.put(KeyStroke.getKeyStroke("control C"), cntrlCDown);
+		actionMap.put(cntrlCDown, new AbstractAction() {
+
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				System.out.println("copy");
+				controller.setClipboardObjects((ArrayList<CpsObject>) model.getSelectedCpsObjects().clone());
+			}
+		});
+
+		String cntrlVDown = "controlV";
+		inputMap.put(KeyStroke.getKeyStroke("control V"), cntrlVDown);
+		actionMap.put(cntrlVDown, new AbstractAction() {
+
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				System.out.println("paste");
+				model.getSelectedCpsObjects().clear();
+				CpsObject tCps = null;
+				for (CpsObject cps : model.getClipboradObjects()) {
+					if (cps instanceof HolonObject) {
+						tCps = new HolonObject(cps);
+						((HolonObject) tCps).setElements(((HolonObject) cps).getElements());
+					} else if (cps instanceof HolonSwitch) {
+						tCps = new HolonSwitch(cps);
+					}
+					tCps.setPosition(cps.getPosition());
+					controller.addObjectCanvas(tCps);
+					controller.addSelectedObject(tCps);
+				}
+				canvas.repaint();
+			}
+		});
+
+		String cntrlXDown = "controlX";
+		inputMap.put(KeyStroke.getKeyStroke("control X"), cntrlXDown);
+		actionMap.put(cntrlXDown, new AbstractAction() {
+
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				System.out.println("cut");
+			}
+		});
+
 		frmCyberPhysical.setJMenuBar(menuBar);
 
 		frmCyberPhysical.setIconImage(new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage()
@@ -331,6 +402,33 @@ public class GUI<E> implements CategoryListener {
 		mnNewMenu_1.add(mntmUndo);
 
 		mnNewMenu_1.add(mntmRedo);
+		mntmFindReplace.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				try {
+
+					searchPopUp dialog = new searchPopUp(controller, canvas);
+					dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+					dialog.setVisible(true);
+				} catch (Exception e1) {
+					e1.printStackTrace();
+				}
+			}
+		});
+		
+		mnNewMenu_1.add(mntmFindReplace);
+		mntmEditShowedInformation.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				try {
+					ShowedInformationPopUp dialog = new ShowedInformationPopUp(canvas);
+					dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+					dialog.setVisible(true);
+				} catch (Exception e1) {
+					e1.printStackTrace();
+				}
+			}
+		});
+		
+		mnNewMenu_1.add(mntmEditShowedInformation);
 
 		menuBar.add(mnNewMenu_2);
 		mntmEditEdges.addActionListener(new ActionListener() {

+ 54 - 13
src/ui/view/MyCanvas.java

@@ -54,7 +54,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 
 	ArrayList<HolonElement> dataSelected = new ArrayList<HolonElement>();
 	ArrayList<CpsObject> TempSelected = new ArrayList<CpsObject>();
-
+	
+	private boolean[] showedInformation = new boolean[3];
 	private boolean dragging = false; // for dragging
 	private boolean dragged = false; // if an object/objects was/were dragged
 	private boolean drawEdge = false; // for drawing edges
@@ -77,6 +78,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		this.controller = control;
 		this.model = model;
 
+		showedInformation[0] = true;
+		showedInformation[1] = false;
 		edgeCapacity = 10000;
 		popmenu.add(itemDelete);
 		itemDelete.setEnabled(false);
@@ -102,6 +105,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	 * 
 	 */
 	public void paintComponent(Graphics g) {
+		String maxCap;
 		super.paintComponent(g);
 		// Rendering
 		g2 = (Graphics2D) g;
@@ -120,9 +124,11 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		for (CpsEdge con : model.getEdgesOnCanvas()) {
 			if (con.getA().getID() != model.getSelectedObjectID() && con.getB().getID() != model.getSelectedObjectID()
 					&& con != edgeHighlight) {
-				if (con.getFlow() <= con.getCapacity()) {
+				if (con.getFlow() <= con.getCapacity() || con.getCapacity() == -1) {
 					g2.setColor(Color.GREEN);
-					g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+					if(con.getCapacity() != -1){
+						g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+					}
 				} else {
 					g2.setColor(Color.RED);
 					g2.setStroke(new BasicStroke(2));
@@ -131,9 +137,17 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 						con.getA().getPosition().y + controller.getScaleDiv2(),
 						con.getB().getPosition().x + controller.getScaleDiv2(),
 						con.getB().getPosition().y + controller.getScaleDiv2());
-				g2.drawString(con.getFlow() + "/" + con.getCapacity(),
-						(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
-						(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+				
+				if(con.getCapacity() == -1){
+					maxCap = Character.toString('\u221e');
+				}else{
+					maxCap = String.valueOf(con.getCapacity());
+				}
+				if(showedInformation[0]){
+					g2.drawString(con.getFlow() + "/" + maxCap,
+							(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
+							(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+				}
 			}
 		}
 
@@ -152,9 +166,17 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 							con.getA().getPosition().y + controller.getScaleDiv2(),
 							con.getB().getPosition().x + controller.getScaleDiv2(),
 							con.getB().getPosition().y + controller.getScaleDiv2());
-					g2.drawString(con.getFlow() + "/" + con.getCapacity(),
-							(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
-							(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+					
+					if(con.getCapacity() == -1){
+						maxCap = Character.toString('\u221e');
+					}else{
+						maxCap = String.valueOf(con.getCapacity());
+					}
+					if(showedInformation[0]){
+						g2.drawString(con.getFlow() + "/" + maxCap,
+								(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
+								(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+					}
 				}
 			}
 		} else if (edgeHighlight != null) {
@@ -164,11 +186,19 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					edgeHighlight.getA().getPosition().y + controller.getScaleDiv2(),
 					edgeHighlight.getB().getPosition().x + controller.getScaleDiv2(),
 					edgeHighlight.getB().getPosition().y + controller.getScaleDiv2());
-			g2.drawString(edgeHighlight.getFlow() + "/" + edgeHighlight.getCapacity(),
-					(edgeHighlight.getA().getPosition().x + edgeHighlight.getB().getPosition().x) / 2
+			
+			if(edgeHighlight.getCapacity() == -1){
+				maxCap = Character.toString('\u221e');
+			}else{
+				maxCap = String.valueOf(edgeHighlight.getCapacity());
+			}
+			if(showedInformation[0]){
+				g2.drawString(edgeHighlight.getFlow() + "/" + maxCap,
+						(edgeHighlight.getA().getPosition().x + edgeHighlight.getB().getPosition().x) / 2
 							+ controller.getScaleDiv2(),
-					(edgeHighlight.getA().getPosition().y + edgeHighlight.getB().getPosition().y) / 2
-							+ controller.getScaleDiv2());
+							(edgeHighlight.getA().getPosition().y + edgeHighlight.getB().getPosition().y) / 2
+								+ controller.getScaleDiv2());
+			}
 		}
 
 		// Objects
@@ -629,4 +659,15 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	public void setEdgeCapacity(float cap) {
 		edgeCapacity = cap;
 	}
+
+	public void setShowedInformation(boolean connection, boolean object) {
+		showedInformation[0] = connection;
+		showedInformation[1] = object;
+	}
+	
+	public boolean[] getShowedInformation(){
+		return showedInformation;
+	}
+	
+	
 }

+ 65 - 0
src/ui/view/ShowedInformationPopUp.java

@@ -0,0 +1,65 @@
+package ui.view;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import javax.swing.JCheckBox;
+import javax.swing.JButton;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class ShowedInformationPopUp extends JDialog{
+	private final JPanel contentPanel = new JPanel();
+	private final JButton btnOk = new JButton("OK");
+	private MyCanvas canvas;
+	private JCheckBox objectEnergyCheckbox;
+	private JCheckBox connectionCheckbox;
+	
+	public ShowedInformationPopUp(MyCanvas canvas){
+		super((java.awt.Frame) null, true);
+		setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
+		this.setTitle("Edit Showed Informations");
+		setBounds(100, 100, 277, 169);
+		getContentPane().setLayout(new BorderLayout());
+		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+		getContentPane().add(contentPanel, BorderLayout.CENTER);
+		contentPanel.setLayout(null);
+		this.canvas = canvas;
+		
+		objectEnergyCheckbox = new JCheckBox("Show Total Energy of Objects");
+		objectEnergyCheckbox.setBounds(19, 19, 181, 23);
+		contentPanel.add(objectEnergyCheckbox);
+		
+		connectionCheckbox = new JCheckBox("Show Connection Properties");
+		connectionCheckbox.setBounds(19, 57, 181, 23);
+		contentPanel.add(connectionCheckbox);
+		
+		objectEnergyCheckbox.setSelected(canvas.getShowedInformation()[1]);
+		connectionCheckbox.setSelected(canvas.getShowedInformation()[0]);
+		btnOk.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent arg0) {
+				setInformation(connectionCheckbox.isSelected(), objectEnergyCheckbox.isSelected());
+				dispose();
+			}
+		});
+		btnOk.setBounds(169, 98, 82, 23);
+		contentPanel.add(btnOk);
+		
+		JButton btnCancel = new JButton("Cancel");
+		btnCancel.setActionCommand("Cancel");
+		btnCancel.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent arg0) {
+				dispose();
+			}
+		});
+		btnCancel.setBounds(70, 98, 89, 23);
+		contentPanel.add(btnCancel);
+	}
+	
+	private void setInformation(boolean connection, boolean object){
+		canvas.setShowedInformation(connection, object);
+		canvas.repaint();
+	}
+}

+ 169 - 0
src/ui/view/searchPopUp.java

@@ -0,0 +1,169 @@
+package ui.view;
+
+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;
+
+import javax.swing.ButtonGroup;
+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;
+import java.awt.event.ActionEvent;
+
+public class searchPopUp extends JDialog {
+	private final JPanel contentPanel = new JPanel();
+	private JTextField replaceTextField;
+	private JTextField findTextField;
+	private Control controller;
+	private MyCanvas canvas;
+	
+	searchPopUp(Control controller, MyCanvas canvas){
+		super((java.awt.Frame) null, true);
+		setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
+		this.setTitle("Search for Objects");
+		setBounds(100, 100, 238, 360);
+		getContentPane().setLayout(new BorderLayout());
+		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+		getContentPane().add(contentPanel, BorderLayout.CENTER);
+		contentPanel.setLayout(null);
+		
+		this.controller = controller;
+		this.canvas = canvas;
+		
+		JLabel lblFind = new JLabel("Find:");
+		lblFind.setFont(new Font("Tahoma", Font.PLAIN, 13));
+		lblFind.setBounds(10, 11, 46, 19);
+		contentPanel.add(lblFind);
+		
+		JLabel lblReplace = new JLabel("Replace:");
+		lblReplace.setFont(new Font("Tahoma", Font.PLAIN, 13));
+		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);
+		findTextField.setColumns(10);
+		
+		JLabel lblNewLabel = new JLabel("Direction");
+		lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
+		lblNewLabel.setBounds(10, 90, 82, 14);
+		contentPanel.add(lblNewLabel);
+		
+		JRadioButton rdbtnForward = new JRadioButton("Forward");
+		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));
+		rdbtnBackward.setBounds(10, 137, 109, 23);
+		contentPanel.add(rdbtnBackward);
+		
+		JLabel lblScope = new JLabel("Scope");
+		lblScope.setFont(new Font("Tahoma", Font.BOLD, 13));
+		lblScope.setBounds(122, 90, 46, 14);
+		contentPanel.add(lblScope);
+		
+		JRadioButton rdbtnAll = new JRadioButton("All");
+		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) {
+				dispose();
+			}
+		});
+		btnClose.setFont(new Font("Tahoma", Font.PLAIN, 13));
+		btnClose.setBounds(110, 287, 89, 23);
+		contentPanel.add(btnClose);
+		
+		ButtonGroup directionbtns = new ButtonGroup();
+		ButtonGroup scopebtns = new ButtonGroup();
+		
+		directionbtns.add(rdbtnBackward);
+		directionbtns.add(rdbtnForward);
+		scopebtns.add(rdbtnSingle);
+		scopebtns.add(rdbtnAll);
+
+	}
+}