소스 검색

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

Edgardo Palza 8 년 전
부모
커밋
ac4a8c497d

+ 9 - 8
.classpath

@@ -1,8 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="res"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="res"/>
+	<classpathentry excluding="src/|res/" kind="src" path=""/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

BIN
bin/Images/Dummy_House.png


BIN
bin/Interfaces/CategoryListener.class


BIN
bin/Interfaces/ComparableObject.class


BIN
bin/Interfaces/ObjectListener.class


BIN
bin/classes/Category.class


BIN
bin/classes/HolonObject.class


BIN
bin/classes/HolonSwitch.class


BIN
bin/classes/HolonTransformer.class


BIN
bin/classes/Position.class


BIN
bin/exceptions/newException1.class


BIN
bin/tests/Tests1.class


BIN
bin/tests/praktikumHolonsTestMinimal.class


BIN
bin/ui/controller/CategoryController.class


BIN
bin/ui/controller/Control$command.class


BIN
bin/ui/controller/Control.class


BIN
bin/ui/model/Model.class


BIN
bin/ui/model/tests.class


BIN
bin/ui/view/AddElementPopUp.class


BIN
bin/ui/view/Main$1.class


BIN
bin/ui/view/Main.class


+ 15 - 16
src/ui/view/AddObjectPopUp.java

@@ -89,18 +89,18 @@ public class AddObjectPopUp extends JDialog {
 				@Override
 				public void keyPressed(KeyEvent arg0) {
 					// TODO Auto-generated method stub
-					
+
 				}
 
 				@Override
 				public void keyReleased(KeyEvent e) {
 					// TODO Auto-generated method stub
-					
+
 				}
 
 				@Override
 				public void keyTyped(KeyEvent e) {
-					objectName.setBackground(Color.WHITE);					
+					objectName.setBackground(Color.WHITE);
 				}
 			});
 			objectName.setBounds(98, 18, 172, 20);
@@ -124,18 +124,18 @@ public class AddObjectPopUp extends JDialog {
 				@Override
 				public void keyPressed(KeyEvent arg0) {
 					// TODO Auto-generated method stub
-					
+
 				}
 
 				@Override
 				public void keyReleased(KeyEvent e) {
 					// TODO Auto-generated method stub
-					
+
 				}
 
 				@Override
 				public void keyTyped(KeyEvent e) {
-					sourcePath.setBackground(Color.WHITE);					
+					sourcePath.setBackground(Color.WHITE);
 				}
 			});
 			sourcePath.setBounds(148, 77, 271, 20);
@@ -202,15 +202,8 @@ public class AddObjectPopUp extends JDialog {
 				okButton.addMouseListener(new MouseAdapter() {
 					public void mouseClicked(MouseEvent e) {
 						Component frame = null;
-						if (objectName.getText().length() == 0) {
-							// JOptionPane.showMessageDialog(frame, "please
-							// enter a name");
-							objectName.setBackground(new Color(255, 50, 50));
-							if (!sourcePath.getText().equals(filePath)) {
-								// JOptionPane.showMessageDialog(frame, "No
-								// image selected!");
-								sourcePath.setBackground(new Color(255, 50, 50));
-							} else {
+						if (objectName.getText().length() > 0) {
+							if (sourcePath.getText().equals(filePath)) {
 								copieFile();
 								theObject = new HolonObject(objectName.getText());
 								theObject.setElements(hElements);
@@ -219,7 +212,13 @@ public class AddObjectPopUp extends JDialog {
 								System.out.println(theObject.getImage());
 								System.out.println(givenCategory);
 								dispose();
-							}
+							} else
+								sourcePath.setBackground(new Color(255, 50, 50));
+						} else {
+							objectName.setBackground(new Color(255, 50, 50));
+							if (!sourcePath.getText().equals(filePath))
+								sourcePath.setBackground(new Color(255, 50, 50));
+
 						}
 					}
 				});

+ 2 - 12
src/ui/view/MyCanvas.java

@@ -1,14 +1,9 @@
 package ui.view;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Font;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Image;
-import java.awt.Paint;
 import java.awt.Rectangle;
 import java.awt.RenderingHints;
 import java.awt.event.ActionEvent;
@@ -16,16 +11,11 @@ import java.awt.event.ActionListener;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 import java.awt.event.MouseMotionListener;
-import java.awt.geom.Line2D;
 import java.util.ArrayList;
-import java.util.LinkedList;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import javax.swing.AbstractButton;
 import javax.swing.ImageIcon;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
@@ -35,7 +25,6 @@ import classes.CpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
-import classes.HolonTransformer;
 import ui.controller.Control;
 import ui.model.*;
 
@@ -237,6 +226,7 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 			repaint();
 		} else {
 			try {
+				//Außerhalb des Randes gedragged?
 				x = e.getX()-controller.getScaleDiv2();
 				y = e.getY()-controller.getScaleDiv2();
 				if(e.getX()<controller.getScaleDiv2())x = 0;
@@ -262,7 +252,7 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 	public void mouseMoved(MouseEvent e) {
 		x = e.getX();
 		y = e.getY();
-		// Everytghin for the tooltip :)
+		// Everytghing for the tooltip :)
 		boolean on = false;
 		for (CpsObject cps : model.getObjectsOnCanvas()) {