Helper class for evaluation attribute in Java

Printing Data Matrix 2d barcode in Java Helper class for evaluation attribute
6
Print Data Matrix In Java
Using Barcode drawer for Java Control to generate, create DataMatrix image in Java applications.
setAndAdd(lblEvaluation, 0, 4, 1, 1); fldEvaluation = new JComboBox( MovieEvaluationgetNames()); setAndAdd(fldEvaluation, 1, 4, 1, 1); setAndAdd(lblLabel, 2, 4, 1, cRELATIVE); setAndAdd(fldLabel, 3, 4, 1, cREMAINDER); // Comment box: setAndAdd(lblComments, 0,5,1,1); textArea = new JTextArea(4,30); JScrollPane textScroll = new JScrollPane(textArea); setAndAdd(textScroll, 1,5,4,cREMAINDER); // Command Buttons bRevert = new JButton(" Cancel "); bRevertsetActionCommand("revert"); bRevertaddActionListener(this); setAndAdd(bRevert, 2,9,1,1); bUpdate = new JButton(" OK "); bUpdatesetActionCommand("update"); bUpdateaddActionListener(this); setAndAdd(bUpdate, 3,9,1,1); Container contentPane = getContentPane(); contentPaneadd(itemPanel,BorderLayoutCENTER); pack(); } public Movie showDialog(Component comp, Movie m) { if (theMovieEditor == null || m == null) return null; editedMovie = null; movie = (Movie)mclone();// make a copy to work with // Set box to current fields fldTitlesetText(moviegetTitle()); fldDirectorsetText(moviegetDirector()); fldYearsetText(moviegetYear()); fldLabelsetText(moviegetLabel()); fldRatingsetSelectedIndex(moviegetRating());
Bar Code Drawer In Java
Using Barcode generator for Java Control to generate, create bar code image in Java applications.
file:///C|/oobook/6html (40 of 47) [13/03/2003 02:55:33 }
Bar Code Reader In Java
Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications.
6
Data Matrix 2d Barcode Creation In Visual C#.NET
Using Barcode printer for VS .NET Control to generate, create Data Matrix 2d barcode image in .NET applications.
fldGenresetSelectedIndex(moviegetGenre()); fldFormatsetSelectedIndex(moviegetFormat()); fldEvaluationsetSelectedIndex(moviegetEvaluation()); textAreasetText(moviegetComments()); setLocationRelativeTo(comp); setVisible(true); // will now wait here until actionPerformed // calls setVisible(false) return editedMovie; } // Implement ActionListener public void actionPerformed(ActionEvent e) { if (egetActionCommand()equals("update")) { moviesetTitle(fldTitlegetText()); moviesetDirector(fldDirectorgetText()); moviesetYear(fldYeargetText()); moviesetLabel(fldLabelgetText()); moviesetRating(fldRatinggetSelectedIndex()); moviesetGenre(fldGenregetSelectedIndex()); moviesetFormat(fldFormatgetSelectedIndex()); moviesetEvaluation( fldEvaluationgetSelectedIndex()); moviesetComments(textAreagetText()); editedMovie = movie; setVisible(false); } else if (egetActionCommand()equals("revert")) { editedMovie = null; setVisible(false); } } } Movie Helper Classes The helper classes are all nearly identical Logically, the classes could have been derived from a single superclass However, to maximize the ease of using these helper classes
Data Matrix 2d Barcode Encoder In Visual Studio .NET
Using Barcode generator for ASP.NET Control to generate, create DataMatrix image in ASP.NET applications.
file:///C|/oobook/6html (41 of 47) [13/03/2003 02:55:33 }
Data Matrix Generation In .NET Framework
Using Barcode printer for .NET Control to generate, create ECC200 image in .NET applications.
6
Data Matrix ECC200 Drawer In Visual Basic .NET
Using Barcode generator for .NET framework Control to generate, create ECC200 image in VS .NET applications.
(specifically, making them completely static with no need of constructors), they were implemented as individual classes Listing 6-8 MovieEvaluationjava
EAN-13 Generation In Java
Using Barcode encoder for Java Control to generate, create EAN13 image in Java applications.
Helper class for evaluation attribute
Barcode Drawer In Java
Using Barcode generator for Java Control to generate, create barcode image in Java applications.
/* MovieEvaluation - very simple helper class * Copyright 2001, Bruce E Wampler */ public class MovieEvaluation { private static String[] values = { "*", "**", "***", "****", "*****" }; public static int indexOf(String str) { for (int ix = 0 ; ix < valueslength ; ++ix) if (values[ix]equals(str)) return ix; return 0; } public static String stringAt(int at) { if (at < 0 || at >= valueslength) return "-"; return values[at]; } public static String[] getNames() { return values; } } Listing 6-9 MovieFormatjava
ECC200 Maker In Java
Using Barcode creation for Java Control to generate, create Data Matrix ECC200 image in Java applications.
Helper class for format attribute
Print Barcode In Java
Using Barcode creator for Java Control to generate, create barcode image in Java applications.
/* MovieFormat - very simple helper class * Copyright 2001, Bruce E Wampler */
Barcode Maker In Java
Using Barcode drawer for Java Control to generate, create barcode image in Java applications.
file:///C|/oobook/6html (42 of 47) [13/03/2003 02:55:33 }
Printing USPS Confirm Service Barcode In Java
Using Barcode drawer for Java Control to generate, create USPS PLANET Barcode image in Java applications.
6
ECC200 Generation In Visual C#
Using Barcode maker for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in .NET framework applications.
public class MovieFormat { private static String[] values = { "VHS", "DVD", "VCD", "SVCD", "Hi8", "DV", "Other" }; public static int indexOf(String str) { for (int ix = 0 ; ix < valueslength ; ++ix) if (values[ix]equals(str)) return ix; return 0; } public static String stringAt(int at) { if (at < 0 || at >= valueslength) return "Other"; return values[at]; } public static String[] getNames() { return values; } } Listing 6-10 MovieGenrejava
Bar Code Printer In Visual Basic .NET
Using Barcode encoder for VS .NET Control to generate, create bar code image in VS .NET applications.
Helper class for genre attribute
Generating Bar Code In VS .NET
Using Barcode generator for .NET framework Control to generate, create barcode image in .NET framework applications.
/* MovieGenre - very simple helper class * Copyright 2001, Bruce E Wampler */ public class MovieGenre { private static String[] values = { "Drama", "Comedy", "Children", "Family", "Action", "Sci-Fi", "Documentary", "Other" }; public static int indexOf(String str) {
Recognizing EAN 13 In Visual Studio .NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET framework applications.
file:///C|/oobook/6html (43 of 47) [13/03/2003 02:55:33 }
Reading Bar Code In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
6
ECC200 Drawer In VB.NET
Using Barcode printer for VS .NET Control to generate, create Data Matrix 2d barcode image in .NET applications.
for (int ix = 0 ; ix < valueslength ; ++ix) if (values[ix]equals(str)) return ix; return 0; } public static String stringAt(int at) { if (at < 0 || at >= valueslength) return "Other"; return values[at]; } public static String[] getNames() { return values; } } Listing 6-11 MovieRatingjava
Code 128 Code Set C Encoder In .NET
Using Barcode maker for ASP.NET Control to generate, create Code 128 Code Set B image in ASP.NET applications.
Helper class for rating attribute
/* MovieRating - very simple helper class * Copyright 2001, Bruce E Wampler */ public class MovieRating { private static String[] values = { "G", "PG", "PG-13", "R", "NC-17", "X", "NR", "Unknown" }; public static int indexOf(String str) { for (int ix = 0 ; ix < valueslength ; ++ix) if (values[ix]equals(str)) return ix; return 0; } public static String stringAt(int at) { if (at < 0 || at >= valueslength) return "Unknown"; return values[at];
file:///C|/oobook/6html (44 of 47) [13/03/2003 02:55:33 }
6
} public static String[] getNames() { return values; } }
Review
At the end of the development of any software, one of the most important steps is to review the project, and to apply lessons learned to the next round of development The MovieCat application is not a completely typical case While it does have a useful purpose, it was designed mostly as a good, short case study for this book, and it meets that goal It lent itself to a good, yet simple analysis It had some non-trivial design issues It provided a good example for using MVC to build a real application And it could be implemented with a reasonable amount of code to include in a book There are still some aspects of MovieCat we can review For one thing, the program is not really complete There are several features that could be added for the next release In fact, the MovieCat app presented in this chapter is not unlike a real world app; now that we have an initial release version, we need to see what should be added for the second release What is missing from MovieCat The following list gives just some features that might be added 1 More attributes, including actors, writers, awards, language, aspect ratio, and others 2 Multiple categories for genre 3 Printing 4 Searching 5 IMDb (Internet Movie DataBase, gives complete information about most existing movies) connectivity 6 Import/Export of movie list 7 Movie images and clips How hard would these be to add Evaluating how easy it would be to modify an existing program is a good measure of how well designed it is Let's examine a couple of items from the list How about adding more attributes Adding them to the Movie class should be simple All the attributes we've discussed would easily map to either a String or a new helper class There would be some problems associated with adding new Movie attributes First, we would have to provide a conversion program to convert from the original file
file:///C|/oobook/6html (45 of 47) [13/03/2003 02:55:33 }