Package org.pdfsam.console.business.dto

Examples of org.pdfsam.console.business.dto.Transition


    }   
   
    for(int j=1; j<=totalPages; j++){
      Object rawTransition = transitionsMap.get(new Integer(j));
      if(rawTransition != null){
        Transition transition = (Transition) rawTransition;
        pdfStamper.setDuration(transition.getDuration(), transition.getPageNumber());
        pdfStamper.setTransition(new PdfTransition(getITextTransition(transition.getTransition()),transition.getTransitionDuration()), transition.getPageNumber());
      }else{
        pdfStamper.setDuration(transitions.getDefaultTransition().getDuration(), j);
        pdfStamper.setTransition(new PdfTransition(getITextTransition(transitions.getDefaultTransition().getTransition()),transitions.getDefaultTransition().getTransitionDuration()), j);
      }
      setPercentageOfWorkDone(((j)*WorkDoneDataModel.MAX_PERGENTAGE)/totalPages);
 
View Full Code Here


          Node defDur = rootNode.selectSingleNode("@defaultduration");
          if(defType != null && defTransDur != null && defDur != null){
            if(transitions.getDefaultTransition() != null){
              throw new SlideShowException(SlideShowException.ERR_DEFAULT_TRANSITION_ALREADY_SET);
            }else{
              transitions.setDefaultTransition(new Transition(Transition.EVERY_PAGE, new Integer(defTransDur.getText().trim()).intValue(), defType.getText().trim(), new Integer(defDur.getText().trim()).intValue()));
            }
          }
          List transitionsList = document.selectNodes("/transitions/transition");
          for (int i = 0; transitionsList != null && i < transitionsList.size(); i++) {
            Node transitionNode = (Node) transitionsList.get(i);
            Node type = transitionNode.selectSingleNode("@type");
            Node transDuration = transitionNode.selectSingleNode("@tduration");
            Node duration = transitionNode.selectSingleNode("@duration");
            Node page = transitionNode.selectSingleNode("@pagenumber");
            if(type != null && transDuration != null && duration != null && page != null){             
              transitions.addTransition(new Transition(new Integer(page.getText().trim()).intValue(), new Integer(transDuration.getText().trim()).intValue(), type.getText().trim(), new Integer(duration.getText().trim()).intValue()));             
            }else{
              throw new SlideShowException(SlideShowException.ERR_READING_TRANSITION, new String[] {i+""});
            }
          }
        }else{
View Full Code Here

          StringParam tOption = (StringParam) cmdLineHandler.getOption(SlideShowParsedCommand.T_ARG);
          if(tOption.isSet()){
            HashSet transitionsList = new HashSet(tOption.getValues().size());
            for(Iterator tIterator = tOption.getValues().iterator(); tIterator.hasNext();){
              String transition = (String) tIterator.next();
              Transition transitionObject = stringToTransition(transition);
              if(!transitionsList.add(transitionObject)){
                throw new SlideShowException(SlideShowException.UNABLE_TO_ADD_TRANSITION, new String[]{transition,transitionObject.toString()});
              }
            }
            parsedCommandDTO.setTransitions((Transition[])transitionsList.toArray(new Transition[transitionsList.size()]));
          }
         
View Full Code Here

   * @param inputString
   * @return corresponding Transition instance
   * @throws ConsoleException
   */
  private Transition stringToTransition(String inputString) throws ConsoleException{
    Transition retVal = null;
    if(inputString!= null && inputString.length()>0){
      String[] transParams = inputString.split(":");
      if(transParams.length>2){
        try{
          String transition = transParams[0];
          int transitionDuration = Integer.parseInt(transParams[1]);
          int duration = Integer.parseInt(transParams[2]);
          int pageNumber = (transParams.length>3)? Integer.parseInt(transParams[3]): Transition.EVERY_PAGE;
          retVal = new Transition(pageNumber, transitionDuration, transition, duration);
        }catch(Exception e){
          throw new SlideShowException(SlideShowException.ERR_BAD_INPUT_STRING, new String[]{inputString}, e);
        }
      }else{
        throw new SlideShowException(SlideShowException.ERR_UNCOMPLETE_INPUT_STRING, new String[]{inputString});
View Full Code Here

TOP

Related Classes of org.pdfsam.console.business.dto.Transition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.