This commit is contained in:
Yorick
2015-02-26 23:58:50 +00:00
parent 18726278a5
commit 9c6b2b44e4
5 changed files with 164 additions and 63 deletions
+32 -17
View File
@@ -8,48 +8,63 @@ import javax.swing.JPanel;
public class TimelinePanel extends JPanel implements Panel {
private Timeline timeline;
// private WestPanel westPanel;
public TimelinePanel()
{
super(new BorderLayout());
this.setSize(1920, 1080);
this.setSize(600, 600);
this.setVisible(true);
timeline = new Timeline(this);
this.add(timeline,BorderLayout.CENTER);
this.add(timeline.createWestPanel(), BorderLayout.WEST);
// westPanel = new WestPanel();
// this.add(timeline.createMainPanel(),BorderLayout.CENTER);
// this.add(new JButton());
// this.add(timeline.createWestPanel(), BorderLayout.WEST);
}
public void refresh()
{
this.removeAll();
this.add(timeline.createMainPanel(),BorderLayout.CENTER);
timeline.refresh();
// westPanel.refresh();
this.add(timeline,BorderLayout.CENTER);
this.add(timeline.createWestPanel(), BorderLayout.WEST);
this.revalidate();
// timeline.refresh();
}
@Override
public void update(ArrayList<Event> events)
{
timeline.setEvents(events);
System.out.println(events.size());
// System.out.println(events.size());
// westPanel.setEvents(events);
// refresh();
// this.add(timeline.createMainPanel(),BorderLayout.CENTER);
// this.add(new JButton());
// this.add(timeline.createWestPanel(), BorderLayout.WEST);
//dit fixt het half
// if(events.size() == 0)
// {
// this.removeAll();
// this.add(timeline.createWestPanel(),BorderLayout.WEST);
// this.add(timeline, BorderLayout.CENTER);
// this.revalidate();
// }
// else
// {
// refresh();
// }
refresh();
if(events.size() != 0)
{
this.removeAll();
timeline.refresh();
this.add(timeline.createWestPanel(),BorderLayout.WEST);
this.add(timeline, BorderLayout.CENTER);
this.revalidate();
}
else
{
this.removeAll();
timeline.createNull();
this.add(timeline);
this.revalidate();
}
}
public TimelinePanel getTimelinePanel()
{
return this;