Exemplo n.º 1
0
 /** aggiunge una pagina al diario passato */
 public static Diary addPageToDiary(Diary mDiary, Page mPage) {
   mCurrentDiary = mDiary;
   Hashtable<Long, Page> mPages = mCurrentDiary.getDiaryPages();
   int mPageNumber = mPages.size();
   mPage.setPageNumber(mPageNumber);
   mPage.setDiaryID(mCurrentDiary.getDiaryID());
   mPages.put(mPage.getPageID(), mPage);
   return mCurrentDiary;
 }
Exemplo n.º 2
0
  /**
   * inizializza una pagina vuota del Nuovo Diario
   *
   * <p>*
   */
  private static Hashtable<Long, Page> newPagesBuilder() {
    Date mDate = new Date();
    SimpleDateFormat oDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    long mPageID = 0;
    try {
      mPageID = Long.parseLong(oDateFormat.format(mDate));
    } catch (NumberFormatException e) {
      mPageID = 0;
    }
    Hashtable<Long, Page> mPages = new Hashtable<Long, Page>();
    Page mPage = new Page();
    mPage.setDiaryID(mCurrentDiary.getDiaryID());
    mPage.setPageID(mPageID);
    mPage.setPageDTCreation(new Date());
    mPage.setPageNumber(1);
    mPage.setDiaryImage(newImagesBuilder());
    mPage.setPageRows(newRowsBuilder());

    mPages.put(mPageID, mPage);

    return mPages;
  }