Esempio n. 1
0
  @Override
  public void initUi() {
    try {
      MigLayout layout = new MigLayout("insets 1", "[fill,grow]", "[top][fill,grow]");
      setLayout(layout);
      setOpaque(false);

      // date
      StrandDateLabel lbDate = new StrandDateLabel(strand, date);
      add(lbDate, "wrap");

      // scenes by strand and date
      BookModel model = mainFrame.getBookModel();
      Session session = model.beginTransaction();
      SceneDAOImpl sceneDao = new SceneDAOImpl(session);
      List<Scene> sceneList = sceneDao.findByStrandAndDate(strand, date);
      model.commit();
      if (sceneList.isEmpty()) {
        SpacePanel spacePanel = new SpacePanel(mainFrame, strand, date);
        add(spacePanel, "grow");
      } else {
        MigLayout layout2 = new MigLayout("insets 0", "[]", "[top]");
        JPanel colPanel = new JPanel(layout2);
        colPanel.setOpaque(false);
        for (Scene scene : sceneList) {
          ChronoScenePanel csp = new ChronoScenePanel(mainFrame, scene);
          colPanel.add(csp, "grow");
        }
        add(colPanel, "grow");
      }
    } catch (Exception e) {
    }
  }
Esempio n. 2
0
 private CategoryDataset createDataset() {
   DefaultCategoryDataset setCategory = new DefaultCategoryDataset();
   try {
     Part part = this.mainFrame.getCurrentPart();
     BookModel model = this.mainFrame.getBookModel();
     Session session = model.beginTransaction();
     StrandDAOImpl daoStrand = new StrandDAOImpl(session);
     List strands = daoStrand.findAll();
     SceneDAOImpl daoScene = new SceneDAOImpl(session);
     List scenes = daoScene.findDistinctDates(part);
     double d = 0.0D;
     Iterator iStrand = strands.iterator();
     while (iStrand.hasNext()) {
       Strand strand = (Strand) iStrand.next();
       Iterator iScene = scenes.iterator();
       while (iScene.hasNext()) {
         Date date = (Date) iScene.next();
         long l = daoStrand.countByDate(date, strand);
         setCategory.addValue(l, strand, date);
         d += l;
       }
     }
     model.commit();
     this.average = (d / (strands.size() + scenes.size()));
   } catch (Exception exc) {
     System.err.println("StrandsByDateChart.createDataset() Exception : " + exc.getMessage());
   }
   return setCategory;
 }
