Exemplo n.º 1
0
  /**
   * Gets the timestamp for the scene and creates a label on the panel that displays the timestamp
   *
   * @return
   */
  private JLabel addSceneTimeTextToPanel() {
    JLabel label = new JLabel();
    if (scene.hasSceneTs()) {
      DateFormat formatter = I18N.getDateTimeFormatter();
      label.setText(formatter.format(scene.getSceneTs()));
    } else {
      // Add the date of scenes with relative dates to the panel
      if (scene.hasRelativeScene()) {
        BookModel model = mainFrame.getBookModel();
        Session session = model.beginTransaction();
        SceneDAOImpl dao = new SceneDAOImpl(session);
        // Get all scenes from the book
        Scene relative = dao.findRealtiveScene(scene.getRelativeSceneId());
        session.close();
        // Create the timestamp for the relative date
        Timestamp ts = relative.getSceneTs();
        Calendar cal = Calendar.getInstance();
        cal.setTime(ts);
        cal.add(Calendar.DAY_OF_WEEK, scene.getRelativeDateDifference());
        ts.setTime(cal.getTime().getTime());
        DateFormat formatter = I18N.getDateTimeFormatter();
        label.setText("[" + formatter.format(ts) + "]");
      }
    }

    return label;
  }
Exemplo n.º 2
0
  @Override
  public void modelPropertyChange(PropertyChangeEvent evt) {
    // Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propName = evt.getPropertyName();

    if (BookController.StrandProps.UPDATE.check(propName)) {
      EntityUtil.refresh(mainFrame, scene.getStrand());
      setEndBgColor(scene.getStrand().getJColor());
      repaint();
      return;
    }

    if (BookController.SceneProps.UPDATE.check(propName)) {
      Scene newScene = (Scene) newValue;
      if (!newScene.getId().equals(scene.getId())) {
        // not this scene
        return;
      }
      scene = newScene;
      lbSceneNo.setText(scene.getChapterSceneNo(false));
      lbSceneNo.setToolTipText(scene.getChapterSceneToolTip());
      lbStatus.setIcon(scene.getStatusIcon());
      taTitle.setText(scene.getTitle());
      taTitle.setCaretPosition(0);
      tcText.setText(scene.getSummary());
      tcText.setCaretPosition(0);
      if (scene.hasSceneTs()) {
        if (!DateUtil.isZeroTimeDate(scene.getSceneTs())) {
          DateFormat formatter = I18N.getDateTimeFormatter();
          lbTime.setText(formatter.format(scene.getSceneTs()));
        } else {
          lbTime.setText("");
        }
      }
      return;
    }

    if (BookController.ChronoViewProps.ZOOM.check(propName)) {
      setZoomedSize((Integer) newValue);
      refresh();
    }
  }
Exemplo n.º 3
0
 public ChronoScenePanel(MainFrame mainFrame, Scene scene) {
   super(mainFrame, scene, true, Color.white, scene.getStrand().getJColor());
   init();
   initUi();
 }