Преглед на файлове

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

Teh-Hai Julian Zheng преди 7 години
родител
ревизия
20520cb964
променени са 3 файла, в които са добавени 50 реда и са изтрити 15 реда
  1. 35 2
      src/ui/view/GUI.java
  2. 8 7
      src/ui/view/MyCanvas.java
  3. 7 6
      src/ui/view/UnitGraph.java

+ 35 - 2
src/ui/view/GUI.java

@@ -123,6 +123,9 @@ public class GUI<E> implements CategoryListener {
 	private final JScrollPane scrollPane1 = new JScrollPane();
 	// private final JScrollPane holonSP = new JScrollPane();
 	private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
+	private final JTabbedPane tabbedPane2 = new JTabbedPane(JTabbedPane.TOP);
+	private final JButton splitButton = new JButton("Split View");
+
 	private final JPanel panelTapped_SimMenu = new JPanel();
 	private JPopupMenu popmenuEdit = new JPopupMenu();
 	private JMenuItem editItem = new JMenuItem("Edit Object");
@@ -754,6 +757,35 @@ public class GUI<E> implements CategoryListener {
 
 		mnHelp.add(aboutUs);
 
+		// Testing
+		menuBar.add(splitButton);
+		//Split View
+		splitButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				if (panelTapped_SimMenu
+						.getComponent(panelTapped_SimMenu.getComponentCount() - 1) instanceof JSplitPane) {
+					tabbedPane2.removeAll();
+					panelTapped_SimMenu
+							.remove(panelTapped_SimMenu.getComponent(panelTapped_SimMenu.getComponentCount() - 1));
+					panelTapped_SimMenu.add(tabbedPane);
+				} else {
+					for (int i = 0; i < tabbedPane.getTabCount(); i++) {
+						tabbedPane2.addTab(tabbedPane.getTitleAt(i), null);
+					}
+					JSplitPane tempSplit = new JSplitPane();
+					tempSplit.setBorder(null);
+					tempSplit.setRightComponent(tabbedPane2);
+					tempSplit.setLeftComponent(tabbedPane);
+					tempSplit.setDividerLocation(tabbedPane.getWidth()/2);
+					panelTapped_SimMenu.remove(tabbedPane);
+					panelTapped_SimMenu.add(tempSplit);
+				}
+				contentPane.updateUI();
+			}
+
+		});
+
 		mnNewMenuOptions.add(mnLanguage);
 		canvas.setBackground(Color.WHITE);
 		canvas.setPreferredSize(new Dimension(model.getCanvasX(), model.getCanvasY()));
@@ -1759,8 +1791,9 @@ public class GUI<E> implements CategoryListener {
 		splitPane.setRightComponent(splitPane1);
 		splitPane.setDividerLocation(200);
 		splitPane1.setDividerLocation(500);
-		splitPaneCanvasConsole.setDividerLocation(500);
-
+		splitPaneCanvasConsole.setDividerLocation(550);
+		splitPaneCanvasConsole.setResizeWeight(0.9);
+		
 		splitPane.setLeftComponent(scrollPane1);
 		splitPaneCanvasConsole.setLeftComponent(panelTapped_SimMenu);
 		tabbedPane.addTab("View", canvasSP);

+ 8 - 7
src/ui/view/MyCanvas.java

@@ -555,12 +555,13 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			// Border Highlighting
 			if (showedInformation[3]) {
 				g2.setColor(cps.getBorderColor());
-				if (g2.getColor() != Color.WHITE) {
-					g2.fillRect((int) (cps.getPosition().x - controller.getScaleDiv2() - scalediv20 - 3),
-							(int) (cps.getPosition().y - controller.getScaleDiv2() - scalediv20 - 3),
-							(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
-							(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
-				}
+				if (!(cps instanceof CpsNode)){
+					//if (g2.getColor() != Color.WHITE) {
+						g2.fillRect((int) (cps.getPosition().x - controller.getScaleDiv2() - scalediv20 - 3),
+								(int) (cps.getPosition().y - controller.getScaleDiv2() - scalediv20 - 3),
+								(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
+								(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
+					}
 			}
 			// node image
 			if (cps instanceof CpsNode && (cps == tempCps || model.getSelectedCpsObject() == cps
@@ -744,7 +745,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	public void mouseReleased(MouseEvent e) {
 		x = e.getX();
 		y = e.getY();
-		
+
 		dragging = false;
 
 		if (drawEdge) {

+ 7 - 6
src/ui/view/UnitGraph.java

@@ -156,13 +156,14 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 
 			/*
 			 * // Actual Iteration Point Visualization g2.setColor(Color.RED);
-			 * if (arrayOfValue != null) { for (int i = 0; i <
-			 * arrayOfValue.length; i++) { g2.fillOval((int) (i * width /
+			 * if (arrayOfFloats != null) { for (int i = 0; i <
+			 * arrayOfFloats.length; i++) { g2.fillOval((int) (i * width /
 			 * (model.getIterations() - 1) * scaleX - recSize.getX() / 2), (int)
-			 * (convertToCanvasY((int) arrayOfValue[i]) * scaleY -
+			 * (convertToCanvasY((int) arrayOfFloats[i]) * scaleY -
 			 * recSize.getY() / 2), (int) recSize.getX(), (int) recSize.getY());
 			 * } }
 			 */
+
 		} else if (isSwitch) {
 			if (arrayOfBooleans != null) {
 				// array fillen
@@ -517,8 +518,8 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	public void reset() {
 		pointList.removeAll(pointList);
 		if (isSwitch) {
-			pointList.addFirst(new Point(-4, (int)(height/6)));
-			pointList.addLast(new Point((int) (width)+4, (int) (height / 6)));
+			pointList.addFirst(new Point(-4, (int) (height / 6)));
+			pointList.addLast(new Point((int) (width) + 4, (int) (height / 6)));
 		} else {
 			pointList.addFirst(new Point(0, 0));
 			pointList.addLast(new Point((int) (this.getWidth() / scaleX), 0));
@@ -583,7 +584,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 		// First time clicked on the Element
 		if (pointList.isEmpty()) {
 			pointList.addFirst(new Point(-4, (int) (height / 6)));
-			pointList.addLast(new Point((int) (width)+4, (int) (height / 6)));
+			pointList.addLast(new Point((int) (width) + 4, (int) (height / 6)));
 		}
 		repaint();
 	}