001 package railo.runtime.tag; 002 003 004 import javax.servlet.jsp.tagext.Tag; 005 006 import railo.runtime.exp.ApplicationException; 007 import railo.runtime.exp.PageException; 008 import railo.runtime.ext.tag.TagSupport; 009 010 /** 011 * implementation of the tag Compiler 012 */ 013 public class VideoPlayerParam extends TagSupport { 014 015 private VideoPlayerParamBean param=new VideoPlayerParamBean(); 016 017 /** 018 * @see javax.servlet.jsp.tagext.Tag#release() 019 */ 020 public void release() { 021 super.release(); 022 param=new VideoPlayerParamBean(); 023 } 024 025 /** 026 * @param video the video to set 027 * @throws PageException 028 */ 029 public void setVideo(String video) throws PageException { 030 param.setVideo(pageContext,video); 031 } 032 033 /** 034 * @param flash the flash to set 035 */ 036 public void setFlash(String flash) throws PageException { 037 param.setFlash(pageContext,flash); 038 } 039 040 /** 041 * @param show the show to set 042 */ 043 public void setShow(String show) throws PageException { 044 param.setShow(show); 045 } 046 047 /** 048 * @param index the index to set 049 * @throws PageException 050 */ 051 public void setIndex(double dIndex) throws PageException { 052 param.setIndex((int) dIndex); 053 } 054 /*public void setAutostart(boolean autostart) { 055 param.setAutostart(autostart); 056 }*/ 057 public void setTitle(String title) { 058 param.setTitle(title); 059 } 060 061 /** 062 * @param preview the preview to set 063 * @throws PageException 064 */ 065 public void setPreview(String preview) throws PageException { 066 param.setImage(pageContext,preview); 067 } 068 public void setImage(String preview) throws PageException { 069 param.setImage(pageContext,preview); 070 } 071 public void setLink(String link) { 072 param.setLink(link); 073 } 074 public void setAuthor(String author) { 075 param.setAuthor(author); 076 } 077 078 /** 079 * @see javax.servlet.jsp.tagext.Tag#doStartTag() 080 */ 081 public int doStartTag() throws PageException { 082 083 if(param.getFlash()==null && param.getVideo()==null) 084 throw new ApplicationException("you have to define video or flash source"); 085 if(param.getFlash()!=null && param.getVideo()!=null) 086 throw new ApplicationException("you can define only one source"); 087 088 089 // get VideoPlayer Tag 090 Tag parent=getParent(); 091 while(parent!=null && !(parent instanceof VideoPlayerJW)) { 092 parent=parent.getParent(); 093 } 094 095 if(parent instanceof VideoPlayerJW) { 096 VideoPlayerJW mail = (VideoPlayerJW)parent; 097 mail.setParam(param); 098 } 099 else { 100 throw new ApplicationException("Wrong Context, tag VideoPlayerParam must be inside a VideoPlayer tag"); 101 } 102 return SKIP_BODY; 103 } 104 105 }