|
@@ -9,27 +9,17 @@ import java.awt.event.ActionListener;
|
|
|
import java.awt.event.MouseEvent;
|
|
import java.awt.event.MouseEvent;
|
|
|
import java.awt.event.MouseListener;
|
|
import java.awt.event.MouseListener;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Enumeration;
|
|
|
|
|
+import java.util.Iterator;
|
|
|
|
|
|
|
|
-import javax.swing.BorderFactory;
|
|
|
|
|
-import javax.swing.BoxLayout;
|
|
|
|
|
-import javax.swing.DefaultListModel;
|
|
|
|
|
-import javax.swing.ImageIcon;
|
|
|
|
|
-import javax.swing.JButton;
|
|
|
|
|
-import javax.swing.JComboBox;
|
|
|
|
|
-import javax.swing.JDialog;
|
|
|
|
|
-import javax.swing.JLabel;
|
|
|
|
|
-import javax.swing.JList;
|
|
|
|
|
-import javax.swing.JOptionPane;
|
|
|
|
|
-import javax.swing.JPanel;
|
|
|
|
|
-import javax.swing.JScrollPane;
|
|
|
|
|
-import javax.swing.JTextField;
|
|
|
|
|
-import javax.swing.ListCellRenderer;
|
|
|
|
|
|
|
+import javax.swing.*;
|
|
|
|
|
|
|
|
import agenda.Act;
|
|
import agenda.Act;
|
|
|
import agenda.ActTime;
|
|
import agenda.ActTime;
|
|
|
import agenda.Agenda;
|
|
import agenda.Agenda;
|
|
|
import agenda.Artist;
|
|
import agenda.Artist;
|
|
|
import agenda.Stage;
|
|
import agenda.Stage;
|
|
|
|
|
+import javafx.scene.control.RadioButton;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Created by gjoosen on 20/02/15.
|
|
* Created by gjoosen on 20/02/15.
|
|
@@ -39,7 +29,9 @@ public class ActDialogPanel extends JDialog{
|
|
|
private Agenda agenda;
|
|
private Agenda agenda;
|
|
|
private JTextField name, genre, beginTime, endTime;
|
|
private JTextField name, genre, beginTime, endTime;
|
|
|
private JComboBox stageComboBox;
|
|
private JComboBox stageComboBox;
|
|
|
-
|
|
|
|
|
|
|
+ private JRadioButton radio1, radio2, radio3, radio4, radio5;
|
|
|
|
|
+ private ButtonGroup radioButtons;
|
|
|
|
|
+
|
|
|
private DefaultListModel model;
|
|
private DefaultListModel model;
|
|
|
private final DefaultListModel artistModel = new DefaultListModel();
|
|
private final DefaultListModel artistModel = new DefaultListModel();
|
|
|
private Act act;
|
|
private Act act;
|
|
@@ -63,6 +55,7 @@ public class ActDialogPanel extends JDialog{
|
|
|
main.add(this.genreChooser());
|
|
main.add(this.genreChooser());
|
|
|
//todo dates
|
|
//todo dates
|
|
|
main.add(this.dates());
|
|
main.add(this.dates());
|
|
|
|
|
+ main.add(this.popularity());
|
|
|
main.add(this.artistsChooser());
|
|
main.add(this.artistsChooser());
|
|
|
|
|
|
|
|
main.add(this.buttons());
|
|
main.add(this.buttons());
|
|
@@ -95,9 +88,13 @@ public class ActDialogPanel extends JDialog{
|
|
|
for(Artist artist: this.act.getArtists()){
|
|
for(Artist artist: this.act.getArtists()){
|
|
|
this.artistModel.addElement(artist);
|
|
this.artistModel.addElement(artist);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ main.add(this.popularity(act.getPopularity()));
|
|
|
main.add(this.artistsChooser());
|
|
main.add(this.artistsChooser());
|
|
|
main.add(this.buttons());
|
|
main.add(this.buttons());
|
|
|
|
|
+
|
|
|
|
|
+ //set time
|
|
|
|
|
+ this.beginTime.setText(this.act.getActTime().getBeginTimeStringField());
|
|
|
|
|
+ this.endTime.setText(this.act.getActTime().getEndTimeStringField());
|
|
|
super.add(main);
|
|
super.add(main);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -211,6 +208,59 @@ public class ActDialogPanel extends JDialog{
|
|
|
return panel;
|
|
return panel;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private JPanel popularity(){
|
|
|
|
|
+ return this.popularity(3);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private JPanel popularity(int number){
|
|
|
|
|
+ JPanel panel = new JPanel();
|
|
|
|
|
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
|
|
|
|
+ panel.add(new JLabel("popularity"));
|
|
|
|
|
+
|
|
|
|
|
+ JPanel buttons = new JPanel();
|
|
|
|
|
+ buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
|
|
|
|
|
+
|
|
|
|
|
+ this.radio1 = new JRadioButton("1");
|
|
|
|
|
+ this.radio2 = new JRadioButton("2");
|
|
|
|
|
+ this.radio3 = new JRadioButton("3");
|
|
|
|
|
+ this.radio4 = new JRadioButton("4");
|
|
|
|
|
+ this.radio5 = new JRadioButton("5");
|
|
|
|
|
+
|
|
|
|
|
+ switch(number){
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ this.radio1.setSelected(true);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ this.radio2.setSelected(true);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ this.radio3.setSelected(true);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ this.radio4.setSelected(true);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 5:
|
|
|
|
|
+ this.radio5.setSelected(true);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ buttons.add(this.radio1);
|
|
|
|
|
+ buttons.add(this.radio2);
|
|
|
|
|
+ buttons.add(this.radio3);
|
|
|
|
|
+ buttons.add(this.radio4);
|
|
|
|
|
+ buttons.add(this.radio5);
|
|
|
|
|
+
|
|
|
|
|
+ this.radioButtons = new ButtonGroup();
|
|
|
|
|
+ this.radioButtons.add(this.radio1);
|
|
|
|
|
+ this.radioButtons.add(this.radio2);
|
|
|
|
|
+ this.radioButtons.add(this.radio3);
|
|
|
|
|
+ this.radioButtons.add(this.radio4);
|
|
|
|
|
+ this.radioButtons.add(this.radio5);
|
|
|
|
|
+
|
|
|
|
|
+ panel.add(buttons);
|
|
|
|
|
+ return panel;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private JPanel artistsChooser(){
|
|
private JPanel artistsChooser(){
|
|
|
JPanel artists = new JPanel();
|
|
JPanel artists = new JPanel();
|
|
|
artists.setOpaque(false);
|
|
artists.setOpaque(false);
|
|
@@ -230,7 +280,7 @@ public class ActDialogPanel extends JDialog{
|
|
|
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
|
|
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
|
|
|
|
|
|
|
|
JLabel addArtists = new JLabel();
|
|
JLabel addArtists = new JLabel();
|
|
|
- addArtists.setIcon(new ImageIcon("E:\\Bibliotheek\\Documenten\\Workspaces\\FestivalPlanner\\res\\add.png"));
|
|
|
|
|
|
|
+ addArtists.setIcon(new ImageIcon(getClass().getResource("/add.png")));
|
|
|
addArtists.setForeground(new Color(51,51,51));
|
|
addArtists.setForeground(new Color(51,51,51));
|
|
|
addArtists.addMouseListener(new MouseListener() {
|
|
addArtists.addMouseListener(new MouseListener() {
|
|
|
@Override
|
|
@Override
|
|
@@ -298,7 +348,7 @@ public class ActDialogPanel extends JDialog{
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
JLabel removeButton = new JLabel();
|
|
JLabel removeButton = new JLabel();
|
|
|
- removeButton.setIcon(new ImageIcon("E:\\Bibliotheek\\Documenten\\Workspaces\\FestivalPlanner\\res\\remove.png"));
|
|
|
|
|
|
|
+ removeButton.setIcon(new ImageIcon(getClass().getResource("/remove.png")));
|
|
|
removeButton.addMouseListener(new MouseListener() {
|
|
removeButton.addMouseListener(new MouseListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void mouseClicked(MouseEvent e) {
|
|
public void mouseClicked(MouseEvent e) {
|
|
@@ -379,7 +429,7 @@ public class ActDialogPanel extends JDialog{
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.act == null){
|
|
if(this.act == null){
|
|
|
- Act act = new Act(this.name.getText(), (Stage) this.stageComboBox.getSelectedItem(), this.genre.getText(), new ActTime(this.beginTime.getText(), this.endTime.getText()), artists);
|
|
|
|
|
|
|
+ Act act = new Act(this.name.getText(), (Stage) this.stageComboBox.getSelectedItem(), this.genre.getText(), new ActTime(this.beginTime.getText(), this.endTime.getText()), this.getSelectedButtonNumber() ,artists);
|
|
|
this.model.addElement(act);
|
|
this.model.addElement(act);
|
|
|
this.agenda.addAct(act);
|
|
this.agenda.addAct(act);
|
|
|
}else{
|
|
}else{
|
|
@@ -388,18 +438,31 @@ public class ActDialogPanel extends JDialog{
|
|
|
this.act.setStage((Stage) this.stageComboBox.getSelectedItem());
|
|
this.act.setStage((Stage) this.stageComboBox.getSelectedItem());
|
|
|
this.act.setArtists(artists);
|
|
this.act.setArtists(artists);
|
|
|
this.act.setTime(new ActTime(this.beginTime.getText(), this.endTime.getText()));
|
|
this.act.setTime(new ActTime(this.beginTime.getText(), this.endTime.getText()));
|
|
|
|
|
+ this.act.setPopularity(this.getSelectedButtonNumber());
|
|
|
|
|
+ this.act.setActTime(new ActTime(this.beginTime.getText(), this.endTime.getText()));
|
|
|
this.model.removeElement(this.act);
|
|
this.model.removeElement(this.act);
|
|
|
this.model.addElement(act);
|
|
this.model.addElement(act);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
System.out.println(act);
|
|
System.out.println(act);
|
|
|
dispose();
|
|
dispose();
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void cancel(){
|
|
private void cancel(){
|
|
|
dispose();
|
|
dispose();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private int getSelectedButtonNumber(){
|
|
|
|
|
+
|
|
|
|
|
+ Enumeration<AbstractButton> buttons = this.radioButtons.getElements();
|
|
|
|
|
+
|
|
|
|
|
+ while(buttons.hasMoreElements()){
|
|
|
|
|
+ AbstractButton button = buttons.nextElement();
|
|
|
|
|
+ if(button.isSelected()){
|
|
|
|
|
+ return Integer.valueOf(button.getText());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class ArtistCellRenderer extends JLabel implements ListCellRenderer {
|
|
class ArtistCellRenderer extends JLabel implements ListCellRenderer {
|