|
From: Hirzel P. <ph...@us...> - 2006-06-29 22:50:10
|
Update of /cvsroot/tcotool/TCO-Tool/src/org/tcotool/application In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30229/src/org/tcotool/application Modified Files: LauncherView.java Formatter.java Log Message: Refactoring: Log-API adapted Index: Formatter.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/application/Formatter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Formatter.java 7 May 2006 14:41:14 -0000 1.2 --- Formatter.java 29 Jun 2006 22:50:05 -0000 1.3 *************** *** 1,13 **** package org.tcotool.application; import ch.softenvironment.client.ResourceManager; import ch.softenvironment.math.MathUtils; import org.tcotool.model.*; - import org.tcotool.standard.report.ReportTool; import org.tcotool.tools.*; /** * Formatt-Tool for Table's in *DetailView. * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ --- 1,28 ---- package org.tcotool.application; + + /* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ import ch.softenvironment.client.ResourceManager; import ch.softenvironment.math.MathUtils; import org.tcotool.model.*; import org.tcotool.tools.*; /** * Formatt-Tool for Table's in *DetailView. * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ *************** *** 66,70 **** return LauncherView.getInstance().getUtility().getSystemParameter().getDefaultCurrency(); } catch(Throwable e) { ! ch.softenvironment.util.Tracer.getInstance().developerError(this, "format()", "IGNORE: SystemParameters.defaultCurrency reference"); return "<" + ResourceManager.getResource(FactCostDetailView.class, "LblCurrency_text") + ">"; } --- 81,85 ---- return LauncherView.getInstance().getUtility().getSystemParameter().getDefaultCurrency(); } catch(Throwable e) { ! ch.softenvironment.util.Tracer.getInstance().developerError("IGNORE: SystemParameters.defaultCurrency reference"); return "<" + ResourceManager.getResource(FactCostDetailView.class, "LblCurrency_text") + ">"; } Index: LauncherView.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/application/LauncherView.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** LauncherView.java 22 Dec 2005 12:26:37 -0000 1.9 --- LauncherView.java 29 Jun 2006 22:50:05 -0000 1.10 *************** *** 15,20 **** * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ! import org.tcotool.standard.charts.CostTypeBarChart; ! import org.tcotool.standard.charts.CostTypePieChart; import org.tcotool.standard.drawing.Layout; import org.tcotool.standard.report.ReportComplete; --- 15,21 ---- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ! ! ! import org.tcotool.standard.charts.ChartTool; import org.tcotool.standard.drawing.Layout; import org.tcotool.standard.report.ReportComplete; *************** *** 29,32 **** --- 30,34 ---- import java.awt.event.KeyEvent; import java.io.FileNotFoundException; + import java.util.Iterator; import java.util.List; *************** *** 39,47 **** --- 41,52 ---- import ch.softenvironment.util.*; import ch.softenvironment.view.*; + import ch.softenvironment.client.ResourceManager; import ch.softenvironment.jomm.*; import ch.softenvironment.jomm.mvc.model.DbChangeableBean; + import ch.softenvironment.jomm.mvc.model.DbCodeType; import ch.softenvironment.jomm.target.xml.*; import org.tcotool.model.*; + import org.tcotool.model.Process; import org.tcotool.pluginsupport.PluginUtility; import org.tcotool.presentation.Diagram; *************** *** 65,69 **** private JMenu mnuEdit = null; private JMenuItem mniFind = null; - private JMenuItem mniTcoCostTypePieChart = null; private JPanel ivjBaseFrameContentPane = null; IvjEventHandler ivjEventHandler = new IvjEventHandler(); --- 70,73 ---- *************** *** 103,107 **** private JMenuItem ivjMniDependencyGraph = null; private JMenuItem ivjMniTcoChart = null; - private JMenuItem ivjMniTcoCostTypeChart = null; private JMenu ivjMnuReports = null; private JMenu ivjMnuFont = null; --- 107,110 ---- *************** *** 144,149 **** if (e.getSource() == LauncherView.this.getMniTcoChart()) connEtoC27(e); - if (e.getSource() == LauncherView.this.getMniTcoCostTypeChart()) - connEtoC28(e); if (e.getSource() == LauncherView.this.getRbtFontDefault()) connEtoC29(e); --- 147,150 ---- *************** *** 191,194 **** --- 192,204 ---- */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ + public LauncherView(ch.softenvironment.view.ViewOptions viewOptions) { + super(viewOptions); + initialize(); + } + /** + * Constructor + * @param viewOptions Symbol + */ + /* WARNING: THIS METHOD WILL BE REGENERATED. */ public LauncherView(ch.softenvironment.view.ViewOptions viewOptions, ApplicationOptions settings) { super(viewOptions); *************** *** 198,201 **** --- 208,317 ---- } /** + * Add a MenuItem to create a Bar- & Pie-Chart for given dbCodeType. + * @param menu + * @param dbCodeType + */ + private void addMenuChartReports(JMenu menu, final Class dbCodeType) { + final String title = ModelUtility.getTypeString(dbCodeType); + + // Bar-Chart + JMenuItem item = new JMenuItem(); + item.setText(title); + item.setIcon(ResourceBundle.getImageIcon(LauncherView.class, "bar_chart.png")); + item.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + showBusy(new Runnable() { + public void run() { + try { + ChartTool tool = new ChartTool((TcoPackage)getUtility().getRoot()); + addReport(tool.createTcoBarChart(dbCodeType), title /*getResourceString("MniTcoCostTypePieChart_text")*/, getDtpRoot().getWidth(), getDtpRoot().getHeight()); + } catch(Throwable ex) { + handleException(ex); + } + } + }); + } + }); + menu.add(item); + + // Pie-Chart + item = new JMenuItem(); + item.setText(title); + item.setIcon(ResourceBundle.getImageIcon(LauncherView.class, "pie_chart.png")); + item.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + showBusy(new Runnable() { + public void run() { + try { + ChartTool tool = new ChartTool((TcoPackage)getUtility().getRoot()); + addReport(tool.createTcoPieChart(dbCodeType), title /*getResourceString("MniTcoCostTypePieChart_text")*/, getDtpRoot().getWidth(), getDtpRoot().getHeight()); + } catch(Throwable ex) { + handleException(ex); + } + } + }); + } + }); + menu.add(item); + } + /** + * Add a MenuItem to create a bar- & pie-chart of a (sub/second)-code within another code attached to a Service. + * @param menu + * @param dbCodeTypeSecond (for e.g. CostCause.class) + * @param dbCodeTypePrimary (for e.g. ServiceCategory.class) + */ + private void addMenuChartReports(JMenu menu, final Class dbCodeTypeSecond, final Class dbCodeTypePrimary) { + Object tokens[] = { ModelUtility.getTypeString(dbCodeTypeSecond), ModelUtility.getTypeString(dbCodeTypePrimary)}; + final String title = NlsUtils.formatMessage(getResourceString("MniSubordinateCodesWithin_text"), tokens); + JMenuItem item = new JMenuItem(); + item.setText(title); + item.setIcon(ResourceBundle.getImageIcon(LauncherView.class, "bar_chart.png")); + item.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + showBusy(new Runnable() { + public void run() { + try { + Iterator it = ((TcoModel)getUtility().getRoot()).getObjectServer().retrieveCodes(dbCodeTypePrimary).iterator(); + //TODO if (!it.hasNext()) { showNoDataFor(dbCodeType) } + while (it.hasNext()) { + DbCodeType maskCode = (DbCodeType)it.next(); + ChartTool tool = new ChartTool((TcoPackage)getUtility().getRoot(), maskCode); + JPanel panel = tool.createTcoBarChart(dbCodeTypeSecond); + addReport(panel, title + ": " + maskCode.getNameString(), getDtpRoot().getWidth(), getDtpRoot().getHeight()/2); + } + } catch(Throwable ex) { + handleException(ex); + } + } + }); + } + }); + menu.add(item); + + item = new JMenuItem(); + item.setText(title); + item.setIcon(ResourceBundle.getImageIcon(LauncherView.class, "pie_chart.png")); + item.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + showBusy(new Runnable() { + public void run() { + try { + Iterator it = ((TcoModel)getUtility().getRoot()).getObjectServer().retrieveCodes(dbCodeTypePrimary).iterator(); + while (it.hasNext()) { + DbCodeType maskCode = (DbCodeType)it.next(); + ChartTool tool = new ChartTool((TcoPackage)getUtility().getRoot(), maskCode); + JPanel panel = tool.createTcoPieChart(dbCodeTypeSecond); + addReport(panel, title + ": " + maskCode.getNameString(), getDtpRoot().getWidth(), getDtpRoot().getHeight()/2); + } + } catch(Throwable ex) { + handleException(ex); + } + } + }); + } + }); + menu.add(item); + } + /** * Adds an internal Frame to DesktopPane. */ *************** *** 206,210 **** internalFrame.setSelected(true); } catch (java.beans.PropertyVetoException e) { ! Tracer.getInstance().runtimeWarning(this, "addReport(..)", "PropertyVetoEception ignored"); } --- 322,326 ---- internalFrame.setSelected(true); } catch (java.beans.PropertyVetoException e) { ! Tracer.getInstance().runtimeWarning("PropertyVetoEception ignored"); } *************** *** 217,221 **** public void addReport(JPanel panel, String title, int width, int height) { JInternalFrame internalFrame = new JInternalFrame(title, true, true, true, true); - // internalFrame.setDrawingView(view); panel.setAutoscrolls(true); JScrollPane spc = new JScrollPane(panel); --- 333,336 ---- *************** *** 524,545 **** } /** - * connEtoC28: (MniTcoCostTypeChart.action.actionPerformed(java.awt.event.ActionEvent) --> LauncherView.mniTcoCostTypeChart()V) - * @param arg1 java.awt.event.ActionEvent - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ - private void connEtoC28(java.awt.event.ActionEvent arg1) { - try { - // user code begin {1} - // user code end - this.mniTcoCostTypeChart(); - // user code begin {2} - // user code end - } catch (java.lang.Throwable ivjExc) { - // user code begin {3} - // user code end - handleException(ivjExc); - } - } - /** * connEtoC29: (RbtFontDefault.action.actionPerformed(java.awt.event.ActionEvent) --> LauncherView.setFont()V) * @param arg1 java.awt.event.ActionEvent --- 639,642 ---- *************** *** 721,733 **** } } - private void saveSettings() { - getSettings().setLastFiles(mnuFileHistory.getHistory()); - // getSettings().setNavigationSort(NavigationTreeModel.SORT_BY_KIND_NAME); - getSettings().setWindowHeight(new Integer(getHeight())); - getSettings().setWindowWidth(new Integer(getWidth())); - // getSettings().setWindowX(new Integer(getX())); - // getSettings().setWindowY(new Integer(getY())); - getSettings().save(); - } /** * Find a given Menu in MenuBar. --- 818,821 ---- *************** *** 791,795 **** ivjDtpRoot.setName("DtpRoot"); // user code begin {1} ! image = ResourceBundle.getImageIcon(LauncherView.class, "TCO_Tool.jpg").getImage(); ivjDtpRoot = new javax.swing.JDesktopPane() { public void paintComponent(java.awt.Graphics g) { --- 879,883 ---- ivjDtpRoot.setName("DtpRoot"); // user code begin {1} ! setBackgroundImage(ResourceBundle.getImageIcon(LauncherView.class, "TCO_Tool.jpg").getImage()); ivjDtpRoot = new javax.swing.JDesktopPane() { public void paintComponent(java.awt.Graphics g) { *************** *** 905,909 **** ivjMniCodes.setText("Codes ändern..."); // user code begin {1} ! ivjMniCodes.setText(getResourceString("MinCodes_text")); // user code end } catch (java.lang.Throwable ivjExc) { --- 993,997 ---- ivjMniCodes.setText("Codes ändern..."); // user code begin {1} ! ivjMniCodes.setText(getResourceString("MinCodes_text") + "..."); // user code end } catch (java.lang.Throwable ivjExc) { *************** *** 1243,1246 **** --- 1331,1335 ---- // user code begin {1} ivjMniTcoChart.setText(getResourceString("MniTcoChart_text")); + ivjMniTcoChart.setIcon(ResourceBundle.getImageIcon(LauncherView.class, "bar_chart.png")); // user code end } catch (java.lang.Throwable ivjExc) { *************** *** 1252,1303 **** return ivjMniTcoChart; } - /** - * Return the MniTcoCostTypeChart property value. - * @return javax.swing.JMenuItem - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ - private javax.swing.JMenuItem getMniTcoCostTypeChart() { - if (ivjMniTcoCostTypeChart == null) { - try { - ivjMniTcoCostTypeChart = new javax.swing.JMenuItem(); - ivjMniTcoCostTypeChart.setName("MniTcoCostTypeChart"); - ivjMniTcoCostTypeChart.setText("Gesamtkosten TCO-Kostenarten (Balkendiagramm)"); - // user code begin {1} - ivjMniTcoCostTypeChart.setText(getResourceString("MniTcoCostTypeChart_text")); - // user code end - } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end - handleException(ivjExc); - } - } - return ivjMniTcoCostTypeChart; - } - private javax.swing.JMenuItem getMniTcoCostTypePieChart() { - if (mniTcoCostTypePieChart == null) { - try { - mniTcoCostTypePieChart = new javax.swing.JMenuItem(); - mniTcoCostTypePieChart.setName("MniTcoCostTypePieChart"); - mniTcoCostTypePieChart.setText(getResourceString("MniTcoCostTypePieChart_text")); - mniTcoCostTypePieChart.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - showBusy(new Runnable() { - public void run() { - try { - CostTypePieChart chartTool = new CostTypePieChart((TcoPackage)getUtility().getRoot()); - addReport(chartTool.createPieChartTcoCostType(), getResourceString("MniTcoCostTypePieChart_text"), getDtpRoot().getWidth(), getDtpRoot().getHeight()); - } catch(Throwable ex) { - handleException(ex); - } - } - }); - } - }); - } catch (java.lang.Throwable ivjExc) { - handleException(ivjExc); - } - } - return mniTcoCostTypePieChart; - } private javax.swing.JMenu getMnuEdit() { if (mnuEdit == null) { --- 1341,1344 ---- *************** *** 1406,1409 **** --- 1447,1459 ---- // user code begin {1} ivjMnuHelp.setText(CommonUserAccess.getMnuHelpText()); + + ivjMnuHelp.add(new JSeparator()); + JMenuItem item = new JMenuItem("Platform Info..."); + item.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + (PlatformInfoPanel.createDialog(getInstance())).show(); + } + }); + ivjMnuHelp.add(item); // user code end } catch (java.lang.Throwable ivjExc) { *************** *** 1549,1558 **** ivjMnuReportTco.add(getMniReportTotalTcoCost()); ivjMnuReportTco.add(getMniTcoChart()); - ivjMnuReportTco.add(getMniTcoCostTypeChart()); // user code begin {1} ! ivjMnuReportTco.add(getMniTcoCostTypePieChart()); ! ! ivjMnuReportTco.setText(getResourceString("MnuReportTco_text")); ! ivjMnuReportTco.setToolTipText(getResourceString("MnuReportTco_toolTipText")); // user code end } catch (java.lang.Throwable ivjExc) { --- 1599,1639 ---- ivjMnuReportTco.add(getMniReportTotalTcoCost()); ivjMnuReportTco.add(getMniTcoChart()); // user code begin {1} ! ivjMnuReportTco.setText(getResourceString("MnuReportTco_text")); ! ivjMnuReportTco.setToolTipText(getResourceString("MnuReportTco_toolTipText")); ! ! JMenu codeCharts = new JMenu(); ! codeCharts.setText(getResourceString("MinCodes_text")); ! codeCharts.setIcon(ResourceBundle.getImageIcon(LauncherView.class, "bar_chart.png")); ! ivjMnuReportTco.add(codeCharts); ! // Service charts ! addMenuChartReports(codeCharts, ServiceCategory.class); ! addMenuChartReports(codeCharts, Responsibility.class); ! addMenuChartReports(codeCharts, CostCentre.class); ! codeCharts.add(new JSeparator()); ! // CostDriver charts ! addMenuChartReports(codeCharts, Process.class); ! //TODO unwanted for CAB ! //addMenuChartReports(codeCharts, ProjectPhase.class); ! //addMenuChartReports(codeCharts, LifeCycle.class); ! addMenuChartReports(codeCharts, Site.class); ! codeCharts.add(new JSeparator()); ! // *Cost charts ! addMenuChartReports(codeCharts, CostCause.class); ! addMenuChartReports(codeCharts, Activity.class); ! addMenuChartReports(codeCharts, Role.class); ! ! // Subordinate-Codes within Service-codes ! codeCharts = new JMenu(); ! codeCharts.setText(NlsUtils.formatMessage(getResourceString("MniSubordinateCodes_text"), getResourceString("MinCodes_text"))); ! codeCharts.setIcon(ResourceBundle.getImageIcon(LauncherView.class, "bar_chart.png")); ! ivjMnuReportTco.add(codeCharts); ! addMenuChartReports(codeCharts, CostCause.class, Responsibility.class); ! codeCharts.add(new JSeparator()); ! addMenuChartReports(codeCharts, CostCause.class, ServiceCategory.class); ! codeCharts.add(new JSeparator()); ! addMenuChartReports(codeCharts, CostCause.class, CostCentre.class); ! codeCharts.add(new JSeparator()); ! addMenuChartReports(codeCharts, Process.class, ServiceCategory.class); // user code end } catch (java.lang.Throwable ivjExc) { *************** *** 1907,1911 **** */ public static String getVersion() { ! return "V1.4.0"; } /** --- 1988,1992 ---- */ public static String getVersion() { ! return "V1.4.3"; } /** *************** *** 1944,1948 **** getMniDependencyGraph().addActionListener(ivjEventHandler); getMniTcoChart().addActionListener(ivjEventHandler); - getMniTcoCostTypeChart().addActionListener(ivjEventHandler); getRbtFontDefault().addActionListener(ivjEventHandler); getRbtFontBig().addActionListener(ivjEventHandler); --- 2025,2028 ---- *************** *** 1976,1980 **** getSppLeft().setDividerLocation(450); // height of Tree getTlbStandard().setTbbNewEnabled(true); ! getTlbStandard().setTbbOpenEnabled(true); mnuFileHistory = new FileHistoryMenu(this, 9, getSettings().getLastFiles()); --- 2056,2060 ---- getSppLeft().setDividerLocation(450); // height of Tree getTlbStandard().setTbbNewEnabled(true); ! getTlbStandard().setTbbChangeEnabled(true); mnuFileHistory = new FileHistoryMenu(this, 9, getSettings().getLastFiles()); *************** *** 2005,2008 **** --- 2085,2106 ---- getRbtFontBig().setSelected(true); } + + JMenuItem item = new JMenuItem(); + item.setText(ResourceManager.getResource(CourseDetailView.class, "FrmWindow_text") + "..."); + item.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + try { + if (!getViewOptions().getViewManager().activateView(CourseDetailView.class)) { + BaseFrame view = new CourseDetailView(getViewOptions(), ListUtils.createList(getUtility().getSystemParameter())); + getViewOptions().getViewManager().checkIn(null, view); + view.setRelativeLocation(getInstance()); + view.setVisible(true); + } + } catch(Throwable ex) { + handleException(ex); + } + } + }); + getMnuSettings().add(item); // user code end } *************** *** 2083,2103 **** } } - private static void showInstance(ViewOptions viewOptions, ModelUtility utility, ApplicationOptions options) throws Throwable { - new LauncherView(viewOptions, options); - // getInstance().addDefaultClosingListener(); - // getInstance().setLookAndFeel(settings.getLookAndFeel()); - java.awt.Insets insets = getInstance().getInsets(); - getInstance().setSize(getInstance().getWidth() + insets.left + insets.right, getInstance().getHeight() + insets.top + insets.bottom); - getInstance().setVisible(true); - getInstance().setUtility(utility); - - try { - //TODO Future use: instantiate LauncherView in ApplicationPlugin#createAndShowGUI() - /*getInstance().pluginManager =*/ PluginUtility.invokePlugins("org.tcotool.core.runtime"); - } catch(Exception e) { - //TODO NLS - BaseDialog.showError(getInstance(), "Plugin-Initialisierung", "Es ist ein Fehler beim Laden allfälliger Plugins aufgetreten.\nMöglicherweise sind nicht alle Plugin-Optionen verfügbar.", e); - } - } /** * Show About Dialog. --- 2181,2184 ---- *************** *** 2105,2109 **** private void mniAbout() { try { ! new AboutDialog(this, getResourceString("FrmWindow_text"), getVersion(), "by Peter Hirzel (softEnvironment) 2004-2005"); } catch(Throwable e) { handleException(e); --- 2186,2190 ---- private void mniAbout() { try { ! new AboutDialog(this, getResourceString("FrmWindow_text"), getVersion(), "by Peter Hirzel (softEnvironment) 2004-2006"); } catch(Throwable e) { handleException(e); *************** *** 2224,2228 **** } /** ! * Comment */ private void mniRisk() { --- 2305,2309 ---- } /** ! * */ private void mniRisk() { *************** *** 2302,2322 **** public void run() { try { ! CostTypeBarChart chartTool = new CostTypeBarChart((TcoPackage)getUtility().getRoot()); ! addReport(chartTool.createBarChartTcoTotal(), getResourceString("MniTcoChart_text"), 500, 500); ! } catch(Throwable e) { ! handleException(e); ! } ! } ! }); ! } ! /** ! * Comment ! */ ! private void mniTcoCostTypeChart() { ! showBusy(new Runnable() { ! public void run() { ! try { ! CostTypeBarChart chartTool = new CostTypeBarChart((TcoPackage)getUtility().getRoot()); ! addReport(chartTool.createBarChartTcoCostType(), getResourceString("MniTcoCostTypeChart_text"), 900, 600); } catch(Throwable e) { handleException(e); --- 2383,2388 ---- public void run() { try { ! ChartTool tool = new ChartTool((TcoPackage)getUtility().getRoot()); ! addReport(tool.createTcoBarChart(), getResourceString("MniTcoChart_text"), 500, 500); } catch(Throwable e) { handleException(e); *************** *** 2360,2364 **** } catch(javax.jdo.JDODataStoreException e) { if (e.getCause() instanceof FileNotFoundException) { ! BaseDialog.showWarning((java.awt.Component)this, getResourceString(FileHistoryMenu.class, "CTFileMissing"), getResourceString(FileHistoryMenu.class, "CWFileMissing")); mnuFileHistory.removeRecent(filename); } else { --- 2426,2430 ---- } catch(javax.jdo.JDODataStoreException e) { if (e.getCause() instanceof FileNotFoundException) { ! BaseDialog.showWarning((java.awt.Component)this, ResourceManager.getResource(FileHistoryMenu.class, "CTFileMissing"), ResourceManager.getResource(FileHistoryMenu.class, "CWFileMissing")); mnuFileHistory.removeRecent(filename); } else { *************** *** 2449,2464 **** if (getTlbStandard().getTbbSaveEnabled()) { Boolean answer = BaseDialog.showConfirmExit((java.awt.Component)this); ! if (answer == Boolean.TRUE) { return mniSaveFile(); - } else { - return answer != null; } - } else { - return true; } } catch(Throwable e) { handleException(e); - return false; } } /** --- 2515,2531 ---- if (getTlbStandard().getTbbSaveEnabled()) { Boolean answer = BaseDialog.showConfirmExit((java.awt.Component)this); ! if (answer == null) { ! // canceled -> do nothing yet! ! return false; ! } else if (answer.booleanValue()) { ! // depends whether save is ok! return mniSaveFile(); } } } catch(Throwable e) { handleException(e); } + // discard (if answer==false) or nothing changed yet + return true; } /** *************** *** 2523,2526 **** --- 2590,2602 ---- }); } + private void saveSettings() { + getSettings().setLastFiles(mnuFileHistory.getHistory()); + // getSettings().setNavigationSort(NavigationTreeModel.SORT_BY_KIND_NAME); + getSettings().setWindowHeight(new Integer(getHeight())); + getSettings().setWindowWidth(new Integer(getWidth())); + // getSettings().setWindowX(new Integer(getX())); + // getSettings().setWindowY(new Integer(getY())); + getSettings().save(); + } /** * Register currently selected treeNode in NavigationTree *************** *** 2586,2600 **** } } catch(Throwable e) { ! Tracer.getInstance().runtimeError(this, "setLanguage()", e.getLocalizedMessage()); } } /** * Keep changes of Model in mind. - * @deprecated (Nasty Hack-method) */ public void setModelChanged(boolean changed) { // hasModelChanged = changed; ! getMniFileSave().setEnabled(changed); ! getTlbStandard().setTbbSaveEnabled(changed); } /** --- 2662,2677 ---- } } catch(Throwable e) { ! Tracer.getInstance().runtimeError(null, e); } } /** * Keep changes of Model in mind. */ public void setModelChanged(boolean changed) { // hasModelChanged = changed; ! boolean saveable = getViewOptions().getViewManager().getRights(TcoModel.class).isSaveObjectAllowed(); ! getMniFileSave().setEnabled(saveable && changed); ! getMniFileSaveAs().setEnabled(saveable); ! getTlbStandard().setTbbSaveEnabled(saveable && changed); } /** *************** *** 2621,2626 **** --- 2698,2730 ---- setModelChanged(false); } + private static void showInstance(ViewOptions viewOptions, ModelUtility utility, ApplicationOptions options) throws Throwable { + new LauncherView(viewOptions, options); + // getInstance().addDefaultClosingListener(); + // getInstance().setLookAndFeel(settings.getLookAndFeel()); + java.awt.Insets insets = getInstance().getInsets(); + getInstance().setSize(getInstance().getWidth() + insets.left + insets.right, getInstance().getHeight() + insets.top + insets.bottom); + getInstance().setVisible(true); + getInstance().setUtility(utility); + + //viewOptions.getViewManager().setRights(new UserActionRights(UserActionRights.READONLY)); // Read-Only Version + getInstance().getStbStatus().setRights(viewOptions.getViewManager().getRights(TcoModel.class)); + + try { + //TODO Future use: instantiate LauncherView in ApplicationPlugin#createAndShowGUI() + /*getInstance().pluginManager =*/ PluginUtility.invokePlugins("org.tcotool.core.runtime"); + } catch(Exception e) { + //TODO NLS + BaseDialog.showError(getInstance(), "Plugin-Initialisierung", "Es ist ein Fehler beim Laden allfälliger Plugins aufgetreten.\nMöglicherweise sind nicht alle Plugin-Optionen verfügbar.", e); + } + } public void showStatus(String status) { getStbStatus().setStatus(status); } + /** + * Set the image to be displayed in the Report-Desktop-Pane. + * @param image + */ + public void setBackgroundImage(Image image) { + this.image = image; + } } |