Esempio n. 3
0
 @SuppressWarnings("unchecked")
 private JTable createTable() {
   Part part = this.mainFrame.getCurrentPart();
   BookModel documentModel = this.mainFrame.getBookModel();
   Session session = documentModel.beginTransaction();
   PersonDAOImpl personDAO = new PersonDAOImpl(session);
   List<Person> persons = personDAO.findByCategories(this.selectedCategories);
   SceneDAOImpl sceneDAO = new SceneDAOImpl(session);
   List<Date> dates = sceneDAO.findDistinctDates(part);
   LocationDAOImpl locationDAO = new LocationDAOImpl(session);
   List<Location> locations = locationDAO.findAll();
   documentModel.commit();
   Object[] arrayOfObject1 =
       ArrayUtils.addAll(new Object[] {I18N.getMsg("msg.common.location"), ""}, dates.toArray());
   this.foundCharacters.clear();
   ArrayList localArrayList = new ArrayList();
   Iterator<Location> locationsIterator = locations.iterator();
   while (locationsIterator.hasNext()) {
     Location location = locationsIterator.next();
     Object[] localObject2 = new Object[arrayOfObject1.length];
     int j = 0;
     localObject2[(j++)] = location.getName();
     localObject2[(j++)] = location.getCountryCity();
     int m = 0;
     Iterator<Date> datesIterator = dates.iterator();
     while (datesIterator.hasNext()) {
       Date localDate = datesIterator.next();
       WiWWContainer localWiWWContainer =
           new WiWWContainer(this.mainFrame, localDate, location, persons);
       localObject2[j] = localWiWWContainer;
       if (localWiWWContainer.isFound()) {
         this.foundCharacters.addAll(localWiWWContainer.getCharacterList());
         m = 1;
       }
       j++;
     }
     if (m != 0) {
       localArrayList.add(localObject2);
     }
   }
   //	Object[] localObject1 = new Object[localArrayList.size()][];
   //	int i = 0;
   /* Obfuscator ?
   Object localObject2 = localArrayList.iterator();
   while (((Iterator) localObject2).hasNext()) {
   	Object[] arrayOfObject2 = (Object[]) ((Iterator) localObject2).next();
   	localObject1[(i++)] = arrayOfObject2;
   }*/
   ReadOnlyTable jTable =
       new ReadOnlyTable((Object[][]) localArrayList.toArray(new Object[0][]), arrayOfObject1);
   for (int k = 2; k < jTable.getColumnCount(); k++) {
     TableColumn localTableColumn = jTable.getColumnModel().getColumn(k);
     localTableColumn.setPreferredWidth(120);
     localTableColumn.setCellRenderer(new WiWWTableCellRenderer());
   }
   jTable.setAutoResizeMode(0);
   jTable.getTableHeader().setReorderingAllowed(false);
   return jTable;
 }
 @SuppressWarnings("unchecked")
 private JTable createTable() {
   Part part = mainFrame.getCurrentPart();
   BookModel model = mainFrame.getBookModel();
   Session session = model.beginTransaction();
   PersonDAOImpl personDAO = new PersonDAOImpl(session);
   List persons = personDAO.findByCategories(selectedCategories);
   SceneDAOImpl sceneDAO = new SceneDAOImpl(session);
   List scenes = sceneDAO.findByPart(part);
   model.commit();
   String[] string1 = new String[scenes.size() + 1];
   string1[0] = "";
   int i = 1;
   Object scenesIterator = scenes.iterator();
   while (((Iterator) scenesIterator).hasNext()) {
     Scene scene = (Scene) ((Iterator) scenesIterator).next();
     string1[i] = ((Scene) scene).getChapterSceneNo(false);
     i++;
   }
   scenesIterator = new ArrayList();
   String[] string2 = new String[scenes.size() + 1];
   Iterator personsIterator = persons.iterator();
   Object localObject6;
   while (personsIterator.hasNext()) {
     Person person = (Person) personsIterator.next();
     int j = 0;
     Object[] string3 = new Object[scenes.size() + 1];
     string3[(j++)] = person.getAbbreviation();
     int n = 0;
     localObject6 = scenes.iterator();
     while (((Iterator) localObject6).hasNext()) {
       Scene localScene = (Scene) ((Iterator) localObject6).next();
       if (localScene.getPersons().contains(person)) {
         n = 1;
         string3[j] = ColorUtil.darker(localScene.getStrand().getJColor(), 0.05D);
       } else {
         string3[j] = null;
       }
       string2[j] = HtmlUtil.wrapIntoTable(localScene.getTitleText(true, 500));
       j++;
     }
     if ((cbShowUnusedPersons == null) || (cbShowUnusedPersons.isSelected()) || (n != 0)) {
       ((List) scenesIterator).add(string3);
     }
   }
   Object[][] localObject31 = new Object[((List) scenesIterator).size()][];
   i = 0;
   Iterator localObject4 = ((List) scenesIterator).iterator();
   while (((Iterator) localObject4).hasNext()) {
     Object[] arrayOfObject1 = (Object[]) ((Iterator) localObject4).next();
     localObject31[(i++)] = arrayOfObject1;
   }
   JTable ntable = new ReadOnlyTable((Object[][]) localObject31, string1);
   if (ntable.getModel().getRowCount() == 0) {
     return ntable;
   }
   ntable.getColumnModel().getColumn(0).setPreferredWidth(200);
   ntable.getColumnModel().getColumn(0).setCellRenderer(new HeaderTableCellRenderer());
   for (int k = 1; k < ntable.getColumnCount(); k++) {
     int m = ntable.getColumnModel().getColumn(k).getModelIndex();
     Object localObject5 = ntable.getModel().getValueAt(0, m);
     localObject6 = ntable.getColumnModel().getColumn(k);
     if ((localObject5 == null) || ((localObject5 instanceof Color))) {
       ((TableColumn) localObject6).setPreferredWidth(colWidth);
       ((TableColumn) localObject6).setCellRenderer(new ColorTableCellRenderer(false));
     }
   }
   ntable.setAutoResizeMode(0);
   ntable.getTableHeader().setReorderingAllowed(false);
   ToolTipHeader localToolTipHeader = new ToolTipHeader(ntable.getColumnModel());
   localToolTipHeader.setToolTipStrings((String[]) string2);
   localToolTipHeader.setToolTipText("Default ToolTip TEXT");
   ntable.setTableHeader(localToolTipHeader);
   return ntable;
 }