1 | public class ModifyDriverAction extends SquirrelAction↵ | | 1 | public class ShowDriverWebsiteAction extends SquirrelAction↵
|
2 | {↵ | | 2 | {↵
|
3 | /** Logger for this class. */↵ | | 3 | /** Logger for this class. */↵
|
4 | private static ILogger s_log =↵ | | 4 | private static ILogger s_log =↵
|
5 | LoggerController.createLogger(ModifyDriverAction.class);↵ | | 5 | LoggerController.createLogger(↵
|
|
6 | /**↵ | | |
|
7 | * List of all the users drivers.↵ | | |
|
8 | */↵ | | |
|
9 | private IDriversList _drivers;↵ | | 6 | ShowDriverWebsiteAction.class);↵
|
|
10 | /** Internationalized strings for this class. */↵ | | 7 | /** Internationalized strings for this class. */↵
|
11 | private static final StringManager s_stringMgr =↵ | | 8 | private static final StringManager s_stringMgr =↵
|
12 | StringManagerFactory.getStringManager(ModifyDriverAction.class); ↵ | | 9 | StringManagerFactory.getStringManager(ShowDriverWebsiteAction.class);↵
|
13 | ↵ | | 10 | ↵
|
14 | ↵ | | 11 | ↵
|
15 | /**↵ | | 12 | /**↵
|
16 | * Ctor specifying the list of drivers.↵ | | 13 | * List of all the users drivers.↵
|
17 | *↵ | | |
|
18 | * @param app Application API.↵ | | |
|
19 | * @param list List of <TT>ISQLDriver</TT> objects.↵ | | |
|
20 | *↵ | | |
|
21 | * @throws IllegalArgumentException↵ | | |
|
22 | * thrown if a <TT>null</TT> <TT>DriversList</TT> passed.↵ | | |
|
23 | */↵ | | |
|
24 | public ModifyDriver↵ | | 14 | */↵
|
| | | 15 | private IDriversList _drivers;↵
|
|
| | | 16 | /**↵
|
| | | 17 | * Ctor.↵
|
| | | 18 | *↵
|
| | | 19 | * @param app Application API.↵
|
| | | 20 | */↵
|
25 | Action(IApplication app, IDriversList list)↵ | | 21 | public ShowDriverWebsiteAction(IApplication app, IDriversList list)↵
|
26 | throws IllegalArgumentException↵ | | 22 | ↵
|
27 | {↵ | | 23 | {↵
|
28 | super(app);↵ | | 24 | super(app);↵
|
29 | if (list == null)↵ | | 25 | if (list == null)↵
|
30 | {↵ | | |
|
31 | ↵ | | 26 | {↵
|
32 | throw new IllegalArgumentException("Null DriversList passed");↵ | | 27 | throw new IllegalArgumentException("Null DriversList passed");↵
|
33 | }↵ | | |
|
34 | ↵ | | 28 | } ↵
|
35 | _drivers = list;↵ | | 29 | _drivers = list;↵
|
36 | }↵ | | 30 | }↵
|
|
37 | /**↵ | | 31 | /**↵
|
38 | * Perform this action. Retrieve the current driver from the list and↵ | | 32 | * Perform this action. Execute the create driver ↵
|
39 | * allow the user to maintain it.↵ | | 33 | command.↵
|
40 | *↵ | | 34 | *↵
|
41 | * @param evt The current event.↵ | | 35 | * @param evt The current event.↵
|
42 | */↵ | | 36 | */↵
|
43 | public void actionPerformed(ActionEvent evt)↵ | | 37 | public void actionPerformed(ActionEvent evt)↵
|
44 | {↵ | | 38 | {↵
|
45 | IApplication app = getApplication();↵ | | 39 | IApplication app = getApplication();↵
|
46 | DriversListInternalFrame tw = app.getWindowManager().getDriversListInternalFrame();↵ | | 40 | DriversListInternalFrame tw = app.getWindowManager().getDriversListInternalFrame();↵
|
47 | tw.moveToFront();↵ | | 41 | tw.moveToFront();↵
|
48 | try↵ | | 42 | try↵
|
49 | {↵ | | 43 | {↵
|
50 | tw.setSelected(true);↵ | | 44 | tw.setSelected(true);↵
|
51 | }↵ | | 45 | }↵
|
52 | catch (PropertyVetoException ex)↵ | | 46 | catch (PropertyVetoException ex)↵
|
53 | {↵ | | 47 | {↵
|
54 | //i18n[ModifyDriverAction.error.selectingwindow=Error selecting window]↵ | | 48 | //i18n[CreateDriverAction.error.selectingwindow=Error selecting window]↵
|
55 | s_log.error(s_stringMgr.getString("ModifyDriverAction.error.selectingwindow"), ex);↵ | | 49 | s_log.error(s_stringMgr.getString("CreateDriverAction.error.selectingwindow"), ex);↵
|
56 | }↵ | | 50 | }↵
|
57 | ↵ | | 51 | ↵
|
58 | ISQLDriver driver = _drivers.getSelectedDriver();↵ | | 52 | ISQLDriver driver = _drivers.getSelectedDriver();↵
|
59 | if (driver != null)↵ | | 53 | if (driver != null)↵
|
60 | {↵ | | |
|
61 | new ModifyDriver↵ | | 54 | {↵
|
62 | Command(app, driver).execute() | | 55 | new ShowDriverWebsiteCommand(app, driver).execute()
|