Source Code Cross Referenced for Page1.java in  » IDE-Netbeans » visualweb.api.designer » movieadmin » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » movieadmin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package movieadmin;
043:
044:        import com.sun.data.provider.RowKey;
045:        import com.sun.rave.web.ui.appbase.AbstractPageBean;
046:        import com.sun.webui.jsf.component.Body;
047:        import com.sun.webui.jsf.component.Button;
048:        import com.sun.webui.jsf.component.DropDown;
049:        import com.sun.webui.jsf.component.Form;
050:        import com.sun.webui.jsf.component.Head;
051:        import com.sun.webui.jsf.component.Html;
052:        import com.sun.webui.jsf.component.Label;
053:        import com.sun.webui.jsf.component.Link;
054:        import com.sun.webui.jsf.component.Message;
055:        import com.sun.webui.jsf.component.Page;
056:        import com.sun.webui.jsf.component.StaticText;
057:        import com.sun.webui.jsf.component.Table;
058:        import com.sun.webui.jsf.component.TableColumn;
059:        import com.sun.webui.jsf.component.TableRowGroup;
060:        import com.sun.webui.jsf.component.TextArea;
061:        import com.sun.webui.jsf.component.TextField;
062:        import com.sun.webui.jsf.component.Upload;
063:        import com.sun.webui.jsf.model.UploadedFile;
064:        import java.io.File;
065:        import javax.faces.FacesException;
066:        import javax.faces.component.html.HtmlPanelGrid;
067:        import javax.faces.convert.IntegerConverter;
068:        import javax.faces.event.ValueChangeEvent;
069:        import javax.faces.validator.LongRangeValidator;
070:        import javax.servlet.ServletContext;
071:        import movieslib.Movie;
072:        import movieslib.MovieListDataProvider;
073:
074:        /**
075:         * <p>Page bean that corresponds to a similarly named JSP page.  This
076:         * class contains component definitions (and initialization code) for
077:         * all components that you have defined on this page, as well as
078:         * lifecycle methods and event handlers where you may add behavior
079:         * to respond to incoming events.</p>
080:         */
081:        public class Page1 extends AbstractPageBean {
082:            // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
083:            private int __placeholder;
084:
085:            /**
086:             * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
087:             * This method is automatically generated, so any user-specified code inserted
088:             * here is subject to being replaced.</p>
089:             */
090:            private void _init() throws Exception {
091:                yearRangeValidator.setMaximum(2010);
092:                yearRangeValidator.setMinimum(1895);
093:            }
094:
095:            private Page page1 = new Page();
096:
097:            public Page getPage1() {
098:                return page1;
099:            }
100:
101:            public void setPage1(Page p) {
102:                this .page1 = p;
103:            }
104:
105:            private Html html1 = new Html();
106:
107:            public Html getHtml1() {
108:                return html1;
109:            }
110:
111:            public void setHtml1(Html h) {
112:                this .html1 = h;
113:            }
114:
115:            private Head head1 = new Head();
116:
117:            public Head getHead1() {
118:                return head1;
119:            }
120:
121:            public void setHead1(Head h) {
122:                this .head1 = h;
123:            }
124:
125:            private Link link1 = new Link();
126:
127:            public Link getLink1() {
128:                return link1;
129:            }
130:
131:            public void setLink1(Link l) {
132:                this .link1 = l;
133:            }
134:
135:            private Body body1 = new Body();
136:
137:            public Body getBody1() {
138:                return body1;
139:            }
140:
141:            public void setBody1(Body b) {
142:                this .body1 = b;
143:            }
144:
145:            private Form form1 = new Form();
146:
147:            public Form getForm1() {
148:                return form1;
149:            }
150:
151:            public void setForm1(Form f) {
152:                this .form1 = f;
153:            }
154:
155:            private HtmlPanelGrid mainPanel = new HtmlPanelGrid();
156:
157:            public HtmlPanelGrid getMainPanel() {
158:                return mainPanel;
159:            }
160:
161:            public void setMainPanel(HtmlPanelGrid hpg) {
162:                this .mainPanel = hpg;
163:            }
164:
165:            private HtmlPanelGrid currentViewPanel = new HtmlPanelGrid();
166:
167:            public HtmlPanelGrid getCurrentViewPanel() {
168:                return currentViewPanel;
169:            }
170:
171:            public void setCurrentViewPanel(HtmlPanelGrid hpg) {
172:                this .currentViewPanel = hpg;
173:            }
174:
175:            private HtmlPanelGrid addMoviePanel = new HtmlPanelGrid();
176:
177:            public HtmlPanelGrid getAddMoviePanel() {
178:                return addMoviePanel;
179:            }
180:
181:            public void setAddMoviePanel(HtmlPanelGrid hpg) {
182:                this .addMoviePanel = hpg;
183:            }
184:
185:            private HtmlPanelGrid moviesTablePanel = new HtmlPanelGrid();
186:
187:            public HtmlPanelGrid getMoviesTablePanel() {
188:                return moviesTablePanel;
189:            }
190:
191:            public void setMoviesTablePanel(HtmlPanelGrid hpg) {
192:                this .moviesTablePanel = hpg;
193:            }
194:
195:            private Label label1 = new Label();
196:
197:            public Label getLabel1() {
198:                return label1;
199:            }
200:
201:            public void setLabel1(Label l) {
202:                this .label1 = l;
203:            }
204:
205:            private DropDown currentGenre = new DropDown();
206:
207:            public DropDown getCurrentGenre() {
208:                return currentGenre;
209:            }
210:
211:            public void setCurrentGenre(DropDown dd) {
212:                this .currentGenre = dd;
213:            }
214:
215:            private Table movies = new Table();
216:
217:            public Table getMovies() {
218:                return movies;
219:            }
220:
221:            public void setMovies(Table t) {
222:                this .movies = t;
223:            }
224:
225:            private TableRowGroup tableRowGroup1 = new TableRowGroup();
226:
227:            public TableRowGroup getTableRowGroup1() {
228:                return tableRowGroup1;
229:            }
230:
231:            public void setTableRowGroup1(TableRowGroup trg) {
232:                this .tableRowGroup1 = trg;
233:            }
234:
235:            private Button update = new Button();
236:
237:            public Button getUpdate() {
238:                return update;
239:            }
240:
241:            public void setUpdate(Button b) {
242:                this .update = b;
243:            }
244:
245:            private Label label2 = new Label();
246:
247:            public Label getLabel2() {
248:                return label2;
249:            }
250:
251:            public void setLabel2(Label l) {
252:                this .label2 = l;
253:            }
254:
255:            private Label label3 = new Label();
256:
257:            public Label getLabel3() {
258:                return label3;
259:            }
260:
261:            public void setLabel3(Label l) {
262:                this .label3 = l;
263:            }
264:
265:            private Label label4 = new Label();
266:
267:            public Label getLabel4() {
268:                return label4;
269:            }
270:
271:            public void setLabel4(Label l) {
272:                this .label4 = l;
273:            }
274:
275:            private Label label5 = new Label();
276:
277:            public Label getLabel5() {
278:                return label5;
279:            }
280:
281:            public void setLabel5(Label l) {
282:                this .label5 = l;
283:            }
284:
285:            private Label label6 = new Label();
286:
287:            public Label getLabel6() {
288:                return label6;
289:            }
290:
291:            public void setLabel6(Label l) {
292:                this .label6 = l;
293:            }
294:
295:            private Label label7 = new Label();
296:
297:            public Label getLabel7() {
298:                return label7;
299:            }
300:
301:            public void setLabel7(Label l) {
302:                this .label7 = l;
303:            }
304:
305:            private Label label8 = new Label();
306:
307:            public Label getLabel8() {
308:                return label8;
309:            }
310:
311:            public void setLabel8(Label l) {
312:                this .label8 = l;
313:            }
314:
315:            private DropDown addGenre = new DropDown();
316:
317:            public DropDown getAddGenre() {
318:                return addGenre;
319:            }
320:
321:            public void setAddGenre(DropDown dd) {
322:                this .addGenre = dd;
323:            }
324:
325:            private Message message1 = new Message();
326:
327:            public Message getMessage1() {
328:                return message1;
329:            }
330:
331:            public void setMessage1(Message m) {
332:                this .message1 = m;
333:            }
334:
335:            private TextField addTitle = new TextField();
336:
337:            public TextField getAddTitle() {
338:                return addTitle;
339:            }
340:
341:            public void setAddTitle(TextField tf) {
342:                this .addTitle = tf;
343:            }
344:
345:            private Message message2 = new Message();
346:
347:            public Message getMessage2() {
348:                return message2;
349:            }
350:
351:            public void setMessage2(Message m) {
352:                this .message2 = m;
353:            }
354:
355:            private TextField addYear = new TextField();
356:
357:            public TextField getAddYear() {
358:                return addYear;
359:            }
360:
361:            public void setAddYear(TextField tf) {
362:                this .addYear = tf;
363:            }
364:
365:            private Message message3 = new Message();
366:
367:            public Message getMessage3() {
368:                return message3;
369:            }
370:
371:            public void setMessage3(Message m) {
372:                this .message3 = m;
373:            }
374:
375:            private TextField addLength = new TextField();
376:
377:            public TextField getAddLength() {
378:                return addLength;
379:            }
380:
381:            public void setAddLength(TextField tf) {
382:                this .addLength = tf;
383:            }
384:
385:            private Message message4 = new Message();
386:
387:            public Message getMessage4() {
388:                return message4;
389:            }
390:
391:            public void setMessage4(Message m) {
392:                this .message4 = m;
393:            }
394:
395:            private DropDown addRating = new DropDown();
396:
397:            public DropDown getAddRating() {
398:                return addRating;
399:            }
400:
401:            public void setAddRating(DropDown dd) {
402:                this .addRating = dd;
403:            }
404:
405:            private Message message5 = new Message();
406:
407:            public Message getMessage5() {
408:                return message5;
409:            }
410:
411:            public void setMessage5(Message m) {
412:                this .message5 = m;
413:            }
414:
415:            private Message message6 = new Message();
416:
417:            public Message getMessage6() {
418:                return message6;
419:            }
420:
421:            public void setMessage6(Message m) {
422:                this .message6 = m;
423:            }
424:
425:            private TextArea addDescription = new TextArea();
426:
427:            public TextArea getAddDescription() {
428:                return addDescription;
429:            }
430:
431:            public void setAddDescription(TextArea ta) {
432:                this .addDescription = ta;
433:            }
434:
435:            private Message message7 = new Message();
436:
437:            public Message getMessage7() {
438:                return message7;
439:            }
440:
441:            public void setMessage7(Message m) {
442:                this .message7 = m;
443:            }
444:
445:            private StaticText staticText4 = new StaticText();
446:
447:            public StaticText getStaticText4() {
448:                return staticText4;
449:            }
450:
451:            public void setStaticText4(StaticText st) {
452:                this .staticText4 = st;
453:            }
454:
455:            private StaticText staticText5 = new StaticText();
456:
457:            public StaticText getStaticText5() {
458:                return staticText5;
459:            }
460:
461:            public void setStaticText5(StaticText st) {
462:                this .staticText5 = st;
463:            }
464:
465:            private Button add = new Button();
466:
467:            public Button getAdd() {
468:                return add;
469:            }
470:
471:            public void setAdd(Button b) {
472:                this .add = b;
473:            }
474:
475:            private StaticText staticText6 = new StaticText();
476:
477:            public StaticText getStaticText6() {
478:                return staticText6;
479:            }
480:
481:            public void setStaticText6(StaticText st) {
482:                this .staticText6 = st;
483:            }
484:
485:            private LongRangeValidator yearRangeValidator = new LongRangeValidator();
486:
487:            public LongRangeValidator getYearRangeValidator() {
488:                return yearRangeValidator;
489:            }
490:
491:            public void setYearRangeValidator(LongRangeValidator lrv) {
492:                this .yearRangeValidator = lrv;
493:            }
494:
495:            private LongRangeValidator lengthRangeValidator = new LongRangeValidator();
496:
497:            public LongRangeValidator getLengthRangeValidator() {
498:                return lengthRangeValidator;
499:            }
500:
501:            public void setLengthRangeValidator(LongRangeValidator lrv) {
502:                this .lengthRangeValidator = lrv;
503:            }
504:
505:            private TableColumn tableColumn1 = new TableColumn();
506:
507:            public TableColumn getTableColumn1() {
508:                return tableColumn1;
509:            }
510:
511:            public void setTableColumn1(TableColumn tc) {
512:                this .tableColumn1 = tc;
513:            }
514:
515:            private TextField textField1 = new TextField();
516:
517:            public TextField getTextField1() {
518:                return textField1;
519:            }
520:
521:            public void setTextField1(TextField tf) {
522:                this .textField1 = tf;
523:            }
524:
525:            private TableColumn tableColumn2 = new TableColumn();
526:
527:            public TableColumn getTableColumn2() {
528:                return tableColumn2;
529:            }
530:
531:            public void setTableColumn2(TableColumn tc) {
532:                this .tableColumn2 = tc;
533:            }
534:
535:            private DropDown dropDown1 = new DropDown();
536:
537:            public DropDown getDropDown1() {
538:                return dropDown1;
539:            }
540:
541:            public void setDropDown1(DropDown dd) {
542:                this .dropDown1 = dd;
543:            }
544:
545:            private TableColumn tableColumn3 = new TableColumn();
546:
547:            public TableColumn getTableColumn3() {
548:                return tableColumn3;
549:            }
550:
551:            public void setTableColumn3(TableColumn tc) {
552:                this .tableColumn3 = tc;
553:            }
554:
555:            private TextField textField2 = new TextField();
556:
557:            public TextField getTextField2() {
558:                return textField2;
559:            }
560:
561:            public void setTextField2(TextField tf) {
562:                this .textField2 = tf;
563:            }
564:
565:            private TableColumn tableColumn4 = new TableColumn();
566:
567:            public TableColumn getTableColumn4() {
568:                return tableColumn4;
569:            }
570:
571:            public void setTableColumn4(TableColumn tc) {
572:                this .tableColumn4 = tc;
573:            }
574:
575:            private TextField textField3 = new TextField();
576:
577:            public TextField getTextField3() {
578:                return textField3;
579:            }
580:
581:            public void setTextField3(TextField tf) {
582:                this .textField3 = tf;
583:            }
584:
585:            private TableColumn tableColumn5 = new TableColumn();
586:
587:            public TableColumn getTableColumn5() {
588:                return tableColumn5;
589:            }
590:
591:            public void setTableColumn5(TableColumn tc) {
592:                this .tableColumn5 = tc;
593:            }
594:
595:            private TextField textField4 = new TextField();
596:
597:            public TextField getTextField4() {
598:                return textField4;
599:            }
600:
601:            public void setTextField4(TextField tf) {
602:                this .textField4 = tf;
603:            }
604:
605:            private TableColumn tableColumn6 = new TableColumn();
606:
607:            public TableColumn getTableColumn6() {
608:                return tableColumn6;
609:            }
610:
611:            public void setTableColumn6(TableColumn tc) {
612:                this .tableColumn6 = tc;
613:            }
614:
615:            private TextArea textArea1 = new TextArea();
616:
617:            public TextArea getTextArea1() {
618:                return textArea1;
619:            }
620:
621:            public void setTextArea1(TextArea ta) {
622:                this .textArea1 = ta;
623:            }
624:
625:            private TableColumn tableColumn7 = new TableColumn();
626:
627:            public TableColumn getTableColumn7() {
628:                return tableColumn7;
629:            }
630:
631:            public void setTableColumn7(TableColumn tc) {
632:                this .tableColumn7 = tc;
633:            }
634:
635:            private Button preview = new Button();
636:
637:            public Button getPreview() {
638:                return preview;
639:            }
640:
641:            public void setPreview(Button b) {
642:                this .preview = b;
643:            }
644:
645:            private Button remove = new Button();
646:
647:            public Button getRemove() {
648:                return remove;
649:            }
650:
651:            public void setRemove(Button b) {
652:                this .remove = b;
653:            }
654:
655:            private Upload uploadIImage = new Upload();
656:
657:            public Upload getUploadIImage() {
658:                return uploadIImage;
659:            }
660:
661:            public void setUploadIImage(Upload u) {
662:                this .uploadIImage = u;
663:            }
664:
665:            private StaticText imagePad1 = new StaticText();
666:
667:            public StaticText getImagePad1() {
668:                return imagePad1;
669:            }
670:
671:            public void setImagePad1(StaticText st) {
672:                this .imagePad1 = st;
673:            }
674:
675:            private StaticText imagePad2 = new StaticText();
676:
677:            public StaticText getImagePad2() {
678:                return imagePad2;
679:            }
680:
681:            public void setImagePad2(StaticText st) {
682:                this .imagePad2 = st;
683:            }
684:
685:            private Button uploadImage = new Button();
686:
687:            public Button getUploadImage() {
688:                return uploadImage;
689:            }
690:
691:            public void setUploadImage(Button b) {
692:                this .uploadImage = b;
693:            }
694:
695:            private Label label9 = new Label();
696:
697:            public Label getLabel9() {
698:                return label9;
699:            }
700:
701:            public void setLabel9(Label l) {
702:                this .label9 = l;
703:            }
704:
705:            private TextField addImage = new TextField();
706:
707:            public TextField getAddImage() {
708:                return addImage;
709:            }
710:
711:            public void setAddImage(TextField tf) {
712:                this .addImage = tf;
713:            }
714:
715:            private Message message8 = new Message();
716:
717:            public Message getMessage8() {
718:                return message8;
719:            }
720:
721:            public void setMessage8(Message m) {
722:                this .message8 = m;
723:            }
724:
725:            private IntegerConverter yearIntegerConverter = new IntegerConverter();
726:
727:            public IntegerConverter getYearIntegerConverter() {
728:                return yearIntegerConverter;
729:            }
730:
731:            public void setYearIntegerConverter(IntegerConverter ic) {
732:                this .yearIntegerConverter = ic;
733:            }
734:
735:            private IntegerConverter lengthIntegerConverter = new IntegerConverter();
736:
737:            public IntegerConverter getLengthIntegerConverter() {
738:                return lengthIntegerConverter;
739:            }
740:
741:            public void setLengthIntegerConverter(IntegerConverter ic) {
742:                this .lengthIntegerConverter = ic;
743:            }
744:
745:            // </editor-fold>
746:
747:            /**
748:             * <p>Construct a new Page bean instance.</p>
749:             */
750:            public Page1() {
751:            }
752:
753:            /**
754:             * <p>Callback method that is called whenever a page is navigated to,
755:             * either directly via a URL, or indirectly via page navigation.
756:             * Customize this method to acquire resources that will be needed
757:             * for event handlers and lifecycle methods, whether or not this
758:             * page is performing post back processing.</p>
759:             * 
760:             * <p>Note that, if the current request is a postback, the property
761:             * values of the components do <strong>not</strong> represent any
762:             * values submitted with this request.  Instead, they represent the
763:             * property values that were saved for this view when it was rendered.</p>
764:             */
765:            @Override
766:            public void init() {
767:                // Perform initializations inherited from our superclass
768:                super .init();
769:                // Perform application initialization that must complete
770:                // *before* managed components are initialized
771:                // TODO - add your own initialiation code here
772:
773:                // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
774:                // Initialize automatically managed components
775:                // *Note* - this logic should NOT be modified
776:                try {
777:                    _init();
778:                } catch (Exception e) {
779:                    log("Page1 Initialization Failure", e);
780:                    throw e instanceof  FacesException ? (FacesException) e
781:                            : new FacesException(e);
782:                }
783:
784:                // </editor-fold>
785:                // Perform application initialization that must complete
786:                // *after* managed components are initialized
787:                // TODO - add your own initialization code here
788:            }
789:
790:            /**
791:             * <p>Callback method that is called after the component tree has been
792:             * restored, but before any event processing takes place.  This method
793:             * will <strong>only</strong> be called on a postback request that
794:             * is processing a form submit.  Customize this method to allocate
795:             * resources that will be required in your event handlers.</p>
796:             */
797:            @Override
798:            public void preprocess() {
799:            }
800:
801:            /**
802:             * <p>Callback method that is called just before rendering takes place.
803:             * This method will <strong>only</strong> be called for the page that
804:             * will actually be rendered (and not, for example, on a page that
805:             * handled a postback and then navigated to a different page).  Customize
806:             * this method to allocate resources that will be required for rendering
807:             * this page.</p>
808:             */
809:            @Override
810:            public void prerender() {
811:                if (this .currentGenre.getValue() == null) {
812:                    this .currentGenre.setValue(getSessionBean1()
813:                            .getCurrentGenre());
814:                }
815:                if (this .addGenre.getSelected() == null) {
816:                    this .addGenre.setSelected(getApplicationBean1()
817:                            .getGenreOptions()[0]);
818:                }
819:                if (this .addRating.getSelected() == null) {
820:                    this .addRating.setSelected(getApplicationBean1()
821:                            .getRatingOptions()[0]);
822:                }
823:            }
824:
825:            /**
826:             * <p>Callback method that is called after rendering is completed for
827:             * this request, if <code>init()</code> was called (regardless of whether
828:             * or not this was the page that was actually rendered).  Customize this
829:             * method to release resources acquired in the <code>init()</code>,
830:             * <code>preprocess()</code>, or <code>prerender()</code> methods (or
831:             * acquired during execution of an event handler).</p>
832:             */
833:            @Override
834:            public void destroy() {
835:            }
836:
837:            /**
838:             * <p>Return a reference to the scoped data bean.</p>
839:             */
840:            protected ApplicationBean1 getApplicationBean1() {
841:                return (ApplicationBean1) getBean("ApplicationBean1");
842:            }
843:
844:            /**
845:             * <p>Return a reference to the scoped data bean.</p>
846:             */
847:            protected SessionBean1 getSessionBean1() {
848:                return (SessionBean1) getBean("SessionBean1");
849:            }
850:
851:            /**
852:             * <p>Return a reference to the scoped data bean.</p>
853:             */
854:            protected RequestBean1 getRequestBean1() {
855:                return (RequestBean1) getBean("RequestBean1");
856:            }
857:
858:            public String update_action() {
859:                // TODO: Process the action. Return value is a navigation
860:                // case name where null will return to the same page.
861:                MovieListDataProvider movieListDataProvider = getSessionBean1()
862:                        .getMovieListDataProvider();
863:                try {
864:                    movieListDataProvider.commitChanges();
865:                } catch (Exception e) {
866:                    error("Could not update movies");
867:                    log("Could not update movies: " + e, e);
868:                    movieListDataProvider.revertChanges();
869:                }
870:                return null;
871:            }
872:
873:            public String add_action() {
874:                // TODO: Process the action. Return value is a navigation
875:                // case name where null will return to the same page.
876:                Movie movie = new Movie();
877:                movie.setGenre((String) addGenre.getSelected());
878:                movie.setTitle((String) addTitle.getText());
879:                movie.setYear((Integer) addYear.getText());
880:                movie.setLength((Integer) addLength.getText());
881:                movie.setRating((String) addRating.getSelected());
882:                movie.setImage((String) addImage.getText());
883:                movie.setDescription((String) addDescription.getText());
884:                try {
885:                    getSessionBean1().addMovie(movie);
886:                } catch (Exception e) {
887:                    error("Could not add movie");
888:                    log("Could not add movie " + movie.getId() + ": " + e, e);
889:                }
890:                tableRowGroup1.setFirst(0);
891:                addGenre.setSelected(null);
892:                addTitle.setText(null);
893:                addYear.setText(null);
894:                addLength.setText(null);
895:                addRating.setSelected(null);
896:                uploadIImage.setText(null);
897:                addDescription.setText(null);
898:                form1.discardSubmittedValues("update");
899:                return null;
900:            }
901:
902:            public void currentGenre_processValueChange(ValueChangeEvent event) {
903:                // change current genre
904:                getSessionBean1().setCurrentGenre((String) event.getNewValue());
905:                // the genre virtual form, in which only the currentGenreDropDown participates, has been submitted
906:                // make sure the input fields in the movies table do not retain their submitted values
907:                form1.discardSubmittedValues("update");
908:            }
909:
910:            public String preview_action() {
911:                // TODO: Process the action. Return value is a navigation
912:                // case name where null will return to the same page.
913:                RowKey rowWhereButtonClicked = tableRowGroup1.getRowKey();
914:                getRequestBean1().setPreviewRow(rowWhereButtonClicked);
915:                return "preview";
916:            }
917:
918:            public String remove_action() {
919:                // TODO: Process the action. Return value is a navigation
920:                // case name where null will return to the same page.
921:                RowKey rowToRemove = tableRowGroup1.getRowKey();
922:                MovieListDataProvider movieListDataProvider = getSessionBean1()
923:                        .getMovieListDataProvider();
924:                Integer movieId = (Integer) movieListDataProvider.getValue(
925:                        movieListDataProvider.getFieldKey("id"), rowToRemove);
926:                try {
927:                    movieListDataProvider.removeRow(rowToRemove);
928:                    movieListDataProvider.commitChanges();
929:                } catch (Exception e) {
930:                    error("Could not remove movie");
931:                    log("Could not remove movie " + movieId + ": " + e, e);
932:                    movieListDataProvider.revertChanges();
933:                }
934:                tableRowGroup1.setFirst(0);
935:                //work around limitation in the dataprovider (uses IndexRowKeys)
936:                //the preview/remove virtual form, which has no participants, has been submitted
937:                //make sure the input fields in the movies table do not retain their submitted values
938:                form1.discardSubmittedValues("update");
939:                return null;
940:            }
941:
942:            public String uploadImage_action() {
943:                // TODO: Process the action. Return value is a navigation
944:                // case name where null will return to the same page.
945:                UploadedFile uploadedFile = this .uploadIImage.getUploadedFile();
946:                String uploadedFileName = uploadedFile.getOriginalName();
947:                // Some browsers return complete path name, some don't
948:                // Make sure we only have the file name        
949:                // First, try forward slash
950:                int index = uploadedFileName.lastIndexOf('/');
951:                String justFileName;
952:                if (index >= 0) {
953:                    justFileName = uploadedFileName.substring(index + 1);
954:                } else {
955:                    // Try backslash
956:                    index = uploadedFileName.lastIndexOf('\\');
957:                    if (index >= 0) {
958:                        justFileName = uploadedFileName.substring(index + 1);
959:                    } else {
960:                        // No forward or back slashes
961:                        justFileName = uploadedFileName;
962:                    }
963:                }
964:                String uploadedFileType = uploadedFile.getContentType();
965:                if (uploadedFileType.equals("image/jpeg")
966:                        || uploadedFileType.equals("image/pjpeg")
967:                        || uploadedFileType.equals("image/gif")
968:                        || uploadedFileType.equals("image/png")
969:                        || uploadedFileType.equals("image/x-png")) {
970:                    try {
971:                        // get the path to the /resources/images directory
972:                        // from the servlet context
973:                        ServletContext theApplicationsServletContext = (ServletContext) this 
974:                                .getExternalContext().getContext();
975:                        String realPath = theApplicationsServletContext
976:                                .getRealPath("/resources");
977:                        File file = new File(realPath + File.separatorChar
978:                                + justFileName);
979:                        uploadedFile.write(file);
980:                        this .addImage.setText("/resources/" + justFileName);
981:                    } catch (Exception ex) {
982:                        error("Cannot upload file: " + justFileName);
983:                    }
984:                } else {
985:                    error("You must upload a JPEG, PJPEG, GIF, PNG, or X-PNG file.");
986:                }
987:                return null;
988:            }
989:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.