|
From: <de...@us...> - 2013-09-03 19:24:43
|
Revision: 8481
http://sourceforge.net/p/fudaa/svn/8481
Author: deniger
Date: 2013-09-03 19:24:37 +0000 (Tue, 03 Sep 2013)
Log Message:
-----------
CRUE-573
Modified Paths:
--------------
trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/view/ItemVariableView.java
trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingNetworkTopComponent.java
trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportNetworkTopComponent.java
trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/service/ReportAggregationCacheService.java
trunk/soft/fudaa-crue/ui-sysdoc/src/main/java/org/fudaa/fudaa/crue/sysdoc/SysdocTopComponent.java
trunk/soft/fudaa-crue/ui-sysdoc/src/main/resources/org/fudaa/fudaa/crue/sysdoc/Bundle.properties
Modified: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/view/ItemVariableView.java
===================================================================
--- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/view/ItemVariableView.java 2013-09-03 12:51:39 UTC (rev 8480)
+++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/view/ItemVariableView.java 2013-09-03 19:24:37 UTC (rev 8481)
@@ -110,10 +110,16 @@
public TextField(ItemVariable property, DecimalFormatEpsilonEnum formatType) {
super(property);
- txt = new JFormattedTextField(property.getFormatter(formatType));
+ if (property != null) {
+ txt = new JFormattedTextField(property.getFormatter(formatType));
+ } else {
+ txt = new JFormattedTextField();
+ }
txt.setColumns(20);
txt.getDocument().addDocumentListener(this);
- txt.setToolTipText(property.getValidator().getHtmlDesc());
+ if (property != null) {
+ txt.setToolTipText(property.getValidator().getHtmlDesc());
+ }
pn = new JPanel(new BorderLayout(2, 2));
label = new JLabel();
label.setText(" ");
@@ -150,7 +156,9 @@
label.setToolTipText(null);
valid = true;
CtuluLog res = new CtuluLog(BusinessMessages.RESOURCE_BUNDLE);
- property.getValidator().validateNumber(StringUtils.EMPTY, (Number) getValue(), res, false);
+ if (property != null) {
+ property.getValidator().validateNumber(StringUtils.EMPTY, (Number) getValue(), res, false);
+ }
if (res.isNotEmpty()) {
CtuluLogRecord record = res.getRecords().get(0);
BusinessMessages.updateLocalizedMessage(record);
@@ -169,11 +177,13 @@
@Override
public void changedUpdate(DocumentEvent e) {
- String tltip = property.format(getValue(), DecimalFormatEpsilonEnum.COMPARISON);
- if (tltip != null) {
- tltip = org.openide.util.NbBundle.getMessage(ItemVariableView.class, "TooltipValue", tltip);
+ if (property != null) {
+ String tltip = property.format(getValue(), DecimalFormatEpsilonEnum.COMPARISON);
+ if (tltip != null) {
+ tltip = org.openide.util.NbBundle.getMessage(ItemVariableView.class, "TooltipValue", tltip);
+ }
+ txt.setToolTipText(property.getValidator().getHtmlDesc(tltip));
}
- txt.setToolTipText(property.getValidator().getHtmlDesc(tltip));
setChanged();
validateData();
notifyObservers(this);
@@ -193,10 +203,13 @@
if (value == null) {
return null;
}
- if (property.isEntier()) {
+ if (property != null && property.isEntier()) {
return Integer.valueOf(((Number) value).intValue());
}
double val = ((Number) value).doubleValue();
+ if (property == null) {
+ return (Number) value;
+ }
return Double.valueOf(property.getNormalizedValue(val));
}
Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingNetworkTopComponent.java
===================================================================
--- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingNetworkTopComponent.java 2013-09-03 12:51:39 UTC (rev 8480)
+++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingNetworkTopComponent.java 2013-09-03 19:24:37 UTC (rev 8481)
@@ -2,6 +2,8 @@
import com.rits.cloning.Cloner;
import java.awt.BorderLayout;
+import java.awt.KeyboardFocusManager;
+import java.awt.Window;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -226,16 +228,25 @@
private class SelectedEMHLookupListener implements LookupListener {
+ private boolean updating;
+
@Override
public void resultChanged(LookupEvent ev) {
- if (WindowManager.getDefault().getRegistry().getActivated() == ModellingNetworkTopComponent.this) {
+ if (updating) {
return;
}
+ Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().
+ getActiveWindow();
+ if (activeWindow == WindowManager.getDefault().getMainWindow() && WindowManager.getDefault().getRegistry().getActivated() == ModellingNetworkTopComponent.this) {
+ return;
+ }
if (modellingSelectedEMHService.isUpdating()) {
return;
}
+ updating = true;
Set<Long> selectedUid = new HashSet<Long>(resultatEMHsSelected.allInstances());
selectEMHs(selectedUid);
+ updating = false;
}
}
Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportNetworkTopComponent.java
===================================================================
--- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportNetworkTopComponent.java 2013-09-03 12:51:39 UTC (rev 8480)
+++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportNetworkTopComponent.java 2013-09-03 19:24:37 UTC (rev 8481)
@@ -1,6 +1,8 @@
package org.fudaa.fudaa.crue.report;
import java.awt.BorderLayout;
+import java.awt.KeyboardFocusManager;
+import java.awt.Window;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -33,15 +35,15 @@
* Top component which displays something.
*/
@ConvertAsProperties(dtd = "-//org.fudaa.fudaa.crue.report//ReportNetworkTopComponent//EN",
-autostore = false)
+ autostore = false)
@TopComponent.Description(preferredID = ReportNetworkTopComponent.TOPCOMPONENT_ID,
-iconBase = "org/fudaa/fudaa/crue/report/rond-orange_16.png",
-persistenceType = TopComponent.PERSISTENCE_ALWAYS)
+ iconBase = "org/fudaa/fudaa/crue/report/rond-orange_16.png",
+ persistenceType = TopComponent.PERSISTENCE_ALWAYS)
@TopComponent.Registration(mode = "report-bottomRight", openAtStartup = false, position = 3)
@ActionID(category = "Window", id = "org.fudaa.fudaa.crue.report.ReportNetworkTopComponent")
@ActionReference(path = "Menu/Window/Report", position = 6)
@TopComponent.OpenActionRegistration(displayName = ReportNetworkTopComponent.TOPCOMPONENT_ACTION_DISPLAYNAME,
-preferredID = ReportNetworkTopComponent.TOPCOMPONENT_ID)
+ preferredID = ReportNetworkTopComponent.TOPCOMPONENT_ID)
public final class ReportNetworkTopComponent extends AbstractReportTopComponent implements LookupListener, ExplorerManager.Provider {
ReportSelectedEMHService reportSelectedEMHService = Lookup.getDefault().lookup(ReportSelectedEMHService.class);
@@ -133,16 +135,22 @@
private class SelectedEMHsLookupListener implements LookupListener {
+ private boolean updating;
+
@Override
public void resultChanged(LookupEvent ev) {
- if (reportSelectedEMHService.isUpdating()) {
+ if (reportSelectedEMHService.isUpdating() || updating) {
return;
}
- //pas de modification si vue active
- if (WindowManager.getDefault().getRegistry().getActivated() != ReportNetworkTopComponent.this) {
+ updating = true;
+ Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().
+ getActiveWindow();
+ //pas de modification si vue active et si pas de recherche depuis la fenetre de recherche
+ if (activeWindow != WindowManager.getDefault().getMainWindow() || WindowManager.getDefault().getRegistry().getActivated() != ReportNetworkTopComponent.this) {
Collection<? extends Long> allItems = resultatEMHsSelected.allInstances();
LinkedEMHHelper.selectEMHs(getExplorerManager(), new HashSet<Long>(allItems));
}
+ updating = false;
}
}
@@ -192,6 +200,6 @@
}
void readProperties(java.util.Properties p) {
- DialogHelper.readProperties(outlineView, "outlineView", p);
+ DialogHelper.readProperties(outlineView, "outlineView", p);
}
}
Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/service/ReportAggregationCacheService.java
===================================================================
--- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/service/ReportAggregationCacheService.java 2013-09-03 12:51:39 UTC (rev 8480)
+++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/service/ReportAggregationCacheService.java 2013-09-03 19:24:37 UTC (rev 8481)
@@ -24,8 +24,7 @@
@ServiceProvider(service = ReportAggregationCacheServiceContrat.class)})
public class ReportAggregationCacheService implements ReportAggregationCacheServiceContrat {
-// private LRUMap map = new LRUMap(1000);
- private LRUMap map = new LRUMap(10000);
+ private LRUMap map = new LRUMap(100000);
private PostRunService postRunService = Lookup.getDefault().lookup(PostRunService.class);
ReportService reportService = Lookup.getDefault().lookup(ReportService.class);
private final Lookup.Result<EMHScenario> resultat;
Modified: trunk/soft/fudaa-crue/ui-sysdoc/src/main/java/org/fudaa/fudaa/crue/sysdoc/SysdocTopComponent.java
===================================================================
--- trunk/soft/fudaa-crue/ui-sysdoc/src/main/java/org/fudaa/fudaa/crue/sysdoc/SysdocTopComponent.java 2013-09-03 12:51:39 UTC (rev 8480)
+++ trunk/soft/fudaa-crue/ui-sysdoc/src/main/java/org/fudaa/fudaa/crue/sysdoc/SysdocTopComponent.java 2013-09-03 19:24:37 UTC (rev 8481)
@@ -13,8 +13,6 @@
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.KeyboardFocusManager;
-import java.awt.Label;
-import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
@@ -46,6 +44,8 @@
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.text.html.HTMLDocument;
@@ -190,7 +190,6 @@
return null;
}
-
protected void highlightStateChanged() {
if (btHighlight.isSelected() != this.editorSearchable.isHighlightEnabled()) {
editorSearchable.setHighlightEnabled(btHighlight.isSelected());
@@ -311,7 +310,13 @@
protected void urlChanged() {
if (sysdocLocaleDir != null && nodeByPath != null && !isUpdating) {
try {
- String location = URLDecoder.decode(browser.getBrowserImpl().getLocation(), "UTF-8");
+ final String initLocation = browser.getBrowserImpl().getLocation();
+ String location = URLDecoder.decode(initLocation, "UTF-8");
+ if (isExternURL(new URL(location))) {
+ nodeSelectionChanged();
+ return;
+ }
+
String base = sysdocLocaleDir.toURI().toURL().toString();
String path = StringUtils.removeStart(location, base);
path = StringUtils.substringBefore(path, LienDocumentation.SIGNET_SEPARATOR);
@@ -587,9 +592,62 @@
JPanel pn = new JPanel(new BuGridLayout(2, 0, 0, true, false));
pn.add(pnButtons);
pn.add(components[1]);
+ Component browserComponent = browser.getBrowserComponent();
+ if (browserComponent instanceof JScrollPane) {
+ browserComponent = ((JScrollPane) browserComponent).getViewport().getView();
+ }
+ if (browserComponent instanceof JEditorPane) {
+ ((JEditorPane) browserComponent).addHyperlinkListener(new HyperlinkListener() {
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ hyperlinkActivated(e);
+ }
+ }
+ });
+ }
browser.add(pn, BorderLayout.NORTH);
}
+ protected boolean isExternURL(final URL url) {
+ if (url == null) {
+ return true;
+ }
+ try {
+ SysdocFolder folder = new SysdocFolder(sysdocLocaleDir);
+ String baseURL = folder.getBaseDir().toURI().toURL().toString().toLowerCase();
+ String targetURL = url.toString().toLowerCase();
+ return !targetURL.startsWith(baseURL);
+ } catch (MalformedURLException malformedURLException) {
+ }
+ return false;
+ }
+
+ protected void hyperlinkActivated(HyperlinkEvent e) {
+ try {
+
+ final URL url = e.getURL();
+ if (url == null) {
+ return;
+ }
+ String targetURL = url.toString().toLowerCase();
+ if (isExternURL(url)) {
+ if (targetURL.startsWith("http") || targetURL.startsWith("mailto")) {
+ Desktop.getDesktop().browse(url.toURI());
+ } else {
+ File targetFile = new File(url.getFile());
+ if (targetFile.exists()) {
+ Desktop.getDesktop().browse(targetFile.toURI());
+ } else {
+ DialogHelper.showWarn(NbBundle.getMessage(SysdocTopComponent.class, "fileNotExist", targetFile.toString()));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
private void configureButton(JButton button) {
button.setOpaque(false);
button.setBorderPainted(false);
Modified: trunk/soft/fudaa-crue/ui-sysdoc/src/main/resources/org/fudaa/fudaa/crue/sysdoc/Bundle.properties
===================================================================
--- trunk/soft/fudaa-crue/ui-sysdoc/src/main/resources/org/fudaa/fudaa/crue/sysdoc/Bundle.properties 2013-09-03 12:51:39 UTC (rev 8480)
+++ trunk/soft/fudaa-crue/ui-sysdoc/src/main/resources/org/fudaa/fudaa/crue/sysdoc/Bundle.properties 2013-09-03 19:24:37 UTC (rev 8481)
@@ -18,3 +18,4 @@
HomeButton.Tooltip=Aller \u00e0 la page d'accueil
PrintButton.Tooltip=Afficher la page dans le navigateur syst\u00e8me
highlight.All=Tout surligner
+fileNotExist=Le fichier {0} n''existe pas
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|