Compare commits
79 Commits
release/8.
...
release/8.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99da8e2286 | ||
|
|
239ece2966 | ||
|
|
ce4740ce83 | ||
|
|
7c795f724c | ||
|
|
67784188df | ||
|
|
248a7d74dc | ||
|
|
c09c406c32 | ||
|
|
bd5b8b0f51 | ||
|
|
eb7c195d3e | ||
|
|
33162c8be4 | ||
|
|
7169a3101a | ||
|
|
192e47b6a3 | ||
|
|
28eda4c880 | ||
|
|
309c2ac056 | ||
|
|
64c530b6b4 | ||
|
|
71f93b5165 | ||
|
|
41b50e16c1 | ||
|
|
b7711e1dd5 | ||
|
|
8ed759c0d8 | ||
|
|
3ff40da876 | ||
|
|
da6a983f29 | ||
|
|
2913c80aef | ||
|
|
fa2abaf8f3 | ||
|
|
81e63ecab0 | ||
|
|
3b647c2316 | ||
|
|
4ff0184a49 | ||
|
|
0e37b9632e | ||
|
|
f2a4328037 | ||
|
|
771a1bf810 | ||
|
|
3f7d1a83d9 | ||
|
|
c20078c3d1 | ||
|
|
d13ae7e637 | ||
|
|
6b094dd4fd | ||
|
|
1ebdb18d27 | ||
|
|
98930c8c96 | ||
|
|
a7ab220672 | ||
|
|
553b2770c9 | ||
|
|
dd851d3202 | ||
|
|
f47f991977 | ||
|
|
a2e44cb5c2 | ||
|
|
e36f0690f0 | ||
|
|
9c4a9c1589 | ||
|
|
da4ba3f1a0 | ||
|
|
087dac391d | ||
|
|
ab843f7a55 | ||
|
|
5949ce647d | ||
|
|
f9e7be104e | ||
|
|
774e6dea26 | ||
|
|
3eccad0352 | ||
|
|
ada4bcf7e3 | ||
|
|
7c72d190de | ||
|
|
025cec4828 | ||
|
|
91df21afcd | ||
|
|
a3af2de13a | ||
|
|
5c6fd374f1 | ||
|
|
c11aa42cee | ||
|
|
5506094ec3 | ||
|
|
a0a7b7cc52 | ||
|
|
0a7eb0653f | ||
|
|
baabcf9167 | ||
|
|
d24160aaf7 | ||
|
|
ff42b63947 | ||
|
|
bc536f772e | ||
|
|
6e88e334a3 | ||
|
|
5b86f87d99 | ||
|
|
11ff6ac63d | ||
|
|
a4679a906a | ||
|
|
a4a0bc0649 | ||
|
|
0709202ae3 | ||
|
|
899c5a03f6 | ||
|
|
5e1bca282f | ||
|
|
61a8ed2b73 | ||
|
|
ab88eda019 | ||
|
|
c4942af4b0 | ||
|
|
80ccccb407 | ||
|
|
4063e6888b | ||
|
|
54d1a85c1f | ||
|
|
a2c23dd110 | ||
|
|
9e56acd4e5 |
@@ -5,7 +5,6 @@
|
||||
<copyright url="http://www.example.com/copyright">[Enter Copyright Description here.]</copyright>
|
||||
<license url="http://www.example.com/license">[Enter License Description here.]</license>
|
||||
<requires>
|
||||
<import plugin="org.bouncycastle.bcprov" version="1.70.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.cedarsoftware.json-io" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-annotations" version="2.9.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-core" version="2.9.8" match="greaterOrEqual"/>
|
||||
|
||||
@@ -37,6 +37,8 @@ public interface ColorConstants {
|
||||
static final Color YELLOW_COLOR = new Color(null, 255, 173, 37);// 254, 182, 84
|
||||
|
||||
static final Color RED_COLOR = new Color(null, new RGB(204, 87, 89));// 255
|
||||
|
||||
static final Color ERROR_FONT_COLOR = new Color(null, new RGB(255, 0, 0));// 255
|
||||
|
||||
static final Color VERTICAL_SEPERATOR_LINE_COLOR = new Color(null, 162, 179, 195);
|
||||
|
||||
@@ -55,12 +57,17 @@ public interface ColorConstants {
|
||||
|
||||
static Color getTableBackgroundColor() {
|
||||
return ITalendThemeService.getColor(ColorConstants.BUNDLE_ID_COMMON_UI_RUNTIME, ColorConstants.KEY_TABLE_BACKGROUND)
|
||||
.orElse(WHITE_COLOR);
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
|
||||
}
|
||||
|
||||
static Color getTableForegroundColor() {
|
||||
return ITalendThemeService.getColor(ColorConstants.BUNDLE_ID_COMMON_UI_RUNTIME, ColorConstants.KEY_TABLE_FOREGROUND)
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
|
||||
}
|
||||
|
||||
static Color getTableReadOnlyForegroundColor() {
|
||||
return ITalendThemeService.getColor("CONTEXT_TABLE_READONLY_FOREGROUND")
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.commons.ui.runtime;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.osgi.framework.BundleContext;
|
||||
@@ -29,6 +30,8 @@ public interface ITalendThemeService {
|
||||
|
||||
public static String DEFAULT_PREFERENCE_ID = "org.eclipse.ui.workbench";
|
||||
|
||||
public static String THEME_PREFERENCE_ID = "org.eclipse.e4.ui.css.swt.theme";
|
||||
|
||||
/**
|
||||
* Get color from instance scope preference of default bundleId, which managed by theme; the standard way eclipse
|
||||
* uses
|
||||
@@ -132,6 +135,8 @@ public interface ITalendThemeService {
|
||||
|
||||
void removePropertyChangeListenerFor(String bundleId, IPropertyChangeListener listener);
|
||||
|
||||
IPreferenceStore getThemePreferenceStore();
|
||||
|
||||
static ITalendThemeService get() {
|
||||
try {
|
||||
BundleContext bc = FrameworkUtil.getBundle(ITalendThemeService.class).getBundleContext();
|
||||
|
||||
@@ -96,7 +96,7 @@ ProposalUtils.CtrlProposal.ErrorMsg=\u3053\u306E\u30BF\u30A4\u30D7\u306E\u5236\u
|
||||
RemovePushButton.RemoveButton.Tip=\u9078\u629E\u3057\u305F\u30A2\u30A4\u30C6\u30E0\u3092\u524A\u9664
|
||||
ResetDBTypesButton.ResetDBTypesButton.Tip=DB\u30BF\u30A4\u30D7\u3092\u30EA\u30BB\u30C3\u30C8
|
||||
Rule.rule=\u30EB\u30FC\u30EB[{0}]
|
||||
SaveAsGenericSchemaPushButton.saveAsSchema=\u6C4E\u7528\u30B9\u30AD\u30FC\u30DE\u3068\u3057\u3066\u4FDD\u5B58
|
||||
SaveAsGenericSchemaPushButton.saveAsSchema=\u30B8\u30A7\u30CD\u30EA\u30C3\u30AF\u30B9\u30AD\u30FC\u30DE\u3068\u3057\u3066\u4FDD\u5B58
|
||||
SelectContextVariablesPushButton.Label=\u30B3\u30F3\u30C6\u30AF\u30B9\u30C8\u5909\u6570\u3092\u9078\u629E
|
||||
SWTCalendarWithTime.contentEvening=\u5915\u65B9
|
||||
SWTCalendarWithTime.contentHr=\u6642:
|
||||
|
||||
@@ -36,6 +36,11 @@ public final class CommonExceptionHandler {
|
||||
Priority priority = getPriority(ex);
|
||||
process(ex, priority);
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, String msg) {
|
||||
Priority priority = getPriority(ex);
|
||||
process(ex, msg, priority);
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, Priority priority) {
|
||||
String message = ex.getMessage();
|
||||
@@ -43,6 +48,13 @@ public final class CommonExceptionHandler {
|
||||
log.log(priority, message, ex);
|
||||
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, String msg, Priority priority) {
|
||||
String message = ex.getMessage() + ": " + msg;
|
||||
|
||||
log.log(priority, message, ex);
|
||||
|
||||
}
|
||||
|
||||
public static void log(String message) {
|
||||
log.log(Level.INFO, message);
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.runtime.model.emf;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.xmi.XMLHelper;
|
||||
import org.eclipse.emf.ecore.xmi.XMLResource;
|
||||
import org.eclipse.emf.ecore.xmi.XMLSave;
|
||||
import org.eclipse.emf.ecore.xmi.impl.XMISaveImpl;
|
||||
import org.eclipse.emf.ecore.xmi.impl.XMLString;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class CustomXMIResource extends TalendXMIResource {
|
||||
|
||||
public static final String ENCODING = "UTF-8"; //$NON-NLS-1$
|
||||
|
||||
CustomXMISave xmiSave;
|
||||
|
||||
public CustomXMIResource() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CustomXMIResource(URI uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
encoding = ENCODING;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected XMLSave createXMLSave() {
|
||||
xmiSave = new CustomXMISave(createXMLHelper());
|
||||
return xmiSave;
|
||||
}
|
||||
|
||||
public String getResourceContent(Map<?, ?> options) {
|
||||
if (xmiSave == null) {
|
||||
createXMLSave();
|
||||
}
|
||||
return xmiSave.getXMLContent(this, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CustomXMISave extends XMISaveImpl {
|
||||
|
||||
public CustomXMISave(XMLHelper helper) {
|
||||
super(helper);
|
||||
}
|
||||
|
||||
public String getXMLContent(XMLResource resource, Map<?, ?> options) {
|
||||
StringJoiner strJoin = new StringJoiner("");
|
||||
super.init(resource, options);
|
||||
super.traverse(resource.getContents());
|
||||
XMLString xmlString = this.doc;
|
||||
Iterator<String> iterator = xmlString.stringIterator();
|
||||
while (iterator.hasNext()) {
|
||||
String string = (String) iterator.next();
|
||||
if (string != null) {
|
||||
strJoin.add(string);
|
||||
}
|
||||
}
|
||||
return strJoin.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -263,4 +264,12 @@ public class EmfHelper {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String getEmfModelContent(EObject model) throws Exception {
|
||||
String content = "";
|
||||
CustomXMIResource xmiResource = new CustomXMIResource();
|
||||
xmiResource.getContents().add(model);
|
||||
content = xmiResource.getResourceContent(Collections.EMPTY_MAP);
|
||||
return content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -145,7 +145,30 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
|
||||
*/
|
||||
@Override
|
||||
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
|
||||
return new DB2ForZosResultSet();
|
||||
ResultSet rs = super.getPrimaryKeys(catalog, schema, table);
|
||||
if (rs == null) {
|
||||
rs = new DB2ForZosResultSet();
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeDatabaseMetaData#getExportedKeys(java.lang.String, java.lang.String,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException {
|
||||
ResultSet rs = super.getExportedKeys(catalog, schema, table);
|
||||
if (rs == null) {
|
||||
if (this.metaData != null) {
|
||||
rs = this.metaData.getExportedKeys(catalog, schema, table);
|
||||
} else {
|
||||
rs = new DB2ForZosResultSet();
|
||||
}
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -174,17 +197,6 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
|
||||
return tableResultSet;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeDatabaseMetaData#getExportedKeys(java.lang.String, java.lang.String,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException {
|
||||
return new DB2ForZosResultSet();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.talend.commons.exception.CommonExceptionHandler;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
|
||||
@@ -108,6 +109,7 @@ public class NetworkUtil {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.process(e, getCheckUrl());
|
||||
return false;
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
@@ -144,6 +146,7 @@ public class NetworkUtil {
|
||||
conn.setRequestMethod("HEAD"); //$NON-NLS-1$
|
||||
conn.getResponseMessage();
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.process(e, urlString);
|
||||
// if not reachable , will throw exception(time out/unknown host) .So if catched exception, make it a
|
||||
// invalid server
|
||||
return false;
|
||||
|
||||
@@ -92,7 +92,7 @@ ProposalUtils.CtrlProposal.ErrorMsg=\u3053\u306E\u30BF\u30A4\u30D7\u306E\u5236\u
|
||||
RemovePushButton.RemoveButton.Tip=\u9078\u629E\u3057\u305F\u30A2\u30A4\u30C6\u30E0\u3092\u524A\u9664
|
||||
ResetDBTypesButton.ResetDBTypesButton.Tip=DB\u30BF\u30A4\u30D7\u3092\u30EA\u30BB\u30C3\u30C8
|
||||
Rule.rule=\u30EB\u30FC\u30EB[{0}]
|
||||
SaveAsGenericSchemaPushButton.saveAsSchema=\u6C4E\u7528\u30B9\u30AD\u30FC\u30DE\u3068\u3057\u3066\u4FDD\u5B58
|
||||
SaveAsGenericSchemaPushButton.saveAsSchema=\u30B8\u30A7\u30CD\u30EA\u30C3\u30AF\u30B9\u30AD\u30FC\u30DE\u3068\u3057\u3066\u4FDD\u5B58
|
||||
SelectContextVariablesPushButton.Label=\u30B3\u30F3\u30C6\u30AF\u30B9\u30C8\u5909\u6570\u3092\u9078\u629E
|
||||
SWTCalendarWithTime.contentEvening=\u5915\u65B9
|
||||
SWTCalendarWithTime.contentHr=\u6642:
|
||||
|
||||
@@ -18,12 +18,12 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.PreferenceConverter;
|
||||
import org.eclipse.jface.resource.StringConverter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.scanner.ColoringScanner;
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ import org.talend.commons.ui.swt.colorstyledtext.scanner.ColoringScanner;
|
||||
*
|
||||
*/
|
||||
public class ColorManager {
|
||||
|
||||
|
||||
public static final RGB DEFAULT_STRING_COLOR = new RGB(0, 0, 0);
|
||||
|
||||
public static final RGB DEFAULT_KEYWORD1_COLOR = new RGB(50, 32, 160);
|
||||
@@ -106,15 +106,19 @@ public class ColorManager {
|
||||
}
|
||||
|
||||
public Color getColor(String colorName) {
|
||||
RGB prefColor = PreferenceConverter.getColor(store, colorName);
|
||||
Color color = null;
|
||||
if (colorMap.containsKey(colorName) && (colorMap.get(colorName)).getRGB().equals(prefColor)) {
|
||||
color = (Color) colorMap.get(colorName);
|
||||
Color prefColor = getThemeColor(colorName);
|
||||
if (colorMap.containsKey(colorName) && (colorMap.get(colorName)).equals(prefColor)) {
|
||||
return colorMap.get(colorName);
|
||||
} else {
|
||||
color = new Color(Display.getDefault(), prefColor);
|
||||
colorMap.put(colorName, color);
|
||||
colorMap.put(colorName, prefColor);
|
||||
}
|
||||
return color;
|
||||
return prefColor;
|
||||
}
|
||||
|
||||
private static Color getThemeColor(String colorName) {
|
||||
Color c = ITalendThemeService.getColor(colorName)
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||
return c;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
@@ -164,20 +168,20 @@ public class ColorManager {
|
||||
}
|
||||
|
||||
public static void initDefaultColors(IPreferenceStore store) {
|
||||
store.setDefault(NULL_COLOR, StringConverter.asString(DEFAULT_STRING_COLOR));
|
||||
store.setDefault(COMMENT1_COLOR, StringConverter.asString(DEFAULT_COMMENT1_COLOR));
|
||||
store.setDefault(COMMENT2_COLOR, StringConverter.asString(DEFAULT_COMMENT2_COLOR));
|
||||
store.setDefault(LITERAL1_COLOR, StringConverter.asString(DEFAULT_LITERAL1_COLOR));
|
||||
store.setDefault(LITERAL2_COLOR, StringConverter.asString(DEFAULT_LITERAL2_COLOR));
|
||||
store.setDefault(LABEL_COLOR, StringConverter.asString(DEFAULT_LABEL_COLOR));
|
||||
store.setDefault(KEYWORD1_COLOR, StringConverter.asString(DEFAULT_KEYWORD1_COLOR));
|
||||
store.setDefault(KEYWORD2_COLOR, StringConverter.asString(DEFAULT_KEYWORD2_COLOR));
|
||||
store.setDefault(KEYWORD3_COLOR, StringConverter.asString(DEFAULT_KEYWORD3_COLOR));
|
||||
store.setDefault(FUNCTION_COLOR, StringConverter.asString(DEFAULT_FUNCTION_COLOR));
|
||||
store.setDefault(MARKUP_COLOR, StringConverter.asString(DEFAULT_MARKUP_COLOR));
|
||||
store.setDefault(OPERATOR_COLOR, StringConverter.asString(DEFAULT_OPERATOR_COLOR));
|
||||
store.setDefault(DIGIT_COLOR, StringConverter.asString(DEFAULT_DIGIT_COLOR));
|
||||
store.setDefault(INVALID_COLOR, StringConverter.asString(DEFAULT_INVALID_COLOR));
|
||||
store.setDefault(NULL_COLOR, StringConverter.asString(getThemeColor(NULL_COLOR).getRGB()));
|
||||
store.setDefault(COMMENT1_COLOR, StringConverter.asString(getThemeColor(COMMENT1_COLOR).getRGB()));
|
||||
store.setDefault(COMMENT2_COLOR, StringConverter.asString(getThemeColor(COMMENT2_COLOR).getRGB()));
|
||||
store.setDefault(LITERAL1_COLOR, StringConverter.asString(getThemeColor(LITERAL1_COLOR).getRGB()));
|
||||
store.setDefault(LITERAL2_COLOR, StringConverter.asString(getThemeColor(LITERAL2_COLOR).getRGB()));
|
||||
store.setDefault(LABEL_COLOR, StringConverter.asString(getThemeColor(LABEL_COLOR).getRGB()));
|
||||
store.setDefault(KEYWORD1_COLOR, StringConverter.asString(getThemeColor(KEYWORD1_COLOR).getRGB()));
|
||||
store.setDefault(KEYWORD2_COLOR, StringConverter.asString(getThemeColor(KEYWORD2_COLOR).getRGB()));
|
||||
store.setDefault(KEYWORD3_COLOR, StringConverter.asString(getThemeColor(KEYWORD3_COLOR).getRGB()));
|
||||
store.setDefault(FUNCTION_COLOR, StringConverter.asString(getThemeColor(FUNCTION_COLOR).getRGB()));
|
||||
store.setDefault(MARKUP_COLOR, StringConverter.asString(getThemeColor(MARKUP_COLOR).getRGB()));
|
||||
store.setDefault(OPERATOR_COLOR, StringConverter.asString(getThemeColor(OPERATOR_COLOR).getRGB()));
|
||||
store.setDefault(DIGIT_COLOR, StringConverter.asString(getThemeColor(DIGIT_COLOR).getRGB()));
|
||||
store.setDefault(INVALID_COLOR, StringConverter.asString(getThemeColor(INVALID_COLOR).getRGB()));
|
||||
|
||||
String bold = BOLD_SUFFIX;
|
||||
store.setDefault(COMMENT1_COLOR + bold, false);
|
||||
|
||||
@@ -1,368 +1,384 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.colorstyledtext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.text.rules.IToken;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ExtendedModifyEvent;
|
||||
import org.eclipse.swt.custom.ExtendedModifyListener;
|
||||
import org.eclipse.swt.custom.StyleRange;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.runtime.xml.XmlUtil;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.jedit.Mode;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.jedit.Modes;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.rules.CToken;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.scanner.ColoringScanner;
|
||||
import org.talend.commons.utils.threading.ExecutionLimiter;
|
||||
|
||||
/**
|
||||
* This component is an adaptation of a Color Editor for a StyledText.
|
||||
*
|
||||
* The original editor can be found on http://www.gstaff.org/colorEditor/ <br/>
|
||||
*
|
||||
* <b>How to use it, example :</b> <br/>
|
||||
* ColorStyledText text = new ColorStyledText(parent, SWT.H_SCROLL | SWT.V_SCROLL,
|
||||
* CorePlugin.getDefault().getPreferenceStore(), ECodeLanguage.PERL.getName());</i> <br/>
|
||||
* <br/>
|
||||
*
|
||||
* $Id: ColorStyledText.java 7183 2007-11-23 11:03:36Z amaumont $
|
||||
*
|
||||
*/
|
||||
public class ColorStyledText extends StyledText {
|
||||
|
||||
private final static int MAXIMUM_CHARACTERS_BEFORE_USE_TIMER = 1000;
|
||||
|
||||
private final ColorManager colorManager;
|
||||
|
||||
private final ColoringScanner scanner;
|
||||
|
||||
private final String languageMode;
|
||||
|
||||
private final MenuItem pasteItem;
|
||||
|
||||
private boolean coloring = true;
|
||||
|
||||
private UndoRedoManager undoRedoManager;
|
||||
|
||||
public ColorStyledText(Composite parent, int style, IPreferenceStore store, String languageMode) {
|
||||
super(parent, style);
|
||||
this.languageMode = languageMode;
|
||||
this.colorManager = new ColorManager(store);
|
||||
|
||||
/*
|
||||
* set the Shortcuts of the undo/redo
|
||||
*/
|
||||
this.setKeyBinding('Z' | SWT.CTRL, ActionCode.UNDO);
|
||||
this.setKeyBinding('Y' | SWT.CTRL, ActionCode.REDO);
|
||||
UndoRedoManager undoManager = new UndoRedoManager(50);
|
||||
undoManager.connect(this);
|
||||
this.setUndoManager(undoManager);
|
||||
|
||||
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
|
||||
Menu popupMenu = new Menu(this);
|
||||
|
||||
MenuItem redoItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
redoItem.setText(Messages.getString("ColorStyledText.RedoItem.Text")); //$NON-NLS-1$
|
||||
redoItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
redo();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem undoItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
undoItem.setText(Messages.getString("ColorStyledText.UndoItem.Text")); //$NON-NLS-1$
|
||||
undoItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
undo();
|
||||
}
|
||||
});
|
||||
|
||||
Image image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
|
||||
MenuItem copyItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
copyItem.setText(Messages.getString("ColorStyledText.CopyItem.Text")); //$NON-NLS-1$
|
||||
copyItem.setImage(image);
|
||||
copyItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
copy();
|
||||
}
|
||||
});
|
||||
|
||||
image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
|
||||
pasteItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
pasteItem.setText(Messages.getString("ColorStyledText.PasteItem.Text")); //$NON-NLS-1$
|
||||
pasteItem.setData(this);
|
||||
pasteItem.setImage(image);
|
||||
pasteItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
paste();
|
||||
}
|
||||
});
|
||||
pasteItem.setEnabled(getEditable());
|
||||
|
||||
this.setMenu(popupMenu);
|
||||
MenuItem selectAllItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
selectAllItem.setText(Messages.getString("ColorStyledText.SelectAllItem.Text")); //$NON-NLS-1$
|
||||
selectAllItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
selectAll();
|
||||
}
|
||||
});
|
||||
this.setMenu(popupMenu);
|
||||
|
||||
Listener selectAllListener = new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
if (event.character == '\u0001') { // CTRL + A
|
||||
selectAll();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
addListener(SWT.KeyDown, selectAllListener);
|
||||
|
||||
Mode mode = Modes.getMode(languageMode + XmlUtil.FILE_XML_SUFFIX);
|
||||
scanner = new ColoringScanner(mode, colorManager);
|
||||
|
||||
addExtendedModifyListener(modifyListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC qli Comment method "invokeAction".
|
||||
*
|
||||
* @param action
|
||||
*
|
||||
* */
|
||||
public void invokeAction(int action) {
|
||||
super.invokeAction(action);
|
||||
|
||||
switch (action) {
|
||||
case ActionCode.UNDO:
|
||||
undo(); // ctrl+Z
|
||||
break;
|
||||
case ActionCode.REDO:
|
||||
redo(); // ctrl+Y
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for undoRedoManager.
|
||||
*
|
||||
* @return the undoRedoManager
|
||||
*/
|
||||
public UndoRedoManager getUndoManager() {
|
||||
return this.undoRedoManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the undoRedoManager.
|
||||
*
|
||||
* @param undoRedoManager the undoRedoManager to set
|
||||
*/
|
||||
public void setUndoManager(UndoRedoManager undoRedoManager) {
|
||||
this.undoRedoManager = undoRedoManager;
|
||||
}
|
||||
|
||||
public static class ActionCode {
|
||||
|
||||
public static final int UNDO = Integer.MAX_VALUE;
|
||||
|
||||
public static final int REDO = UNDO - 1;
|
||||
|
||||
}
|
||||
|
||||
private void undo() {
|
||||
if (undoRedoManager != null) {
|
||||
undoRedoManager.undo();
|
||||
}
|
||||
}
|
||||
|
||||
private void redo() {
|
||||
if (undoRedoManager != null) {
|
||||
undoRedoManager.redo();
|
||||
}
|
||||
}
|
||||
|
||||
protected void colorize(final ColoringScanner scanner) {
|
||||
final ArrayList<StyleRange> styles = new ArrayList<StyleRange>();
|
||||
if (this.coloring) {
|
||||
IToken token;
|
||||
if (this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
scanner.parse(this.getText().replaceAll("\"", " ").replaceAll("'", " ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
|
||||
do {
|
||||
token = scanner.nextToken();
|
||||
if (!token.isEOF()) {
|
||||
if (token instanceof CToken) {
|
||||
CToken ctoken = (CToken) token;
|
||||
StyleRange styleRange;
|
||||
styleRange = new StyleRange();
|
||||
styleRange.start = scanner.getTokenOffset();
|
||||
styleRange.length = scanner.getTokenLength();
|
||||
if (ctoken.getType() == null) {
|
||||
styleRange.fontStyle = colorManager.getStyleFor(ctoken.getColor());
|
||||
styleRange.foreground = colorManager.getColor(ctoken.getColor());
|
||||
} else {
|
||||
styleRange.fontStyle = colorManager.getStyleForType(ctoken.getColor());
|
||||
styleRange.foreground = colorManager.getColorForType(ctoken.getColor());
|
||||
}
|
||||
styles.add(styleRange);
|
||||
}
|
||||
}
|
||||
} while (!token.isEOF());
|
||||
setStyles(styles);
|
||||
} else {
|
||||
StyleRange styleRange = new StyleRange();
|
||||
styles.add(styleRange);
|
||||
styleRange.start = 0;
|
||||
styleRange.length = this.getText().getBytes().length;
|
||||
styleRange.foreground = null;
|
||||
setStyles(styles);
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyles(final ArrayList<StyleRange> styles) {
|
||||
if (ColorStyledText.this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
int countChars = getCharCount();
|
||||
|
||||
for (int i = 0; i < styles.size(); i++) {
|
||||
StyleRange styleRange = styles.get(i);
|
||||
// System.out.println("styleRange.start=" + styleRange.start);
|
||||
// System.out.println("styleRange.length=" + styleRange.length);
|
||||
if (!(0 <= styleRange.start && styleRange.start + styleRange.length <= countChars)) {
|
||||
continue;
|
||||
}
|
||||
setStyleRange(styleRange);
|
||||
}
|
||||
}
|
||||
|
||||
ExtendedModifyListener modifyListener = new ExtendedModifyListener() {
|
||||
|
||||
public void modifyText(ExtendedModifyEvent event) {
|
||||
if (ColorStyledText.this.getCharCount() > MAXIMUM_CHARACTERS_BEFORE_USE_TIMER) {
|
||||
colorizeLimiter.resetTimer();
|
||||
colorizeLimiter.startIfExecutable(true, null);
|
||||
} else {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
colorize(scanner);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public ColorManager getColorManager() {
|
||||
return this.colorManager;
|
||||
}
|
||||
|
||||
public String getLanguageMode() {
|
||||
return this.languageMode;
|
||||
}
|
||||
|
||||
public ColoringScanner getScanner() {
|
||||
return this.scanner;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.swt.custom.StyledText#setEditable(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setEditable(boolean editable) {
|
||||
super.setEditable(editable);
|
||||
if (pasteItem != null) {
|
||||
pasteItem.setEnabled(editable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for coloring.
|
||||
*
|
||||
* @return the coloring
|
||||
*/
|
||||
public boolean isColoring() {
|
||||
return this.coloring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the coloring.
|
||||
*
|
||||
* @param coloring the coloring to set
|
||||
*/
|
||||
public void setColoring(boolean coloring) {
|
||||
boolean wasDifferent = this.coloring != coloring;
|
||||
this.coloring = coloring;
|
||||
if (!coloring) {
|
||||
removeExtendedModifyListener(modifyListener);
|
||||
} else if (wasDifferent) {
|
||||
colorizeLimiter.resetTimer();
|
||||
colorizeLimiter.startIfExecutable(true, null);
|
||||
addExtendedModifyListener(modifyListener);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.swt.widgets.Widget#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
colorManager.dispose();
|
||||
}
|
||||
|
||||
private final ExecutionLimiter colorizeLimiter = new ExecutionLimiter(1000, true) {
|
||||
|
||||
@Override
|
||||
public void execute(final boolean isFinalExecution, Object data) {
|
||||
if (!isDisposed()) {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
colorize(scanner);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.colorstyledtext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.text.rules.IToken;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ExtendedModifyEvent;
|
||||
import org.eclipse.swt.custom.ExtendedModifyListener;
|
||||
import org.eclipse.swt.custom.StyleRange;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.runtime.xml.XmlUtil;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.jedit.Mode;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.jedit.Modes;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.rules.CToken;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.scanner.ColoringScanner;
|
||||
import org.talend.commons.utils.threading.ExecutionLimiter;
|
||||
|
||||
/**
|
||||
* This component is an adaptation of a Color Editor for a StyledText.
|
||||
*
|
||||
* The original editor can be found on http://www.gstaff.org/colorEditor/ <br/>
|
||||
*
|
||||
* <b>How to use it, example :</b> <br/>
|
||||
* ColorStyledText text = new ColorStyledText(parent, SWT.H_SCROLL | SWT.V_SCROLL,
|
||||
* CorePlugin.getDefault().getPreferenceStore(), ECodeLanguage.PERL.getName());</i> <br/>
|
||||
* <br/>
|
||||
*
|
||||
* $Id: ColorStyledText.java 7183 2007-11-23 11:03:36Z amaumont $
|
||||
*
|
||||
*/
|
||||
public class ColorStyledText extends StyledText {
|
||||
|
||||
|
||||
public static final String PREFERENCE_COLOR_FOREGROUND= "ColorStyledText.Color.Foreground"; //$NON-NLS-1$
|
||||
public static final String PREFERENCE_COLOR_BACKGROUND= "ColorStyledText.Color.Background"; //$NON-NLS-1$
|
||||
public static final String PREFERENCE_COLOR_SELECTION_FOREGROUND= "ColorStyledText.Color.SelectionForeground"; //$NON-NLS-1$
|
||||
public static final String PREFERENCE_COLOR_SELECTION_BACKGROUND= "ColorStyledText.Color.SelectionBackground"; //$NON-NLS-1$
|
||||
|
||||
private final static int MAXIMUM_CHARACTERS_BEFORE_USE_TIMER = 1000;
|
||||
|
||||
private final ColorManager colorManager;
|
||||
|
||||
private final ColoringScanner scanner;
|
||||
|
||||
private final String languageMode;
|
||||
|
||||
private final MenuItem pasteItem;
|
||||
|
||||
private boolean coloring = true;
|
||||
|
||||
private UndoRedoManager undoRedoManager;
|
||||
|
||||
public ColorStyledText(Composite parent, int style, IPreferenceStore store, String languageMode) {
|
||||
super(parent, style);
|
||||
this.languageMode = languageMode;
|
||||
this.colorManager = new ColorManager(store);
|
||||
|
||||
/*
|
||||
* set the Shortcuts of the undo/redo
|
||||
*/
|
||||
this.setKeyBinding('Z' | SWT.CTRL, ActionCode.UNDO);
|
||||
this.setKeyBinding('Y' | SWT.CTRL, ActionCode.REDO);
|
||||
UndoRedoManager undoManager = new UndoRedoManager(50);
|
||||
undoManager.connect(this);
|
||||
this.setUndoManager(undoManager);
|
||||
|
||||
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
|
||||
Menu popupMenu = new Menu(this);
|
||||
|
||||
MenuItem redoItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
redoItem.setText(Messages.getString("ColorStyledText.RedoItem.Text")); //$NON-NLS-1$
|
||||
redoItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
redo();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem undoItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
undoItem.setText(Messages.getString("ColorStyledText.UndoItem.Text")); //$NON-NLS-1$
|
||||
undoItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
undo();
|
||||
}
|
||||
});
|
||||
|
||||
Image image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
|
||||
MenuItem copyItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
copyItem.setText(Messages.getString("ColorStyledText.CopyItem.Text")); //$NON-NLS-1$
|
||||
copyItem.setImage(image);
|
||||
copyItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
copy();
|
||||
}
|
||||
});
|
||||
|
||||
image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
|
||||
pasteItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
pasteItem.setText(Messages.getString("ColorStyledText.PasteItem.Text")); //$NON-NLS-1$
|
||||
pasteItem.setData(this);
|
||||
pasteItem.setImage(image);
|
||||
pasteItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
paste();
|
||||
}
|
||||
});
|
||||
pasteItem.setEnabled(getEditable());
|
||||
|
||||
this.setMenu(popupMenu);
|
||||
MenuItem selectAllItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
selectAllItem.setText(Messages.getString("ColorStyledText.SelectAllItem.Text")); //$NON-NLS-1$
|
||||
selectAllItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
selectAll();
|
||||
}
|
||||
});
|
||||
this.setMenu(popupMenu);
|
||||
|
||||
Listener selectAllListener = new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
if (event.character == '\u0001') { // CTRL + A
|
||||
selectAll();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
addListener(SWT.KeyDown, selectAllListener);
|
||||
|
||||
Mode mode = Modes.getMode(languageMode + XmlUtil.FILE_XML_SUFFIX);
|
||||
scanner = new ColoringScanner(mode, colorManager);
|
||||
|
||||
addExtendedModifyListener(modifyListener);
|
||||
initColorSetting();
|
||||
}
|
||||
|
||||
|
||||
protected void initColorSetting() {
|
||||
this.setForeground(ITalendThemeService.getColor(PREFERENCE_COLOR_FOREGROUND).orElse(null));
|
||||
this.setBackground(ITalendThemeService.getColor(PREFERENCE_COLOR_BACKGROUND).orElse(null));
|
||||
this.setSelectionBackground(ITalendThemeService.getColor(PREFERENCE_COLOR_SELECTION_BACKGROUND).orElse(null));
|
||||
this.setSelectionForeground(ITalendThemeService.getColor(PREFERENCE_COLOR_SELECTION_FOREGROUND).orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC qli Comment method "invokeAction".
|
||||
*
|
||||
* @param action
|
||||
*
|
||||
* */
|
||||
public void invokeAction(int action) {
|
||||
super.invokeAction(action);
|
||||
|
||||
switch (action) {
|
||||
case ActionCode.UNDO:
|
||||
undo(); // ctrl+Z
|
||||
break;
|
||||
case ActionCode.REDO:
|
||||
redo(); // ctrl+Y
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for undoRedoManager.
|
||||
*
|
||||
* @return the undoRedoManager
|
||||
*/
|
||||
public UndoRedoManager getUndoManager() {
|
||||
return this.undoRedoManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the undoRedoManager.
|
||||
*
|
||||
* @param undoRedoManager the undoRedoManager to set
|
||||
*/
|
||||
public void setUndoManager(UndoRedoManager undoRedoManager) {
|
||||
this.undoRedoManager = undoRedoManager;
|
||||
}
|
||||
|
||||
public static class ActionCode {
|
||||
|
||||
public static final int UNDO = Integer.MAX_VALUE;
|
||||
|
||||
public static final int REDO = UNDO - 1;
|
||||
|
||||
}
|
||||
|
||||
private void undo() {
|
||||
if (undoRedoManager != null) {
|
||||
undoRedoManager.undo();
|
||||
}
|
||||
}
|
||||
|
||||
private void redo() {
|
||||
if (undoRedoManager != null) {
|
||||
undoRedoManager.redo();
|
||||
}
|
||||
}
|
||||
|
||||
protected void colorize(final ColoringScanner scanner) {
|
||||
final ArrayList<StyleRange> styles = new ArrayList<StyleRange>();
|
||||
if (this.coloring) {
|
||||
IToken token;
|
||||
if (this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
scanner.parse(this.getText().replaceAll("\"", " ").replaceAll("'", " ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
|
||||
do {
|
||||
token = scanner.nextToken();
|
||||
if (!token.isEOF()) {
|
||||
if (token instanceof CToken) {
|
||||
CToken ctoken = (CToken) token;
|
||||
StyleRange styleRange;
|
||||
styleRange = new StyleRange();
|
||||
styleRange.start = scanner.getTokenOffset();
|
||||
styleRange.length = scanner.getTokenLength();
|
||||
if (ctoken.getType() == null) {
|
||||
styleRange.fontStyle = colorManager.getStyleFor(ctoken.getColor());
|
||||
styleRange.foreground = colorManager.getColor(ctoken.getColor());
|
||||
} else {
|
||||
styleRange.fontStyle = colorManager.getStyleForType(ctoken.getColor());
|
||||
styleRange.foreground = colorManager.getColorForType(ctoken.getColor());
|
||||
}
|
||||
styles.add(styleRange);
|
||||
}
|
||||
}
|
||||
} while (!token.isEOF());
|
||||
setStyles(styles);
|
||||
} else {
|
||||
StyleRange styleRange = new StyleRange();
|
||||
styles.add(styleRange);
|
||||
styleRange.start = 0;
|
||||
styleRange.length = this.getText().getBytes().length;
|
||||
styleRange.foreground = null;
|
||||
setStyles(styles);
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyles(final ArrayList<StyleRange> styles) {
|
||||
if (ColorStyledText.this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
int countChars = getCharCount();
|
||||
|
||||
for (int i = 0; i < styles.size(); i++) {
|
||||
StyleRange styleRange = styles.get(i);
|
||||
// System.out.println("styleRange.start=" + styleRange.start);
|
||||
// System.out.println("styleRange.length=" + styleRange.length);
|
||||
if (!(0 <= styleRange.start && styleRange.start + styleRange.length <= countChars)) {
|
||||
continue;
|
||||
}
|
||||
setStyleRange(styleRange);
|
||||
}
|
||||
}
|
||||
|
||||
ExtendedModifyListener modifyListener = new ExtendedModifyListener() {
|
||||
|
||||
public void modifyText(ExtendedModifyEvent event) {
|
||||
if (ColorStyledText.this.getCharCount() > MAXIMUM_CHARACTERS_BEFORE_USE_TIMER) {
|
||||
colorizeLimiter.resetTimer();
|
||||
colorizeLimiter.startIfExecutable(true, null);
|
||||
} else {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
colorize(scanner);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public ColorManager getColorManager() {
|
||||
return this.colorManager;
|
||||
}
|
||||
|
||||
public String getLanguageMode() {
|
||||
return this.languageMode;
|
||||
}
|
||||
|
||||
public ColoringScanner getScanner() {
|
||||
return this.scanner;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.swt.custom.StyledText#setEditable(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setEditable(boolean editable) {
|
||||
super.setEditable(editable);
|
||||
if (pasteItem != null) {
|
||||
pasteItem.setEnabled(editable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for coloring.
|
||||
*
|
||||
* @return the coloring
|
||||
*/
|
||||
public boolean isColoring() {
|
||||
return this.coloring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the coloring.
|
||||
*
|
||||
* @param coloring the coloring to set
|
||||
*/
|
||||
public void setColoring(boolean coloring) {
|
||||
boolean wasDifferent = this.coloring != coloring;
|
||||
this.coloring = coloring;
|
||||
if (!coloring) {
|
||||
removeExtendedModifyListener(modifyListener);
|
||||
} else if (wasDifferent) {
|
||||
colorizeLimiter.resetTimer();
|
||||
colorizeLimiter.startIfExecutable(true, null);
|
||||
addExtendedModifyListener(modifyListener);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.swt.widgets.Widget#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
colorManager.dispose();
|
||||
}
|
||||
|
||||
private final ExecutionLimiter colorizeLimiter = new ExecutionLimiter(1000, true) {
|
||||
|
||||
@Override
|
||||
public void execute(final boolean isFinalExecution, Object data) {
|
||||
if (!isDisposed()) {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
colorize(scanner);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@ import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.viewers.ICellEditorListener;
|
||||
import org.eclipse.jface.viewers.TextCellEditor;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.talend.commons.ui.runtime.ColorConstants;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.data.ModifiedObjectInfo;
|
||||
import org.talend.commons.ui.runtime.thread.AsynchronousThreading;
|
||||
@@ -39,6 +41,8 @@ public abstract class DialogErrorForCellEditorListener implements ICellEditorLis
|
||||
protected TableViewerCreatorColumn column;
|
||||
|
||||
protected TableViewerCreator tableViewerCreator;
|
||||
|
||||
private Color tableBackground = ColorConstants.getTableBackgroundColor();
|
||||
|
||||
/**
|
||||
* DOC amaumont CellEditorListener constructor comment.
|
||||
@@ -89,7 +93,7 @@ public abstract class DialogErrorForCellEditorListener implements ICellEditorLis
|
||||
final String errorMessage = validateValue(newValue, beanPosition);
|
||||
if (errorMessage == null) {
|
||||
newValidValueTyped(beanPosition, lastValidValue, newValue, state);
|
||||
text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_WHITE));
|
||||
text.setBackground(tableBackground);
|
||||
lastValidValue = newValue;
|
||||
} else {
|
||||
text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_RED));
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.talend.commons.ui.gmf.util.DisplayUtils;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
|
||||
/**
|
||||
* Figure managing some simple HTML styles. <br/>
|
||||
@@ -77,6 +78,8 @@ public class SimpleHtmlFigure extends Figure {
|
||||
private static Font boldFont = null;
|
||||
|
||||
private static Font boldItalicFont = null;
|
||||
|
||||
private static final Color DEFAULT_LABEL_COLOR = ITalendThemeService.getColor("NODE_FIGURE_LABEL_FORCEGROUND").orElse(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
/**
|
||||
* Constructs a new SimpleHtmlFigure.
|
||||
@@ -262,6 +265,8 @@ public class SimpleHtmlFigure extends Figure {
|
||||
label.setFont(fontToUse);
|
||||
if (colorStack.size() > 0) {
|
||||
label.setForegroundColor(colorStack.get(colorStack.size() - 1));
|
||||
} else {
|
||||
label.setForegroundColor(DEFAULT_LABEL_COLOR); // Set label default foreground color
|
||||
}
|
||||
horizContainer.add(label);
|
||||
}
|
||||
|
||||
@@ -204,3 +204,4 @@ RenameFolderAction.warning.cannotFind.title=Action not available
|
||||
ConvertJobsUtil.warning.title=Warning
|
||||
ConvertJobsUtil.warning.message=The target framework is not fully supported for this release.
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=Create stats log and implicit parameters
|
||||
WizardPageAPIDefinition_operationIdMissing=API is missing operationIds. operationIds are used to initialize tRESTRequest/cRest output flows. See tRESTRequest/cRest online help.
|
||||
|
||||
@@ -204,3 +204,4 @@ RenameFolderAction.warning.cannotFind.title=Action non disponible
|
||||
ConvertJobsUtil.warning.title=Avertissement
|
||||
ConvertJobsUtil.warning.message=Le framework cible n'est pas totalement support\u00E9 dans cette version.
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=Cr\u00E9er des logs de stat et des param\u00E8tres implicites.
|
||||
WizardPageAPIDefinition_operationIdMissing=Des operationIds manquent dans l'API. Ces operationIds sont utilis\u00E9s pour initialiser les flux de sortie du tRESTRequest/cRest. Consultez l'aide en ligne des composants tRESTRequest/cRest.
|
||||
|
||||
@@ -156,7 +156,7 @@ ProjectRepositoryNode.invalidItem=\u7121\u52B9\u306A\u30A2\u30A4\u30C6\u30E0
|
||||
ProjectRepositoryNode.columns=\u30AB\u30E9\u30E0
|
||||
ProjectRepositoryNode.validationRules=\u691C\u8A3C\u30EB\u30FC\u30EB
|
||||
ProjectRepositoryNode.cdcFoundation=CDC Foundation
|
||||
ProjectRepositoryNode.genericSchema=\u6C4E\u7528\u30B9\u30AD\u30FC\u30DE
|
||||
ProjectRepositoryNode.genericSchema=\u30B8\u30A7\u30CD\u30EA\u30C3\u30AF\u30B9\u30AD\u30FC\u30DE
|
||||
ProjectRepositoryNode.queries=\u30AF\u30A8\u30EA\u30FC
|
||||
ProjectRepositoryNode.synonymSchemas=\u30B7\u30CE\u30CB\u30E0\u30B9\u30AD\u30FC\u30DE
|
||||
ProjectRepositoryNode.calculationViewSchemas=\u8A08\u7B97\u30D3\u30E5\u30FC\u30B9\u30AD\u30FC\u30DE
|
||||
@@ -204,3 +204,4 @@ RenameFolderAction.warning.cannotFind.title=\u4F7F\u7528\u3067\u304D\u306A\u3044
|
||||
ConvertJobsUtil.warning.title=\u8B66\u544A
|
||||
ConvertJobsUtil.warning.message=\u3053\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u306F\u3001\u30BF\u30FC\u30B2\u30C3\u30C8\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u304C\u5B8C\u5168\u306B\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=\u7D71\u8A08\u30ED\u30B0\u3068\u6697\u9ED9\u7684\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u3092\u4F5C\u6210
|
||||
WizardPageAPIDefinition_operationIdMissing=API\u3067operationIds\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002operationIds\u306F\u3001tRESTRequest/cRest\u51FA\u529B\u30D5\u30ED\u30FC\u3092\u521D\u671F\u5316\u3059\u308B\u305F\u3081\u306B\u4F7F\u308F\u308C\u307E\u3059\u3002tRESTRequest/cRest\u306E\u30AA\u30F3\u30E9\u30A4\u30F3\u30D8\u30EB\u30D7\u3092\u3054\u89A7\u304F\u3060\u3055\u3044\u3002
|
||||
|
||||
@@ -204,3 +204,4 @@ RenameFolderAction.warning.cannotFind.title=\u64CD\u4F5C\u4E0D\u53EF\u7528
|
||||
ConvertJobsUtil.warning.title=\u8B66\u544A
|
||||
ConvertJobsUtil.warning.message=\u6B64\u7248\u672C\u4E0D\u5B8C\u5168\u652F\u6301\u76EE\u6807\u6846\u67B6.
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=\u521B\u5EFA\u7EDF\u8BA1\u65E5\u5FD7\u548C\u9690\u5F0F\u53C2\u6570
|
||||
WizardPageAPIDefinition_operationIdMissing=API \u7F3A\u5931 operationId \u53C2\u6570\uFF0C\u8FD9\u4E9B operationId \u53C2\u6570\u7528\u6765\u521D\u59CB\u5316 tRESTRequest \u6216 cRest \u8F93\u51FA\u6D41\u3002\u8BF7\u53C2\u89C1 tRESTRequest \u6216 cRest \u5728\u7EBF\u5E2E\u52A9\u6587\u6863\u3002
|
||||
|
||||
@@ -240,14 +240,14 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
private ICoreService getCoreService() {
|
||||
public ICoreService getCoreService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IRunProcessService getRunProcessService() {
|
||||
public IRunProcessService getRunProcessService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
}
|
||||
@@ -352,7 +352,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
* @param project
|
||||
* @throws LoginException
|
||||
*/
|
||||
private void checkProjectCompatibility(Project project) throws LoginException {
|
||||
public void checkProjectCompatibility(Project project) throws LoginException {
|
||||
IMigrationToolService migrationToolService = GlobalServiceRegister.getDefault().getService(
|
||||
IMigrationToolService.class);
|
||||
// update migration system.
|
||||
@@ -1849,7 +1849,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
* @param project
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
private void emptyTempFolder(Project project) throws PersistenceException {
|
||||
public void emptyTempFolder(Project project) throws PersistenceException {
|
||||
try {
|
||||
String str = SharedStudioUtils.getTempFolderPath().toPortableString();
|
||||
FilesUtils.deleteFolder(new File(str), false);
|
||||
@@ -2528,7 +2528,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkReferenceProjectsProblems(Project project) throws BusinessException, PersistenceException {
|
||||
public void checkReferenceProjectsProblems(Project project) throws BusinessException, PersistenceException {
|
||||
if (ReferenceProjectProblemManager.getInstance().getAllInvalidProjectReferenceSet().size() > 0) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (String technicalLabel : ReferenceProjectProblemManager.getInstance().getAllInvalidProjectReferenceSet()) {
|
||||
@@ -3026,4 +3026,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
this.repositoryFactoryFromProvider.saveProject(project);
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.isCancelled = cancelled;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.isCancelled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,3 +139,5 @@ Bundle-ClassPath: .,
|
||||
lib/delight-rhino-sandbox-0.0.15.jar,
|
||||
lib/rhino-1.7.13.jar
|
||||
Eclipse-RegisterBuddy: org.talend.testutils
|
||||
Import-Package: org.eclipse.equinox.p2.repository,
|
||||
org.eclipse.equinox.security.storage
|
||||
|
||||
@@ -252,6 +252,8 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_EXECUTOR_MEMORY = "CONN_PARA_KEY_EXECUTOR_MEMORY"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_EXECUTOR_CORES = "CONN_PARA_KEY_EXECUTOR_CORES";
|
||||
|
||||
public static final String CONN_PARA_KEY_TUNING_PROPERTIES = "CONN_PARA_KEY_TUNING_PROPERTIES"; //$NON-NLS-1$
|
||||
|
||||
/******************************************/
|
||||
@@ -366,7 +368,57 @@ public class ConnParameterKeys {
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_RUNTIME_VERSION="CONN_PARA_KEY_DATABRICKS_RUNTIME_VERSION";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER="CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER";
|
||||
|
||||
/**kubernetes*/
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_SUBMIT_MODE="CONN_PARA_KEY_K8S_SUBMIT_MODE";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_MASTER="CONN_PARA_KEY_K8S_MASTER";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_INSTANCES="CONN_PARA_KEY_K8S_INSTANCES";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_REGISTRYSECRET_CHECK="CONN_PARA_KEY_K8S_REGISTRYSECRET_CHECK";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_REGISTRYSECRET="CONN_PARA_KEY_K8S_REGISTRYSECRET";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_IMAGE="CONN_PARA_KEY_K8S_IMAGE";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_NAMESPACE="CONN_PARA_KEY_K8S_NAMESPACE";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_SERVICEACCOUNT="CONN_PARA_KEY_K8S_SERVICEACCOUNT";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_DISTUPLOAD="CONN_PARA_KEY_K8S_DISTUPLOAD";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_S3BUCKET="CONN_PARA_KEY_K8S_S3BUCKET";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_S3FOLDER="CONN_PARA_KEY_K8S_S3FOLDER";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_S3CREDENTIALS="CONN_PARA_KEY_K8S_S3CREDENTIALS";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_S3ACCESSKEY="CONN_PARA_KEY_K8S_S3ACCESSKEY";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_S3SECRETKEY="CONN_PARA_KEY_K8S_S3SECRETKEY";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_BLOBACCOUNT="CONN_PARA_KEY_K8S_BLOBACCOUNT";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_BLOBCONTAINER="CONN_PARA_KEY_K8S_BLOBCONTAINER";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_BLOBSECRETKEY="CONN_PARA_KEY_K8S_BLOBSECRETKEY";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_AZUREACCOUNT="CONN_PARA_KEY_K8S_AZUREACCOUNT";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_AZURECREDENTIALS="CONN_PARA_KEY_K8S_AZURECREDENTIALS";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_AZURECONTAINER="CONN_PARA_KEY_K8S_AZURECONTAINER";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_AZURESECRETKEY="CONN_PARA_KEY_K8S_AZURESECRETKEY";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_AZUREAADKEY="CONN_PARA_KEY_K8S_AZUREAADKEY";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_AZUREAADCLIENTID="CONN_PARA_KEY_K8S_AZUREAADCLIENTID";
|
||||
|
||||
public static final String CONN_PARA_KEY_K8S_AZUREAADDIRECTORYID="CONN_PARA_KEY_K8S_AZUREAADDIRECTORYID";
|
||||
|
||||
/**
|
||||
* Override hadoop configuration
|
||||
*/
|
||||
|
||||
@@ -81,7 +81,7 @@ public enum EDatabaseVersion4Drivers {
|
||||
new String[] { "mssql-jdbc.jar", "slf4j-api-1.7.34.jar", "slf4j-reload4j-1.7.34.jar", "msal4j-1.11.0.jar", //$NON-NLS-1$
|
||||
"oauth2-oidc-sdk-9.7.jar", "reload4j-1.2.22.jar", "jackson-core-2.13.4.jar",
|
||||
"jackson-databind-2.13.4.2.jar", "jackson-annotations-2.13.4.jar", "jcip-annotations-1.0-1.jar",
|
||||
"json-smart-2.4.7.jar", "nimbus-jose-jwt-9.22.jar", "accessors-smart-2.4.7.jar", "asm-9.1.jar",
|
||||
"json-smart-2.4.9.jar", "nimbus-jose-jwt-9.22.jar", "accessors-smart-2.4.9.jar", "asm-9.5.jar",
|
||||
"content-type-2.1.jar", "lang-tag-1.5.jar" })),
|
||||
|
||||
VERTICA_9(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 9.X", "VERTICA_9_0", "vertica-jdbc-9.3.1-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
@@ -150,10 +150,11 @@ public enum EDatabaseVersion4Drivers {
|
||||
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[]{ "redshift-jdbc42-no-awssdk-1.2.55.1083.jar", "antlr4-runtime-4.8-1.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.55.1083.jar", "antlr4-runtime-4.8-1.jar", "aws-java-sdk-1.11.848.jar", "jackson-core-2.13.4.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"jackson-databind-2.13.4.2.jar", "jackson-annotations-2.13.4.jar", "httpcore-4.4.13.jar", "httpclient-4.5.13.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.2.jar", "commons-codec-1.14.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"aws-java-sdk-redshift-internal-1.12.x.jar" })), //$NON-NLS-1$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.55.1083.jar", "antlr4-runtime-4.8-1.jar", "jackson-core-2.13.4.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.13.4.2.jar", "jackson-annotations-2.13.4.jar", "httpcore-4.4.13.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"httpclient-4.5.13.jar", "joda-time-2.8.1.jar", "commons-logging-1.2.jar", "commons-codec-1.14.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"aws-java-sdk-redshift-internal-1.12.x.jar", "aws-java-sdk-core-1.12.315.jar", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"aws-java-sdk-sts-1.12.315.jar", "aws-java-sdk-redshift-1.12.315.jar", "jmespath-java-1.12.315.jar" })), //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
||||
|
||||
AMAZON_AURORA(new DbVersion4Drivers(EDatabaseTypeName.AMAZON_AURORA, "mysql-connector-java-5.1.49.jar")); //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ public class HadoopConstants {
|
||||
public static final String SPARK_MODE_YARN_CLUSTER = "YARN_CLUSTER";
|
||||
|
||||
public static final String SPARK_MODE_DATAPROC = "DATAPROC";
|
||||
|
||||
public static final String SPARK_MODE_SYNAPSE = "SYNAPSE";
|
||||
|
||||
public static final String FRAMEWORK = "FRAMEWORK";
|
||||
|
||||
|
||||
@@ -142,6 +142,8 @@ public enum EHadoopProperties {
|
||||
|
||||
SPARK_EXECUTOR_MEMORY,
|
||||
|
||||
SPARK_EXECUTOR_CORES,
|
||||
|
||||
DATABRICKS_ENDPOINT,
|
||||
|
||||
DATABRICKS_CLOUD_PROVIDER,
|
||||
@@ -153,6 +155,52 @@ public enum EHadoopProperties {
|
||||
DATABRICKS_TOKEN,
|
||||
|
||||
DATABRICKS_DBFS_DEP_FOLDER,
|
||||
|
||||
K8S_SUBMIT_MODE,
|
||||
|
||||
K8S_MASTER,
|
||||
|
||||
K8S_INSTANCES,
|
||||
|
||||
K8S_REGISTRYSECRET,
|
||||
|
||||
K8S_IMAGE,
|
||||
|
||||
K8S_NAMESPACE,
|
||||
|
||||
K8S_SERVICEACCOUNT,
|
||||
|
||||
K8S_DISTUPLOAD,
|
||||
|
||||
K8S_S3BUCKET,
|
||||
|
||||
K8S_S3FOLDER,
|
||||
|
||||
K8S_S3CREDENTIALS,
|
||||
|
||||
K8S_S3ACCESSKEY,
|
||||
|
||||
K8S_S3SECRETKEY,
|
||||
|
||||
K8S_BLOBACCOUNT,
|
||||
|
||||
K8S_BLOBCONTAINER,
|
||||
|
||||
K8S_BLOBSECRETKEY,
|
||||
|
||||
K8S_AZUREACCOUNT,
|
||||
|
||||
K8S_AZURECREDENTIALS,
|
||||
|
||||
K8S_AZURECONTAINER,
|
||||
|
||||
K8S_AZURESECRETKEY,
|
||||
|
||||
K8S_AZUREAADKEY,
|
||||
|
||||
K8S_AZUREAADCLIENTID,
|
||||
|
||||
K8S_AZUREAADDIRECTORYID,
|
||||
|
||||
DATABRICKS_NODE_TYPE,
|
||||
|
||||
|
||||
@@ -984,6 +984,14 @@ public class ContextUtils {
|
||||
|
||||
}
|
||||
|
||||
public boolean remove(Item item, String param) {
|
||||
Set<String> params = map.get(item);
|
||||
if (params != null && params.contains(param)) {
|
||||
return params.remove(param);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return map.isEmpty();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public enum EParameterFieldType {
|
||||
SCHEMA_XPATH_QUERYS,
|
||||
QUERYSTORE_TYPE,
|
||||
GUESS_SCHEMA,
|
||||
DYNAMIC_GUESS_SCHEMA,
|
||||
PROPERTY_TYPE,
|
||||
EXTERNAL,
|
||||
FILE,
|
||||
|
||||
@@ -1477,12 +1477,8 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
return allTypes;
|
||||
}
|
||||
|
||||
public static List<ERepositoryObjectType> getAllTypesOfJoblet() {
|
||||
public static List<ERepositoryObjectType> getAllBigDataTypesOfJoblet(){
|
||||
List<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>();
|
||||
|
||||
if (ERepositoryObjectType.JOBLET != null) {
|
||||
allTypes.add(ERepositoryObjectType.JOBLET);
|
||||
}
|
||||
if (ERepositoryObjectType.SPARK_JOBLET != null) {
|
||||
allTypes.add(ERepositoryObjectType.SPARK_JOBLET);
|
||||
}
|
||||
@@ -1492,6 +1488,15 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
return allTypes;
|
||||
}
|
||||
|
||||
public static List<ERepositoryObjectType> getAllTypesOfJoblet() {
|
||||
List<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>();
|
||||
allTypes.addAll(getAllBigDataTypesOfJoblet());
|
||||
if (ERepositoryObjectType.JOBLET != null) {
|
||||
allTypes.add(ERepositoryObjectType.JOBLET);
|
||||
}
|
||||
return allTypes;
|
||||
}
|
||||
|
||||
public static List<ERepositoryObjectType> getAllTypesOfTestContainer() {
|
||||
List<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>();
|
||||
|
||||
|
||||
@@ -79,4 +79,8 @@ public final class TalendPropertiesUtil {
|
||||
public static String getProductApp() {
|
||||
return System.getProperty(PROD_APP);
|
||||
}
|
||||
|
||||
public static boolean isEnabledUseShortJobletName() {
|
||||
return isEnabled("talend.job.build.useShortJobletName"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
package org.talend.core.pendo;
|
||||
|
||||
import org.talend.core.pendo.properties.IPendoDataProperties;
|
||||
import org.talend.core.service.IRemoteService;
|
||||
import org.talend.core.service.ICoreTisRuntimeService;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
@@ -22,11 +22,11 @@ public class PendoDataTrackFactory {
|
||||
|
||||
private static PendoDataTrackFactory instance;
|
||||
|
||||
private static IRemoteService remoteService;
|
||||
private static ICoreTisRuntimeService coreRuntimeService;
|
||||
|
||||
static {
|
||||
instance = new PendoDataTrackFactory();
|
||||
remoteService = IRemoteService.get();
|
||||
coreRuntimeService = ICoreTisRuntimeService.get();
|
||||
}
|
||||
|
||||
private PendoDataTrackFactory() {
|
||||
@@ -37,35 +37,35 @@ public class PendoDataTrackFactory {
|
||||
}
|
||||
|
||||
public boolean isTrackSendAvailable() throws Exception {
|
||||
if (remoteService != null) {
|
||||
return remoteService.isPendoTrackAvailable();
|
||||
if (coreRuntimeService != null) {
|
||||
return coreRuntimeService.isPendoTrackAvailable();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendTrackData(TrackEvent event, IPendoDataProperties properties) throws Exception {
|
||||
if (remoteService != null) {
|
||||
remoteService.sendPendoTrackData(event, properties);
|
||||
if (coreRuntimeService != null) {
|
||||
coreRuntimeService.sendPendoTrackData(event, properties);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendProjectLoginTrack() {
|
||||
if (remoteService != null) {
|
||||
AbstractPendoTrackManager pendoProjectLoginManager = remoteService.getPendoProjectLoginManager();
|
||||
if (coreRuntimeService != null) {
|
||||
AbstractPendoTrackManager pendoProjectLoginManager = coreRuntimeService.getPendoProjectLoginManager();
|
||||
pendoProjectLoginManager.sendTrackToPendo();
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGenericTrack(TrackEvent event, IPendoDataProperties properties) {
|
||||
if (remoteService != null) {
|
||||
AbstractPendoTrackManager genericManager = remoteService.getPendoGenericManager(event, properties);
|
||||
if (coreRuntimeService != null) {
|
||||
AbstractPendoTrackManager genericManager = coreRuntimeService.getPendoGenericManager(event, properties);
|
||||
genericManager.sendTrackToPendo();
|
||||
}
|
||||
}
|
||||
|
||||
public String getTmcUser(String url, String token) {
|
||||
if (remoteService != null) {
|
||||
return remoteService.getTmcUser(url, token);
|
||||
if (coreRuntimeService != null) {
|
||||
return coreRuntimeService.getTmcUser(url, token);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ ProgressMonitorDialogWithCancel.executeTimeout=Suspension de l'ex\u00E9cution, l
|
||||
ProgressMonitorDialogWithCancel.CheckingConnectionJob.waitingFinish=en attente de la fin de {0}...
|
||||
ProgressMonitorDialogWithCancel.CheckingConnectionJob.emptyWaitingfinish=en attente de la fin...
|
||||
OverTimePopupDialogTask.title=Ex\u00E9cution...
|
||||
OverTimePopupDialogTask.message=T\u00E2che d'ex\u00E9cution en arri\u00E8re plan, patientez...
|
||||
OverTimePopupDialogTask.message=T\u00E2che d'ex\u00E9cution en arri\u00E8re-plan, patientez...
|
||||
OverTimePopupDialogTask.executeTimeout=Suspension de l'ex\u00E9cution, le Studio a essay\u00E9 d'interrompre la v\u00E9rification en t\u00E2che de fond.
|
||||
OverTimePopupDialogTask.killed=Ex\u00E9cution arr\u00EAt\u00E9e
|
||||
OverTimePopupDialogTask.waitingFinishMessage.default=Interruption impossible de la t\u00E2che en fond,\n
|
||||
@@ -656,3 +656,7 @@ AnalysisReportAccessDialog.shellTitle=Analyse du projet
|
||||
AnalysisReportAccessDialog.generateSuccess=Analyse du projet termin\u00E9e.
|
||||
AnalysisReportAccessDialog.completeReportAvailable=Consulter le rapport
|
||||
AnalysisReportAccessDialog.accessReport=ici
|
||||
AbstractPomTemplateProjectSettingPage.defaultTabLabel=Par d\u00E9faut
|
||||
AbstractPomTemplateProjectSettingPage.customTabLabel=Personnalis\u00E9
|
||||
AbstractPomTemplateProjectSettingPage.previewButton=Aper\u00E7u
|
||||
AbstractPomTemplateProjectSettingPage.learnMoreLink=En savoir plus
|
||||
|
||||
@@ -637,8 +637,8 @@ DynamicPlugin.addExtension.empty=ExtensionPoint\u307E\u305F\u306FID\u304C\u7A7A\
|
||||
BigDataBasicUtil.loadDynamicDistribution.IDynamicDistributionManager.notFound={0}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
|
||||
TalendLibsServerManager.connectUserLibraryFailureMessage=\u7BA1\u7406\u8005\u30E2\u30FC\u30C9\u3067\u8A2D\u5B9A\u3055\u308C\u305F\u30E6\u30FC\u30B6\u30FC\u30E9\u30A4\u30D6\u30E9\u30EA\u30FC\u30A2\u30FC\u30C6\u30A3\u30D5\u30A1\u30AF\u30C8\u30EA\u30DD\u30B8\u30C8\u30EA\u30FC\u304C\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3002{0}\u3078\u306E\u63A5\u7D9A\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
|
||||
TalendLibsServerManager.cannotGetUserLibraryServer=\u30EA\u30E2\u30FC\u30C8\u7BA1\u7406\u8005\u304B\u3089\u30E6\u30FC\u30B6\u30FC\u30E9\u30A4\u30D6\u30E9\u30EA\u30FC\u30B5\u30FC\u30D0\u30FC\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093
|
||||
MigrationReportAccessDialog.title=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30A2\u30A4\u30C6\u30E0\u3092\u79FB\u884C
|
||||
MigrationReportAccessDialog.migrateSuccess=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30A2\u30A4\u30C6\u30E0\u304C\u6B63\u3057\u304F\u79FB\u884C\u3055\u308C\u307E\u3057\u305F\u3002
|
||||
MigrationReportAccessDialog.title=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u9805\u76EE\u3092\u79FB\u884C
|
||||
MigrationReportAccessDialog.migrateSuccess=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u9805\u76EE\u304C\u6B63\u3057\u304F\u79FB\u884C\u3055\u308C\u307E\u3057\u305F\u3002
|
||||
MigrationReportAccessDialog.completeReportAvailable=\u30EC\u30DD\u30FC\u30C8\u3092\u30C1\u30A7\u30C3\u30AF
|
||||
MigrationReportAccessDialog.accessReport=\u3053\u3061\u3089
|
||||
MigrationReportAccessDialog.provideAnalysisTool=\u4ECA\u3059\u3050\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u5206\u6790\u3092\u5B9F\u884C\u3057\u3066\u3001\u79FB\u884C\u3055\u308C\u305F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u5206\u6790\u3067\u304D\u307E\u3059\u3002\u3053\u306E\u8A66\u9A13\u7684\u306A\u30C4\u30FC\u30EB\u306B\u3088\u3063\u3066\u3001\u4EE5\u4E0B\u304C\u542B\u307E\u308C\u308B\u30EC\u30DD\u30FC\u30C8\u304C\u751F\u6210\u3055\u308C\u307E\u3059:
|
||||
@@ -656,3 +656,7 @@ AnalysisReportAccessDialog.shellTitle=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u5206
|
||||
AnalysisReportAccessDialog.generateSuccess=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u5206\u6790\u304C\u6B63\u3057\u304F\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002
|
||||
AnalysisReportAccessDialog.completeReportAvailable=\u30EC\u30DD\u30FC\u30C8\u3092\u30C1\u30A7\u30C3\u30AF
|
||||
AnalysisReportAccessDialog.accessReport=\u3053\u3061\u3089
|
||||
AbstractPomTemplateProjectSettingPage.defaultTabLabel=\u30C7\u30D5\u30A9\u30EB\u30C8
|
||||
AbstractPomTemplateProjectSettingPage.customTabLabel=\u30AB\u30B9\u30BF\u30E0
|
||||
AbstractPomTemplateProjectSettingPage.previewButton=\u30D7\u30EC\u30D3\u30E5\u30FC
|
||||
AbstractPomTemplateProjectSettingPage.learnMoreLink=\u8A73\u7D30
|
||||
|
||||
@@ -656,3 +656,7 @@ AnalysisReportAccessDialog.shellTitle=\u5DE5\u7A0B\u5206\u6790
|
||||
AnalysisReportAccessDialog.generateSuccess=\u5DE5\u7A0B\u5206\u6790\u6210\u529F\u5B8C\u6210\u3002
|
||||
AnalysisReportAccessDialog.completeReportAvailable=\u8BF7\u68C0\u67E5\u62A5\u544A
|
||||
AnalysisReportAccessDialog.accessReport=\u6B64\u5904
|
||||
AbstractPomTemplateProjectSettingPage.defaultTabLabel=\u9ED8\u8BA4
|
||||
AbstractPomTemplateProjectSettingPage.customTabLabel=\u81EA\u5B9A\u4E49
|
||||
AbstractPomTemplateProjectSettingPage.previewButton=\u9884\u89C8
|
||||
AbstractPomTemplateProjectSettingPage.learnMoreLink=\u4E86\u89E3\u66F4\u591A
|
||||
|
||||
@@ -41,6 +41,8 @@ public interface MavenConstants {
|
||||
static final String DEFAULT_VERSION = "6.0.0";
|
||||
|
||||
static final String SNAPSHOT = "-SNAPSHOT";
|
||||
|
||||
static final String DOT_SNAPSHOT = ".SNAPSHOT";
|
||||
|
||||
static final String POM_FILTER = "POM_FILTER";
|
||||
|
||||
|
||||
@@ -21,10 +21,6 @@ public interface ICloudSignOnService extends IService {
|
||||
|
||||
TokenMode getToken(String authCode, String codeVerifier, String dataCenter) throws Exception;
|
||||
|
||||
void startHeartBeat() throws Exception;
|
||||
|
||||
void stopHeartBeat();
|
||||
|
||||
String generateCodeVerifier();
|
||||
|
||||
String getCodeChallenge(String seed) throws Exception;
|
||||
@@ -43,11 +39,13 @@ public interface ICloudSignOnService extends IService {
|
||||
|
||||
boolean isNeedShowSSOPage();
|
||||
|
||||
public void showReloginDialog();
|
||||
public boolean showReloginDialog();
|
||||
|
||||
public boolean isReloginDialogRunning();
|
||||
|
||||
public void reload();
|
||||
|
||||
public boolean isRelogined4CurrentTask(String clazz);
|
||||
|
||||
public static ICloudSignOnService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICloudSignOnService.class)) {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.service;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.pendo.AbstractPendoTrackManager;
|
||||
import org.talend.core.pendo.TrackEvent;
|
||||
import org.talend.core.pendo.properties.IPendoDataProperties;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public interface ICoreTisRuntimeService extends IService {
|
||||
|
||||
String getTmcUser(String url, String token);
|
||||
|
||||
AbstractPendoTrackManager getPendoProjectLoginManager();
|
||||
|
||||
AbstractPendoTrackManager getPendoGenericManager(TrackEvent event, IPendoDataProperties peoperties);
|
||||
|
||||
boolean isPendoTrackAvailable() throws Exception;
|
||||
|
||||
void sendPendoTrackData(TrackEvent event, IPendoDataProperties properties) throws Exception;
|
||||
|
||||
void sendPTPTrackData(String componentName, String componentUniqName, String jobId, String data);
|
||||
|
||||
static ICoreTisRuntimeService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisRuntimeService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ICoreTisRuntimeService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,9 +17,6 @@ import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.pendo.AbstractPendoTrackManager;
|
||||
import org.talend.core.pendo.TrackEvent;
|
||||
import org.talend.core.pendo.properties.IPendoDataProperties;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
|
||||
@@ -39,16 +36,6 @@ public interface IRemoteService extends IService {
|
||||
|
||||
boolean isAuthorized(String value);
|
||||
|
||||
boolean isPendoTrackAvailable() throws Exception;
|
||||
|
||||
void sendPendoTrackData(TrackEvent event, IPendoDataProperties properties) throws Exception;
|
||||
|
||||
AbstractPendoTrackManager getPendoProjectLoginManager();
|
||||
|
||||
AbstractPendoTrackManager getPendoGenericManager(TrackEvent event, IPendoDataProperties peoperties);
|
||||
|
||||
String getTmcUser(String url, String token);
|
||||
|
||||
public boolean isCloudConnection();
|
||||
|
||||
public static IRemoteService get() {
|
||||
|
||||
@@ -12,14 +12,23 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.service;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.equinox.p2.repository.IRepository;
|
||||
import org.eclipse.equinox.security.storage.ISecurePreferences;
|
||||
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.general.Project;
|
||||
@@ -201,6 +210,12 @@ public interface IStudioLiteP2Service extends IService {
|
||||
}
|
||||
|
||||
public static interface UpdateSiteConfig {
|
||||
|
||||
public static final int DEFAULT_TIMEOUT = 4000;
|
||||
|
||||
public static final String PROTOCOL_HTTP = "http";
|
||||
|
||||
public static final String PROTOCOL_HTTPS = "https";
|
||||
|
||||
boolean isReleaseEditable();
|
||||
|
||||
@@ -239,6 +254,83 @@ public interface IStudioLiteP2Service extends IService {
|
||||
boolean isOverwriteTmcUpdateSettings(IProgressMonitor monitor) throws Exception;
|
||||
|
||||
void overwriteTmcUpdateSettings(IProgressMonitor monitor, boolean overwrite) throws Exception;
|
||||
|
||||
void enableBasicAuth(String uri, boolean enable) throws Exception;
|
||||
|
||||
boolean isEnabledBasicAuth(String uri) throws Exception;
|
||||
|
||||
public static boolean requireCredentials(URI uri, String nameAndPwd) throws Exception {
|
||||
String scheme = uri.getScheme();
|
||||
if (StringUtils.isEmpty(scheme) || (!StringUtils.equals(scheme, PROTOCOL_HTTP) && !StringUtils.equals(scheme, PROTOCOL_HTTPS))) {
|
||||
return false;
|
||||
}
|
||||
URL url = new URL(uri.toString() + "/p2.index");
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(DEFAULT_TIMEOUT);
|
||||
conn.setReadTimeout(DEFAULT_TIMEOUT);
|
||||
conn.setRequestMethod("HEAD");
|
||||
if (!StringUtils.isEmpty(nameAndPwd)) {
|
||||
nameAndPwd = Base64.encodeBase64String(nameAndPwd.getBytes());
|
||||
conn.addRequestProperty("Authorization", "Basic " + nameAndPwd);
|
||||
}
|
||||
|
||||
int responseCode = conn.getResponseCode();
|
||||
if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED || responseCode == HttpURLConnection.HTTP_FORBIDDEN) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (responseCode != HttpURLConnection.HTTP_OK) {
|
||||
throw new Exception("status code: " + responseCode);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void saveCredentialsIntoSecureStore(URI uri, String uname, String pwd) throws Exception {
|
||||
ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
|
||||
String nodeKey = URLEncoder.encode(uri.getHost(), StandardCharsets.UTF_8.name());
|
||||
|
||||
String nodeName = IRepository.PREFERENCE_NODE + '/' + nodeKey;
|
||||
ISecurePreferences prefNode = null;
|
||||
|
||||
prefNode = securePreferences.node(nodeName);
|
||||
prefNode.put(IRepository.PROP_USERNAME, uname, true);
|
||||
prefNode.put(IRepository.PROP_PASSWORD, pwd, true);
|
||||
securePreferences.flush();
|
||||
}
|
||||
|
||||
public static String[] loadCredentialsFromSecureStore(URI uri) throws Exception {
|
||||
ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
|
||||
String nodeKey = URLEncoder.encode(uri.getHost(), StandardCharsets.UTF_8.name());
|
||||
|
||||
String nodeName = IRepository.PREFERENCE_NODE + '/' + nodeKey;
|
||||
ISecurePreferences prefNode = null;
|
||||
|
||||
String[] namePwd = new String[2];
|
||||
|
||||
if (!securePreferences.nodeExists(nodeName)) {
|
||||
return null;
|
||||
}
|
||||
prefNode = securePreferences.node(nodeName);
|
||||
|
||||
namePwd[0] = prefNode.get(IRepository.PROP_USERNAME, "");
|
||||
namePwd[1] = prefNode.get(IRepository.PROP_PASSWORD, "");
|
||||
|
||||
return namePwd;
|
||||
}
|
||||
|
||||
public static void deleteCredentialsFromSecureStore(URI uri) throws Exception {
|
||||
ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
|
||||
String nodeKey = URLEncoder.encode(uri.getHost(), StandardCharsets.UTF_8.name());
|
||||
|
||||
String nodeName = IRepository.PREFERENCE_NODE + '/' + nodeKey;
|
||||
|
||||
if (securePreferences.nodeExists(nodeName)) {
|
||||
securePreferences.node(nodeName).removeNode();
|
||||
securePreferences.flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -560,6 +560,7 @@ ContextNebulaComposite.ContextsUnAvailable=Context view is not available.
|
||||
ContextNebulaComposite.ContextGroupLabel=Default context environment
|
||||
ContextTreeTable.PromptToolTips=activate prompt on variable
|
||||
ContextValidator.ParameterNotValid=parameter name is not valid
|
||||
ContextValidator.ParameterValueNotMatch=Type/value mismatch: the value of a variable must match its type
|
||||
WorkspaceMnu.switch.text=Switch &Workspace
|
||||
WorkspaceMnu.switch.tooltip=Open Workspace
|
||||
WorkspaceMnu.choose.text=&Choose...
|
||||
|
||||
@@ -560,6 +560,7 @@ ContextNebulaComposite.ContextsUnAvailable=La vue Contextes n'est pas disponible
|
||||
ContextNebulaComposite.ContextGroupLabel=Environnement du contexte par d\u00E9faut
|
||||
ContextTreeTable.PromptToolTips=activer le prompt sur variable
|
||||
ContextValidator.ParameterNotValid=le nom du param\u00E8tre n'est pas valide
|
||||
ContextValidator.ParameterValueNotMatch=Mauvaise correspondance de type/valeur\u00A0: la valeur d'une variable doit correspondre \u00E0 son type
|
||||
WorkspaceMnu.switch.text=Changer de r\u00E9pertoire &Workspace
|
||||
WorkspaceMnu.switch.tooltip=Ouvrir le r\u00E9pertoire Workspace
|
||||
WorkspaceMnu.choose.text=&Choisir...
|
||||
|
||||
@@ -321,7 +321,7 @@ repository.metadataFileRegexp=\u6B63\u898F\u8868\u73FE\u30D5\u30A1\u30A4\u30EB
|
||||
repository.metadataFileRegexp.alias=REGX
|
||||
repository.metadataFileXml=XML\u30D5\u30A1\u30A4\u30EB
|
||||
repository.metadataFileXml.alias=XML
|
||||
repository.metadataGenericSchema=\u6C4E\u7528\u30B9\u30AD\u30FC\u30DE
|
||||
repository.metadataGenericSchema=\u30B8\u30A7\u30CD\u30EA\u30C3\u30AF\u30B9\u30AD\u30FC\u30DE
|
||||
repository.metadataGenericSchema.alias=GENERIC
|
||||
repository.metadataLDAPSchema=LDAP
|
||||
repository.metadataLDAPSchema.alias=LDAP
|
||||
@@ -560,6 +560,7 @@ ContextNebulaComposite.ContextsUnAvailable=\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\
|
||||
ContextNebulaComposite.ContextGroupLabel=\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u74B0\u5883
|
||||
ContextTreeTable.PromptToolTips=\u5909\u6570\u306E\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u6709\u52B9\u5316
|
||||
ContextValidator.ParameterNotValid=\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u540D\u304C\u7121\u52B9\u3067\u3059\u3002
|
||||
ContextValidator.ParameterValueNotMatch=\u578B\u3068\u5024\u306E\u4E0D\u4E00\u81F4: \u5909\u6570\u306E\u5024\u306F\u305D\u306E\u578B\u3068\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
|
||||
WorkspaceMnu.switch.text=\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3092\u5207\u308A\u63DB\u3048(&W)
|
||||
WorkspaceMnu.switch.tooltip=\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3092\u958B\u304F
|
||||
WorkspaceMnu.choose.text=\u9078\u629E(&C)...
|
||||
@@ -579,6 +580,6 @@ I18nPreferencePage.restart=\u518D\u8D77\u52D5
|
||||
I18nPreferencePage.restartButton=\u6709\u52B9\u5316\u306B\u306F\u518D\u8D77\u52D5\u304C\u5FC5\u8981\u3067\u3059\u3002
|
||||
I18nPreferencePage.restoreDefault=\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u5FA9\u5143
|
||||
I18nPreferencePage.wait_process=\u3053\u306E\u51E6\u7406\u306B\u306F\u6570\u5206\u304B\u304B\u308A\u307E\u3059\u3002\u3057\u3070\u3089\u304F\u304A\u5F85\u3061\u304F\u3060\u3055\u3044...
|
||||
MetadataPreferencePage.EnableBasic.name=\u57FA\u672C\u8A8D\u8A3C\u30D8\u30C3\u30C0\u30FC\u3092\u6709\u52B9\u306B\u3059\u308B
|
||||
MetadataPreferencePage.EnableBasic.name=\u57FA\u672C\u8A8D\u8A3C\u30D8\u30C3\u30C0\u30FC\u3092\u6709\u52B9\u5316
|
||||
MetadataPreferencePage.MessageDialog.Restart=\u3053\u306E\u8A2D\u5B9A\u304C\u6709\u52B9\u306B\u306A\u308B\u3088\u3046\u3001Studio\u3092\u518D\u8D77\u52D5\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\u7D9A\u884C\u3057\u307E\u3059\u304B?
|
||||
TalendTabbedPropertyTitle.componentHelpTooltip=\u30AA\u30F3\u30E9\u30A4\u30F3\u30D8\u30EB\u30D7\u3092\u958B\u304F
|
||||
|
||||
@@ -560,6 +560,7 @@ ContextNebulaComposite.ContextsUnAvailable=\u4E0A\u4E0B\u6587\u89C6\u56FE\u4E0D\
|
||||
ContextNebulaComposite.ContextGroupLabel=\u9ED8\u8BA4\u4E0A\u4E0B\u6587\u73AF\u5883
|
||||
ContextTreeTable.PromptToolTips=\u6FC0\u6D3B\u63D0\u793A\u53D8\u91CF
|
||||
ContextValidator.ParameterNotValid=\u53C2\u6570\u540D\u65E0\u6548
|
||||
ContextValidator.ParameterValueNotMatch=\u7C7B\u578B/\u503C\u4E0D\u5339\u914D\uFF1A\u53D8\u91CF\u7684\u503C\u4E0E\u5176\u7C7B\u578B\u4E0D\u5339\u914D
|
||||
WorkspaceMnu.switch.text=\u5207\u6362\u5DE5\u4F5C\u533A(&W)
|
||||
WorkspaceMnu.switch.tooltip=\u6253\u5F00\u5DE5\u4F5C\u533A
|
||||
WorkspaceMnu.choose.text=\u9009\u62E9(&C)...
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer;
|
||||
import org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand;
|
||||
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
|
||||
import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator;
|
||||
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
|
||||
import org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration;
|
||||
import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
|
||||
import org.eclipse.nebula.widgets.nattable.painter.layer.NatGridLayerPainter;
|
||||
@@ -111,6 +112,7 @@ import org.talend.core.ui.context.nattableTree.ContextNatTableStyleConfiguration
|
||||
import org.talend.core.ui.context.nattableTree.ContextNatTableUtils;
|
||||
import org.talend.core.ui.context.nattableTree.ContextParaModeChangeMenuConfiguration;
|
||||
import org.talend.core.ui.context.nattableTree.ContextRowDataListFixture;
|
||||
import org.talend.core.ui.context.nattableTree.ContextValueLabelAccumulator;
|
||||
import org.talend.core.ui.context.nattableTree.ExtendedContextColumnPropertyAccessor;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.repository.ProjectManager;
|
||||
@@ -130,7 +132,7 @@ public class ContextTreeTable {
|
||||
|
||||
private NatTable natTable;
|
||||
|
||||
// for bug TDI-32821, use LinkedList to keep the original order of context parameter list.
|
||||
// for bug TDI-32821锛<EFBFBD> use LinkedList to keep the original order of context parameter list.
|
||||
private List<ContextTreeNode> treeNodes = new LinkedList<ContextTreeNode>();
|
||||
|
||||
private static Map<String, Boolean> expandMap = new HashMap<>();
|
||||
@@ -272,7 +274,7 @@ public class ContextTreeTable {
|
||||
final GridLayer gridLayer = new GridLayer(viewportLayer, sortHeaderLayer, rowHeaderLayer, cornerLayer);
|
||||
|
||||
// config the column edit configuration
|
||||
ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer);
|
||||
ContextValueLabelAccumulator labelAccumulator = new ContextValueLabelAccumulator(bodyDataLayer, bodyDataProvider, manager.getContextManager(), columnGroupModel);
|
||||
bodyDataLayer.setConfigLabelAccumulator(labelAccumulator);
|
||||
registerColumnLabels(labelAccumulator, ContextRowDataListFixture.getContexts(manager.getContextManager()));
|
||||
|
||||
@@ -804,12 +806,32 @@ public class ContextTreeTable {
|
||||
if (cellValue instanceof Boolean) {
|
||||
return new Point(col, row);
|
||||
}
|
||||
ILayerCell cell = this.nt.getCellByPosition(col, row);
|
||||
if (cell != null && cell.getConfigLabels() != null
|
||||
&& cell.getConfigLabels().contains(ContextTableConstants.LABEL_VALUE_NOT_MATCH_TYPE)
|
||||
&& cell.getConfigLabels().contains(ContextTableConstants.COLUMN_CONTEXT_VALUE)) {
|
||||
return new Point(col, row);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getText(Event event) {
|
||||
return Messages.getString("ContextTreeTable.PromptToolTips"); //$NON-NLS-1$
|
||||
int col = this.nt.getColumnPositionByX(event.x);
|
||||
int row = this.nt.getRowPositionByY(event.y);
|
||||
|
||||
Object cellValue = this.nt.getDataValueByPosition(col, row);
|
||||
|
||||
if (cellValue instanceof Boolean) {
|
||||
return Messages.getString("ContextTreeTable.PromptToolTips");
|
||||
}
|
||||
ILayerCell cell = this.nt.getCellByPosition(col, row);
|
||||
if (cell != null && cell.getConfigLabels() != null
|
||||
&& cell.getConfigLabels().contains(ContextTableConstants.LABEL_VALUE_NOT_MATCH_TYPE)
|
||||
&& cell.getConfigLabels().contains(ContextTableConstants.COLUMN_CONTEXT_VALUE)) {
|
||||
return Messages.getString("ContextValidator.ParameterValueNotMatch");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,6 +28,10 @@ public class ContextTableConstants {
|
||||
public static final String COLUMN_PROMPT_PROPERTY = "Prompt label"; //$NON-NLS-1$
|
||||
|
||||
public static final String COLUMN_CONTEXT_VALUE = "Value"; //$NON-NLS-1$
|
||||
|
||||
|
||||
public static final String LABEL_CHANGED_FORCEGROUND = "LABEL_CHANGED_FORCEGROUND";
|
||||
|
||||
public static final String LABEL_VALUE_NOT_MATCH_TYPE = "LABEL_VALUE_NOT_MATCH_TYPE";
|
||||
|
||||
public static final int DEFAULT_COLUMN_COUNT = 8;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
|
||||
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
|
||||
import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
|
||||
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
|
||||
import org.eclipse.nebula.widgets.nattable.style.CellStyleProxy;
|
||||
import org.eclipse.nebula.widgets.nattable.style.IStyle;
|
||||
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
@@ -43,12 +44,8 @@ public class ContextAutoResizeTextPainter extends TextPainter {
|
||||
@Override
|
||||
public void setupGCFromConfig(GC gc, IStyle cellStyle) {
|
||||
super.setupGCFromConfig(gc, cellStyle);
|
||||
if (cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR).equals(GUIHelper.COLOR_RED)) {
|
||||
gc.setForeground(GUIHelper.COLOR_BLACK);
|
||||
} else if (containsRowName) {
|
||||
if (containsRowName) {
|
||||
gc.setForeground(GUIHelper.COLOR_RED);
|
||||
} else if (changeBackgroundColor) {
|
||||
gc.setForeground(GUIHelper.COLOR_WIDGET_DARK_SHADOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,15 @@ import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsData
|
||||
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
|
||||
import org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundPainter;
|
||||
import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
|
||||
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.talend.core.ui.context.ContextTreeTable.ContextTreeNode;
|
||||
import org.talend.core.ui.context.model.ContextTabChildModel;
|
||||
import org.talend.core.ui.context.model.ContextTabParentModel;
|
||||
import org.talend.core.ui.context.model.table.ContextTableConstants;
|
||||
import org.talend.core.ui.context.model.table.ContextTableTabParentModel;
|
||||
|
||||
/**
|
||||
@@ -49,18 +52,9 @@ public class ContextNatTableBackGroudPainter extends BackgroundPainter {
|
||||
@Override
|
||||
public void paintCell(ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
|
||||
ContextTreeNode rowNode = ((GlazedListsDataProvider<ContextTreeNode>) dataProvider).getRowObject(cell.getRowIndex());
|
||||
if (rowNode.getTreeData() instanceof ContextTableTabParentModel) {
|
||||
ContextTableTabParentModel rowModel = (ContextTableTabParentModel) rowNode.getTreeData();
|
||||
Boolean isRepositoryContext = rowModel.hasChildren();
|
||||
if (isRepositoryContext) {
|
||||
((ContextAutoResizeTextPainter) getWrappedPainter()).setChangeBackgroundColor(true);
|
||||
} else {
|
||||
((ContextAutoResizeTextPainter) getWrappedPainter()).setChangeBackgroundColor(false);
|
||||
}
|
||||
} else {
|
||||
if (rowNode.getTreeData() instanceof ContextTabChildModel) {
|
||||
ContextTabChildModel rowChildModel = (ContextTabChildModel) rowNode.getTreeData();
|
||||
if (rowChildModel != null) {
|
||||
((ContextAutoResizeTextPainter) getWrappedPainter()).setChangeBackgroundColor(true);
|
||||
checkContainsRowName(rowNode, rowChildModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,6 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
|
||||
Style cellStyleSelect = new Style();
|
||||
cellStyleSelect.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_TITLE_INACTIVE_BACKGROUND);
|
||||
cellStyleSelect.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, GUIHelper.COLOR_RED);
|
||||
cellStyleSelect.setAttributeValue(CellStyleAttributes.FONT, GUIHelper.DEFAULT_FONT);
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleSelect, DisplayMode.SELECT,
|
||||
ContextTableConstants.COLUMN_TYPE_PROPERTY);
|
||||
@@ -161,11 +160,15 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
private void registerValidateRules(IConfigRegistry configRegistry) {
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR,
|
||||
new EventDataValidator(dataProvider, manager), DisplayMode.EDIT, ContextTableConstants.COLUMN_NAME_PROPERTY);
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR,
|
||||
new EventDataValueValidator(dataProvider, manager, columnGroupModel), DisplayMode.EDIT, ContextTableConstants.COLUMN_CONTEXT_VALUE);
|
||||
}
|
||||
|
||||
private void registerErrorHandlingStrategies(IConfigRegistry configRegistry) {
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.VALIDATION_ERROR_HANDLER, new DialogErrorHandling(),
|
||||
DisplayMode.EDIT, ContextTableConstants.COLUMN_NAME_PROPERTY);
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.VALIDATION_ERROR_HANDLER, new DialogErrorHandling(),
|
||||
DisplayMode.EDIT, ContextTableConstants.COLUMN_CONTEXT_VALUE);
|
||||
}
|
||||
|
||||
private IEditableRule getEditRule() {
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
|
||||
import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator;
|
||||
import org.eclipse.nebula.widgets.nattable.style.BorderStyle;
|
||||
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
|
||||
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
|
||||
import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum;
|
||||
import org.eclipse.nebula.widgets.nattable.style.Style;
|
||||
import org.eclipse.nebula.widgets.nattable.style.VerticalAlignmentEnum;
|
||||
@@ -28,6 +29,7 @@ import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.talend.commons.ui.runtime.ColorConstants;
|
||||
import org.talend.core.ui.context.model.table.ContextTableConstants;
|
||||
|
||||
/**
|
||||
* created by ldong on Aug 26, 2014 Detailled comment
|
||||
@@ -70,9 +72,17 @@ public class ContextNatTableStyleConfiguration extends AbstractRegistryConfigura
|
||||
cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign);
|
||||
cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign);
|
||||
cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle);
|
||||
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle);
|
||||
|
||||
|
||||
Style cellStyleValueError = new Style();
|
||||
cellStyleValueError.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, ColorConstants.ERROR_FONT_COLOR);
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleValueError, DisplayMode.NORMAL, ContextTableConstants.LABEL_VALUE_NOT_MATCH_TYPE);
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleValueError, DisplayMode.SELECT, ContextTableConstants.LABEL_VALUE_NOT_MATCH_TYPE);
|
||||
|
||||
Style cellStyleChangedForceGround = new Style();
|
||||
cellStyleChangedForceGround.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, ColorConstants.getTableReadOnlyForegroundColor());
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleChangedForceGround, DisplayMode.NORMAL, ContextTableConstants.LABEL_CHANGED_FORCEGROUND);
|
||||
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter());
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.context.nattableTree;
|
||||
|
||||
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
|
||||
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider;
|
||||
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel;
|
||||
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
|
||||
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
|
||||
import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator;
|
||||
import org.talend.core.model.process.IContextManager;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.ui.context.ContextTreeTable.ContextTreeNode;
|
||||
import org.talend.core.ui.context.model.ContextTabChildModel;
|
||||
import org.talend.core.ui.context.model.table.ContextTableConstants;
|
||||
import org.talend.core.ui.context.model.table.ContextTableTabParentModel;
|
||||
import org.talend.core.ui.utils.ContextTypeValidator;
|
||||
|
||||
|
||||
public class ContextValueLabelAccumulator extends ColumnOverrideLabelAccumulator {
|
||||
|
||||
private IDataProvider dataProvider;
|
||||
private ColumnGroupModel columnGroupModel;
|
||||
private IContextManager manager;
|
||||
|
||||
public ContextValueLabelAccumulator(ILayer layer, IDataProvider dataProvider, IContextManager manager, ColumnGroupModel columnGroupModel) {
|
||||
super(layer);
|
||||
this.dataProvider = dataProvider;
|
||||
this.manager = manager;
|
||||
this.columnGroupModel = columnGroupModel;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
|
||||
super.accumulateConfigLabels(configLabels, columnPosition, rowPosition);
|
||||
boolean isAddedValueNotMatchStyle = false;
|
||||
ContextTreeNode rowNode = ((GlazedListsDataProvider<ContextTreeNode>) dataProvider).getList().get(rowPosition);
|
||||
if (configLabels.contains(ContextTableConstants.COLUMN_CONTEXT_VALUE)) {
|
||||
if (columnGroupModel != null && columnGroupModel.isPartOfAGroup(columnPosition)) {
|
||||
String columnGroupName = columnGroupModel.getColumnGroupByIndex(columnPosition).getName();
|
||||
IContextParameter realPara = ContextNatTableUtils.getRealParameter(manager, columnGroupName, rowNode.getTreeData());
|
||||
if (realPara != null) {
|
||||
boolean isValid = ContextTypeValidator.isMatchType(realPara.getType(), realPara.getValue());
|
||||
if (isValid) {
|
||||
configLabels.remove(ContextTableConstants.LABEL_VALUE_NOT_MATCH_TYPE);
|
||||
} else {
|
||||
configLabels.addLabel(ContextTableConstants.LABEL_VALUE_NOT_MATCH_TYPE);
|
||||
isAddedValueNotMatchStyle = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAddedValueNotMatchStyle) {
|
||||
if (rowNode.getTreeData() instanceof ContextTableTabParentModel) {
|
||||
ContextTableTabParentModel rowModel = (ContextTableTabParentModel) rowNode.getTreeData();
|
||||
Boolean isRepositoryContext = rowModel.hasChildren();
|
||||
if (isRepositoryContext) {
|
||||
configLabels.addLabel(ContextTableConstants.LABEL_CHANGED_FORCEGROUND);
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
ContextTabChildModel rowChildModel = (ContextTabChildModel) rowNode.getTreeData();
|
||||
if (rowChildModel != null) {
|
||||
configLabels.addLabel(ContextTableConstants.LABEL_CHANGED_FORCEGROUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ import org.eclipse.swt.events.KeyListener;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
@@ -272,4 +274,28 @@ public class ContextValuesNatText extends Composite {
|
||||
public Button getButton() {
|
||||
return this.button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackground(Color color) {
|
||||
super.setBackground(color);
|
||||
if (text != null && !text.isDisposed()) {
|
||||
text.setBackground(color);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFont(Font font) {
|
||||
super.setFont(font);
|
||||
if (text != null && !text.isDisposed()) {
|
||||
text.setFont(font);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForeground(Color color) {
|
||||
super.setForeground(color);
|
||||
if (text != null && !text.isDisposed()) {
|
||||
text.setForeground(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,17 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.context.nattableTree;
|
||||
|
||||
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
|
||||
import org.eclipse.nebula.widgets.nattable.edit.config.RenderErrorHandling;
|
||||
import org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor;
|
||||
import org.eclipse.nebula.widgets.nattable.edit.editor.ControlDecorationProvider;
|
||||
import org.eclipse.nebula.widgets.nattable.edit.editor.IEditErrorHandler;
|
||||
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
|
||||
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
|
||||
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
|
||||
import org.eclipse.nebula.widgets.nattable.style.IStyle;
|
||||
import org.eclipse.nebula.widgets.nattable.style.Style;
|
||||
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
|
||||
import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.KeyAdapter;
|
||||
@@ -52,6 +60,18 @@ public class CustomTextCellEditor extends AbstractCellEditor {
|
||||
* if password, the value will be * always. should find out the real value.
|
||||
*/
|
||||
private Object recordOriginalCanonicalValue;
|
||||
|
||||
protected final ControlDecorationProvider decorationProvider = new ControlDecorationProvider();
|
||||
|
||||
/**
|
||||
* The {@link IEditErrorHandler} that is used for showing conversion errors
|
||||
* on typing into this editor. By default this is the
|
||||
* {@link RenderErrorHandling} which will render the content in the editor
|
||||
* red to indicate a conversion error.
|
||||
*/
|
||||
private IEditErrorHandler inputConversionErrorHandler = new RenderErrorHandling(this.decorationProvider);
|
||||
|
||||
private IEditErrorHandler inputValidationErrorHandler = new RenderErrorHandling(this.decorationProvider);
|
||||
|
||||
public CustomTextCellEditor(IContextParameter realPara, IStyle cellStyle, boolean commitOnUpDown, boolean moveSelectionOnEnter) {
|
||||
this.realPara = realPara;
|
||||
@@ -106,9 +126,26 @@ public class CustomTextCellEditor extends AbstractCellEditor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
try {
|
||||
// always do the conversion
|
||||
Object canonicalValue = getCanonicalValue(CustomTextCellEditor.this.inputConversionErrorHandler);
|
||||
// and always do the validation, even if for committing the
|
||||
// validation should be skipped, on editing
|
||||
// a validation failure should be made visible
|
||||
// otherwise there would be no need for validation!
|
||||
validateCanonicalValue(canonicalValue, CustomTextCellEditor.this.inputValidationErrorHandler);
|
||||
} catch (Exception ex) {
|
||||
// do nothing as exceptions caused by conversion or
|
||||
// validation are handled already we just need this catch
|
||||
// block for stopping the process if conversion failed with
|
||||
// an exception
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// text.addFocusListener(new FocusAdapter() {
|
||||
//
|
||||
// @Override
|
||||
@@ -164,6 +201,30 @@ public class CustomTextCellEditor extends AbstractCellEditor {
|
||||
}
|
||||
|
||||
this.buttonText = (ContextValuesNatText) createEditorControl(parentComp);
|
||||
if (this.inputConversionErrorHandler instanceof RenderErrorHandling) {
|
||||
IStyle conversionErrorStyle = this.configRegistry.getConfigAttribute(
|
||||
EditConfigAttributes.CONVERSION_ERROR_STYLE,
|
||||
DisplayMode.EDIT,
|
||||
this.labelStack);
|
||||
|
||||
((RenderErrorHandling) this.inputConversionErrorHandler).setErrorStyle(conversionErrorStyle);
|
||||
}
|
||||
|
||||
if (this.inputValidationErrorHandler instanceof RenderErrorHandling) {
|
||||
IStyle validationErrorStyle = this.configRegistry.getConfigAttribute(
|
||||
EditConfigAttributes.VALIDATION_ERROR_STYLE,
|
||||
DisplayMode.EDIT,
|
||||
this.labelStack);
|
||||
|
||||
if (validationErrorStyle == null) {
|
||||
validationErrorStyle = new Style();
|
||||
validationErrorStyle.setAttributeValue(
|
||||
CellStyleAttributes.FOREGROUND_COLOR,
|
||||
GUIHelper.COLOR_RED);
|
||||
}
|
||||
|
||||
((RenderErrorHandling) this.inputValidationErrorHandler).setErrorStyle(validationErrorStyle);
|
||||
}
|
||||
// use the real value.
|
||||
setCanonicalValue(this.recordOriginalCanonicalValue);
|
||||
|
||||
@@ -194,4 +255,24 @@ public class CustomTextCellEditor extends AbstractCellEditor {
|
||||
this.freeEdit = freeEdit;
|
||||
}
|
||||
|
||||
|
||||
public IEditErrorHandler getInputConversionErrorHandler() {
|
||||
return inputConversionErrorHandler;
|
||||
}
|
||||
|
||||
|
||||
public void setInputConversionErrorHandler(IEditErrorHandler inputConversionErrorHandler) {
|
||||
this.inputConversionErrorHandler = inputConversionErrorHandler;
|
||||
}
|
||||
|
||||
|
||||
public IEditErrorHandler getInputValidationErrorHandler() {
|
||||
return inputValidationErrorHandler;
|
||||
}
|
||||
|
||||
|
||||
public void setInputValidationErrorHandler(IEditErrorHandler inputValidationErrorHandler) {
|
||||
this.inputValidationErrorHandler = inputValidationErrorHandler;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.context.nattableTree;
|
||||
|
||||
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
|
||||
import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
|
||||
import org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException;
|
||||
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider;
|
||||
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel;
|
||||
import org.talend.core.model.process.IContextManager;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.ui.context.ContextTreeTable.ContextTreeNode;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.core.ui.utils.ContextTypeValidator;
|
||||
|
||||
public class EventDataValueValidator extends DataValidator {
|
||||
|
||||
private ColumnGroupModel columnGroupModel;
|
||||
private IDataProvider dataProvider;
|
||||
|
||||
private IContextManager manager;
|
||||
|
||||
EventDataValueValidator(IDataProvider bodyDataProvider, IContextManager manager, ColumnGroupModel columnGroupModel) {
|
||||
this.dataProvider = bodyDataProvider;
|
||||
this.manager = manager;
|
||||
this.columnGroupModel = columnGroupModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate(int columnIndex, int rowIndex, Object newValue) {
|
||||
boolean isValid = true;
|
||||
ContextTreeNode rowNode = ((GlazedListsDataProvider<ContextTreeNode>) dataProvider).getList().get(rowIndex);
|
||||
if (columnGroupModel != null && columnGroupModel.isPartOfAGroup(columnIndex)) {
|
||||
String columnGroupName = columnGroupModel.getColumnGroupByIndex(columnIndex).getName();
|
||||
IContextParameter realPara = ContextNatTableUtils.getRealParameter(manager, columnGroupName, rowNode.getTreeData());
|
||||
if (realPara != null) {
|
||||
isValid = ContextTypeValidator.isMatchType(realPara.getType(), newValue);
|
||||
if (!isValid) {
|
||||
throw new ValidationFailedException(Messages.getString("ContextValidator.ParameterValueNotMatch")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
return isValid;
|
||||
}
|
||||
}
|
||||
@@ -425,6 +425,7 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
|
||||
&& jobContextManager.isOriginalParameter(param.getName())) {
|
||||
jobContextManager.setModified(true);
|
||||
manager.fireContextsChangedEvent();
|
||||
modelManager.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -507,6 +508,7 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
|
||||
&& jobContextManager.isOriginalParameter(param.getName())) {
|
||||
jobContextManager.setModified(true);
|
||||
manager.fireContextsChangedEvent();
|
||||
modelManager.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -588,6 +590,7 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
|
||||
&& jobContextManager.isOriginalParameter(param.getName())) {
|
||||
jobContextManager.setModified(true);
|
||||
manager.fireContextsChangedEvent();
|
||||
modelManager.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -684,6 +687,7 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
|
||||
&& jobContextManager.isOriginalParameter(param.getName())) {
|
||||
jobContextManager.setModified(true);
|
||||
manager.fireContextsChangedEvent();
|
||||
modelManager.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public class RoutinesFunctionProposal implements IContentProposal {
|
||||
message += Messages.getString("RoutinesFunctionProposal.CreatedBy.v1");
|
||||
message += Messages.getString("RoutinesFunctionProposal.ReturnType.v1");
|
||||
message += Messages.getString("RoutinesFunctionProposal.VariableName.v1");
|
||||
message = message.replaceAll("\n", System.getProperty("line.separator", "\n")); // for display on Windows platform
|
||||
|
||||
MessageFormat format = new MessageFormat(message);
|
||||
Object[] args = new Object[] { function.getDescription(),
|
||||
|
||||
@@ -134,7 +134,7 @@ public final class TokenInforUtil {
|
||||
targetArray = new JSONArray();
|
||||
Map<String,List<JSONObject>> objectMap = new HashMap<String,List<JSONObject>>();
|
||||
for (Object obj : data) {
|
||||
if((obj instanceof JSONObject) && ((JSONObject)obj).get("component_name")!=null){//$NON-NLS-1$
|
||||
if((obj instanceof JSONObject) && ((JSONObject)obj).has("component_name") && ((JSONObject)obj).get("component_name")!=null){//$NON-NLS-1$
|
||||
List<JSONObject> dataList = new ArrayList<JSONObject>();
|
||||
String componentName = (String) ((JSONObject)obj).get("component_name");//$NON-NLS-1$
|
||||
if(objectMap.containsKey(componentName)){
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
|
||||
|
||||
public class ContextTypeValidator {
|
||||
|
||||
public static boolean isMatchType(ContextParameterType contextParam) {
|
||||
return isMatchType(contextParam.getType(), contextParam.getValue());
|
||||
}
|
||||
|
||||
public static boolean isMatchType(String type, Object objValue) {
|
||||
String strValue = null;
|
||||
if (objValue == null) {
|
||||
return true;
|
||||
}
|
||||
if (objValue instanceof String) {
|
||||
strValue = (String) objValue;
|
||||
}
|
||||
if (StringUtils.isEmpty(strValue)) {
|
||||
return true;
|
||||
}
|
||||
boolean isValid = true;
|
||||
switch (type) {
|
||||
case "id_Integer": {
|
||||
try {
|
||||
ParserUtils.parseTo_int(strValue);
|
||||
} catch (NumberFormatException ex) {
|
||||
isValid = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "id_Double": {
|
||||
try {
|
||||
ParserUtils.parseTo_double(strValue);
|
||||
} catch (NumberFormatException ex) {
|
||||
isValid = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "id_Float": {
|
||||
try {
|
||||
ParserUtils.parseTo_float(strValue);
|
||||
} catch (NumberFormatException ex) {
|
||||
isValid = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "id_BigDecimal": {
|
||||
try {
|
||||
ParserUtils.parseTo_BigDecimal(strValue);
|
||||
} catch (NumberFormatException ex) {
|
||||
isValid = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "id_Long": {
|
||||
try {
|
||||
ParserUtils.parseTo_long(strValue);
|
||||
} catch (NumberFormatException ex) {
|
||||
isValid = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "id_Short": {
|
||||
try {
|
||||
ParserUtils.parseTo_short(strValue);
|
||||
} catch (NumberFormatException ex) {
|
||||
isValid = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isValid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ParserUtils {
|
||||
|
||||
public static List<String> parseTo_List(String s) {
|
||||
return parseTo_List(s, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* the source should be a string wrapped in chars[ ] which stands for it is a collection
|
||||
*
|
||||
* @param stSrc
|
||||
* @param fieldSep
|
||||
* @return
|
||||
*/
|
||||
public static List<String> parseTo_List(final String strSrc, String fieldSep) {
|
||||
if (strSrc == null) {
|
||||
return null;
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
// the source string is wrap in [] which means it is a collection
|
||||
if ((fieldSep == null || "".equals(fieldSep)) || !(strSrc.startsWith("[") && strSrc.endsWith("]"))) {
|
||||
list.add(strSrc);
|
||||
return list;
|
||||
}
|
||||
String strTemp = strSrc.substring(1, strSrc.length() - 1); // remove the [ ]
|
||||
for (String str : strTemp.split(fieldSep, -1)) {
|
||||
list.add(str);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Character parseTo_Character(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return s.charAt(0);
|
||||
}
|
||||
|
||||
public static char parseTo_char(String s) {
|
||||
return parseTo_Character(s);
|
||||
}
|
||||
|
||||
public static Byte parseTo_Byte(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return Byte.decode(s).byteValue();
|
||||
}
|
||||
|
||||
public static Byte parseTo_Byte(String s, boolean isDecode) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
if (isDecode) {
|
||||
return Byte.decode(s).byteValue();
|
||||
} else {
|
||||
return Byte.parseByte(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte parseTo_byte(String s) {
|
||||
return parseTo_Byte(s);
|
||||
}
|
||||
|
||||
public static byte parseTo_byte(String s, boolean isDecode) {
|
||||
return parseTo_Byte(s, isDecode);
|
||||
}
|
||||
|
||||
public static Double parseTo_Double(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return Double.parseDouble(s);
|
||||
}
|
||||
|
||||
public static double parseTo_double(String s) {
|
||||
return parseTo_Double(s);
|
||||
}
|
||||
|
||||
public static float parseTo_float(String s) {
|
||||
return Float.parseFloat(s);
|
||||
}
|
||||
|
||||
public static Float parseTo_Float(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return parseTo_float(s);
|
||||
}
|
||||
|
||||
public static int parseTo_int(String s) {
|
||||
return Integer.parseInt(s);
|
||||
}
|
||||
|
||||
public static int parseTo_int(String s, boolean isDecode) {
|
||||
if (isDecode) {
|
||||
return Integer.decode(s).intValue();
|
||||
} else {
|
||||
return Integer.parseInt(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer parseTo_Integer(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return parseTo_int(s);
|
||||
}
|
||||
|
||||
public static Integer parseTo_Integer(String s, boolean isDecode) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return parseTo_int(s, isDecode);
|
||||
}
|
||||
|
||||
public static short parseTo_short(String s) {
|
||||
return Short.parseShort(s);
|
||||
}
|
||||
|
||||
public static short parseTo_short(String s, boolean isDecode) {
|
||||
if (isDecode) {
|
||||
return Short.decode(s).shortValue();
|
||||
} else {
|
||||
return Short.parseShort(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static Short parseTo_Short(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return parseTo_short(s);
|
||||
}
|
||||
|
||||
public static Short parseTo_Short(String s, boolean isDecode) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return parseTo_short(s, isDecode);
|
||||
}
|
||||
|
||||
public static long parseTo_long(String s) {
|
||||
return Long.parseLong(s);
|
||||
}
|
||||
|
||||
public static long parseTo_long(String s, boolean isDecode) {
|
||||
if (isDecode) {
|
||||
return Long.decode(s).longValue();
|
||||
} else {
|
||||
return Long.parseLong(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static Long parseTo_Long(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return parseTo_long(s);
|
||||
}
|
||||
|
||||
public static Long parseTo_Long(String s, boolean isDecode) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return parseTo_long(s, isDecode);
|
||||
}
|
||||
|
||||
public static Boolean parseTo_Boolean(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
if (s.equals("1")) { //$NON-NLS-1$
|
||||
return Boolean.parseBoolean("true"); //$NON-NLS-1$
|
||||
}
|
||||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
|
||||
public static boolean parseTo_boolean(String s) {
|
||||
return parseTo_Boolean(s);
|
||||
}
|
||||
|
||||
public static String parseTo_String(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
public static String parseTo_String(final List<String> s, String fieldSep) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuffer result = new StringBuffer();
|
||||
result.append("[");
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
if (i != 0) {
|
||||
result.append(fieldSep);
|
||||
}
|
||||
result.append(s.get(i));
|
||||
}
|
||||
result.append("]");
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static BigDecimal parseTo_BigDecimal(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return new BigDecimal(s);
|
||||
|
||||
} catch (NumberFormatException nfe) {
|
||||
|
||||
if (nfe.getMessage() == null) {
|
||||
|
||||
throw new NumberFormatException("Incorrect input \"" + s + "\" for BigDecimal.");
|
||||
|
||||
} else {
|
||||
|
||||
throw nfe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -63,6 +63,12 @@ public interface IGITProviderService extends IService {
|
||||
*/
|
||||
boolean isStandardMode();
|
||||
|
||||
/**
|
||||
* Whether git storage mode is set in preference or not
|
||||
* @return
|
||||
*/
|
||||
boolean isGitModeInPreference();
|
||||
|
||||
/**
|
||||
* Set git mode
|
||||
* @param standardMode
|
||||
|
||||
@@ -1076,6 +1076,21 @@ public class ProcessorUtilities {
|
||||
}
|
||||
progressMonitor.subTask(Messages.getString("ProcessorUtilities.loadingJob") + currentJobName); //$NON-NLS-1$
|
||||
|
||||
//APPINT-35554 correct build type for child job of Route
|
||||
JobInfo parentJobInfo = jobInfo.getFatherJobInfo();
|
||||
if (selectedProcessItem != null && parentJobInfo != null
|
||||
&& parentJobInfo.getProcessor() != null && parentJobInfo.getProcessor().getProperty() != null ) {
|
||||
Property childProperty = selectedProcessItem.getProperty();
|
||||
String childBuildType = (String)childProperty.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
|
||||
if (childBuildType == null) {
|
||||
Property parentProperty = parentJobInfo.getProcessor().getProperty();
|
||||
String parentBuildType = (String)parentProperty.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
|
||||
if ("ROUTE".equalsIgnoreCase(parentBuildType)) {
|
||||
childProperty.getAdditionalProperties().put(TalendProcessArgumentConstant.ARG_BUILD_TYPE, "OSGI");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jobInfo.getProcess() == null) {
|
||||
if (selectedProcessItem != null) {
|
||||
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
|
||||
|
||||
@@ -22,7 +22,7 @@ _UI_Dependency_type=\u4F9D\u5B58\u9805\u76EE
|
||||
_UI_Expression_type=\u5F0F
|
||||
_UI_BooleanExpression_type=\u30D6\u30FC\u30EB\u5024\u306E\u5F0F
|
||||
_UI_ProcedureExpression_type=\u30D7\u30ED\u30B7\u30FC\u30B8\u30E3\u30FC\u30A8\u30AF\u30B9\u30D7\u30EC\u30C3\u30B7\u30E7\u30F3
|
||||
_UI_Multiplicity_type=\u591A\u69D8\u6027
|
||||
_UI_Multiplicity_type=\u591A\u91CD\u5EA6
|
||||
_UI_MultiplicityRange_type=\u591A\u69D8\u6027\u30EC\u30F3\u30B8
|
||||
_UI_Stereotype_type=\u30B9\u30C6\u30EC\u30AA\u30BF\u30A4\u30D7
|
||||
_UI_TaggedValue_type=\u30BF\u30B0\u4ED8\u3051\u3055\u308C\u305F\u5024
|
||||
@@ -367,7 +367,7 @@ _UI_Feature_featureNode_feature=\u6A5F\u80FD\u30CE\u30FC\u30C9
|
||||
_UI_Feature_featureMap_feature=\u6A5F\u80FD\u30DE\u30C3\u30D7
|
||||
_UI_Feature_cfMap_feature=Cf\u30DE\u30C3\u30D7
|
||||
_UI_StructuralFeature_changeability_feature=\u53EF\u5909\u6027
|
||||
_UI_StructuralFeature_multiplicity_feature=\u591A\u69D8\u6027
|
||||
_UI_StructuralFeature_multiplicity_feature=\u591A\u91CD\u5EA6
|
||||
_UI_StructuralFeature_ordering_feature=\u9806\u5E8F\u4ED8\u3051
|
||||
_UI_StructuralFeature_targetScope_feature=\u30BF\u30FC\u30B2\u30C3\u30C8\u30B9\u30B3\u30FC\u30D7
|
||||
_UI_StructuralFeature_type_feature=\u30BF\u30A4\u30D7
|
||||
@@ -390,7 +390,7 @@ _UI_Expression_language_feature=\u8A00\u8A9E
|
||||
_UI_Multiplicity_range_feature=\u7BC4\u56F2
|
||||
_UI_MultiplicityRange_lower_feature=\u4E0B\u65B9
|
||||
_UI_MultiplicityRange_upper_feature=\u4E0A\u65B9
|
||||
_UI_MultiplicityRange_multiplicity_feature=\u591A\u69D8\u6027
|
||||
_UI_MultiplicityRange_multiplicity_feature=\u591A\u91CD\u5EA6
|
||||
_UI_Stereotype_baseClass_feature=\u30D9\u30FC\u30B9\u30AF\u30E9\u30B9
|
||||
_UI_Stereotype_stereotypeConstraint_feature=\u30B9\u30C6\u30EC\u30AA\u30BF\u30A4\u30D7\u5236\u7D04
|
||||
_UI_Stereotype_extendedElement_feature=\u62E1\u5F35\u3055\u308C\u305F\u30A8\u30EC\u30E1\u30F3\u30C8
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
<jcache.version>1.0.5</jcache.version>
|
||||
<jcache_spec.version>1.0-alpha-1</jcache_spec.version>
|
||||
<johnzon.version>1.2.19</johnzon.version>
|
||||
<meecrowave.version>1.2.14</meecrowave.version>
|
||||
<meecrowave.version>1.2.15</meecrowave.version>
|
||||
<microprofile.version>1.2.1</microprofile.version>
|
||||
<owb.version>2.0.27</owb.version>
|
||||
<slf4j.version>1.7.34</slf4j.version>
|
||||
<tomcat.version>9.0.68</tomcat.version>
|
||||
<tomcat.version>9.0.73</tomcat.version>
|
||||
<xbean.version>4.20</xbean.version>
|
||||
<reload4j.version>1.2.22</reload4j.version>
|
||||
<log4j2.version>2.18.0</log4j2.version>
|
||||
<log4j2.version>2.20.0</log4j2.version>
|
||||
<tycho.buildtimestamp.format>${timestamp}</tycho.buildtimestamp.format>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<talend_releases>https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/</talend_releases>
|
||||
<talend_snapshots_ee>https://artifacts-zl.talend.com/nexus/content/repositories/snapshots/</talend_snapshots_ee>
|
||||
<talend_releases_ee>https://artifacts-zl.talend.com/nexus/content/repositories/releases/</talend_releases_ee>
|
||||
<tycho.buildtimestamp.format>${timestamp}</tycho.buildtimestamp.format>
|
||||
<tycho.buildtimestamp.format>${timestamp}</tycho.buildtimestamp.format>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -72,15 +72,15 @@
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20140107</version>
|
||||
<version>20230227</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-cbor</artifactId>
|
||||
<version>${m2.fasterxml.jackson.version}</version>
|
||||
</dependency>
|
||||
<!-- It fixes provided dependency scope to compile, because maven-dependency-plugin is setup to include
|
||||
only compile and runtime scopes, but provided is also required. It's not possible to setup plugin to
|
||||
<!-- It fixes provided dependency scope to compile, because maven-dependency-plugin is setup to include
|
||||
only compile and runtime scopes, but provided is also required. It's not possible to setup plugin to
|
||||
include all: compile, runtime and provided dependencies -->
|
||||
<dependency>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
@@ -99,7 +99,7 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- Dependencies in provided scope should be explicitly added as dependency in this module,
|
||||
<!-- Dependencies in provided scope should be explicitly added as dependency in this module,
|
||||
because provided scope is not transitive -->
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
|
||||
@@ -52,8 +52,17 @@
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
|
||||
@@ -59,8 +59,17 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
@@ -99,7 +108,7 @@
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.4.16</version>
|
||||
<version>1.4.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20140107</version>
|
||||
<version>20230227</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.2.6</version>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.53.0</tcomp.version>
|
||||
<tcomp.version>1.56.1</tcomp.version>
|
||||
<slf4j.version>1.7.34</slf4j.version>
|
||||
<reload4j.version>1.2.22</reload4j.version>
|
||||
</properties>
|
||||
|
||||
@@ -11,6 +11,10 @@ ProjectPomProjectSettingPage_FilterPomLabel=Filtrer pour utiliser la g\u00E9n\u0
|
||||
ProjectPomProjectSettingPage_FilterErrorMessage=Le filtre n'est pas valide.
|
||||
ProjectPomProjectSettingPage.syncAllPomsButtonText=Forcer la resynchronisation compl\u00E8te des POM
|
||||
ProjectPomProjectSettingPage.syncBuildTypesButtonText=Forcer la resynchronisation compl\u00E8te des types de build
|
||||
ProjectPomProjectSettingPage.validateTitle=R\u00E9sultat de la validation
|
||||
ProjectPomProjectSettingPage.warningTip=La configuration par d\u00E9faut sera \u00E9cras\u00E9e.\n
|
||||
ProjectPomProjectSettingPage.errorTip=Impossible d'\u00E9craser la configuration par d\u00E9faut.\n
|
||||
ProjectPomProjectSettingPage.preview=Aper\u00E7u
|
||||
AbstractPersistentProjectSettingPage.syncAllPoms=Mettre \u00E0 jour tous les POM ? \n Cette op\u00E9ration peut prendre un moment, selon la taille de votre projet.
|
||||
MavenProjectSettingPage.filterExampleMessage=Exemples de filtres\u00A0:\nlibell\u00E9=monJob \t\t\t\t=> G\u00E9n\u00E9rer uniquement le Job nomm\u00E9 "monJob"\n!(libell\u00E9=monJob) \t\t\t\t=> G\u00E9n\u00E9rer tous les Jobs sauf celui nomm\u00E9 "monJob"\n(path=folder1/folder2) \t\t\t=> G\u00E9n\u00E9rer tous Jobs dans le dossier "dossier1/dossier2"\n(chemin=dossier1/dossier2)ou(libell\u00E9=monJob)\t=> G\u00E9n\u00E9rer tous Jobs dans le dossier "dossier1/dossier2" ou nomm\u00E9 "monJob"\n(libell\u00E9=monJob)et(version=0.2)\t\t=> G\u00E9n\u00E9rer uniquement le Job nomm\u00E9 "monJob" avec une version 0.2\n!((libell\u00E9=monJob)et(version=0.1))\t\t=> G\u00E9n\u00E9rer tous les Jobs sauf "monJob" version 0.1
|
||||
MavenProjectSettingPage.refModuleText=Configurer les modules du projet de r\u00E9f\u00E9rence dans le profil
|
||||
|
||||
@@ -11,6 +11,10 @@ ProjectPomProjectSettingPage_FilterPomLabel=POM\u306E\u751F\u6210\u306B\u4F7F\u7
|
||||
ProjectPomProjectSettingPage_FilterErrorMessage=\u30D5\u30A3\u30EB\u30BF\u30FC\u304C\u7121\u52B9\u3067\u3059\u3002
|
||||
ProjectPomProjectSettingPage.syncAllPomsButtonText=\u5B8C\u5168\u306A\u518D\u540C\u671FPOM\u3092\u5F37\u5236
|
||||
ProjectPomProjectSettingPage.syncBuildTypesButtonText=\u5B8C\u5168\u306A\u518D\u540C\u671F\u30D3\u30EB\u30C9\u30BF\u30A4\u30D7\u3092\u5F37\u5236
|
||||
ProjectPomProjectSettingPage.validateTitle=\u691C\u8A3C\u7D50\u679C
|
||||
ProjectPomProjectSettingPage.warningTip=\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u8A2D\u5B9A\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n
|
||||
ProjectPomProjectSettingPage.errorTip=\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u8A2D\u5B9A\u3092\u4E0A\u66F8\u304D\u3067\u304D\u307E\u305B\u3093\u3002\n
|
||||
ProjectPomProjectSettingPage.preview=\u30D7\u30EC\u30D3\u30E5\u30FC
|
||||
AbstractPersistentProjectSettingPage.syncAllPoms=POM\u3092\u3059\u3079\u3066\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3057\u307E\u3059\u304B? \n \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30B5\u30A4\u30BA\u306B\u3088\u3063\u3066\u306F\u3053\u306E\u64CD\u4F5C\u3067\u9577\u3044\u6642\u9593\u304C\u304B\u304B\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002
|
||||
MavenProjectSettingPage.filterExampleMessage=\u30D5\u30A3\u30EB\u30BF\u30FC\u306E\u4F8B:\nlabel=myJob \t\t\t\t=> "myJob"\u3068\u3044\u3046\u540D\u524D\u306E\u30B8\u30E7\u30D6\u3060\u3051\u3092\u751F\u6210\n!(label=myJob) \t\t\t\t=> "myJob"\u3068\u3044\u3046\u540D\u524D\u4EE5\u5916\u306E\u30B8\u30E7\u30D6\u3092\u3059\u3079\u3066\u751F\u6210\n(path=folder1/folder2) \t\t\t=> "folder1/folder2"\u3068\u3044\u3046\u30D5\u30A3\u30EB\u30C0\u30FC\u306B\u3042\u308B\u30B8\u30E7\u30D6\u3092\u3059\u3079\u3066\u751F\u6210\n(path=folder1/folder2)or(label=myJob)\t=> "folder1/folder2"\u3068\u3044\u3046\u30D5\u30A9\u30EB\u30C0\u30FC\u306B\u3042\u308B\u3059\u3079\u3066\u306E\u30B8\u30E7\u30D6\u3001\u307E\u305F\u306F"myJob"\u3068\u3044\u3046\u540D\u524D\u306E\u30B8\u30E7\u30D6\u3092\u751F\u6210\n(label=myJob)and(version=0.2)\t\t=> \u30D0\u30FC\u30B8\u30E7\u30F30.2\u3067"myJob"\u3068\u3044\u3046\u540D\u524D\u306E\u30B8\u30E7\u30D6\u306E\u307F\u751F\u6210\n!((label=myJob)and(version=0.1))\t\t=> \u30D0\u30FC\u30B8\u30E7\u30F30.1\u3067"myJob"\u3068\u3044\u3046\u540D\u524D\u4EE5\u5916\u306E\u30B8\u30E7\u30D6\u3092\u3059\u3079\u3066\u751F\u6210
|
||||
MavenProjectSettingPage.refModuleText=\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u3067\u53C2\u7167\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u8A2D\u5B9A
|
||||
|
||||
@@ -11,6 +11,10 @@ ProjectPomProjectSettingPage_FilterPomLabel=\u7528\u4E8E\u751F\u6210 pom \u7684\
|
||||
ProjectPomProjectSettingPage_FilterErrorMessage=\u7B5B\u9009\u5668\u65E0\u6548\u3002
|
||||
ProjectPomProjectSettingPage.syncAllPomsButtonText=\u5F3A\u5236\u5B8C\u5168\u91CD\u65B0\u540C\u6B65 POM
|
||||
ProjectPomProjectSettingPage.syncBuildTypesButtonText=\u5F3A\u5236\u91CD\u65B0\u540C\u6B65\u6784\u5EFA\u7C7B\u578B
|
||||
ProjectPomProjectSettingPage.validateTitle=\u9A8C\u8BC1\u7ED3\u679C
|
||||
ProjectPomProjectSettingPage.warningTip=\u9ED8\u8BA4\u8BBE\u7F6E\u5C06\u88AB\u8986\u76D6\u3002\n
|
||||
ProjectPomProjectSettingPage.errorTip=\u65E0\u6CD5\u8986\u76D6\u9ED8\u8BA4\u8BBE\u7F6E\u3002\n
|
||||
ProjectPomProjectSettingPage.preview=\u9884\u89C8
|
||||
AbstractPersistentProjectSettingPage.syncAllPoms=\u662F\u5426\u66F4\u65B0\u6240\u6709 POM \u6587\u4EF6? \n \u6B64\u64CD\u4F5C\u53EF\u80FD\u9700\u8981\u5F88\u957F\u65F6\u95F4\uFF0C\u5177\u4F53\u53D6\u51B3\u4E8E\u60A8\u7684\u5DE5\u7A0B\u5927\u5C0F\u3002
|
||||
MavenProjectSettingPage.filterExampleMessage=\u7B5B\u9009\u5668\u793A\u4F8B\uFF1A\nlabel=myJob \t\t\t\t=> \u4EC5\u751F\u6210\u540D\u4E3A "myJob" \u7684\u4F5C\u4E1A\n!(label=myJob) \t\t\t\t=> \u751F\u6210\u540D\u4E3A "myJob" \u9664\u5916\u7684\u4EFB\u610F\u4F5C\u4E1A\n(path=folder1/folder2) \t\t\t=> \u751F\u6210\u6587\u4EF6\u5939 "folder1/folder2" \u4E2D\u4EFB\u610F\u4F5C\u4E1A\n(path=folder1/folder2)or(label=myJob)\t=> \u751F\u6210\u6587\u4EF6\u5939 "folder1/folder2" \u4E2D\u7684\u4EFB\u610F\u4F5C\u4E1A\u6216\u4EFB\u610F\u540D\u4E3A "myJob" \u7684\u4F5C\u4E1A\n(label=myJob)and(version=0.2)\t\t=> \u4EC5\u751F\u6210\u7248\u672C 0.2 \u4E14\u540D\u4E3A "myJob" \u7684\u4F5C\u4E1A\n!((label=myJob)and(version=0.1))\t\t=> \u751F\u6210\u4EFB\u610F\u540D\u79F0\u4E0D\u4E3A "myJob" \u4E14\u7248\u672C\u4E0D\u4E3A 0.1 \u7684\u4F5C\u4E1A
|
||||
MavenProjectSettingPage.refModuleText=\u5728\u914D\u7F6E\u6587\u4EF6\u4E2D\u8BBE\u7F6E\u5F15\u7528\u5DE5\u7A0B\u6A21\u5757
|
||||
|
||||
@@ -377,8 +377,8 @@ public class PomIdsHelper {
|
||||
if (version == null) {
|
||||
version = VersionUtils.getPublishVersion(property.getVersion());
|
||||
}
|
||||
if (useSnapshot && version != null && !version.contains(MavenConstants.SNAPSHOT)) {
|
||||
version += MavenConstants.SNAPSHOT;
|
||||
if (useSnapshot && version != null && !version.contains(MavenConstants.DOT_SNAPSHOT)) {
|
||||
version += MavenConstants.DOT_SNAPSHOT;
|
||||
}
|
||||
}
|
||||
return version;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/apache-mime4j-0.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/castor-1.0.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/apache-mime4j-core-0.8.9.jar" sourcepath="lib/apache-mime4j-core-0.8.9.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/castor-1.0.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -4,7 +4,7 @@ Bundle-Name: Apache Plug-in
|
||||
Bundle-SymbolicName: org.talend.libraries.apache
|
||||
Bundle-Version: 8.0.1.qualifier
|
||||
Bundle-ClassPath: .,
|
||||
lib/apache-mime4j-0.6.jar,
|
||||
lib/apache-mime4j-core-0.8.9.jar,
|
||||
lib/castor-1.0.3.jar,
|
||||
lib/jakarta-oro-2.0.8.jar
|
||||
Bundle-Vendor: .Talend SA.
|
||||
@@ -16,21 +16,8 @@ Require-Bundle: org.apache.log4j;resolution:=optional,
|
||||
Export-Package:
|
||||
org.apache.james.mime4j,
|
||||
org.apache.james.mime4j.codec,
|
||||
org.apache.james.mime4j.descriptor,
|
||||
org.apache.james.mime4j.field,
|
||||
org.apache.james.mime4j.field.address,
|
||||
org.apache.james.mime4j.field.address.parser,
|
||||
org.apache.james.mime4j.field.contentdisposition.parser,
|
||||
org.apache.james.mime4j.field.contenttype.parser,
|
||||
org.apache.james.mime4j.field.datetime,
|
||||
org.apache.james.mime4j.field.datetime.parser,
|
||||
org.apache.james.mime4j.field.language.parser,
|
||||
org.apache.james.mime4j.field.mimeversion.parser,
|
||||
org.apache.james.mime4j.field.structured.parser,
|
||||
org.apache.james.mime4j.io,
|
||||
org.apache.james.mime4j.message,
|
||||
org.apache.james.mime4j.parser,
|
||||
org.apache.james.mime4j.storage,
|
||||
org.apache.james.mime4j.util,
|
||||
org.apache.oro.io,
|
||||
org.apache.oro.text,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -81,6 +81,11 @@
|
||||
<artifactId>log4j-1.2-api</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.james</groupId>
|
||||
<artifactId>apache-mime4j-core</artifactId>
|
||||
<version>0.8.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -109,7 +114,7 @@
|
||||
<excludeTypes>pom</excludeTypes>
|
||||
<excludeTransitive>true</excludeTransitive>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<includeGroupIds>ch.qos.reload4j,org.slf4j,org.apache.logging.log4j</includeGroupIds>
|
||||
<includeGroupIds>ch.qos.reload4j,org.slf4j,org.apache.logging.log4j,org.apache.james</includeGroupIds>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/talendcsv-1.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/talendcsv-1.1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/csv-1.0.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
|
||||
@@ -5,7 +5,8 @@ Bundle-SymbolicName: org.talend.libraries.csv
|
||||
Bundle-Version: 8.0.1.qualifier
|
||||
Bundle-ClassPath: .,
|
||||
lib/csv-1.0.jar,
|
||||
lib/talendcsv-1.0.0.jar
|
||||
lib/talendcsv-1.1.0.jar
|
||||
Require-Bundle: org.slf4j.api
|
||||
Export-Package: com.talend.csv,
|
||||
org.skife.csv
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
||||
@@ -2,4 +2,4 @@ output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/csv-1.0.jar,\
|
||||
lib/talendcsv-1.0.0.jar
|
||||
lib/talendcsv-1.1.0.jar
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<artifactItem>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>talendcsv</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.1.0</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* ------------------------------
|
||||
* CombinedCategoryPlotDemo1.java
|
||||
* ------------------------------
|
||||
* (C) Copyright 2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): ;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 05-May-2008 : Version 1 (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.experimental.chart.demo;
|
||||
|
||||
import java.awt.Font;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.jfree.chart.ChartPanel;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.chart.axis.CategoryAxis;
|
||||
import org.jfree.chart.axis.NumberAxis;
|
||||
import org.jfree.chart.labels.StandardCategoryToolTipGenerator;
|
||||
import org.jfree.chart.plot.CategoryPlot;
|
||||
import org.jfree.chart.renderer.category.BarRenderer;
|
||||
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
|
||||
import org.jfree.data.category.CategoryDataset;
|
||||
import org.jfree.data.category.DefaultCategoryDataset;
|
||||
import org.jfree.experimental.chart.plot.CombinedCategoryPlot;
|
||||
import org.jfree.ui.ApplicationFrame;
|
||||
import org.jfree.ui.RefineryUtilities;
|
||||
|
||||
/**
|
||||
* A demo for the {@link CombinedCategoryPlot} class.
|
||||
*/
|
||||
public class CombinedCategoryPlotDemo1 extends ApplicationFrame {
|
||||
|
||||
/**
|
||||
* Creates a new demo instance.
|
||||
*
|
||||
* @param title the frame title.
|
||||
*/
|
||||
public CombinedCategoryPlotDemo1(String title) {
|
||||
super(title);
|
||||
JPanel chartPanel = createDemoPanel();
|
||||
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
|
||||
setContentPane(chartPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a dataset.
|
||||
*
|
||||
* @return A dataset.
|
||||
*/
|
||||
public static CategoryDataset createDataset1() {
|
||||
DefaultCategoryDataset result = new DefaultCategoryDataset();
|
||||
String series1 = "First";
|
||||
String series2 = "Second";
|
||||
String type1 = "Type 1";
|
||||
String type2 = "Type 2";
|
||||
String type3 = "Type 3";
|
||||
String type4 = "Type 4";
|
||||
String type5 = "Type 5";
|
||||
String type6 = "Type 6";
|
||||
String type7 = "Type 7";
|
||||
String type8 = "Type 8";
|
||||
|
||||
result.addValue(1.0, series1, type1);
|
||||
result.addValue(4.0, series1, type2);
|
||||
result.addValue(3.0, series1, type3);
|
||||
result.addValue(5.0, series1, type4);
|
||||
result.addValue(5.0, series1, type5);
|
||||
result.addValue(7.0, series1, type6);
|
||||
result.addValue(7.0, series1, type7);
|
||||
result.addValue(8.0, series1, type8);
|
||||
|
||||
result.addValue(5.0, series2, type1);
|
||||
result.addValue(7.0, series2, type2);
|
||||
result.addValue(6.0, series2, type3);
|
||||
result.addValue(8.0, series2, type4);
|
||||
result.addValue(4.0, series2, type5);
|
||||
result.addValue(4.0, series2, type6);
|
||||
result.addValue(2.0, series2, type7);
|
||||
result.addValue(1.0, series2, type8);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a dataset.
|
||||
*
|
||||
* @return A dataset.
|
||||
*/
|
||||
public static CategoryDataset createDataset2() {
|
||||
|
||||
DefaultCategoryDataset result = new DefaultCategoryDataset();
|
||||
|
||||
String series1 = "Third";
|
||||
String series2 = "Fourth";
|
||||
|
||||
String type1 = "Type 1";
|
||||
String type2 = "Type 2";
|
||||
String type3 = "Type 3";
|
||||
String type4 = "Type 4";
|
||||
String type5 = "Type 5";
|
||||
String type6 = "Type 6";
|
||||
String type7 = "Type 7";
|
||||
String type8 = "Type 8";
|
||||
|
||||
result.addValue(11.0, series1, type1);
|
||||
result.addValue(14.0, series1, type2);
|
||||
result.addValue(13.0, series1, type3);
|
||||
result.addValue(15.0, series1, type4);
|
||||
result.addValue(15.0, series1, type5);
|
||||
result.addValue(17.0, series1, type6);
|
||||
result.addValue(17.0, series1, type7);
|
||||
result.addValue(18.0, series1, type8);
|
||||
|
||||
result.addValue(15.0, series2, type1);
|
||||
result.addValue(17.0, series2, type2);
|
||||
result.addValue(16.0, series2, type3);
|
||||
result.addValue(18.0, series2, type4);
|
||||
result.addValue(14.0, series2, type5);
|
||||
result.addValue(14.0, series2, type6);
|
||||
result.addValue(12.0, series2, type7);
|
||||
result.addValue(11.0, series2, type8);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a chart.
|
||||
*
|
||||
* @return A chart.
|
||||
*/
|
||||
private static JFreeChart createChart() {
|
||||
|
||||
CategoryDataset dataset1 = createDataset1();
|
||||
NumberAxis rangeAxis1 = new NumberAxis("Value");
|
||||
rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
|
||||
LineAndShapeRenderer renderer1 = new LineAndShapeRenderer();
|
||||
renderer1.setBaseToolTipGenerator(
|
||||
new StandardCategoryToolTipGenerator());
|
||||
CategoryPlot subplot1 = new CategoryPlot(dataset1, null, rangeAxis1,
|
||||
renderer1);
|
||||
subplot1.setDomainGridlinesVisible(true);
|
||||
|
||||
CategoryDataset dataset2 = createDataset2();
|
||||
NumberAxis rangeAxis2 = new NumberAxis("Value");
|
||||
rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
|
||||
BarRenderer renderer2 = new BarRenderer();
|
||||
renderer2.setBaseToolTipGenerator(
|
||||
new StandardCategoryToolTipGenerator());
|
||||
CategoryPlot subplot2 = new CategoryPlot(dataset2, null, rangeAxis2,
|
||||
renderer2);
|
||||
subplot2.setDomainGridlinesVisible(true);
|
||||
|
||||
CategoryAxis domainAxis = new CategoryAxis("Category");
|
||||
CombinedCategoryPlot plot = new CombinedCategoryPlot(
|
||||
domainAxis, new NumberAxis("Range"));
|
||||
plot.add(subplot1, 2);
|
||||
plot.add(subplot2, 1);
|
||||
|
||||
JFreeChart result = new JFreeChart(
|
||||
"Combined Domain Category Plot Demo",
|
||||
new Font("SansSerif", Font.BOLD, 12), plot, true);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a panel for the demo (used by SuperDemo.java).
|
||||
*
|
||||
* @return A panel.
|
||||
*/
|
||||
public static JPanel createDemoPanel() {
|
||||
JFreeChart chart = createChart();
|
||||
return new ChartPanel(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starting point for the demonstration application.
|
||||
*
|
||||
* @param args ignored.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
String title = "Combined Category Plot Demo 1";
|
||||
CombinedCategoryPlotDemo1 demo = new CombinedCategoryPlotDemo1(title);
|
||||
demo.pack();
|
||||
RefineryUtilities.centerFrameOnScreen(demo);
|
||||
demo.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* ------------------------
|
||||
* CombinedXYPlotDemo1.java
|
||||
* ------------------------
|
||||
* (C) Copyright 2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): ;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 05-May-2008 : Version 1 (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.experimental.chart.demo;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Paint;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.jfree.chart.ChartPanel;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.chart.axis.DateAxis;
|
||||
import org.jfree.chart.axis.NumberAxis;
|
||||
import org.jfree.chart.axis.ValueAxis;
|
||||
import org.jfree.chart.labels.StandardXYToolTipGenerator;
|
||||
import org.jfree.chart.plot.XYPlot;
|
||||
import org.jfree.chart.renderer.xy.XYBarRenderer;
|
||||
import org.jfree.chart.renderer.xy.XYItemRenderer;
|
||||
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
|
||||
import org.jfree.chart.title.LegendTitle;
|
||||
import org.jfree.data.time.Month;
|
||||
import org.jfree.data.time.TimeSeries;
|
||||
import org.jfree.data.time.TimeSeriesCollection;
|
||||
import org.jfree.data.xy.IntervalXYDataset;
|
||||
import org.jfree.data.xy.XYDataset;
|
||||
import org.jfree.experimental.chart.plot.CombinedXYPlot;
|
||||
import org.jfree.ui.ApplicationFrame;
|
||||
import org.jfree.ui.RefineryUtilities;
|
||||
|
||||
/**
|
||||
* A demonstration application showing a {@link CombinedXYPlot} with
|
||||
* two subplots.
|
||||
*/
|
||||
public class CombinedXYPlotDemo1 extends ApplicationFrame {
|
||||
|
||||
/**
|
||||
* Constructs a new demonstration application.
|
||||
*
|
||||
* @param title the frame title.
|
||||
*/
|
||||
public CombinedXYPlotDemo1(String title) {
|
||||
super(title);
|
||||
JPanel panel = createDemoPanel();
|
||||
panel.setPreferredSize(new java.awt.Dimension(500, 270));
|
||||
setContentPane(panel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an overlaid chart.
|
||||
*
|
||||
* @return The chart.
|
||||
*/
|
||||
private static JFreeChart createCombinedChart() {
|
||||
|
||||
// create plot ...
|
||||
IntervalXYDataset data1 = createDataset1();
|
||||
XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
|
||||
renderer1.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
|
||||
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
|
||||
new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
|
||||
renderer1.setSeriesStroke(0, new BasicStroke(4.0f,
|
||||
BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
|
||||
renderer1.setSeriesPaint(0, Color.blue);
|
||||
|
||||
DateAxis domainAxis = new DateAxis("Year");
|
||||
domainAxis.setLowerMargin(0.0);
|
||||
domainAxis.setUpperMargin(0.02);
|
||||
ValueAxis rangeAxis = new NumberAxis("$billion");
|
||||
XYPlot plot1 = new XYPlot(data1, null, rangeAxis, renderer1);
|
||||
plot1.setBackgroundPaint(Color.lightGray);
|
||||
plot1.setDomainGridlinePaint(Color.white);
|
||||
plot1.setRangeGridlinePaint(Color.white);
|
||||
|
||||
// add a second dataset and renderer...
|
||||
IntervalXYDataset data2 = createDataset2();
|
||||
XYBarRenderer renderer2 = new XYBarRenderer() {
|
||||
public Paint getItemPaint(int series, int item) {
|
||||
XYDataset dataset = getPlot().getDataset();
|
||||
if (dataset.getYValue(series, item) >= 0.0) {
|
||||
return Color.red;
|
||||
}
|
||||
else {
|
||||
return Color.green;
|
||||
}
|
||||
}
|
||||
};
|
||||
renderer2.setSeriesPaint(0, Color.red);
|
||||
renderer2.setDrawBarOutline(false);
|
||||
renderer2.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
|
||||
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
|
||||
new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
|
||||
|
||||
XYPlot plot2 = new XYPlot(data2, null, new NumberAxis("$billion"),
|
||||
renderer2);
|
||||
plot2.setBackgroundPaint(Color.lightGray);
|
||||
plot2.setDomainGridlinePaint(Color.white);
|
||||
plot2.setRangeGridlinePaint(Color.white);
|
||||
|
||||
CombinedXYPlot cplot = new CombinedXYPlot(domainAxis, rangeAxis);
|
||||
cplot.add(plot1, 3);
|
||||
cplot.add(plot2, 2);
|
||||
cplot.setGap(8.0);
|
||||
cplot.setDomainGridlinePaint(Color.white);
|
||||
cplot.setDomainGridlinesVisible(true);
|
||||
|
||||
// return a new chart containing the overlaid plot...
|
||||
JFreeChart chart = new JFreeChart("CombinedXYPlotDemo1",
|
||||
JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
|
||||
chart.setBackgroundPaint(Color.white);
|
||||
LegendTitle legend = new LegendTitle(cplot);
|
||||
chart.addSubtitle(legend);
|
||||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a sample dataset. You wouldn't normally hard-code the
|
||||
* population of a dataset in this way (it would be better to read the
|
||||
* values from a file or a database query), but for a self-contained demo
|
||||
* this is the least complicated solution.
|
||||
*
|
||||
* @return The dataset.
|
||||
*/
|
||||
private static IntervalXYDataset createDataset1() {
|
||||
|
||||
// create dataset 1...
|
||||
TimeSeries series1 = new TimeSeries("Series 1", Month.class);
|
||||
series1.add(new Month(1, 2005), 7627.743);
|
||||
series1.add(new Month(2, 2005), 7713.138);
|
||||
series1.add(new Month(3, 2005), 6776.939);
|
||||
series1.add(new Month(4, 2005), 5764.537);
|
||||
series1.add(new Month(5, 2005), 4777.880);
|
||||
series1.add(new Month(6, 2005), 4836.496);
|
||||
series1.add(new Month(7, 2005), 3887.618);
|
||||
series1.add(new Month(8, 2005), 3926.933);
|
||||
series1.add(new Month(9, 2005), 4932.710);
|
||||
series1.add(new Month(10, 2005), 4027.123);
|
||||
series1.add(new Month(11, 2005), 8092.322);
|
||||
series1.add(new Month(12, 2005), 8170.414);
|
||||
series1.add(new Month(1, 2006), 8196.070);
|
||||
series1.add(new Month(2, 2006), 8269.886);
|
||||
series1.add(new Month(3, 2006), 5371.156);
|
||||
series1.add(new Month(4, 2006), 5355.718);
|
||||
series1.add(new Month(5, 2006), 5356.777);
|
||||
series1.add(new Month(6, 2006), 8420.042);
|
||||
series1.add(new Month(7, 2006), 8444.347);
|
||||
series1.add(new Month(8, 2006), 8515.034);
|
||||
series1.add(new Month(9, 2006), 8506.974);
|
||||
series1.add(new Month(10, 2006), 8584.329);
|
||||
series1.add(new Month(11, 2006), 8633.246);
|
||||
series1.add(new Month(12, 2006), 8680.224);
|
||||
series1.add(new Month(1, 2007), 8707.561);
|
||||
return new TimeSeriesCollection(series1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a sample dataset. You wouldn't normally hard-code the
|
||||
* population of a dataset in this way (it would be better to read the
|
||||
* values from a file or a database query), but for a self-contained demo
|
||||
* this is the least complicated solution.
|
||||
*
|
||||
* @return A sample dataset.
|
||||
*/
|
||||
private static IntervalXYDataset createDataset2() {
|
||||
TimeSeriesCollection dataset = new TimeSeriesCollection();
|
||||
|
||||
TimeSeries series1 = new TimeSeries("Series 2", Month.class);
|
||||
series1.add(new Month(1, 2005), 1200);
|
||||
series1.add(new Month(2, 2005), 1400);
|
||||
series1.add(new Month(3, 2005), 1500);
|
||||
series1.add(new Month(4, 2005), 1700);
|
||||
series1.add(new Month(5, 2005), 1600);
|
||||
series1.add(new Month(6, 2005), 2400);
|
||||
series1.add(new Month(7, 2005), 2100);
|
||||
series1.add(new Month(8, 2005), 2200);
|
||||
series1.add(new Month(9, 2005), 800);
|
||||
series1.add(new Month(10, 2005), 2350);
|
||||
series1.add(new Month(11, 2005), 500);
|
||||
series1.add(new Month(12, 2005), 700);
|
||||
series1.add(new Month(1, 2006), 900);
|
||||
series1.add(new Month(2, 2006), 1500);
|
||||
series1.add(new Month(3, 2006), 2100);
|
||||
series1.add(new Month(4, 2006), 2200);
|
||||
series1.add(new Month(5, 2006), 1900);
|
||||
series1.add(new Month(6, 2006), 3000);
|
||||
series1.add(new Month(7, 2006), 3780);
|
||||
series1.add(new Month(8, 2006), 4000);
|
||||
series1.add(new Month(9, 2006), 4500);
|
||||
series1.add(new Month(10, 2006), 7000);
|
||||
series1.add(new Month(11, 2006), 5500);
|
||||
series1.add(new Month(12, 2006), 6000);
|
||||
series1.add(new Month(1, 2007), 6500);
|
||||
dataset.addSeries(series1);
|
||||
return dataset;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a panel for the demo (used by SuperDemo.java).
|
||||
*
|
||||
* @return A panel.
|
||||
*/
|
||||
public static JPanel createDemoPanel() {
|
||||
JFreeChart chart = createCombinedChart();
|
||||
return new ChartPanel(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starting point for the demonstration application.
|
||||
*
|
||||
* @param args ignored.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
CombinedXYPlotDemo1 demo = new CombinedXYPlotDemo1(
|
||||
"JFreeChart : CombinedXYPlotDemo1");
|
||||
demo.pack();
|
||||
RefineryUtilities.centerFrameOnScreen(demo);
|
||||
demo.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* -------------------------
|
||||
* CombinedCategoryPlot.java
|
||||
* -------------------------
|
||||
* (C) Copyright 2008, by Richard West and Contributors.
|
||||
*
|
||||
* Original Author: Richard West, Advanced Micro Devices, Inc.;
|
||||
* Contributor(s): David Gilbert (for Object Refinery Limited);
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 02-Feb-2007 : Version 1, contributed by Richard West - see
|
||||
* patch 1924543 (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.experimental.chart.plot;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.jfree.chart.axis.CategoryAxis;
|
||||
import org.jfree.chart.axis.ValueAxis;
|
||||
import org.jfree.chart.plot.CategoryPlot;
|
||||
import org.jfree.chart.plot.CombinedDomainCategoryPlot;
|
||||
import org.jfree.data.Range;
|
||||
|
||||
/**
|
||||
* A specialised form of {@link CombinedDomainCategoryPlot} where the
|
||||
* subplots share not only the same x-axis, but also the same y-axis.
|
||||
*/
|
||||
public class CombinedCategoryPlot extends CombinedDomainCategoryPlot {
|
||||
|
||||
/**
|
||||
* Creates a new instance with the specified axes.
|
||||
*
|
||||
* @param domainAxis the x-axis.
|
||||
* @param rangeAxis the y-axis.
|
||||
*/
|
||||
public CombinedCategoryPlot (CategoryAxis domainAxis, ValueAxis rangeAxis) {
|
||||
super(domainAxis);
|
||||
super.setGap(10.0);
|
||||
super.setRangeAxis(rangeAxis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new subplot with weight <code>1</code>.
|
||||
*
|
||||
* @param subplot the subplot.
|
||||
*/
|
||||
public void add(CategoryPlot subplot) {
|
||||
this.add(subplot, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new subplot with the specified weight.
|
||||
*
|
||||
* @param subplot the subplot.
|
||||
* @param weight the weight for the subplot.
|
||||
*/
|
||||
public void add(CategoryPlot subplot, int weight) {
|
||||
super.add(subplot, weight);
|
||||
|
||||
ValueAxis l_range = super.getRangeAxis();
|
||||
subplot.setRangeAxis(0, l_range, false);
|
||||
|
||||
super.setRangeAxis(l_range);
|
||||
if (null == l_range) {
|
||||
return;
|
||||
}
|
||||
|
||||
l_range.configure();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounds of the data values that will be plotted against
|
||||
* the specified axis.
|
||||
*
|
||||
* @param axis the axis.
|
||||
*
|
||||
* @return The bounds.
|
||||
*/
|
||||
public Range getDataRange(ValueAxis axis) {
|
||||
Range l_result = null;
|
||||
Iterator l_itr = getSubplots().iterator();
|
||||
while (l_itr.hasNext()) {
|
||||
CategoryPlot l_subplot = (CategoryPlot) l_itr.next();
|
||||
|
||||
l_result = Range.combine(l_result, l_subplot.getDataRange(axis));
|
||||
}
|
||||
return l_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the range axis that is shared by all the subplots.
|
||||
*
|
||||
* @param axis the axis.
|
||||
*/
|
||||
public void setRangeAxis(ValueAxis axis) {
|
||||
Iterator l_itr = getSubplots().iterator();
|
||||
while (l_itr.hasNext()) {
|
||||
CategoryPlot l_subplot = (CategoryPlot) l_itr.next();
|
||||
l_subplot.setRangeAxis(0, axis, false);
|
||||
}
|
||||
|
||||
super.setRangeAxis(axis);
|
||||
if (null == axis) {
|
||||
return;
|
||||
}
|
||||
|
||||
axis.configure();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* -------------------
|
||||
* CombinedXYPlot.java
|
||||
* -------------------
|
||||
* (C) Copyright 2008, by Richard West and Contributors.
|
||||
*
|
||||
* Original Author: Richard West, Advanced Micro Devices, Inc.;
|
||||
* Contributor(s): David Gilbert (for Object Refinery Limited);
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 05-May-2008 : Version 1, contributed by Richard West - see
|
||||
* patch 1924543 (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.experimental.chart.plot;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.jfree.chart.axis.ValueAxis;
|
||||
import org.jfree.chart.plot.CombinedDomainCategoryPlot;
|
||||
import org.jfree.chart.plot.CombinedDomainXYPlot;
|
||||
import org.jfree.chart.plot.XYPlot;
|
||||
import org.jfree.data.Range;
|
||||
|
||||
/**
|
||||
* A specialised form of {@link CombinedDomainCategoryPlot} where the
|
||||
* subplots share not only the same x-axis, but also the same y-axis.
|
||||
*/
|
||||
public class CombinedXYPlot extends CombinedDomainXYPlot {
|
||||
|
||||
/**
|
||||
* Creates a new instance with the specified axes.
|
||||
*
|
||||
* @param domainAxis the x-axis.
|
||||
* @param rangeAxis the y-axis.
|
||||
*/
|
||||
public CombinedXYPlot(ValueAxis domainAxis, ValueAxis rangeAxis) {
|
||||
super(domainAxis);
|
||||
super.setGap(10.0);
|
||||
super.setRangeAxis(rangeAxis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new subplot with weight <code>1</code>.
|
||||
*
|
||||
* @param subplot the subplot.
|
||||
*/
|
||||
public void add(XYPlot subplot) {
|
||||
this.add(subplot, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new subplot with the specified weight.
|
||||
*
|
||||
* @param subplot the subplot.
|
||||
* @param weight the weight for the subplot.
|
||||
*/
|
||||
public void add(XYPlot subplot, int weight) {
|
||||
super.add(subplot, weight);
|
||||
|
||||
ValueAxis l_range = super.getRangeAxis();
|
||||
subplot.setRangeAxis(0, l_range, false);
|
||||
|
||||
super.setRangeAxis(l_range);
|
||||
if (null == l_range) {
|
||||
return;
|
||||
}
|
||||
|
||||
l_range.configure();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounds of the data values that will be plotted against
|
||||
* the specified axis.
|
||||
*
|
||||
* @param axis the axis.
|
||||
*
|
||||
* @return The bounds.
|
||||
*/
|
||||
public Range getDataRange(ValueAxis axis) {
|
||||
Range l_result = null;
|
||||
Iterator l_itr = getSubplots().iterator();
|
||||
while (l_itr.hasNext()) {
|
||||
XYPlot l_subplot = (XYPlot) l_itr.next();
|
||||
|
||||
l_result = Range.combine(l_result, l_subplot.getDataRange(axis));
|
||||
}
|
||||
return l_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the range axis that is shared by all the subplots.
|
||||
*
|
||||
* @param axis the axis.
|
||||
*/
|
||||
public void setRangeAxis(ValueAxis axis) {
|
||||
Iterator l_itr = getSubplots().iterator();
|
||||
while (l_itr.hasNext()) {
|
||||
XYPlot l_subplot = (XYPlot) l_itr.next();
|
||||
l_subplot.setRangeAxis(0, axis, false);
|
||||
}
|
||||
|
||||
super.setRangeAxis(axis);
|
||||
if (null == axis) {
|
||||
return;
|
||||
}
|
||||
|
||||
axis.configure();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,298 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* ---------------------------------
|
||||
* XYSmoothLineAndShapeRenderer.java
|
||||
* ---------------------------------
|
||||
* (C) Copyright 2007, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Original Author: -;
|
||||
* Contributor(s): -;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 14-Jun-2007 : Version 1;
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.experimental.chart.renderer.xy;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.jfree.chart.axis.ValueAxis;
|
||||
import org.jfree.chart.entity.EntityCollection;
|
||||
import org.jfree.chart.plot.CrosshairState;
|
||||
import org.jfree.chart.plot.PlotOrientation;
|
||||
import org.jfree.chart.plot.XYPlot;
|
||||
import org.jfree.chart.renderer.xy.XYItemRendererState;
|
||||
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
|
||||
import org.jfree.data.xy.XYDataset;
|
||||
import org.jfree.ui.RectangleEdge;
|
||||
|
||||
/**
|
||||
* A line and shape renderer that performs line smoothing. See
|
||||
* http://www.jfree.org/phpBB2/viewtopic.php?t=20671
|
||||
*
|
||||
* WARNING: THIS CLASS IS NOT PART OF THE STANDARD JFREECHART API AND IS
|
||||
* SUBJECT TO ALTERATION OR REMOVAL. DO NOT RELY ON THIS CLASS FOR
|
||||
* PRODUCTION USE. Please experiment with this code and provide feedback.
|
||||
*/
|
||||
public class XYSmoothLineAndShapeRenderer extends XYLineAndShapeRenderer {
|
||||
|
||||
/**
|
||||
* Draws the item (first pass). This method draws the lines
|
||||
* connecting the items.
|
||||
*
|
||||
* @param g2 the graphics device.
|
||||
* @param state the renderer state.
|
||||
* @param dataArea the area within which the data is being drawn.
|
||||
* @param plot the plot (can be used to obtain standard color
|
||||
* information etc).
|
||||
* @param domainAxis the domain axis.
|
||||
* @param rangeAxis the range axis.
|
||||
* @param dataset the dataset.
|
||||
* @param pass the pass.
|
||||
* @param series the series index (zero-based).
|
||||
* @param item the item index (zero-based).
|
||||
*/
|
||||
protected void drawPrimaryLine(XYItemRendererState state, Graphics2D g2,
|
||||
XYPlot plot, XYDataset dataset, int pass, int series, int item,
|
||||
ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) {
|
||||
|
||||
if (item == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get the data point...
|
||||
double x1 = dataset.getXValue(series, item);
|
||||
double y1 = dataset.getYValue(series, item);
|
||||
if (Double.isNaN(y1) || Double.isNaN(x1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
double x0 = dataset.getXValue(series, item - 1);
|
||||
double y0 = dataset.getYValue(series, item - 1);
|
||||
if (Double.isNaN(y0) || Double.isNaN(x0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
|
||||
RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
|
||||
|
||||
double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation);
|
||||
double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation);
|
||||
|
||||
double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
|
||||
double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);
|
||||
|
||||
// only draw if we have good values
|
||||
if (Double.isNaN(transX0) || Double.isNaN(transY0)
|
||||
|| Double.isNaN(transX1) || Double.isNaN(transY1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Point2D.Double point0 = new Point2D.Double();
|
||||
Point2D.Double point1 = new Point2D.Double();
|
||||
Point2D.Double point2 = new Point2D.Double();
|
||||
Point2D.Double point3 = new Point2D.Double();
|
||||
|
||||
if (item == 1) {
|
||||
point0 = null;
|
||||
}
|
||||
else {
|
||||
point0.x = domainAxis.valueToJava2D(dataset.getXValue(series,
|
||||
item - 2), dataArea, xAxisLocation);
|
||||
point0.y = rangeAxis.valueToJava2D(dataset.getYValue(series,
|
||||
item - 2), dataArea, yAxisLocation);
|
||||
}
|
||||
|
||||
point1.x = transX0;
|
||||
point1.y = transY0;
|
||||
|
||||
point2.x = transX1;
|
||||
point2.y = transY1;
|
||||
|
||||
if ((item + 1) == dataset.getItemCount(series)) {
|
||||
point3 = null;
|
||||
}
|
||||
else {
|
||||
point3.x = domainAxis.valueToJava2D(dataset.getXValue(series,
|
||||
item + 1), dataArea, xAxisLocation);
|
||||
point3.y = rangeAxis.valueToJava2D(dataset.getYValue(series,
|
||||
item + 1), dataArea, yAxisLocation);
|
||||
}
|
||||
|
||||
int steps = ((int) ((point2.x - point1.x) / 0.2) < 30)
|
||||
? (int) ((point2.x - point1.x) / 0.2) : 30;
|
||||
|
||||
Point2D.Double[] points = getBezierCurve(point0, point1, point2,
|
||||
point3, 1, steps);
|
||||
|
||||
for (int i = 1; i < points.length; i++) {
|
||||
transX0 = points[i - 1].x;
|
||||
transY0 = points[i - 1].y;
|
||||
transX1 = points[i].x;
|
||||
transY1 = points[i].y;
|
||||
|
||||
PlotOrientation orientation = plot.getOrientation();
|
||||
if (orientation == PlotOrientation.HORIZONTAL) {
|
||||
state.workingLine.setLine(transY0, transX0, transY1, transX1);
|
||||
}
|
||||
else if (orientation == PlotOrientation.VERTICAL) {
|
||||
state.workingLine.setLine(transX0, transY0, transX1, transY1);
|
||||
}
|
||||
|
||||
if (state.workingLine.intersects(dataArea)) {
|
||||
drawFirstPassShape(g2, pass, series, item, state.workingLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the item shapes and adds chart entities (second pass). This method
|
||||
* draws the shapes which mark the item positions. If <code>entities</code>
|
||||
* is not <code>null</code> it will be populated with entity information
|
||||
* for points that fall within the data area.
|
||||
*
|
||||
* @param g2 the graphics device.
|
||||
* @param plot the plot (can be used to obtain standard color
|
||||
* information etc).
|
||||
* @param domainAxis the domain axis.
|
||||
* @param dataArea the area within which the data is being drawn.
|
||||
* @param rangeAxis the range axis.
|
||||
* @param dataset the dataset.
|
||||
* @param pass the pass.
|
||||
* @param series the series index (zero-based).
|
||||
* @param item the item index (zero-based).
|
||||
* @param crosshairState the crosshair state.
|
||||
* @param entities the entity collection.
|
||||
*/
|
||||
protected void drawSecondaryPass(Graphics2D g2, XYPlot plot,
|
||||
XYDataset dataset, int pass, int series, int item,
|
||||
ValueAxis domainAxis, Rectangle2D dataArea,
|
||||
ValueAxis rangeAxis, CrosshairState crosshairState,
|
||||
EntityCollection entities) {
|
||||
// super.drawSecondaryPass(g2, plot, dataset, pass, series, item,
|
||||
// domainAxis, dataArea, rangeAxis, crosshairState, entities);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the control points.
|
||||
*
|
||||
* @param point0
|
||||
* @param point1
|
||||
* @param point2
|
||||
* @param point3
|
||||
* @param control1
|
||||
* @param control2
|
||||
* @param smooth
|
||||
*/
|
||||
public static void getControlPoints(Point2D.Double point0,
|
||||
Point2D.Double point1, Point2D.Double point2,
|
||||
Point2D.Double point3, Point2D.Double control1,
|
||||
Point2D.Double control2, double smooth) {
|
||||
|
||||
// Reference: http://www.antigrain.com/research/bezier_interpolation/
|
||||
|
||||
if (point0 == null) point0 = point1; //new Point2D.Double(0, 0);
|
||||
if (point3 == null) point3 = point2; //new Point2D.Double(0, 0);
|
||||
|
||||
Point2D.Double c1 = new Point2D.Double(
|
||||
(point0.x + point1.x) / 2.0, (point0.y + point1.y) / 2.0);
|
||||
Point2D.Double c2 = new Point2D.Double(
|
||||
(point1.x + point2.x) / 2.0, (point1.y + point2.y) / 2.0);
|
||||
Point2D.Double c3 = new Point2D.Double(
|
||||
(point2.x + point3.x) / 2.0, (point2.y + point3.y) / 2.0);
|
||||
|
||||
double len1 = point1.distance(point0);
|
||||
double len2 = point2.distance(point1);
|
||||
double len3 = point3.distance(point2);
|
||||
|
||||
double k1 = len1 / (len1 + len2);
|
||||
double k2 = len2 / (len2 + len3);
|
||||
|
||||
Point2D.Double m1 = new Point2D.Double(
|
||||
c1.x + (c2.x - c1.x) * k1, c1.y + (c2.y - c1.y) * k1);
|
||||
Point2D.Double m2 = new Point2D.Double(
|
||||
c2.x + (c3.x - c2.x) * k2, c2.y + (c3.y - c2.y) * k2);
|
||||
|
||||
control1.setLocation(new Point2D.Double(
|
||||
m1.x + (c2.x - m1.x) * smooth + point1.x - m1.x,
|
||||
m1.y + (c2.y - m1.y) * smooth + point1.y - m1.y));
|
||||
control2.setLocation(new Point2D.Double(
|
||||
m2.x + (c2.x - m2.x) * smooth + point2.x - m2.x,
|
||||
m2.y + (c2.y - m2.y) * smooth + point2.y - m2.y));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the points for a bezier curve.
|
||||
*
|
||||
* @param point0
|
||||
* @param point1
|
||||
* @param point2
|
||||
* @param point3
|
||||
* @param smooth
|
||||
* @param steps
|
||||
*
|
||||
* @return The curve points.
|
||||
*/
|
||||
public static Point2D.Double[] getBezierCurve(Point2D.Double point0,
|
||||
Point2D.Double point1, Point2D.Double point2,
|
||||
Point2D.Double point3, double smooth, int steps) {
|
||||
Point2D.Double control1 = new Point2D.Double();
|
||||
Point2D.Double control2 = new Point2D.Double();
|
||||
|
||||
getControlPoints(point0, point1, point2, point3, control1, control2,
|
||||
smooth);
|
||||
|
||||
Point2D.Double C = new Point2D.Double(
|
||||
3 * (control1.x - point1.x), 3 * (control1.y - point1.y));
|
||||
Point2D.Double B = new Point2D.Double(3 * (control2.x - control1.x)
|
||||
- C.x, 3 * (control2.y - control1.y) - C.y);
|
||||
Point2D.Double A = new Point2D.Double(point2.x - point1.x - C.x - B.x,
|
||||
point2.y - point1.y - C.y - B.y);
|
||||
|
||||
Point2D.Double[] res = new Point2D.Double[steps + 1];
|
||||
double stepSize = 1.0 / steps;
|
||||
double step = stepSize;
|
||||
|
||||
res[0] = point1;
|
||||
for (int i = 1; i < steps; i++) {
|
||||
res[i] = new Point2D.Double(A.x * Math.pow(step, 3) + B.x
|
||||
* Math.pow(step, 2) + C.x * step + point1.x, A.y
|
||||
* Math.pow(step, 3) + B.y * Math.pow(step, 2) + C.y * step
|
||||
+ point1.y);
|
||||
//System.out.println(step + " : " + res[i]);
|
||||
step += stepSize;
|
||||
}
|
||||
res[steps] = point2;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* ---------------
|
||||
* ChartColor.java
|
||||
* ---------------
|
||||
* (C) Copyright 2003-2008, by Cameron Riley and Contributors.
|
||||
*
|
||||
* Original Author: Cameron Riley;
|
||||
* Contributor(s): David Gilbert (for Object Refinery Limited);
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 23-Jan-2003 : Version 1, contributed by Cameron Riley (DG);
|
||||
* 25-Nov-2004 : Changed first 7 colors to softer shades (DG);
|
||||
* 03-Nov-2005 : Removed orange color, too close to yellow - see bug
|
||||
* report 1328408 (DG);
|
||||
* ------------- JFREECHART 1.0.x ---------------------------------------------
|
||||
* 02-Feb-2007 : Removed author tags all over JFreeChart sources (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.chart;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Paint;
|
||||
|
||||
/**
|
||||
* Class to extend the number of Colors available to the charts. This
|
||||
* extends the java.awt.Color object and extends the number of final
|
||||
* Colors publically accessible.
|
||||
*/
|
||||
public class ChartColor extends Color {
|
||||
|
||||
/** A very dark red color. */
|
||||
public static final Color VERY_DARK_RED = new Color(0x80, 0x00, 0x00);
|
||||
|
||||
/** A dark red color. */
|
||||
public static final Color DARK_RED = new Color(0xc0, 0x00, 0x00);
|
||||
|
||||
/** A light red color. */
|
||||
public static final Color LIGHT_RED = new Color(0xFF, 0x40, 0x40);
|
||||
|
||||
/** A very light red color. */
|
||||
public static final Color VERY_LIGHT_RED = new Color(0xFF, 0x80, 0x80);
|
||||
|
||||
/** A very dark yellow color. */
|
||||
public static final Color VERY_DARK_YELLOW = new Color(0x80, 0x80, 0x00);
|
||||
|
||||
/** A dark yellow color. */
|
||||
public static final Color DARK_YELLOW = new Color(0xC0, 0xC0, 0x00);
|
||||
|
||||
/** A light yellow color. */
|
||||
public static final Color LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x40);
|
||||
|
||||
/** A very light yellow color. */
|
||||
public static final Color VERY_LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x80);
|
||||
|
||||
/** A very dark green color. */
|
||||
public static final Color VERY_DARK_GREEN = new Color(0x00, 0x80, 0x00);
|
||||
|
||||
/** A dark green color. */
|
||||
public static final Color DARK_GREEN = new Color(0x00, 0xC0, 0x00);
|
||||
|
||||
/** A light green color. */
|
||||
public static final Color LIGHT_GREEN = new Color(0x40, 0xFF, 0x40);
|
||||
|
||||
/** A very light green color. */
|
||||
public static final Color VERY_LIGHT_GREEN = new Color(0x80, 0xFF, 0x80);
|
||||
|
||||
/** A very dark cyan color. */
|
||||
public static final Color VERY_DARK_CYAN = new Color(0x00, 0x80, 0x80);
|
||||
|
||||
/** A dark cyan color. */
|
||||
public static final Color DARK_CYAN = new Color(0x00, 0xC0, 0xC0);
|
||||
|
||||
/** A light cyan color. */
|
||||
public static final Color LIGHT_CYAN = new Color(0x40, 0xFF, 0xFF);
|
||||
|
||||
/** Aa very light cyan color. */
|
||||
public static final Color VERY_LIGHT_CYAN = new Color(0x80, 0xFF, 0xFF);
|
||||
|
||||
/** A very dark blue color. */
|
||||
public static final Color VERY_DARK_BLUE = new Color(0x00, 0x00, 0x80);
|
||||
|
||||
/** A dark blue color. */
|
||||
public static final Color DARK_BLUE = new Color(0x00, 0x00, 0xC0);
|
||||
|
||||
/** A light blue color. */
|
||||
public static final Color LIGHT_BLUE = new Color(0x40, 0x40, 0xFF);
|
||||
|
||||
/** A very light blue color. */
|
||||
public static final Color VERY_LIGHT_BLUE = new Color(0x80, 0x80, 0xFF);
|
||||
|
||||
/** A very dark magenta/purple color. */
|
||||
public static final Color VERY_DARK_MAGENTA = new Color(0x80, 0x00, 0x80);
|
||||
|
||||
/** A dark magenta color. */
|
||||
public static final Color DARK_MAGENTA = new Color(0xC0, 0x00, 0xC0);
|
||||
|
||||
/** A light magenta color. */
|
||||
public static final Color LIGHT_MAGENTA = new Color(0xFF, 0x40, 0xFF);
|
||||
|
||||
/** A very light magenta color. */
|
||||
public static final Color VERY_LIGHT_MAGENTA = new Color(0xFF, 0x80, 0xFF);
|
||||
|
||||
/**
|
||||
* Creates a Color with an opaque sRGB with red, green and blue values in
|
||||
* range 0-255.
|
||||
*
|
||||
* @param r the red component in range 0x00-0xFF.
|
||||
* @param g the green component in range 0x00-0xFF.
|
||||
* @param b the blue component in range 0x00-0xFF.
|
||||
*/
|
||||
public ChartColor(int r, int g, int b) {
|
||||
super(r, g, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to return an array of <code>Paint</code> objects that
|
||||
* represent the pre-defined colors in the <code>Color<code> and
|
||||
* <code>ChartColor</code> objects.
|
||||
*
|
||||
* @return An array of objects with the <code>Paint</code> interface.
|
||||
*/
|
||||
public static Paint[] createDefaultPaintArray() {
|
||||
|
||||
return new Paint[] {
|
||||
new Color(0xFF, 0x55, 0x55),
|
||||
new Color(0x55, 0x55, 0xFF),
|
||||
new Color(0x55, 0xFF, 0x55),
|
||||
new Color(0xFF, 0xFF, 0x55),
|
||||
new Color(0xFF, 0x55, 0xFF),
|
||||
new Color(0x55, 0xFF, 0xFF),
|
||||
Color.pink,
|
||||
Color.gray,
|
||||
ChartColor.DARK_RED,
|
||||
ChartColor.DARK_BLUE,
|
||||
ChartColor.DARK_GREEN,
|
||||
ChartColor.DARK_YELLOW,
|
||||
ChartColor.DARK_MAGENTA,
|
||||
ChartColor.DARK_CYAN,
|
||||
Color.darkGray,
|
||||
ChartColor.LIGHT_RED,
|
||||
ChartColor.LIGHT_BLUE,
|
||||
ChartColor.LIGHT_GREEN,
|
||||
ChartColor.LIGHT_YELLOW,
|
||||
ChartColor.LIGHT_MAGENTA,
|
||||
ChartColor.LIGHT_CYAN,
|
||||
Color.lightGray,
|
||||
ChartColor.VERY_DARK_RED,
|
||||
ChartColor.VERY_DARK_BLUE,
|
||||
ChartColor.VERY_DARK_GREEN,
|
||||
ChartColor.VERY_DARK_YELLOW,
|
||||
ChartColor.VERY_DARK_MAGENTA,
|
||||
ChartColor.VERY_DARK_CYAN,
|
||||
ChartColor.VERY_LIGHT_RED,
|
||||
ChartColor.VERY_LIGHT_BLUE,
|
||||
ChartColor.VERY_LIGHT_GREEN,
|
||||
ChartColor.VERY_LIGHT_YELLOW,
|
||||
ChartColor.VERY_LIGHT_MAGENTA,
|
||||
ChartColor.VERY_LIGHT_CYAN
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,96 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* ---------------
|
||||
* ChartFrame.java
|
||||
* ---------------
|
||||
* (C) Copyright 2001-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): -;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 22-Nov-2001 : Version 1 (DG);
|
||||
* 08-Jan-2001 : Added chartPanel attribute (DG);
|
||||
* 24-May-2002 : Renamed JFreeChartFrame --> ChartFrame (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.chart;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
/**
|
||||
* A frame for displaying a chart.
|
||||
*/
|
||||
public class ChartFrame extends JFrame {
|
||||
|
||||
/** The chart panel. */
|
||||
private ChartPanel chartPanel;
|
||||
|
||||
/**
|
||||
* Constructs a frame for a chart.
|
||||
*
|
||||
* @param title the frame title.
|
||||
* @param chart the chart.
|
||||
*/
|
||||
public ChartFrame(String title, JFreeChart chart) {
|
||||
this(title, chart, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a frame for a chart.
|
||||
*
|
||||
* @param title the frame title.
|
||||
* @param chart the chart.
|
||||
* @param scrollPane if <code>true</code>, put the Chart(Panel) into a
|
||||
* JScrollPane.
|
||||
*/
|
||||
public ChartFrame(String title, JFreeChart chart, boolean scrollPane) {
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
this.chartPanel = new ChartPanel(chart);
|
||||
if (scrollPane) {
|
||||
setContentPane(new JScrollPane(this.chartPanel));
|
||||
}
|
||||
else {
|
||||
setContentPane(this.chartPanel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chart panel for the frame.
|
||||
*
|
||||
* @return The chart panel.
|
||||
*/
|
||||
public ChartPanel getChartPanel() {
|
||||
return this.chartPanel;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* --------------------
|
||||
* ChartMouseEvent.java
|
||||
* --------------------
|
||||
* (C) Copyright 2002-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): Alex Weber;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 27-May-2002 : Version 1, incorporating code and ideas by Alex Weber (DG);
|
||||
* 13-Jun-2002 : Added Javadoc comments (DG);
|
||||
* 26-Sep-2002 : Fixed errors reported by Checkstyle (DG);
|
||||
* 05-Nov-2002 : Added a reference to the source chart (DG);
|
||||
* 13-Jul-2004 : Now extends EventObject and implements Serializable (DG);
|
||||
* ------------- JFREECHART 1.0.x ---------------------------------------------
|
||||
* 24-May-2007 : Updated API docs (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.chart;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.Serializable;
|
||||
import java.util.EventObject;
|
||||
|
||||
import org.jfree.chart.entity.ChartEntity;
|
||||
|
||||
/**
|
||||
* A mouse event for a chart that is displayed in a {@link ChartPanel}.
|
||||
*
|
||||
* @see ChartMouseListener
|
||||
*/
|
||||
public class ChartMouseEvent extends EventObject implements Serializable {
|
||||
|
||||
/** For serialization. */
|
||||
private static final long serialVersionUID = -682393837314562149L;
|
||||
|
||||
/** The chart that the mouse event relates to. */
|
||||
private JFreeChart chart;
|
||||
|
||||
/** The Java mouse event that triggered this event. */
|
||||
private MouseEvent trigger;
|
||||
|
||||
/** The chart entity (if any). */
|
||||
private ChartEntity entity;
|
||||
|
||||
/**
|
||||
* Constructs a new event.
|
||||
*
|
||||
* @param chart the source chart (<code>null</code> not permitted).
|
||||
* @param trigger the mouse event that triggered this event
|
||||
* (<code>null</code> not permitted).
|
||||
* @param entity the chart entity (if any) under the mouse point
|
||||
* (<code>null</code> permitted).
|
||||
*/
|
||||
public ChartMouseEvent(JFreeChart chart, MouseEvent trigger,
|
||||
ChartEntity entity) {
|
||||
super(chart);
|
||||
this.chart = chart;
|
||||
this.trigger = trigger;
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chart that the mouse event relates to.
|
||||
*
|
||||
* @return The chart (never <code>null</code>).
|
||||
*/
|
||||
public JFreeChart getChart() {
|
||||
return this.chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mouse event that triggered this event.
|
||||
*
|
||||
* @return The event (never <code>null</code>).
|
||||
*/
|
||||
public MouseEvent getTrigger() {
|
||||
return this.trigger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chart entity (if any) under the mouse point.
|
||||
*
|
||||
* @return The chart entity (possibly <code>null</code>).
|
||||
*/
|
||||
public ChartEntity getEntity() {
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* -----------------------
|
||||
* ChartMouseListener.java
|
||||
* -----------------------
|
||||
* (C) Copyright 2002-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): Alex Weber;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 27-May-2002 : Version 1, incorporating code and ideas by Alex Weber (DG);
|
||||
* 13-Jun-2002 : Added Javadocs (DG);
|
||||
* 26-Sep-2002 : Fixed errors reported by Checkstyle (DG);
|
||||
* 23-Nov-2005 : Now extends EventListener (DG);
|
||||
* ------------- JFREECHART 1.0.x ---------------------------------------------
|
||||
* 24-May-2007 : Updated API docs (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.chart;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* The interface that must be implemented by classes that wish to receive
|
||||
* {@link ChartMouseEvent} notifications from a {@link ChartPanel}.
|
||||
*
|
||||
* @see ChartPanel#addChartMouseListener(ChartMouseListener)
|
||||
*/
|
||||
public interface ChartMouseListener extends EventListener {
|
||||
|
||||
/**
|
||||
* Callback method for receiving notification of a mouse click on a chart.
|
||||
*
|
||||
* @param event information about the event.
|
||||
*/
|
||||
void chartMouseClicked(ChartMouseEvent event);
|
||||
|
||||
/**
|
||||
* Callback method for receiving notification of a mouse movement on a
|
||||
* chart.
|
||||
*
|
||||
* @param event information about the event.
|
||||
*/
|
||||
void chartMouseMoved(ChartMouseEvent event);
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,255 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* -----------------------
|
||||
* ChartRenderingInfo.java
|
||||
* -----------------------
|
||||
* (C) Copyright 2002-2008, by Object Refinery Limited.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): -;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 22-Jan-2002 : Version 1 (DG);
|
||||
* 05-Feb-2002 : Added a new constructor, completed Javadoc comments (DG);
|
||||
* 05-Mar-2002 : Added a clear() method (DG);
|
||||
* 23-May-2002 : Renamed DrawInfo --> ChartRenderingInfo (DG);
|
||||
* 26-Sep-2002 : Fixed errors reported by Checkstyle (DG);
|
||||
* 17-Sep-2003 : Added PlotRenderingInfo (DG);
|
||||
* 01-Nov-2005 : Updated equals() method (DG);
|
||||
* 30-Nov-2005 : Removed get/setPlotArea() (DG);
|
||||
* ------------- JFREECHART 1.0.x ---------------------------------------------
|
||||
* 01-Dec-2006 : Fixed equals() and clone() (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.chart;
|
||||
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.jfree.chart.entity.EntityCollection;
|
||||
import org.jfree.chart.entity.StandardEntityCollection;
|
||||
import org.jfree.chart.plot.PlotRenderingInfo;
|
||||
import org.jfree.io.SerialUtilities;
|
||||
import org.jfree.util.ObjectUtilities;
|
||||
import org.jfree.util.PublicCloneable;
|
||||
|
||||
/**
|
||||
* A structure for storing rendering information from one call to the
|
||||
* JFreeChart.draw() method.
|
||||
* <P>
|
||||
* An instance of the {@link JFreeChart} class can draw itself within an
|
||||
* arbitrary rectangle on any <code>Graphics2D</code>. It is assumed that
|
||||
* client code will sometimes render the same chart in more than one view, so
|
||||
* the {@link JFreeChart} instance does not retain any information about its
|
||||
* rendered dimensions. This information can be useful sometimes, so you have
|
||||
* the option to collect the information at each call to
|
||||
* <code>JFreeChart.draw()</code>, by passing an instance of this
|
||||
* <code>ChartRenderingInfo</code> class.
|
||||
*/
|
||||
public class ChartRenderingInfo implements Cloneable, Serializable {
|
||||
|
||||
/** For serialization. */
|
||||
private static final long serialVersionUID = 2751952018173406822L;
|
||||
|
||||
/** The area in which the chart is drawn. */
|
||||
private transient Rectangle2D chartArea;
|
||||
|
||||
/** Rendering info for the chart's plot (and subplots, if any). */
|
||||
private PlotRenderingInfo plotInfo;
|
||||
|
||||
/**
|
||||
* Storage for the chart entities. Since retaining entity information for
|
||||
* charts with a large number of data points consumes a lot of memory, it
|
||||
* is intended that you can set this to <code>null</code> to prevent the
|
||||
* information being collected.
|
||||
*/
|
||||
private EntityCollection entities;
|
||||
|
||||
/**
|
||||
* Constructs a new ChartRenderingInfo structure that can be used to
|
||||
* collect information about the dimensions of a rendered chart.
|
||||
*/
|
||||
public ChartRenderingInfo() {
|
||||
this(new StandardEntityCollection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance. If an entity collection is supplied, it will
|
||||
* be populated with information about the entities in a chart. If it is
|
||||
* <code>null</code>, no entity information (including tool tips) will
|
||||
* be collected.
|
||||
*
|
||||
* @param entities an entity collection (<code>null</code> permitted).
|
||||
*/
|
||||
public ChartRenderingInfo(EntityCollection entities) {
|
||||
this.chartArea = new Rectangle2D.Double();
|
||||
this.plotInfo = new PlotRenderingInfo(this);
|
||||
this.entities = entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the area in which the chart was drawn.
|
||||
*
|
||||
* @return The area in which the chart was drawn.
|
||||
*
|
||||
* @see #setChartArea(Rectangle2D)
|
||||
*/
|
||||
public Rectangle2D getChartArea() {
|
||||
return this.chartArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the area in which the chart was drawn.
|
||||
*
|
||||
* @param area the chart area.
|
||||
*
|
||||
* @see #getChartArea()
|
||||
*/
|
||||
public void setChartArea(Rectangle2D area) {
|
||||
this.chartArea.setRect(area);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the collection of entities maintained by this instance.
|
||||
*
|
||||
* @return The entity collection (possibly <code>null</code>).
|
||||
*
|
||||
* @see #setEntityCollection(EntityCollection)
|
||||
*/
|
||||
public EntityCollection getEntityCollection() {
|
||||
return this.entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entity collection.
|
||||
*
|
||||
* @param entities the entity collection (<code>null</code> permitted).
|
||||
*
|
||||
* @see #getEntityCollection()
|
||||
*/
|
||||
public void setEntityCollection(EntityCollection entities) {
|
||||
this.entities = entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the information recorded by this object.
|
||||
*/
|
||||
public void clear() {
|
||||
this.chartArea.setRect(0.0, 0.0, 0.0, 0.0);
|
||||
this.plotInfo = new PlotRenderingInfo(this);
|
||||
if (this.entities != null) {
|
||||
this.entities.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rendering info for the chart's plot.
|
||||
*
|
||||
* @return The rendering info for the plot.
|
||||
*/
|
||||
public PlotRenderingInfo getPlotInfo() {
|
||||
return this.plotInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests this object for equality with an arbitrary object.
|
||||
*
|
||||
* @param obj the object to test against (<code>null</code> permitted).
|
||||
*
|
||||
* @return A boolean.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof ChartRenderingInfo)) {
|
||||
return false;
|
||||
}
|
||||
ChartRenderingInfo that = (ChartRenderingInfo) obj;
|
||||
if (!ObjectUtilities.equal(this.chartArea, that.chartArea)) {
|
||||
return false;
|
||||
}
|
||||
if (!ObjectUtilities.equal(this.plotInfo, that.plotInfo)) {
|
||||
return false;
|
||||
}
|
||||
if (!ObjectUtilities.equal(this.entities, that.entities)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a clone of this object.
|
||||
*
|
||||
* @return A clone.
|
||||
*
|
||||
* @throws CloneNotSupportedException if the object cannot be cloned.
|
||||
*/
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
ChartRenderingInfo clone = (ChartRenderingInfo) super.clone();
|
||||
if (this.chartArea != null) {
|
||||
clone.chartArea = (Rectangle2D) this.chartArea.clone();
|
||||
}
|
||||
if (this.entities instanceof PublicCloneable) {
|
||||
PublicCloneable pc = (PublicCloneable) this.entities;
|
||||
clone.entities = (EntityCollection) pc.clone();
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides serialization support.
|
||||
*
|
||||
* @param stream the output stream.
|
||||
*
|
||||
* @throws IOException if there is an I/O error.
|
||||
*/
|
||||
private void writeObject(ObjectOutputStream stream) throws IOException {
|
||||
stream.defaultWriteObject();
|
||||
SerialUtilities.writeShape(this.chartArea, stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides serialization support.
|
||||
*
|
||||
* @param stream the input stream.
|
||||
*
|
||||
* @throws IOException if there is an I/O error.
|
||||
* @throws ClassNotFoundException if there is a classpath problem.
|
||||
*/
|
||||
private void readObject(ObjectInputStream stream)
|
||||
throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
this.chartArea = (Rectangle2D) SerialUtilities.readShape(stream);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* ---------------
|
||||
* ChartTheme.java
|
||||
* ---------------
|
||||
* (C) Copyright 2008, by Object Refinery Limited.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): -;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 14-Aug-2008 : Version 1 (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.chart;
|
||||
|
||||
import org.jfree.chart.JFreeChart;
|
||||
|
||||
/**
|
||||
* A {@link ChartTheme} a class that can apply a style or 'theme' to a chart.
|
||||
* It can be implemented in an arbitrary manner, with the styling applied to
|
||||
* the chart via the <code>apply(JFreeChart)</code> method. We provide one
|
||||
* implementation ({@link StandardChartTheme}) that just mimics the manual
|
||||
* process of calling methods to set various chart parameters.
|
||||
*
|
||||
* @since 1.0.11
|
||||
*/
|
||||
public interface ChartTheme {
|
||||
|
||||
/**
|
||||
* Applies this theme to the supplied chart.
|
||||
*
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
*/
|
||||
public void apply(JFreeChart chart);
|
||||
|
||||
}
|
||||
@@ -1,762 +0,0 @@
|
||||
/* ===========================================================
|
||||
* JFreeChart : a free chart library for the Java(tm) platform
|
||||
* ===========================================================
|
||||
*
|
||||
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Project Info: http://www.jfree.org/jfreechart/index.html
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* -------------------
|
||||
* ChartUtilities.java
|
||||
* -------------------
|
||||
* (C) Copyright 2001-2008, by Object Refinery Limited and Contributors.
|
||||
*
|
||||
* Original Author: David Gilbert (for Object Refinery Limited);
|
||||
* Contributor(s): Wolfgang Irler;
|
||||
* Richard Atkinson;
|
||||
* Xavier Poinsard;
|
||||
*
|
||||
* Changes
|
||||
* -------
|
||||
* 11-Dec-2001 : Version 1. The JPEG method comes from Wolfgang Irler's
|
||||
* JFreeChartServletDemo class (DG);
|
||||
* 23-Jan-2002 : Changed saveChartAsXXX() methods to pass IOExceptions back to
|
||||
* caller (DG);
|
||||
* 26-Jun-2002 : Added image map methods (DG);
|
||||
* 05-Aug-2002 : Added writeBufferedImage methods
|
||||
* Modified writeImageMap method to support flexible image
|
||||
* maps (RA);
|
||||
* 26-Aug-2002 : Added saveChartAsJPEG and writeChartAsJPEG methods with info
|
||||
* objects (RA);
|
||||
* 05-Sep-2002 : Added writeImageMap() method to support OverLIB
|
||||
* - http://www.bosrup.com/web/overlib (RA);
|
||||
* 26-Sep-2002 : Fixed errors reported by Checkstyle (DG);
|
||||
* 17-Oct-2002 : Exposed JPEG quality setting and PNG compression level as
|
||||
* parameters (DG);
|
||||
* 25-Oct-2002 : Fixed writeChartAsJPEG() empty method bug (DG);
|
||||
* 13-Mar-2003 : Updated writeImageMap method as suggested by Xavier Poinsard
|
||||
* (see Feature Request 688079) (DG);
|
||||
* 12-Aug-2003 : Added support for custom image maps using
|
||||
* ToolTipTagFragmentGenerator and URLTagFragmentGenerator (RA);
|
||||
* 02-Sep-2003 : Separated PNG encoding from writing chart to an
|
||||
* OutputStream (RA);
|
||||
* 04-Dec-2003 : Chart draw() method modified to include anchor point (DG);
|
||||
* 20-Feb-2004 : Edited Javadocs and added argument checking (DG);
|
||||
* 05-Apr-2004 : Fixed problem with buffered image type (DG);
|
||||
* 01-Aug-2004 : Modified to use EncoderUtil for all image encoding (RA);
|
||||
* 02-Aug-2004 : Delegated image map related functionality to ImageMapUtil (RA);
|
||||
* 13-Jan-2005 : Renamed ImageMapUtil --> ImageMapUtilities, removed method
|
||||
* writeImageMap(PrintWriter, String, ChartRenderingInfo) which
|
||||
* exists in ImageMapUtilities (DG);
|
||||
* ------------- JFREECHART 1.0.x ---------------------------------------------
|
||||
* 06-Feb-2006 : API doc update (DG);
|
||||
* 19-Mar-2007 : Use try-finally to close output stream in saveChartAsXXX()
|
||||
* methods (DG);
|
||||
* 10-Jan-2008 : Fix bug 1868251 - don't create image with transparency when
|
||||
* saving to JPEG format (DG);
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jfree.chart;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import org.jfree.chart.encoders.EncoderUtil;
|
||||
import org.jfree.chart.encoders.ImageFormat;
|
||||
import org.jfree.chart.imagemap.ImageMapUtilities;
|
||||
import org.jfree.chart.imagemap.OverLIBToolTipTagFragmentGenerator;
|
||||
import org.jfree.chart.imagemap.StandardToolTipTagFragmentGenerator;
|
||||
import org.jfree.chart.imagemap.StandardURLTagFragmentGenerator;
|
||||
import org.jfree.chart.imagemap.ToolTipTagFragmentGenerator;
|
||||
import org.jfree.chart.imagemap.URLTagFragmentGenerator;
|
||||
|
||||
/**
|
||||
* A collection of utility methods for JFreeChart. Includes methods for
|
||||
* converting charts to image formats (PNG and JPEG) plus creating simple HTML
|
||||
* image maps.
|
||||
*
|
||||
* @see ImageMapUtilities
|
||||
*/
|
||||
public abstract class ChartUtilities {
|
||||
|
||||
/**
|
||||
* Applies the current theme to the specified chart. This method is
|
||||
* provided for convenience, the theme itself is stored in the
|
||||
* {@link ChartFactory} class.
|
||||
*
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
*
|
||||
* @since 1.0.11
|
||||
*/
|
||||
public static void applyCurrentTheme(JFreeChart chart) {
|
||||
ChartFactory.getChartTheme().apply(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a chart to an output stream in PNG format.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeChartAsPNG(OutputStream out, JFreeChart chart,
|
||||
int width, int height) throws IOException {
|
||||
|
||||
// defer argument checking...
|
||||
writeChartAsPNG(out, chart, width, height, null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a chart to an output stream in PNG format.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param encodeAlpha encode alpha?
|
||||
* @param compression the compression level (0-9).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeChartAsPNG(OutputStream out, JFreeChart chart,
|
||||
int width, int height, boolean encodeAlpha, int compression)
|
||||
throws IOException {
|
||||
|
||||
// defer argument checking...
|
||||
ChartUtilities.writeChartAsPNG(out, chart, width, height, null,
|
||||
encodeAlpha, compression);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a chart to an output stream in PNG format. This method allows
|
||||
* you to pass in a {@link ChartRenderingInfo} object, to collect
|
||||
* information about the chart dimensions/entities. You will need this
|
||||
* info if you want to create an HTML image map.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param info the chart rendering info (<code>null</code> permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeChartAsPNG(OutputStream out, JFreeChart chart,
|
||||
int width, int height, ChartRenderingInfo info)
|
||||
throws IOException {
|
||||
|
||||
if (chart == null) {
|
||||
throw new IllegalArgumentException("Null 'chart' argument.");
|
||||
}
|
||||
BufferedImage bufferedImage
|
||||
= chart.createBufferedImage(width, height, info);
|
||||
EncoderUtil.writeBufferedImage(bufferedImage, ImageFormat.PNG, out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a chart to an output stream in PNG format. This method allows
|
||||
* you to pass in a {@link ChartRenderingInfo} object, to collect
|
||||
* information about the chart dimensions/entities. You will need this
|
||||
* info if you want to create an HTML image map.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param info carries back chart rendering info (<code>null</code>
|
||||
* permitted).
|
||||
* @param encodeAlpha encode alpha?
|
||||
* @param compression the PNG compression level (0-9).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeChartAsPNG(OutputStream out, JFreeChart chart,
|
||||
int width, int height, ChartRenderingInfo info,
|
||||
boolean encodeAlpha, int compression) throws IOException {
|
||||
|
||||
if (out == null) {
|
||||
throw new IllegalArgumentException("Null 'out' argument.");
|
||||
}
|
||||
if (chart == null) {
|
||||
throw new IllegalArgumentException("Null 'chart' argument.");
|
||||
}
|
||||
BufferedImage chartImage = chart.createBufferedImage(width, height,
|
||||
BufferedImage.TYPE_INT_ARGB, info);
|
||||
ChartUtilities.writeBufferedImageAsPNG(out, chartImage, encodeAlpha,
|
||||
compression);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a scaled version of a chart to an output stream in PNG format.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the unscaled chart width.
|
||||
* @param height the unscaled chart height.
|
||||
* @param widthScaleFactor the horizontal scale factor.
|
||||
* @param heightScaleFactor the vertical scale factor.
|
||||
*
|
||||
* @throws IOException if there are any I/O problems.
|
||||
*/
|
||||
public static void writeScaledChartAsPNG(OutputStream out,
|
||||
JFreeChart chart, int width, int height, int widthScaleFactor,
|
||||
int heightScaleFactor) throws IOException {
|
||||
|
||||
if (out == null) {
|
||||
throw new IllegalArgumentException("Null 'out' argument.");
|
||||
}
|
||||
if (chart == null) {
|
||||
throw new IllegalArgumentException("Null 'chart' argument.");
|
||||
}
|
||||
|
||||
double desiredWidth = width * widthScaleFactor;
|
||||
double desiredHeight = height * heightScaleFactor;
|
||||
double defaultWidth = width;
|
||||
double defaultHeight = height;
|
||||
boolean scale = false;
|
||||
|
||||
// get desired width and height from somewhere then...
|
||||
if ((widthScaleFactor != 1) || (heightScaleFactor != 1)) {
|
||||
scale = true;
|
||||
}
|
||||
|
||||
double scaleX = desiredWidth / defaultWidth;
|
||||
double scaleY = desiredHeight / defaultHeight;
|
||||
|
||||
BufferedImage image = new BufferedImage((int) desiredWidth,
|
||||
(int) desiredHeight, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g2 = image.createGraphics();
|
||||
|
||||
if (scale) {
|
||||
AffineTransform saved = g2.getTransform();
|
||||
g2.transform(AffineTransform.getScaleInstance(scaleX, scaleY));
|
||||
chart.draw(g2, new Rectangle2D.Double(0, 0, defaultWidth,
|
||||
defaultHeight), null, null);
|
||||
g2.setTransform(saved);
|
||||
g2.dispose();
|
||||
}
|
||||
else {
|
||||
chart.draw(g2, new Rectangle2D.Double(0, 0, defaultWidth,
|
||||
defaultHeight), null, null);
|
||||
}
|
||||
out.write(encodeAsPNG(image));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a chart to the specified file in PNG format.
|
||||
*
|
||||
* @param file the file name (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void saveChartAsPNG(File file, JFreeChart chart,
|
||||
int width, int height) throws IOException {
|
||||
|
||||
// defer argument checking...
|
||||
saveChartAsPNG(file, chart, width, height, null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a chart to a file in PNG format. This method allows you to pass
|
||||
* in a {@link ChartRenderingInfo} object, to collect information about the
|
||||
* chart dimensions/entities. You will need this info if you want to
|
||||
* create an HTML image map.
|
||||
*
|
||||
* @param file the file (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param info the chart rendering info (<code>null</code> permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void saveChartAsPNG(File file, JFreeChart chart,
|
||||
int width, int height, ChartRenderingInfo info)
|
||||
throws IOException {
|
||||
|
||||
if (file == null) {
|
||||
throw new IllegalArgumentException("Null 'file' argument.");
|
||||
}
|
||||
OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
|
||||
try {
|
||||
ChartUtilities.writeChartAsPNG(out, chart, width, height, info);
|
||||
}
|
||||
finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a chart to a file in PNG format. This method allows you to pass
|
||||
* in a {@link ChartRenderingInfo} object, to collect information about the
|
||||
* chart dimensions/entities. You will need this info if you want to
|
||||
* create an HTML image map.
|
||||
*
|
||||
* @param file the file (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param info the chart rendering info (<code>null</code> permitted).
|
||||
* @param encodeAlpha encode alpha?
|
||||
* @param compression the PNG compression level (0-9).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void saveChartAsPNG(File file, JFreeChart chart,
|
||||
int width, int height, ChartRenderingInfo info, boolean encodeAlpha,
|
||||
int compression) throws IOException {
|
||||
|
||||
if (file == null) {
|
||||
throw new IllegalArgumentException("Null 'file' argument.");
|
||||
}
|
||||
if (chart == null) {
|
||||
throw new IllegalArgumentException("Null 'chart' argument.");
|
||||
}
|
||||
|
||||
OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
|
||||
try {
|
||||
writeChartAsPNG(out, chart, width, height, info, encodeAlpha,
|
||||
compression);
|
||||
}
|
||||
finally {
|
||||
out.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a chart to an output stream in JPEG format. Please note that
|
||||
* JPEG is a poor format for chart images, use PNG if possible.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeChartAsJPEG(OutputStream out,
|
||||
JFreeChart chart, int width, int height) throws IOException {
|
||||
|
||||
// defer argument checking...
|
||||
writeChartAsJPEG(out, chart, width, height, null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a chart to an output stream in JPEG format. Please note that
|
||||
* JPEG is a poor format for chart images, use PNG if possible.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param quality the quality setting.
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeChartAsJPEG(OutputStream out, float quality,
|
||||
JFreeChart chart, int width, int height) throws IOException {
|
||||
|
||||
// defer argument checking...
|
||||
ChartUtilities.writeChartAsJPEG(out, quality, chart, width, height,
|
||||
null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a chart to an output stream in JPEG format. This method allows
|
||||
* you to pass in a {@link ChartRenderingInfo} object, to collect
|
||||
* information about the chart dimensions/entities. You will need this
|
||||
* info if you want to create an HTML image map.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param info the chart rendering info (<code>null</code> permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeChartAsJPEG(OutputStream out, JFreeChart chart,
|
||||
int width, int height, ChartRenderingInfo info)
|
||||
throws IOException {
|
||||
|
||||
if (chart == null) {
|
||||
throw new IllegalArgumentException("Null 'chart' argument.");
|
||||
}
|
||||
BufferedImage image = chart.createBufferedImage(width, height,
|
||||
BufferedImage.TYPE_INT_RGB, info);
|
||||
EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a chart to an output stream in JPEG format. This method allows
|
||||
* you to pass in a {@link ChartRenderingInfo} object, to collect
|
||||
* information about the chart dimensions/entities. You will need this
|
||||
* info if you want to create an HTML image map.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param quality the output quality (0.0f to 1.0f).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param info the chart rendering info (<code>null</code> permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeChartAsJPEG(OutputStream out, float quality,
|
||||
JFreeChart chart, int width, int height, ChartRenderingInfo info)
|
||||
throws IOException {
|
||||
|
||||
if (chart == null) {
|
||||
throw new IllegalArgumentException("Null 'chart' argument.");
|
||||
}
|
||||
BufferedImage image = chart.createBufferedImage(width, height,
|
||||
BufferedImage.TYPE_INT_RGB, info);
|
||||
EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out, quality);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a chart to a file in JPEG format.
|
||||
*
|
||||
* @param file the file (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void saveChartAsJPEG(File file, JFreeChart chart,
|
||||
int width, int height) throws IOException {
|
||||
|
||||
// defer argument checking...
|
||||
saveChartAsJPEG(file, chart, width, height, null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a chart to a file in JPEG format.
|
||||
*
|
||||
* @param file the file (<code>null</code> not permitted).
|
||||
* @param quality the JPEG quality setting.
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void saveChartAsJPEG(File file, float quality,
|
||||
JFreeChart chart, int width, int height) throws IOException {
|
||||
|
||||
// defer argument checking...
|
||||
saveChartAsJPEG(file, quality, chart, width, height, null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a chart to a file in JPEG format. This method allows you to pass
|
||||
* in a {@link ChartRenderingInfo} object, to collect information about the
|
||||
* chart dimensions/entities. You will need this info if you want to
|
||||
* create an HTML image map.
|
||||
*
|
||||
* @param file the file name (<code>null</code> not permitted).
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param info the chart rendering info (<code>null</code> permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void saveChartAsJPEG(File file, JFreeChart chart,
|
||||
int width, int height, ChartRenderingInfo info) throws IOException {
|
||||
|
||||
if (file == null) {
|
||||
throw new IllegalArgumentException("Null 'file' argument.");
|
||||
}
|
||||
if (chart == null) {
|
||||
throw new IllegalArgumentException("Null 'chart' argument.");
|
||||
}
|
||||
OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
|
||||
try {
|
||||
writeChartAsJPEG(out, chart, width, height, info);
|
||||
}
|
||||
finally {
|
||||
out.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a chart to a file in JPEG format. This method allows you to pass
|
||||
* in a {@link ChartRenderingInfo} object, to collect information about the
|
||||
* chart dimensions/entities. You will need this info if you want to
|
||||
* create an HTML image map.
|
||||
*
|
||||
* @param file the file name (<code>null</code> not permitted).
|
||||
* @param quality the quality setting.
|
||||
* @param chart the chart (<code>null</code> not permitted).
|
||||
* @param width the image width.
|
||||
* @param height the image height.
|
||||
* @param info the chart rendering info (<code>null</code> permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void saveChartAsJPEG(File file, float quality,
|
||||
JFreeChart chart, int width, int height,
|
||||
ChartRenderingInfo info) throws IOException {
|
||||
|
||||
if (file == null) {
|
||||
throw new IllegalArgumentException("Null 'file' argument.");
|
||||
}
|
||||
if (chart == null) {
|
||||
throw new IllegalArgumentException("Null 'chart' argument.");
|
||||
}
|
||||
|
||||
OutputStream out = new BufferedOutputStream(new FileOutputStream(
|
||||
file));
|
||||
try {
|
||||
writeChartAsJPEG(out, quality, chart, width, height, info);
|
||||
}
|
||||
finally {
|
||||
out.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a {@link BufferedImage} to an output stream in JPEG format.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param image the image (<code>null</code> not permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeBufferedImageAsJPEG(OutputStream out,
|
||||
BufferedImage image) throws IOException {
|
||||
|
||||
// defer argument checking...
|
||||
writeBufferedImageAsJPEG(out, 0.75f, image);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a {@link BufferedImage} to an output stream in JPEG format.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param quality the image quality (0.0f to 1.0f).
|
||||
* @param image the image (<code>null</code> not permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeBufferedImageAsJPEG(OutputStream out, float quality,
|
||||
BufferedImage image) throws IOException {
|
||||
|
||||
EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out, quality);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a {@link BufferedImage} to an output stream in PNG format.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param image the image (<code>null</code> not permitted).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeBufferedImageAsPNG(OutputStream out,
|
||||
BufferedImage image) throws IOException {
|
||||
|
||||
EncoderUtil.writeBufferedImage(image, ImageFormat.PNG, out);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a {@link BufferedImage} to an output stream in PNG format.
|
||||
*
|
||||
* @param out the output stream (<code>null</code> not permitted).
|
||||
* @param image the image (<code>null</code> not permitted).
|
||||
* @param encodeAlpha encode alpha?
|
||||
* @param compression the compression level (0-9).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeBufferedImageAsPNG(OutputStream out,
|
||||
BufferedImage image, boolean encodeAlpha, int compression)
|
||||
throws IOException {
|
||||
|
||||
EncoderUtil.writeBufferedImage(image, ImageFormat.PNG, out,
|
||||
compression, encodeAlpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a {@link BufferedImage} to PNG format.
|
||||
*
|
||||
* @param image the image (<code>null</code> not permitted).
|
||||
*
|
||||
* @return A byte array in PNG format.
|
||||
*
|
||||
* @throws IOException if there is an I/O problem.
|
||||
*/
|
||||
public static byte[] encodeAsPNG(BufferedImage image) throws IOException {
|
||||
return EncoderUtil.encode(image, ImageFormat.PNG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a {@link BufferedImage} to PNG format.
|
||||
*
|
||||
* @param image the image (<code>null</code> not permitted).
|
||||
* @param encodeAlpha encode alpha?
|
||||
* @param compression the PNG compression level (0-9).
|
||||
*
|
||||
* @return The byte array in PNG format.
|
||||
*
|
||||
* @throws IOException if there is an I/O problem.
|
||||
*/
|
||||
public static byte[] encodeAsPNG(BufferedImage image, boolean encodeAlpha,
|
||||
int compression)
|
||||
throws IOException {
|
||||
return EncoderUtil.encode(image, ImageFormat.PNG, compression,
|
||||
encodeAlpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an image map to an output stream.
|
||||
*
|
||||
* @param writer the writer (<code>null</code> not permitted).
|
||||
* @param name the map name (<code>null</code> not permitted).
|
||||
* @param info the chart rendering info (<code>null</code> not permitted).
|
||||
* @param useOverLibForToolTips whether to use OverLIB for tooltips
|
||||
* (http://www.bosrup.com/web/overlib/).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeImageMap(PrintWriter writer,
|
||||
String name,
|
||||
ChartRenderingInfo info,
|
||||
boolean useOverLibForToolTips)
|
||||
throws IOException {
|
||||
|
||||
ToolTipTagFragmentGenerator toolTipTagFragmentGenerator = null;
|
||||
if (useOverLibForToolTips) {
|
||||
toolTipTagFragmentGenerator
|
||||
= new OverLIBToolTipTagFragmentGenerator();
|
||||
}
|
||||
else {
|
||||
toolTipTagFragmentGenerator
|
||||
= new StandardToolTipTagFragmentGenerator();
|
||||
}
|
||||
ImageMapUtilities.writeImageMap(writer, name, info,
|
||||
toolTipTagFragmentGenerator,
|
||||
new StandardURLTagFragmentGenerator());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an image map to the specified writer.
|
||||
*
|
||||
* @param writer the writer (<code>null</code> not permitted).
|
||||
* @param name the map name (<code>null</code> not permitted).
|
||||
* @param info the chart rendering info (<code>null</code> not permitted).
|
||||
* @param toolTipTagFragmentGenerator a generator for the HTML fragment
|
||||
* that will contain the tooltip text (<code>null</code> not permitted
|
||||
* if <code>info</code> contains tooltip information).
|
||||
* @param urlTagFragmentGenerator a generator for the HTML fragment that
|
||||
* will contain the URL reference (<code>null</code> not permitted if
|
||||
* <code>info</code> contains URLs).
|
||||
*
|
||||
* @throws IOException if there are any I/O errors.
|
||||
*/
|
||||
public static void writeImageMap(PrintWriter writer, String name,
|
||||
ChartRenderingInfo info,
|
||||
ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
|
||||
URLTagFragmentGenerator urlTagFragmentGenerator)
|
||||
throws IOException {
|
||||
|
||||
writer.println(ImageMapUtilities.getImageMap(name, info,
|
||||
toolTipTagFragmentGenerator, urlTagFragmentGenerator));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an HTML image map. This method maps to
|
||||
* {@link ImageMapUtilities#getImageMap(String, ChartRenderingInfo,
|
||||
* ToolTipTagFragmentGenerator, URLTagFragmentGenerator)}, using default
|
||||
* generators.
|
||||
*
|
||||
* @param name the map name (<code>null</code> not permitted).
|
||||
* @param info the chart rendering info (<code>null</code> not permitted).
|
||||
*
|
||||
* @return The map tag.
|
||||
*/
|
||||
public static String getImageMap(String name, ChartRenderingInfo info) {
|
||||
return ImageMapUtilities.getImageMap(name, info,
|
||||
new StandardToolTipTagFragmentGenerator(),
|
||||
new StandardURLTagFragmentGenerator());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an HTML image map. This method maps directly to
|
||||
* {@link ImageMapUtilities#getImageMap(String, ChartRenderingInfo,
|
||||
* ToolTipTagFragmentGenerator, URLTagFragmentGenerator)}.
|
||||
*
|
||||
* @param name the map name (<code>null</code> not permitted).
|
||||
* @param info the chart rendering info (<code>null</code> not permitted).
|
||||
* @param toolTipTagFragmentGenerator a generator for the HTML fragment
|
||||
* that will contain the tooltip text (<code>null</code> not permitted
|
||||
* if <code>info</code> contains tooltip information).
|
||||
* @param urlTagFragmentGenerator a generator for the HTML fragment that
|
||||
* will contain the URL reference (<code>null</code> not permitted if
|
||||
* <code>info</code> contains URLs).
|
||||
*
|
||||
* @return The map tag.
|
||||
*/
|
||||
public static String getImageMap(String name, ChartRenderingInfo info,
|
||||
ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
|
||||
URLTagFragmentGenerator urlTagFragmentGenerator) {
|
||||
|
||||
return ImageMapUtilities.getImageMap(name, info,
|
||||
toolTipTagFragmentGenerator, urlTagFragmentGenerator);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user