JInfoPanel infoPanel = new JInfoPanel(pluginsMap);
PluginDataModel infoDataModel = new PluginDataModel(infoPanel.getPluginName(), infoPanel.getVersion(), infoPanel.getPluginAuthor(), infoPanel.getClass().getName());
mainPanel.add(infoPanel,infoPanel.getPluginName());
//Settings panel
JSettingsPanel settingsPanel = new JSettingsPanel();
PluginDataModel settingsDataModel = new PluginDataModel(settingsPanel.getPluginName(), settingsPanel.getVersion(), settingsPanel.getPluginAuthor(), settingsPanel.getClass().getName());
mainPanel.add(settingsPanel,settingsPanel.getPluginName());
//sets main panel
mainPanel.setPreferredSize(new Dimension(670,500));
for(AbstractPlugablePanel instance: pluginsMap.values()){
mainPanel.add(instance,instance.getPluginName());
}
//status panel
setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Building status bar.."));
statusPanel = new JStatusPanel(new ImageIcon(iconUrl16),GuiClient.getApplicationName(),WorkDoneDataModel.MAX_PERGENTAGE);
getContentPane().add(statusPanel,BorderLayout.PAGE_END);
Configuration.getInstance().getConsoleServicesFacade().addExecutionObserver(statusPanel);
//tree panel
setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Building tree.."));
treePanel = new JTreePanel(new DefaultMutableTreeNode(GuiClient.UNIXNAME+" "+GuiClient.getVersion()));
for (PluginDataModel item : pluginsMap.keySet()) {
treePanel.addToPlugsNode(item);
}
treePanel.addToRootNode(settingsDataModel);
treePanel.addToRootNode(infoDataModel);
treePanel.getTree().addTreeSelectionListener(new TreeMediator(this));
treePanel.expand();
//add info and settings to plugins map
pluginsMap.put(settingsDataModel, settingsPanel);
pluginsMap.put(infoDataModel, infoPanel);
//menu
setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Building menus.."));
Environment environment = new Environment(pluginsMap, treePanel);
SaveEnvironmentAction saveAction = new SaveEnvironmentAction(environment, this);
LoadEnvironmentAction loadAction = new LoadEnvironmentAction(environment, this);
exitMediator = new ApplicationExitMediator(new ApplicationCloser(this));
getRootPane().setJMenuBar(new JMainMenuBar(saveAction, loadAction, exitMediator));
//buttons bar
setSplashStep(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Building buttons bar.."));
buttonsPanel = new JButtonsPanel(saveAction, loadAction, exitMediator, new LogActionListener());
getContentPane().add(buttonsPanel,BorderLayout.PAGE_START);
//set up check for updates mediator
updateMediator = new UpdateCheckerMediator(statusPanel);
if(Configuration.getInstance().isCheckForUpdates()){
updateMediator.checkForUpdates(5000, false);
}
settingsPanel.setCheckUpdateMediator(updateMediator);
//final set up
mainScrollPanel = new JScrollPane(mainPanel);
mainScrollPanel.setMinimumSize(new Dimension(100, 400));