Changeset 158
- Timestamp:
- 03/08/07 22:01:09 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dmp/trunk/gwt-windows-1.3.3/src/DMP/client/DMPWebsite.java
r135 r158 2 2 3 3 import com.google.gwt.core.client.EntryPoint; 4 import com.google.gwt.core.client.GWT; 4 5 import com.google.gwt.user.client.ui.*; 5 import com.google.gwt.core.client.GWT;6 6 import com.google.gwt.user.client.rpc.*; 7 import com.google.gwt.user.client. Timer;7 import com.google.gwt.user.client.*; 8 8 import java.util.Vector; 9 9 import java.util.HashMap; … … 19 19 SongTable playing = new PlayingTable(this); 20 20 DockPanel mainPanel = new DockPanel(); 21 FocusPanel flashPanel = new FocusPanel(); 21 22 // the panel containing the flash movie and navigation links 23 DeckPanel flashPanel; 24 22 25 int currentMusicDuration = 0; 23 26 Date currentSongStart = null; 24 27 String testString = "This is a test."; 25 28 26 29 public void onClick(Widget w) … … 73 76 String moduleRelativeURL = GWT.getModuleBaseURL() + "music"; 74 77 endpoint.setServiceEntryPoint(moduleRelativeURL); 75 78 Window.setTitle("Rubicon"); 79 80 //init javascript methods 81 initJavascriptAPI(this); 82 76 83 getSongsFromCollection(); 77 84 … … 90 97 91 98 HorizontalPanel topPanel = new HorizontalPanel(); 92 Image logo = new Image(); 99 100 // sets the logo picture 101 Image logo = new Image("C:\\Documents and Settings\\Beverly Fitzpatrick\\My" + 102 " Documents\\Visual Studio 2005\\Projects\\DMPGraphics\\Rubicon Logo Final.png"); 103 logo.setPixelSize(189, 74); //resize the logo to a resonable sizing 93 104 topPanel.add(logo); 105 106 // the panel containing the flash movie and html navigation links 107 flashPanel = new DeckPanel(); 108 Hyperlink nextSongLink = new Hyperlink("Next Song",false,""); 109 nextSongLink.addClickListener(new ClickListener(){ 110 public void onClick(Widget w) 111 { 112 playNextSong(); 113 } 114 }); 115 flashPanel.add(nextSongLink); 116 GWT.log(nextSongLink.getElement().toString(), null); 117 SimplePanel placeholder = new SimplePanel(); 118 flashPanel.add(placeholder); // add a blank panel as a placeholder 119 flashPanel.showWidget(flashPanel.getWidgetIndex(placeholder)); 94 120 topPanel.add(flashPanel); 121 122 // button to refresh songs from the collection 95 123 Button refreshButton = new Button("Refresh"); 96 124 refreshButton.addClickListener(new ClickListener(){ … … 143 171 public void playNextSong() 144 172 { 173 GWT.log("playNextSong in DMPWebsite", null); 145 174 final boolean firstSong = (currentMusicDuration == 0); 146 175 musicServ.getNextSong(new AsyncCallback(){ … … 158 187 return; 159 188 } 160 HTML flash = new HTML("<object width=\"100\" height=\"100\">" + 189 Widget lastFlash = flashPanel.getWidget(flashPanel.getVisibleWidget()); 190 flashPanel.remove(lastFlash); //remove the last flash movie 191 HTML flash = new HTML("<object width=\"50\" height=\"50\">" + 161 192 "<param name=\"movie\" value=\"" + path + "\"><PARAM NAME=loop VALUE=\"false\">" + 162 193 "<PARAM NAME=menu VALUE=\"true\">" + 163 194 "<embed src=\"" + path + 164 "\" width=\" 100\" height=\"100\" loop=\"false\" menu=\"true\">" +195 "\" width=\"50\" height=\"50\" loop=\"false\" menu=\"true\">" + 165 196 "</embed></object>"); 166 flashPanel.setWidget(flash); 197 flashPanel.add(flash); 198 flashPanel.showWidget(flashPanel.getWidgetIndex(flash)); // make sure we're showing the movie 167 199 currentMusicDuration = Double.valueOf((String)song.get("duration")).intValue(); 168 200 if(firstSong) 169 201 { 170 Timer nextSong = new NextSongTimer();171 nextSong.schedule(currentMusicDuration);202 //Timer nextSong = new NextSongTimer(); 203 //nextSong.schedule(currentMusicDuration); 172 204 } 173 205 playing.removeSong(song.get("id")); … … 215 247 } 216 248 } 249 250 /** 251 * Javascript initialization method. 252 */ 253 public native void initJavascriptAPI(DMPWebsite site)/*-{ 254 $wnd.nextSong = function() { site.@DMP.client.DMPWebsite::playNextSong()(); } 255 }-*/; 217 256 } dmp/trunk/gwt-windows-1.3.3/src/DMP/server/MusicServImpl.java
r135 r158 29 29 private DMPXmlRpcClient client; 30 30 private HashMap<HashMap,File> flashFileHandles = new HashMap<HashMap,File>(); 31 private String graphicsPath = "C:\\Documents and Settings\\Beverly Fitzpatrick\\My" + 32 " Documents\\Visual Studio 2005\\Projects\\DMPGraphics\\"; 31 33 32 34 // testing method … … 46 48 } 47 49 48 // Need to figure out how to notify webpage that the song is now playing49 50 public HashMap getNextSong() 50 51 { … … 55 56 song.put("duration",0); 56 57 return song; 58 } 59 while(!flashFileHandles.containsKey(song)) 60 { 61 try { 62 Thread.sleep(100); 63 } catch (InterruptedException e) { 64 // TODO Auto-generated catch block 65 e.printStackTrace(); 66 } 57 67 } 58 68 File songHandle = flashFileHandles.get(song); … … 209 219 { 210 220 int framesPerSecond = 12; 211 FSMovie musicMov = new FSMovie(new FSBounds(0,0, 930,930),new Float(framesPerSecond).floatValue());221 FSMovie musicMov = new FSMovie(new FSBounds(0,0,1000,1000),new Float(framesPerSecond).floatValue()); 212 222 musicMov.add(new FSSetBackgroundColor(new FSColor(255,200,255))); // random color for testing 223 FSGetUrl nextSongAction = new FSGetUrl("javascript:nextSong()"); 213 224 214 225 // make the sound … … 232 243 233 244 // make the next button 234 String imageBasePath = "C:\\Documents and Settings\\Beverly Fitzpatrick\\My" +235 " Documents\\Visual Studio 2005\\Projects\\DMPGraphics\\";236 245 FSImageConstructor imageMaker = new FSImageConstructor(); 237 246 FSDefineObject nextHover; … … 239 248 FSDefineObject nextPressed; 240 249 try { 241 imageMaker.setImageFromFile( imageBasePath + "Next_hover.png");250 imageMaker.setImageFromFile(graphicsPath + "Next_hover.png"); 242 251 nextHover = imageMaker.defineImage(musicMov.newIdentifier()); 243 imageMaker.setImageFromFile( imageBasePath + "Next_nohover.png");252 imageMaker.setImageFromFile(graphicsPath + "Next_nohover.png"); 244 253 nextNoHover = imageMaker.defineImage(musicMov.newIdentifier()); 245 imageMaker.setImageFromFile( imageBasePath + "Next_pressed.png");254 imageMaker.setImageFromFile(graphicsPath + "Next_pressed.png"); 246 255 nextPressed = imageMaker.defineImage(musicMov.newIdentifier()); 247 256 } catch (IOException e2) { … … 253 262 } 254 263 FSDefineShape3 nextNoHoverShape = imageMaker.defineEnclosingShape(musicMov.newIdentifier(), 255 nextNoHover.getIdentifier(), 0, 0, new FSSolidLine(1,new FSColor( 5,5,5)));264 nextNoHover.getIdentifier(), 0, 0, new FSSolidLine(1,new FSColor(0,0,10))); 256 265 FSDefineShape3 nextHoverShape = imageMaker.defineEnclosingShape(musicMov.newIdentifier(), 257 nextHover.getIdentifier(), 0, 0, n ull);266 nextHover.getIdentifier(), 0, 0, new FSSolidLine(1,new FSColor(10,0,0))); 258 267 FSDefineShape3 nextPressedShape = imageMaker.defineEnclosingShape(musicMov.newIdentifier(), 259 nextPressed.getIdentifier(), 0, 0, n ull);268 nextPressed.getIdentifier(), 0, 0, new FSSolidLine(1,new FSColor(0,10,0))); 260 269 261 270 // make the buttons 262 ArrayList<FSButton> nextButtonImages = new ArrayList<FSButton>(); 263 nextButtonImages.add(new FSButton(FSButton.Up, nextNoHoverShape.getIdentifier(), 2)); 264 nextButtonImages.add(new FSButton(FSButton.Over, nextHoverShape.getIdentifier(), 1)); 265 nextButtonImages.add(new FSButton(FSButton.Down, nextPressedShape.getIdentifier(), 3)); 271 ArrayList<FSButton> nextButtonParts = new ArrayList<FSButton>(); 272 nextButtonParts.add(new FSButton(FSButton.Up, nextNoHoverShape.getIdentifier(), 1)); 273 nextButtonParts.add(new FSButton(FSButton.Over, nextHoverShape.getIdentifier(), 2)); 274 nextButtonParts.add(new FSButton(FSButton.Down, nextPressedShape.getIdentifier(), 3)); 275 nextButtonParts.add(new FSButton(FSButton.Active, nextNoHoverShape.getIdentifier(),4)); 266 276 267 277 // button actions 268 ArrayList nextButtonActions = new ArrayList(); 278 ArrayList<FSActionObject> nextButtonActions = new ArrayList<FSActionObject>(); 279 nextButtonActions.add(new FSGetUrl("javascript:nextSong()")); 269 280 270 281 // define the button and add it to the movie 271 282 FSDefineButton nextButton = new FSDefineButton(musicMov.newIdentifier(), 272 nextButtonImages, nextButtonActions); 283 nextButtonParts, nextButtonActions); 284 nextButton.setButtonRecords(nextButtonParts); 273 285 musicMov.add(nextHover); 274 286 musicMov.add(nextNoHover); … … 279 291 musicMov.add(nextButton); 280 292 musicMov.add(new FSPlaceObject(nextButton.getIdentifier(), 1, 0, 0)); 293 // done making the button and placing it in the movie 281 294 282 295 int samplesPerBlock; … … 298 311 if(i == numberOfBlocks - 1) // adds a stop action to the last frame of the movie 299 312 { 300 ArrayList<FSAction > actions = new ArrayList<FSAction>();313 ArrayList<FSActionObject> actions = new ArrayList<FSActionObject>(); 301 314 actions.add(new FSAction(FSAction.Stop)); 315 actions.add(nextSongAction); 302 316 FSDoAction action = new FSDoAction(actions); 303 317 musicMov.add(action);
