Update of /cvsroot/tcotool/TCO-Tool/src/org/tcotool/application
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28357/src/org/tcotool/application
Modified Files:
NavigationView.java
Log Message:
BUG FIX: Popup Menu Control mechanism
Index: NavigationView.java
===================================================================
RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/application/NavigationView.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** NavigationView.java 14 Dec 2005 13:14:14 -0000 1.5
--- NavigationView.java 22 Dec 2005 12:27:15 -0000 1.6
***************
*** 22,25 ****
--- 22,26 ----
import java.util.List;
+ import org.tcotool.pluginsupport.Menu;
import org.tcotool.standard.report.ReportInvestment;
import org.tcotool.standard.report.ReportTco;
***************
*** 146,149 ****
--- 147,151 ----
boolean selected = (node != null);
boolean isPackage = selected && (node instanceof TcoPackage);
+ boolean isService = selected && (node instanceof Service);
getMnuFileNew().setEnabled(false);
***************
*** 173,179 ****
}
getMniService().setEnabled(isPackage && (!node.equals(modelAdapter.getUtility().getRoot())));
- getMniReportBlockTcoDetailed().setEnabled(selected);
- getMniReportBlockTcoTotal().setEnabled(isPackage);
- getMniReportInvestment().setEnabled(isPackage);
// treat "Main-Menu"
--- 175,178 ----
***************
*** 190,206 ****
getMniExportConfiguration().setEnabled(isPackage && (!modelAdapter.getUtility().getRoot().equals(node)));
! Component[] items = getMnuReportFinance().getMenuComponents();
! for (int i=0; i<items.length; i++) {
JComponent comp = (JComponent)items[i];
// @see ApplicationPlugin#createMenuItem()
Boolean isGroup = (Boolean)comp.getClientProperty(org.tcotool.pluginsupport.Menu.GROUP_SPECIFIC);
if (isGroup == null) {
! comp.setEnabled(selected);
} else {
! comp.setEnabled(isGroup.booleanValue() && isPackage);
}
}
-
- // LauncherView.getInstance().adaptSelection(node);
}
/**
--- 189,223 ----
getMniExportConfiguration().setEnabled(isPackage && (!modelAdapter.getUtility().getRoot().equals(node)));
! adaptReports(getMnuReportTco().getMenuComponents(), isService, isPackage);
! adaptReports(getMnuReportFinance().getMenuComponents(), isService, isPackage);
! // getMniReportBlockTcoTotal().setEnabled(isPackage);
! // getMniReportBlockTcoDetailed().setEnabled(isService || isPackage);
! // getMniReportInvestment().setEnabled(isPackage);
!
! // LauncherView.getInstance().adaptSelection(node);
! }
! /**
! * Adapt Plugin-Reports.
! * @param items
! * @param isService
! * @param isPackage
! * @see org.tcotool.pluginsupport.Menu
! */
! private void adaptReports(Component[] items, boolean isService, boolean isPackage) {
! for (int i=0; i<items.length; i++) {
JComponent comp = (JComponent)items[i];
// @see ApplicationPlugin#createMenuItem()
Boolean isGroup = (Boolean)comp.getClientProperty(org.tcotool.pluginsupport.Menu.GROUP_SPECIFIC);
if (isGroup == null) {
! // report is available for Group or Package
! comp.setEnabled(isService || isPackage);
! } else if (isGroup.booleanValue()) {
! // only TcoPackage specific
! comp.setEnabled(isPackage);
} else {
! // only Service specific
! comp.setEnabled(isService);
}
}
}
/**
***************
*** 1017,1020 ****
--- 1034,1038 ----
ivjMniReportBlockTcoDetailed.setText("Kostenblock detailiert (TCO)");
// user code begin {1}
+ ivjMniReportBlockTcoDetailed.putClientProperty(Menu.GROUP_SPECIFIC, null);
ivjMniReportBlockTcoDetailed.setToolTipText(getResourceString("CICostBlock"));
ivjMniReportBlockTcoDetailed.setText(getResourceString("MniReportTcoCostDetailed_text"));
***************
*** 1041,1044 ****
--- 1059,1063 ----
ivjMniReportBlockTcoTotal.setText("Kostenblock gesamt (TCO)");
// user code begin {1}
+ ivjMniReportBlockTcoTotal.putClientProperty(Menu.GROUP_SPECIFIC, Boolean.TRUE);
ivjMniReportBlockTcoTotal.setToolTipText(getResourceString("CICostBlock"));
ivjMniReportBlockTcoTotal.setText(getResourceString(LauncherView.class, "MniReportTotalTcoCost_text"));
***************
*** 1055,1058 ****
--- 1074,1078 ----
if (mniReportInvestment == null) {
mniReportInvestment = new JMenuItem();
+ mniReportInvestment.putClientProperty(Menu.GROUP_SPECIFIC, Boolean.TRUE);
mniReportInvestment.setText(getResourceString(LauncherView.class, "MniReportInvestment_text"));
mniReportInvestment.addActionListener(new java.awt.event.ActionListener() {
***************
*** 1757,1760 ****
--- 1777,1781 ----
this.viewOptions = viewOptions;
if (!viewOptions.isSet(LauncherView.TEST_RELEASE)) {
+ //TODO not yet robust
getSepImportExport().setVisible(false);
getMniImportConfiguration().setVisible(false);
|