소스 검색

Click to edit changed to an edit button.

Gilian Joosen 10 년 전
부모
커밋
cc419df5a3
3개의 변경된 파일50개의 추가작업 그리고 41개의 파일을 삭제
  1. 17 15
      src/gui/panels/edit/ActsPane.java
  2. 15 12
      src/gui/panels/edit/ArtistPane.java
  3. 18 14
      src/gui/panels/edit/StagesPane.java

+ 17 - 15
src/gui/panels/edit/ActsPane.java

@@ -42,21 +42,6 @@ public class ActsPane extends JPanel {
         //the cell renderer.
         this.actsList.setCellRenderer(new ActCellRenderer());
         
-        
-        this.actsList.addListSelectionListener(new ListSelectionListener() {
-            @Override
-            public void valueChanged(ListSelectionEvent e) {
-                
-                if(e.getValueIsAdjusting()) {
-                    JDialog dialog = new ActDialogPanel(ActsPane.this.agenda, model, (Act) actsList.getSelectedValue());
-                    dialog.setLocation(getCenterOfScreen(dialog));
-                    dialog.setLocationRelativeTo(null);
-                    dialog.pack();
-                    dialog.setVisible(true);
-                }
-            }
-        });
-
         //the JList inside a scrollPane.
         JScrollPane scrollPane = new JScrollPane(this.actsList);
 
@@ -93,6 +78,23 @@ public class ActsPane extends JPanel {
             }
         });
         buttonPane.add(removeButton);
+
+        JButton edit = new JButton("edit");
+        edit.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                Object obj = actsList.getSelectedValue();
+                if(obj != null){
+                    JDialog dialog = new ActDialogPanel(ActsPane.this.agenda, model, (Act) actsList.getSelectedValue());
+                    dialog.setLocation(getCenterOfScreen(dialog));
+                    dialog.setLocationRelativeTo(null);
+                    dialog.pack();
+                    dialog.setVisible(true);
+                }
+            }
+        });
+        buttonPane.add(edit);
+
         return buttonPane;
     }
 

+ 15 - 12
src/gui/panels/edit/ArtistPane.java

@@ -47,18 +47,6 @@ public class ArtistPane extends JPanel {
         //the cell renderer.
         this.artistList.setCellRenderer(new ArtistCellRenderer());
         
-        this.artistList.addListSelectionListener(new ListSelectionListener() {
-            @Override
-            public void valueChanged(ListSelectionEvent e) {
-                if(e.getValueIsAdjusting()){
-                    JDialog dialog = new ArtistDialogPanel(ArtistPane.this.agenda, model, (Artist) artistList.getSelectedValue());
-                    dialog.setLocation(getCenterOfScreen(dialog));
-                    dialog.pack();
-                    dialog.setVisible(true);
-                }
-            }
-        });
-
         //the JList inside a scrollPane.
         JScrollPane scrollPane = new JScrollPane(this.artistList);
         super.add(scrollPane, BorderLayout.CENTER);
@@ -94,6 +82,21 @@ public class ArtistPane extends JPanel {
         });
         buttonPane.add(removeButton);
         
+        JButton editButton = new JButton("edit");
+        editButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                Object obj = artistList.getSelectedValue();
+                if(obj != null){
+                    JDialog dialog = new ArtistDialogPanel(ArtistPane.this.agenda, model, (Artist) artistList.getSelectedValue());
+                    dialog.setLocation(getCenterOfScreen(dialog));
+                    dialog.pack();
+                    dialog.setVisible(true);
+                }
+            }
+        });
+        buttonPane.add(editButton);
+        
         return buttonPane;
     }
 

+ 18 - 14
src/gui/panels/edit/StagesPane.java

@@ -46,20 +46,6 @@ public class StagesPane extends JPanel {
         //the cell renderer.
         this.stagesList.setCellRenderer(new StageCellRenderer());
         
-        //select stage
-        this.stagesList.addListSelectionListener(new ListSelectionListener() {
-            @Override
-            public void valueChanged(ListSelectionEvent e) {
-                if(e.getValueIsAdjusting()){
-                    JDialog dialog = new StageDialogPanel(StagesPane.this.agenda, model, (Stage) stagesList.getSelectedValue());
-                    dialog.setLocation(getCenterOfScreen(dialog));
-                    dialog.setLocationRelativeTo(null);
-                    dialog.pack();
-                    dialog.setVisible(true);
-                }
-            }
-        });
-
         //the JList inside a scrollPane.
         JScrollPane scrollPane = new JScrollPane(this.stagesList);
 
@@ -95,6 +81,24 @@ public class StagesPane extends JPanel {
         });
         
         buttonPane.add(remove);
+        
+        JButton edit = new JButton("edit");
+        edit.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                Object obj = stagesList.getSelectedValue();
+                if(obj != null){
+                    JDialog dialog = new StageDialogPanel(StagesPane.this.agenda, model, (Stage) stagesList.getSelectedValue());
+                    dialog.setLocation(getCenterOfScreen(dialog));
+                    dialog.setLocationRelativeTo(null);
+                    dialog.pack();
+                    dialog.setVisible(true);
+                }
+            }
+        });
+        
+        buttonPane.add(edit);
+        
         return buttonPane;
     }