Ording by start time

This commit is contained in:
Yorick
2015-02-24 21:53:22 +00:00
parent ddd9435e4f
commit 0ce2e7e6e9
+55 -13
View File
@@ -65,9 +65,36 @@ public class Timeline extends JPanel
for(Stage stage : stages) for(Stage stage : stages)
{ {
StagePanel stagepanel = new StagePanel(calcshit(stage.getLength()), 30, 100); StagePanel stagepanel = new StagePanel(calcLengthOfStage(stage.getLength()), 30, calcshit(stage.getStartTime()));
Container content = stagepanel; Container content = stagepanel;
content.setMaximumSize(new Dimension(frame.getWidth() - 70,30)); content.setMaximumSize(new Dimension(frame.getWidth() - 70,30));
content.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
resizeTimeline();
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseClicked(MouseEvent e) {
}
});
content.addMouseMotionListener(new MouseMotionListener() { content.addMouseMotionListener(new MouseMotionListener() {
@Override @Override
@@ -87,23 +114,36 @@ public class Timeline extends JPanel
this.add(centerPanel, BorderLayout.CENTER); this.add(centerPanel, BorderLayout.CENTER);
} }
public void resizeTimeline()
{
}
//testcode
public int calcLengthOfStage(int length)
{
double lengthOfStage = 0;
int min = test(1);
int max = test(2);
double frameWidth = frame.getWidth();
double pixelsPerLength = frameWidth / (max - min);
// System.out.println(pixelsPerLength);
lengthOfStage = pixelsPerLength * (double)length;
// System.out.println(length);
System.out.println(lengthOfStage);
return (int)lengthOfStage;
}
//Testcode //Testcode
public int calcshit(int lengthInHours) public int calcshit(int startTime)
{ {
int posx = 0; int posx = 0;
int min = test(1); int min = test(1);
int max = test(2); int max = test(2);
int timeSpan = max - min; posx = startTime - min;
return posx;
System.out.println(timeSpan);
return 10;
} }
//testcode //testcode
@@ -214,8 +254,10 @@ public class Timeline extends JPanel
stages.add(stage1); stages.add(stage1);
Stage stage2 = new Stage(performances, 100, null, 1700, 1900); Stage stage2 = new Stage(performances, 100, null, 1700, 1900);
Stage stage3 = new Stage(performances, 100, null, 1600, 1800); Stage stage3 = new Stage(performances, 100, null, 1600, 1800);
Stage stage4 = new Stage(performances, 100, null, 1600, 2100);
stages.add(stage3); stages.add(stage3);
stages.add(stage2); stages.add(stage2);
// stages.add(stage4);
} }