Пример #1
0
 public void generateMagnifiedTileBar(ArrayList<Integer> selectedChapters) {
   hasBeenMagnified = true;
   this.removeAll();
   tileBar.removeAll();
   int accumulator = 0;
   for (int i = 0; i < selectedChapters.size(); i++) {
     chapterTiles.get(selectedChapters.get(i)).magnifyTileBar(magnification);
     chapterTiles
         .get(selectedChapters.get(i))
         .setBounds(
             moveX + (offSetBetweenTiles * i + accumulator) * magnification,
             moveY,
             ((selected.getChapter(selectedChapters.get(i)).getEnd()
                         - selected.getChapter(selectedChapters.get(i)).getStart())
                     + 1)
                 * magnification,
             52);
     ArrayList<Chapter> subChapters =
         chapterTiles.get(selectedChapters.get(i)).getChapter().getSubChapters();
     for (Chapter c : subChapters) {
       // Add the two ticks(top/bottom)
       JPanel topMarker = new JPanel();
       topMarker.setBackground(Color.GRAY);
       topMarker.setBounds(
           new Rectangle(
               (moveX
                   + (c.getStart()
                           - chapterTiles.get(selectedChapters.get(i)).getChapter().getStart()
                           + offSetBetweenTiles * i
                           + accumulator)
                       * magnification),
               moveY - markerLength,
               1,
               markerLength));
       this.add(topMarker);
       JPanel bottomMarker = new JPanel();
       bottomMarker.setBackground(Color.GRAY);
       bottomMarker.setBounds(
           (moveX
               + (c.getStart()
                       - chapterTiles.get(selectedChapters.get(i)).getChapter().getStart()
                       + offSetBetweenTiles * i
                       + accumulator)
                   * magnification),
           52 + moveY,
           1,
           markerLength);
       this.add(bottomMarker);
     }
     accumulator +=
         selected.getChapter(selectedChapters.get(i)).getEnd()
             - selected.getChapter(selectedChapters.get(i)).getStart()
             + 1;
     tileBar.add(chapterTiles.get(selectedChapters.get(i)));
     this.add(chapterTiles.get(selectedChapters.get(i)));
   }
 }
Пример #2
0
 public void instantiateTileBarView(
     ArrayList<Term> query1,
     ArrayList<Term> query2,
     ArrayList<Term> query3,
     ArrayList<String> query1Strings,
     ArrayList<String> query2Strings,
     ArrayList<String> query3Strings) {
   if (selected != null) {
     int numChapters = selected.getNumChapters();
     Tile chapter;
     Chapter chap;
     // Build the tilebar structure itself.
     for (int i = 0; i < numChapters; i++) {
       chap = selected.getChapter(i);
       chapter =
           new Tile(chap, menu, this, chap.getStart(), chap.getEnd(), moveX, moveY, bookNumber);
       chapter.setBounds(
           chap.getStart() + moveX + offSetBetweenTiles * i,
           moveY,
           (chap.getEnd() - chap.getStart()) + 1,
           52);
       chapter.setTitleColor(Color.BLACK);
       ArrayList<Chapter> subChapters = chap.getSubChapters();
       /*
       for(Chapter c : subChapters){
       	//Add the two sub chapter ticks(top/bottom)
       	JPanel topMarker = new JPanel();
       	topMarker.setBackground(Color.GRAY);
       	topMarker.setBounds(new Rectangle(c.getStart()+moveX+offSetBetweenTiles*i,moveY-markerLength,1,markerLength));
       	this.add(topMarker);
       	JPanel bottomMarker = new JPanel();
       	bottomMarker.setBackground(Color.GRAY);
       	bottomMarker.setBounds(c.getStart()+moveX+offSetBetweenTiles*i, 52+moveY, 1, markerLength);
       	this.add(bottomMarker);
       }
       */
       chapterTiles.add(chapter);
       // frame.add(chapter);
       tileBar.add(chapter);
       this.add(chapter);
     }
     if (query1Strings.size() != 0) {
       textInformation += "Red Terms:\n";
     }
     updateTilebarWithQuery(query1, query1Strings, 1);
     if (query2Strings.size() != 0) {
       textInformation += "Green Terms:\n";
     }
     updateTilebarWithQuery(query2, query2Strings, 2);
     if (query3Strings.size() != 0) {
       textInformation += "Blue Terms:\n";
     }
     updateTilebarWithQuery(query3, query3Strings, 3);
   } else {
     // TODO: Error processing here.
   }
 }