Browse Source

Merge remote-tracking branch 'origin/bugfix/10.0' into bugfix/10.0

bugfix/10.0
Yvan 4 years ago
parent
commit
009735a504
  1. 47
      designer-base/src/main/java/com/fr/design/DesignModelAdapter.java
  2. 1
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  3. 16
      designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java
  4. 2
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  5. 1
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  6. 12
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  7. 674
      designer-base/src/main/java/com/fr/design/gui/autocomplete/DefaultCompletionProvider.java
  8. 1
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  9. 30
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  10. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java
  11. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Theme.java
  12. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/Macro.java
  13. 8
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  14. 15
      designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java
  15. 5
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java
  16. 0
      designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg
  17. 0
      designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg
  18. 0
      designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg
  19. 64
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  20. 10
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java
  21. 4
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  22. 4
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
  23. 5
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  24. 4
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  25. 5
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  26. 23
      designer-realize/src/main/java/com/fr/design/style/BorderUtils.java

47
designer-base/src/main/java/com/fr/design/DesignModelAdapter.java

@ -21,6 +21,8 @@ import com.fr.stable.StringUtils;
import com.fr.stable.js.WidgetName; import com.fr.stable.js.WidgetName;
import com.fr.util.ParameterApplyHelper; import com.fr.util.ParameterApplyHelper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -282,6 +284,12 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
Map<String, ParameterProvider> map, Map<String, ParameterProvider> map,
Filter<ParameterProvider> filter) { Filter<ParameterProvider> filter) {
// 处理初始化添加
if (tableDataParametersMap.isEmpty()) {
addTableDataParameters(map, filter);
return;
}
ParameterProvider[] providers = null; ParameterProvider[] providers = null;
if (!ComparatorUtils.equals(oldName, tdName)) { if (!ComparatorUtils.equals(oldName, tdName)) {
@ -303,13 +311,13 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
} else { } else {
parameterProviders = entry.getValue(); parameterProviders = entry.getValue();
} }
updateParaMap(map, parameterProviders, filter);
}
if (filter != null) { // 处理非初始化(已存在数据集参数)时 添加逻辑
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter); if (!tableDataParametersMap.containsKey(tdName)) {
} else { providers = DataOperator.getInstance().getTableDataParameters(tableData);
ParameterApplyHelper.addPara2Map(map, parameterProviders); updateParaMap(map, providers, filter);
}
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -321,6 +329,33 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
} }
} }
/**
* 更新全部参数中的数据集参数
*/
private void updateParaMap(Map<String, ParameterProvider> map, ParameterProvider[] parameterProviders, Filter<ParameterProvider> filter) {
if (filter != null) {
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter);
} else {
ParameterApplyHelper.addPara2Map(map, parameterProviders);
}
}
public void removeTableDataParameters(String tdName) {
ParameterProvider[] tableDataParameters = tableDataParametersMap.remove(tdName);
List<Parameter> allParameterList = new ArrayList<>(Arrays.asList(parameters));
List<Parameter> tableDataParameterList = new ArrayList<>();
for (ParameterProvider parameterProvider : tableDataParameters) {
tableDataParameterList.add((Parameter) parameterProvider);
}
allParameterList.removeAll(tableDataParameterList);
parameters = allParameterList.toArray(new Parameter[0]);
}
public void updateAllParameters() {
parameters = getLatestParameters();
}
protected void addGlobalParameters(Map<String, ParameterProvider> map) { protected void addGlobalParameters(Map<String, ParameterProvider> map) {
// 添加全局参数 // 添加全局参数
Parameter[] glbParas = ParameterConfig.getInstance().getGlobalParameters(); Parameter[] glbParas = ParameterConfig.getInstance().getGlobalParameters();

1
designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java

@ -60,6 +60,7 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
TableDataSourceAction.this.getEditingComponent().fireTargetModified(); TableDataSourceAction.this.getEditingComponent().fireTargetModified();
fireDSChanged(tableDataPane.getDsNameChangedMap()); fireDSChanged(tableDataPane.getDsNameChangedMap());
DesignModelAdapter.getCurrentModelAdapter().updateAllParameters();
} }
}); });
reportTableDataDialog.setVisible(true); reportTableDataDialog.setVisible(true);

16
designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java

@ -13,12 +13,14 @@ import javax.swing.KeyStroke;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArraySet;
/** /**
* 插入单元格元素和插入悬浮元素的一些集合方法 * 插入单元格元素和插入悬浮元素的一些集合方法
@ -27,8 +29,8 @@ import java.util.concurrent.ConcurrentMap;
* @version 2017年11月17日14点39分 * @version 2017年11月17日14点39分
*/ */
public class ActionFactory { public class ActionFactory {
private static LinkedHashSet<Class<?>> actionClasses = new LinkedHashSet<>(); private static Set<Class<?>> actionClasses = new CopyOnWriteArraySet<>();
private static LinkedHashSet<Class<?>> floatActionClasses = new LinkedHashSet<>(); private static Set<Class<?>> floatActionClasses = new CopyOnWriteArraySet<>();
private static Class chartCollectionClass = null; private static Class chartCollectionClass = null;
/** /**
* 无需每次实例化的悬浮元素编辑器 * 无需每次实例化的悬浮元素编辑器
@ -256,14 +258,14 @@ public class ActionFactory {
*/ */
public static void registerCellInsertActionClass(Class<?>[] cls) { public static void registerCellInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
Collections.addAll(actionClasses, cls); actionClasses.addAll(Arrays.asList(cls));
} }
} }
public static void referCellInsertActionClass(Class<?>[] cls) { public static void referCellInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
actionClasses.clear(); actionClasses.clear();
Collections.addAll(actionClasses, cls); actionClasses.addAll(Arrays.asList(cls));
} }
} }
@ -321,14 +323,14 @@ public class ActionFactory {
*/ */
public static void registerFloatInsertActionClass(Class<?>[] cls) { public static void registerFloatInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
Collections.addAll(floatActionClasses, cls); floatActionClasses.addAll(Arrays.asList(cls));
} }
} }
public static void referFloatInsertActionClass(Class<?>[] cls) { public static void referFloatInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
floatActionClasses.clear(); floatActionClasses.clear();
Collections.addAll(floatActionClasses, cls); floatActionClasses.addAll(Arrays.asList(cls));
} }
} }

2
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -86,6 +86,8 @@ public final class WebPreviewUtils {
if (!jt.saveAsTemplate()) { if (!jt.saveAsTemplate()) {
return; return;
} }
} else {
return;
} }
currentTemplate = jt.getEditingFILE(); currentTemplate = jt.getEditingFILE();
} }

1
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -288,6 +288,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
fireDSChanged(); fireDSChanged();
checkButtonEnabled(); checkButtonEnabled();
DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName());
DesignModelAdapter.getCurrentModelAdapter().removeTableDataParameters(selectedNO.getName());
} }
} }
} }

12
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -99,6 +99,8 @@ public class JDBCDefPane extends JPanel {
private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor(); private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor();
private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor(); private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor();
private JDBCDatabaseConnection jdbcDatabase;
public JDBCDefPane() { public JDBCDefPane() {
this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":")); this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":"));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
@ -202,6 +204,8 @@ public class JDBCDefPane extends JPanel {
if (jdbcDatabase == null) { if (jdbcDatabase == null) {
jdbcDatabase = new JDBCDatabaseConnection(); jdbcDatabase = new JDBCDatabaseConnection();
} }
this.jdbcDatabase = jdbcDatabase;
this.dbtypeComboBox.removeActionListener(dbtypeActionListener);
if (ComparatorUtils.equals(jdbcDatabase.getDriver(), "sun.jdbc.odbc.JdbcOdbcDriver") if (ComparatorUtils.equals(jdbcDatabase.getDriver(), "sun.jdbc.odbc.JdbcOdbcDriver")
&& jdbcDatabase.getURL().startsWith("jdbc:odbc:Driver={Microsoft")) { && jdbcDatabase.getURL().startsWith("jdbc:odbc:Driver={Microsoft")) {
this.dbtypeComboBox.setSelectedItem("Access"); this.dbtypeComboBox.setSelectedItem("Access");
@ -226,6 +230,7 @@ public class JDBCDefPane extends JPanel {
this.dbtypeComboBox.setSelectedItem(OTHER_DB); this.dbtypeComboBox.setSelectedItem(OTHER_DB);
} }
} }
this.dbtypeComboBox.addActionListener(dbtypeActionListener);
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
this.urlTextField.setText(jdbcDatabase.getURL()); this.urlTextField.setText(jdbcDatabase.getURL());
this.userNameTextField.setText(jdbcDatabase.getUser()); this.userNameTextField.setText(jdbcDatabase.getUser());
@ -235,6 +240,7 @@ public class JDBCDefPane extends JPanel {
if (dbcpAttr == null) { if (dbcpAttr == null) {
dbcpAttr = new DBCPConnectionPoolAttr(); dbcpAttr = new DBCPConnectionPoolAttr();
jdbcDatabase.setDbcpAttr(dbcpAttr); jdbcDatabase.setDbcpAttr(dbcpAttr);
this.jdbcDatabase.setDbcpAttr(dbcpAttr);
} }
this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize()); this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize());
this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive()); this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive());
@ -251,7 +257,9 @@ public class JDBCDefPane extends JPanel {
} }
public JDBCDatabaseConnection update() { public JDBCDatabaseConnection update() {
JDBCDatabaseConnection jdbcDatabase = new JDBCDatabaseConnection(); if (jdbcDatabase == null) {
jdbcDatabase = new JDBCDatabaseConnection();
}
Object driveItem = this.driverComboBox.getSelectedItem(); Object driveItem = this.driverComboBox.getSelectedItem();
jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString()); jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString());
jdbcDatabase.setURL(this.urlTextField.getText().trim()); jdbcDatabase.setURL(this.urlTextField.getText().trim());
@ -297,6 +305,8 @@ public class JDBCDefPane extends JPanel {
urlTextField.setText(dus[i].getURL()); urlTextField.setText(dus[i].getURL());
} }
} }
// 更改数据库类型后 数据库名称置空和之前逻辑保持一致
jdbcDatabase.setDatabase(StringUtils.EMPTY);
} }
}; };

674
designer-base/src/main/java/com/fr/design/gui/autocomplete/DefaultCompletionProvider.java

@ -24,7 +24,11 @@ import javax.swing.text.Segment;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
import com.fr.log.FineLoggerFactory;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
/** /**
@ -38,337 +42,345 @@ import org.xml.sax.SAXException;
*/ */
public class DefaultCompletionProvider extends AbstractCompletionProvider { public class DefaultCompletionProvider extends AbstractCompletionProvider {
protected Segment seg; protected Segment seg;
/** /**
* Used to speed up {@link #getCompletionsAt(JTextComponent, Point)}. * Used to speed up {@link #getCompletionsAt(JTextComponent, Point)}.
*/ */
private String lastCompletionsAtText; private String lastCompletionsAtText;
/** /**
* Used to speed up {@link #getCompletionsAt(JTextComponent, Point)}, * Used to speed up {@link #getCompletionsAt(JTextComponent, Point)},
* since this may be called multiple times in succession (this is usually * since this may be called multiple times in succession (this is usually
* called by <tt>JTextComponent.getToolTipText()</tt>, and if the user * called by <tt>JTextComponent.getToolTipText()</tt>, and if the user
* wiggles the mouse while a tool tip is displayed, this method gets * wiggles the mouse while a tool tip is displayed, this method gets
* repeatedly called. It can be costly so we try to speed it up a tad). * repeatedly called. It can be costly so we try to speed it up a tad).
*/ */
private List<Completion> lastParameterizedCompletionsAt; private List<Completion> lastParameterizedCompletionsAt;
/** /**
* Constructor. The returned provider will not be aware of any completions. * Constructor. The returned provider will not be aware of any completions.
* *
* @see #addCompletion(Completion) * @see #addCompletion(Completion)
*/ */
public DefaultCompletionProvider() { public DefaultCompletionProvider() {
init(); init();
} }
/** /**
* Creates a completion provider that provides completion for a simple * Creates a completion provider that provides completion for a simple
* list of words. * list of words.
* *
* @param words The words to offer as completion suggestions. If this is * @param words The words to offer as completion suggestions. If this is
* <code>null</code>, no completions will be known. * <code>null</code>, no completions will be known.
* @see BasicCompletion * @see BasicCompletion
*/ */
public DefaultCompletionProvider(String[] words) { public DefaultCompletionProvider(String[] words) {
init(); init();
addWordCompletions(words); addWordCompletions(words);
} }
/** /**
* Returns the text just before the current caret position that could be * Returns the text just before the current caret position that could be
* the start of something auto-completable.<p> * the start of something auto-completable.<p>
* * <p>
* This method returns all characters before the caret that are matched * This method returns all characters before the caret that are matched
* by {@link #isValidChar(char)}. * by {@link #isValidChar(char)}.
* * <p>
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getAlreadyEnteredText(JTextComponent comp) { public String getAlreadyEnteredText(JTextComponent comp) {
Document doc = comp.getDocument(); Document doc = comp.getDocument();
int dot = comp.getCaretPosition(); int dot = comp.getCaretPosition();
Element root = doc.getDefaultRootElement(); Element root = doc.getDefaultRootElement();
int index = root.getElementIndex(dot); int index = root.getElementIndex(dot);
Element elem = root.getElement(index); Element elem = root.getElement(index);
int start = elem.getStartOffset(); int start = elem.getStartOffset();
int len = dot-start; int len = dot - start;
try { try {
doc.getText(start, len, seg); doc.getText(start, len, seg);
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
return EMPTY_STRING; return EMPTY_STRING;
} }
int segEnd = seg.offset + len; int segEnd = seg.offset + len;
start = segEnd - 1; start = segEnd - 1;
while (start>=seg.offset && isValidChar(seg.array[start])) { while (start >= seg.offset && isValidChar(seg.array[start])) {
start--; start--;
} }
start++; start++;
len = segEnd - start; len = segEnd - start;
return len==0 ? EMPTY_STRING : new String(seg.array, start, len); return len == 0 ? EMPTY_STRING : new String(seg.array, start, len);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public List<Completion> getCompletionsAt(JTextComponent tc, Point p) { public List<Completion> getCompletionsAt(JTextComponent tc, Point p) {
int offset = tc.viewToModel(p); int offset = tc.viewToModel(p);
if (offset<0 || offset>=tc.getDocument().getLength()) { if (offset < 0 || offset >= tc.getDocument().getLength()) {
lastCompletionsAtText = null; lastCompletionsAtText = null;
return lastParameterizedCompletionsAt = null; return lastParameterizedCompletionsAt = null;
} }
Segment s = new Segment(); Segment s = new Segment();
Document doc = tc.getDocument(); Document doc = tc.getDocument();
Element root = doc.getDefaultRootElement(); Element root = doc.getDefaultRootElement();
int line = root.getElementIndex(offset); int line = root.getElementIndex(offset);
Element elem = root.getElement(line); Element elem = root.getElement(line);
int start = elem.getStartOffset(); int start = elem.getStartOffset();
int end = elem.getEndOffset() - 1; int end = elem.getEndOffset() - 1;
try { try {
doc.getText(start, end-start, s); doc.getText(start, end - start, s);
// Get the valid chars before the specified offset. // Get the valid chars before the specified offset.
int startOffs = s.offset + (offset-start) - 1; int startOffs = s.offset + (offset - start) - 1;
while (startOffs>=s.offset && isValidChar(s.array[startOffs])) { while (startOffs >= s.offset && isValidChar(s.array[startOffs])) {
startOffs--; startOffs--;
} }
// Get the valid chars at and after the specified offset. // Get the valid chars at and after the specified offset.
int endOffs = s.offset + (offset-start); int endOffs = s.offset + (offset - start);
while (endOffs<s.offset+s.count && isValidChar(s.array[endOffs])) { while (endOffs < s.offset + s.count && isValidChar(s.array[endOffs])) {
endOffs++; endOffs++;
} }
int len = endOffs - startOffs - 1; int len = endOffs - startOffs - 1;
if (len<=0) { if (len <= 0) {
return lastParameterizedCompletionsAt = null; return lastParameterizedCompletionsAt = null;
} }
String text = new String(s.array, startOffs+1, len); String text = new String(s.array, startOffs + 1, len);
if (text.equals(lastCompletionsAtText)) { if (text.equals(lastCompletionsAtText)) {
return lastParameterizedCompletionsAt; return lastParameterizedCompletionsAt;
} }
// Get a list of all Completions matching the text. // Get a list of all Completions matching the text.
List<Completion> list = getCompletionByInputText(text); List<Completion> list = getCompletionByInputText(text);
lastCompletionsAtText = text; lastCompletionsAtText = text;
return lastParameterizedCompletionsAt = list; return lastParameterizedCompletionsAt = list;
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
// Never happens // Never happens
} }
lastCompletionsAtText = null; lastCompletionsAtText = null;
return lastParameterizedCompletionsAt = null; return lastParameterizedCompletionsAt = null;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public List<ParameterizedCompletion> getParameterizedCompletions( public List<ParameterizedCompletion> getParameterizedCompletions(
JTextComponent tc) { JTextComponent tc) {
List<ParameterizedCompletion> list = null; List<ParameterizedCompletion> list = null;
// If this provider doesn't support parameterized completions, // If this provider doesn't support parameterized completions,
// bail out now. // bail out now.
char paramListStart = getParameterListStart(); char paramListStart = getParameterListStart();
if (paramListStart==0) { if (paramListStart == 0) {
return list; // null return list; // null
} }
int dot = tc.getCaretPosition(); int dot = tc.getCaretPosition();
Segment s = new Segment(); Segment s = new Segment();
Document doc = tc.getDocument(); Document doc = tc.getDocument();
Element root = doc.getDefaultRootElement(); Element root = doc.getDefaultRootElement();
int line = root.getElementIndex(dot); int line = root.getElementIndex(dot);
Element elem = root.getElement(line); Element elem = root.getElement(line);
int offs = elem.getStartOffset(); int offs = elem.getStartOffset();
int len = dot - offs - 1/*paramListStart.length()*/; int len = dot - offs - 1/*paramListStart.length()*/;
if (len<=0) { // Not enough chars on line for a method. if (len <= 0) { // Not enough chars on line for a method.
return list; // null return list; // null
} }
try { try {
doc.getText(offs, len, s); doc.getText(offs, len, s);
// Get the identifier preceding the '(', ignoring any whitespace // Get the identifier preceding the '(', ignoring any whitespace
// between them. // between them.
offs = s.offset + len - 1; offs = s.offset + len - 1;
while (offs>=s.offset && Character.isWhitespace(s.array[offs])) { while (offs >= s.offset && Character.isWhitespace(s.array[offs])) {
offs--; offs--;
} }
int end = offs; int end = offs;
while (offs>=s.offset && isValidChar(s.array[offs])) { while (offs >= s.offset && isValidChar(s.array[offs])) {
offs--; offs--;
} }
String text = new String(s.array, offs+1, end-offs); String text = new String(s.array, offs + 1, end - offs);
// Get a list of all Completions matching the text, but then // Get a list of all Completions matching the text, but then
// narrow it down to just the ParameterizedCompletions. // narrow it down to just the ParameterizedCompletions.
List<Completion> l = getCompletionByInputText(text); List<Completion> l = getCompletionByInputText(text);
if (l!=null && !l.isEmpty()) { if (l != null && !l.isEmpty()) {
for (int i=0; i<l.size(); i++) { for (int i = 0; i < l.size(); i++) {
Object o = l.get(i); Object o = l.get(i);
if (o instanceof ParameterizedCompletion) { if (o instanceof ParameterizedCompletion) {
if (list==null) { if (list == null) {
list = new ArrayList<ParameterizedCompletion>(1); list = new ArrayList<ParameterizedCompletion>(1);
} }
list.add((ParameterizedCompletion)o); list.add((ParameterizedCompletion) o);
} }
} }
} }
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
// Never happens // Never happens
} }
return list; return list;
} }
/** /**
* Initializes this completion provider. * Initializes this completion provider.
*/ */
protected void init() { protected void init() {
completions = new ArrayList<Completion>(); completions = new ArrayList<Completion>();
seg = new Segment(); seg = new Segment();
} }
/** /**
* Returns whether the specified character is valid in an auto-completion. * Returns whether the specified character is valid in an auto-completion.
* The default implementation is equivalent to * The default implementation is equivalent to
* "<code>Character.isLetterOrDigit(ch) || ch=='_'</code>". Subclasses * "<code>Character.isLetterOrDigit(ch) || ch=='_'</code>". Subclasses
* can override this method to change what characters are matched. * can override this method to change what characters are matched.
* *
* @param ch The character. * @param ch The character.
* @return Whether the character is valid. * @return Whether the character is valid.
*/ */
protected boolean isValidChar(char ch) { protected boolean isValidChar(char ch) {
return Character.isLetterOrDigit(ch) || ch=='_'; return Character.isLetterOrDigit(ch) || ch == '_';
} }
/** /**
* Loads completions from an XML file. The XML should validate against * Loads completions from an XML file. The XML should validate against
* <code>CompletionXml.dtd</code>. * <code>CompletionXml.dtd</code>.
* *
* @param file An XML file to load from. * @param file An XML file to load from.
* @throws IOException If an IO error occurs. * @throws IOException If an IO error occurs.
*/ */
public void loadFromXML(File file) throws IOException { public void loadFromXML(File file) throws IOException {
BufferedInputStream bin = new BufferedInputStream( BufferedInputStream bin = new BufferedInputStream(
new FileInputStream(file)); new FileInputStream(file));
try { try {
loadFromXML(bin); loadFromXML(bin);
} finally { } finally {
bin.close(); bin.close();
} }
} }
/** /**
* Loads completions from an XML input stream. The XML should validate * Loads completions from an XML input stream. The XML should validate
* against <code>CompletionXml.dtd</code>. * against <code>CompletionXml.dtd</code>.
* *
* @param in The input stream to read from. * @param in The input stream to read from.
* @throws IOException If an IO error occurs. * @throws IOException If an IO error occurs.
*/ */
public void loadFromXML(InputStream in) throws IOException { public void loadFromXML(InputStream in) throws IOException {
loadFromXML(in, null); loadFromXML(in, null);
} }
/** /**
* Loads completions from an XML input stream. The XML should validate * Loads completions from an XML input stream. The XML should validate
* against <code>CompletionXml.dtd</code>. * against <code>CompletionXml.dtd</code>.
* *
* @param in The input stream to read from. * @param in The input stream to read from.
* @param cl The class loader to use when loading any extra classes defined * @param cl The class loader to use when loading any extra classes defined
* in the XML, such as custom {@link FunctionCompletion}s. This * in the XML, such as custom {@link FunctionCompletion}s. This
* may be <code>null</code> if the default is to be used, or if no * may be <code>null</code> if the default is to be used, or if no
* custom completions are defined in the XML. * custom completions are defined in the XML.
* @throws IOException If an IO error occurs. * @throws IOException If an IO error occurs.
*/ */
public void loadFromXML(InputStream in, ClassLoader cl) throws IOException { public void loadFromXML(InputStream in, ClassLoader cl) throws IOException {
//long start = System.currentTimeMillis(); //long start = System.currentTimeMillis();
SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true); try {
CompletionXMLParser handler = new CompletionXMLParser(this, cl); factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
BufferedInputStream bin = new BufferedInputStream(in); factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
try { factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
SAXParser saxParser = factory.newSAXParser(); factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
saxParser.parse(bin, handler); } catch (ParserConfigurationException | SAXNotSupportedException | SAXNotRecognizedException e) {
List<Completion> completions = handler.getCompletions(); FineLoggerFactory.getLogger().warn(e.getMessage(), e);
addCompletions(completions); }
char startChar = handler.getParamStartChar();
if (startChar!=0) { factory.setValidating(true);
char endChar = handler.getParamEndChar(); CompletionXMLParser handler = new CompletionXMLParser(this, cl);
String sep = handler.getParamSeparator(); BufferedInputStream bin = new BufferedInputStream(in);
if (endChar!=0 && sep!=null && sep.length()>0) { // Sanity try {
setParameterizedCompletionParams(startChar, sep, endChar); SAXParser saxParser = factory.newSAXParser();
} saxParser.parse(bin, handler);
} List<Completion> completions = handler.getCompletions();
} catch (SAXException se) { addCompletions(completions);
throw new IOException(se.toString()); char startChar = handler.getParamStartChar();
} catch (ParserConfigurationException pce) { if (startChar != 0) {
throw new IOException(pce.toString()); char endChar = handler.getParamEndChar();
} finally { String sep = handler.getParamSeparator();
//long time = System.currentTimeMillis() - start; if (endChar != 0 && sep != null && sep.length() > 0) { // Sanity
//System.out.println("XML loaded in: " + time + "ms"); setParameterizedCompletionParams(startChar, sep, endChar);
bin.close(); }
} }
} catch (SAXException se) {
} throw new IOException(se.toString());
} catch (ParserConfigurationException pce) {
throw new IOException(pce.toString());
/** } finally {
* Loads completions from an XML file. The XML should validate against //long time = System.currentTimeMillis() - start;
* <code>CompletionXml.dtd</code>. //System.out.println("XML loaded in: " + time + "ms");
* bin.close();
* @param resource A resource the current ClassLoader can get to. }
* @throws IOException If an IO error occurs.
*/ }
public void loadFromXML(String resource) throws IOException {
ClassLoader cl = getClass().getClassLoader();
InputStream in = cl.getResourceAsStream(resource); /**
if (in==null) { * Loads completions from an XML file. The XML should validate against
File file = new File(resource); * <code>CompletionXml.dtd</code>.
if (file.isFile()) { *
in = new FileInputStream(file); * @param resource A resource the current ClassLoader can get to.
} * @throws IOException If an IO error occurs.
else { */
throw new IOException("No such resource: " + resource); public void loadFromXML(String resource) throws IOException {
} ClassLoader cl = getClass().getClassLoader();
} InputStream in = cl.getResourceAsStream(resource);
BufferedInputStream bin = new BufferedInputStream(in); if (in == null) {
try { File file = new File(resource);
loadFromXML(bin); if (file.isFile()) {
} finally { in = new FileInputStream(file);
bin.close(); } else {
} throw new IOException("No such resource: " + resource);
} }
}
BufferedInputStream bin = new BufferedInputStream(in);
try {
loadFromXML(bin);
} finally {
bin.close();
}
}
} }

1
designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java

@ -4,7 +4,6 @@ import com.fr.base.Utils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument; import javax.swing.text.PlainDocument;

30
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -217,18 +217,36 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
int lineStyle = currentLineCombo.getSelectedLineStyle(); int lineStyle = currentLineCombo.getSelectedLineStyle();
Color lineColor = currentLineColorPane.getSelectObject(); Color lineColor = currentLineColorPane.getSelectObject();
CellBorderStyle cellBorderStyle = new CellBorderStyle(); CellBorderStyle cellBorderStyle = new CellBorderStyle();
cellBorderStyle.setTopColor(lineColor); if (topToggleButton.isSelected()) {
cellBorderStyle.setTopColor(lineColor);
}
cellBorderStyle.setTopStyle(topToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setTopStyle(topToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setBottomColor(lineColor);
if (bottomToggleButton.isSelected()) {
cellBorderStyle.setBottomColor(lineColor);
}
cellBorderStyle.setBottomStyle(bottomToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setBottomStyle(bottomToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setLeftColor(lineColor);
if (leftToggleButton.isSelected()) {
cellBorderStyle.setLeftColor(lineColor);
}
cellBorderStyle.setLeftStyle(leftToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setLeftStyle(leftToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setRightColor(lineColor);
if (rightToggleButton.isSelected()) {
cellBorderStyle.setRightColor(lineColor);
}
cellBorderStyle.setRightStyle(rightToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setRightStyle(rightToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setVerticalColor(lineColor);
if (verticalToggleButton.isSelected()) {
cellBorderStyle.setVerticalColor(lineColor);
}
cellBorderStyle.setVerticalStyle(verticalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setVerticalStyle(verticalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setHorizontalColor(lineColor);
if (horizontalToggleButton.isSelected()) {
cellBorderStyle.setHorizontalColor(lineColor);
}
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) { if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) {
outerToggleButton.setSelected(true); outerToggleButton.setSelected(true);
} else { } else {

4
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxScheme.java

@ -624,6 +624,10 @@ public class SyntaxScheme implements Cloneable, TokenTypes {
SyntaxSchemeLoader parser = null; SyntaxSchemeLoader parser = null;
try { try {
XMLReader reader = XMLReaderFactory.createXMLReader(); XMLReader reader = XMLReaderFactory.createXMLReader();
reader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
parser = new SyntaxSchemeLoader(baseFont); parser = new SyntaxSchemeLoader(baseFont);
parser.baseFont = baseFont; parser.baseFont = baseFont;
reader.setContentHandler(parser); reader.setContentHandler(parser);

9
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/Theme.java

@ -22,6 +22,7 @@ import java.lang.reflect.Field;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ColorUIResource;
import javax.swing.text.StyleContext; import javax.swing.text.StyleContext;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
@ -493,6 +494,8 @@ public class Theme {
StreamResult result = new StreamResult(new PrintWriter( StreamResult result = new StreamResult(new PrintWriter(
new UnicodeWriter(bout, "UTF-8"))); new UnicodeWriter(bout, "UTF-8")));
TransformerFactory transFac = TransformerFactory.newInstance(); TransformerFactory transFac = TransformerFactory.newInstance();
transFac.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transFac.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer transformer = transFac.newTransformer(); Transformer transformer = transFac.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
@ -580,8 +583,12 @@ public class Theme {
public static void load(Theme theme, InputStream in) throws IOException { public static void load(Theme theme, InputStream in) throws IOException {
SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(true);
try { try {
spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
spf.setValidating(true);
SAXParser parser = spf.newSAXParser(); SAXParser parser = spf.newSAXParser();
XMLReader reader = parser.getXMLReader(); XMLReader reader = parser.getXMLReader();
XmlHandler handler = new XmlHandler(); XmlHandler handler = new XmlHandler();

8
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/Macro.java

@ -14,6 +14,7 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import javax.xml.transform.*; import javax.xml.transform.*;
import javax.xml.transform.dom.*; import javax.xml.transform.dom.*;
@ -94,6 +95,11 @@ public class Macro {
DocumentBuilder db = null; DocumentBuilder db = null;
Document doc = null; Document doc = null;
try { try {
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
dbf.setXIncludeAware(false);
db = dbf.newDocumentBuilder(); db = dbf.newDocumentBuilder();
//InputSource is = new InputSource(new FileReader(file)); //InputSource is = new InputSource(new FileReader(file));
InputSource is = new InputSource(new UnicodeReader( InputSource is = new InputSource(new UnicodeReader(
@ -374,6 +380,8 @@ public class Macro {
StreamResult result = new StreamResult(new File(fileName)); StreamResult result = new StreamResult(new File(fileName));
DOMSource source = new DOMSource(doc); DOMSource source = new DOMSource(doc);
TransformerFactory transFac = TransformerFactory.newInstance(); TransformerFactory transFac = TransformerFactory.newInstance();
transFac.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transFac.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer transformer = transFac.newTransformer(); Transformer transformer = transFac.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, FILE_ENCODING); transformer.setOutputProperty(OutputKeys.ENCODING, FILE_ENCODING);

8
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -598,7 +598,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}); });
// 重名提示 // 重名提示
warnLabel = new UILabel(); warnLabel = new UILabel();
warnLabel.setPreferredSize(new Dimension(300, 30)); warnLabel.setPreferredSize(new Dimension(300, 50));
warnLabel.setHorizontalAlignment(SwingConstants.LEFT); warnLabel.setHorizontalAlignment(SwingConstants.LEFT);
warnLabel.setVerticalAlignment(SwingConstants.TOP); warnLabel.setVerticalAlignment(SwingConstants.TOP);
warnLabel.setForeground(Color.RED); warnLabel.setForeground(Color.RED);
@ -641,7 +641,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
new Component[]{midPanel}, new Component[]{midPanel},
new Component[]{buttonsPane} new Component[]{buttonsPane}
}, },
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED}, new double[]{TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED},
new double[]{TableLayout.FILL} new double[]{TableLayout.FILL}
), ),
BorderLayout.CENTER); BorderLayout.CENTER);
@ -803,7 +803,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}); });
// 重名提示 // 重名提示
warnLabel = new UILabel(); warnLabel = new UILabel();
warnLabel.setPreferredSize(new Dimension(300, 30)); warnLabel.setPreferredSize(new Dimension(300, 50));
warnLabel.setHorizontalAlignment(SwingConstants.LEFT); warnLabel.setHorizontalAlignment(SwingConstants.LEFT);
warnLabel.setVerticalAlignment(SwingConstants.TOP); warnLabel.setVerticalAlignment(SwingConstants.TOP);
warnLabel.setForeground(Color.RED); warnLabel.setForeground(Color.RED);
@ -848,7 +848,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
new Component[]{midPanel}, new Component[]{midPanel},
new Component[]{bottomPanel} new Component[]{bottomPanel}
}, },
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED}, new double[]{TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED},
new double[]{TableLayout.FILL} new double[]{TableLayout.FILL}
), ),
BorderLayout.CENTER); BorderLayout.CENTER);

15
designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java

@ -4,12 +4,15 @@ import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.os.OperatingSystem;
import java.awt.*; import java.awt.*;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
public class GUIPaintUtils { public class GUIPaintUtils {
private static boolean macos = OperatingSystem.isMacos();
public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection) { public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection) {
drawBorder(g2d, x, y, width, height, isRound, rectDirection, false); drawBorder(g2d, x, y, width, height, isRound, rectDirection, false);
} }
@ -39,10 +42,14 @@ public class GUIPaintUtils {
g2d.drawLine(x, y, x, height - 1); g2d.drawLine(x, y, x, height - 1);
g2d.drawLine(x, height - 1, x + 3, height - 1); g2d.drawLine(x, height - 1, x + 3, height - 1);
} else { } else {
double offsetX = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleX() - 1, 0.5d); if (macos) {
double offsetY = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleY() - 1, 0.5d); g2d.drawRoundRect(x, y, width - 1, height - 1, UIConstants.ARC, UIConstants.ARC);
Shape shape = new RoundRectangle2D.Double(x + offsetX, y + offsetY, width - 1d, height - 1d, UIConstants.ARC, UIConstants.ARC); } else {
g2d.draw(shape); double offsetX = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleX() - 1, 0.5d);
double offsetY = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleY() - 1, 0.5d);
Shape shape = new RoundRectangle2D.Double(x + offsetX, y + offsetY, width - 1d, height - 1d, UIConstants.ARC, UIConstants.ARC);
g2d.draw(shape);
}
} }
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} else { } else {

5
designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

@ -12,6 +12,7 @@ import com.fr.third.springframework.web.context.support.AnnotationConfigWebAppli
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.apache.catalina.Context; import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleException;
import org.apache.catalina.Wrapper;
import org.apache.catalina.loader.WebappLoader; import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.webresources.StandardRoot; import org.apache.catalina.webresources.StandardRoot;
@ -73,6 +74,10 @@ public class FineEmbedServerActivator extends Activator {
String contextPath = "/" + ProductConstants.getAppFolderName(); String contextPath = "/" + ProductConstants.getAppFolderName();
final Context context = tomcat.addContext(contextPath, docBase); final Context context = tomcat.addContext(contextPath, docBase);
context.setResources(new StandardRoot(context)); context.setResources(new StandardRoot(context));
Wrapper servlet = Tomcat.addServlet(context, "DruidStatView", "com.fr.third.alibaba.druid.support.http.StatViewServlet");
context.addServletMappingDecoded("/druid/*", "DruidStatView");
servlet.setLoadOnStartup(1);
servlet.setOverridable(true);
Tomcat.initWebappDefaults(context); Tomcat.initWebappDefaults(context);
//覆盖tomcat的WebAppClassLoader //覆盖tomcat的WebAppClassLoader
context.setLoader(new FRTomcatLoader()); context.setLoader(new FRTomcatLoader());

0
designer-base/src/main/resources/com/fr/design/images/control/edit_disable.svg → designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg

Before

Width:  |  Height:  |  Size: 864 B

After

Width:  |  Height:  |  Size: 864 B

0
designer-base/src/main/resources/com/fr/design/images/control/remove_disable.svg → designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 804 B

0
designer-base/src/main/resources/com/fr/design/images/m_file/preview_disable.svg → designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

64
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -10,7 +10,6 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.FontAutoType; import com.fr.plugin.chart.type.FontAutoType;
@ -50,7 +49,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
public GaugeStyle getGaugeStyle() { public GaugeStyle getGaugeStyle() {
return ((VanChartGaugePlot)this.getPlot()).getGaugeStyle(); return ((VanChartGaugePlot) this.getPlot()).getGaugeStyle();
} }
public void setGaugeStyle(GaugeStyle gaugeStyle) { public void setGaugeStyle(GaugeStyle gaugeStyle) {
@ -127,15 +126,13 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
if (hasLabelAlignPane()) { if (hasLabelAlignPane()) {
return new Component[][]{ return new Component[][]{
new Component[]{getDataLabelContentPane(), null}, new Component[]{getDataLabelContentPane(), null},
new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical"), plot), null}, new Component[]{createLabelPositionPane(getVerticalTitle(), plot), null},
new Component[]{createLabelAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")), null}, new Component[]{createLabelAlignPane(), null},
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null},
}; };
} else { } else {
return new Component[][]{ return new Component[][]{
new Component[]{getDataLabelContentPane(), null}, new Component[]{getDataLabelContentPane(), null},
new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null},
@ -143,50 +140,37 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
} }
private JPanel createLabelAlignPane(String title) { private JPanel createLabelAlignPane() {
JPanel panel = new JPanel(new BorderLayout()); alignPane = new JPanel(new BorderLayout());
checkAlignPane();
alignPane = new JPanel(); return alignPane;
checkAlignPane(title);
panel.add(alignPane, BorderLayout.CENTER);
return panel;
} }
protected void checkAlignPane(String title) { protected void checkAlignPane() {
if (alignPane == null && !hasLabelAlign(getPlot())) { if (!hasLabelAlignPane()) {
return; return;
} }
if (alignPane != null && !hasLabelAlign(getPlot())) { if (!hasLabelAlign()) {
oldAlignValues = null;
alignPane.removeAll(); alignPane.removeAll();
return; return;
} }
if (alignPane == null && hasLabelAlign(getPlot())) {
alignPane = new JPanel(); if (alignPane.getComponents().length > 0) {
return;
} }
TwoTuple<String[], Integer[]> result = getAlignNamesAndValues(); TwoTuple<String[], Integer[]> result = getAlignNamesAndValues();
String[] names = result.getFirst(); String[] names = result.getFirst();
Integer[] values = result.getSecond(); Integer[] values = result.getSecond();
if (ComparatorUtils.equals(values, oldAlignValues)) { align = new UIButtonGroup<>(names, values);
return;
}
oldAlignValues = values;
align = new UIButtonGroup<Integer>(names, values);
Component[][] comps = new Component[2][2]; Component[][] comps = new Component[2][2];
comps[0] = new Component[]{null, null}; comps[0] = new Component[]{null, null};
comps[1] = new Component[]{new UILabel(title, SwingConstants.LEFT), align}; comps[1] = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal"), SwingConstants.LEFT), align};
double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED};
double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH};
alignPane.removeAll();
alignPane.setLayout(new BorderLayout());
alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER); alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER);
if (getParentPane() != null) { if (getParentPane() != null) {
@ -214,12 +198,16 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
protected void checkPane() { protected void checkPane() {
String verticalTitle = hasLabelAlign(getPlot()) String verticalTitle = getVerticalTitle();
? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical")
: Toolkit.i18nText("Fine-Design_Chart_Layout_Position");
checkPositionPane(verticalTitle); checkPositionPane(verticalTitle);
checkAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")); checkAlignPane();
}
private String getVerticalTitle() {
return hasLabelAlign()
? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical")
: Toolkit.i18nText("Fine-Design_Chart_Layout_Position");
} }
protected void checkStyleUse() { protected void checkStyleUse() {
@ -227,8 +215,8 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
textFontPane.setPreferredSize(new Dimension(0, TEXT_FONT_PANE_HEIGHT)); textFontPane.setPreferredSize(new Dimension(0, TEXT_FONT_PANE_HEIGHT));
} }
protected boolean hasLabelAlign(Plot plot) { protected boolean hasLabelAlign() {
return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) getPlot()).getGaugeDetailStyle().isHorizontalLayout();
} }
protected boolean hasLabelAlignPane() { protected boolean hasLabelAlignPane() {
@ -240,7 +228,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
style.setSelectedIndex(1); style.setSelectedIndex(1);
textFontPane.populate(detail.getTextAttr()); textFontPane.populate(detail.getTextAttr());
if (hasLabelAlign(this.getPlot()) && align != null) { if (hasLabelAlign() && align != null) {
align.setSelectedItem(detail.getAlign()); align.setSelectedItem(detail.getAlign());
} }

10
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java

@ -79,6 +79,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
private JPanel createGISLayerPane() { private JPanel createGISLayerPane() {
gisButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); gisButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), Toolkit.i18nText("Fine-Design_Chart_Custom")});
gisButton.setSelectedIndex(0);
gisGaoDeLayer = new UIComboBox(MapLayerConfigManager.getGaoDeLayerItems()); gisGaoDeLayer = new UIComboBox(MapLayerConfigManager.getGaoDeLayerItems());
gisButton.addActionListener(event -> { gisButton.addActionListener(event -> {
refreshZoomLevel(); refreshZoomLevel();
@ -221,12 +222,9 @@ public class GisLayerPane extends JPanel implements UIObserver {
/* mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO); /* mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO);
mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));*/ mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));*/
GaoDeGisType gaoDeGisType= mapPlot.getDefaultGisLayerType(); GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer();
mapPlot.setGisLayer(defaultGisLayer);
mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API); populate(defaultGisLayer);
mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName());
mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType);
populate(mapPlot.getGisLayer());
} }
public void populate(GisLayer layer) { public void populate(GisLayer layer) {

4
designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

@ -74,10 +74,10 @@
}], }],
layouts: [{ layouts: [{
type: "bi.left", type: "bi.left",
rgap: 5 rgap: 2
}], }],
value: this.model.mode, value: this.model.mode,
width: 125 width: 170
}, this._getToolBar()], }, this._getToolBar()],
height: 24 height: 24
}, { }, {

4
designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js

@ -18,7 +18,7 @@
return [{ return [{
type: "bi.single_select_radio_item", type: "bi.single_select_radio_item",
text: BI.i18nText("BI-Basic_Auto"), text: BI.i18nText("BI-Basic_Auto"),
width: 50, width: 70,
logic: { logic: {
dynamic: true dynamic: true
}, },
@ -27,7 +27,7 @@
}, { }, {
type: "bi.single_select_radio_item", type: "bi.single_select_radio_item",
text: BI.i18nText("BI-Basic_Custom"), text: BI.i18nText("BI-Basic_Custom"),
width: 60, width: 80,
logic: { logic: {
dynamic: true dynamic: true
}, },

5
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.style.BorderUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -67,6 +68,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override @Override
public void updateBeans() { public void updateBeans() {
Object[] selectionCellBorderObjects = BorderUtils.createCellBorderObject(elementCasePane);
if (stylePane.getSelectedIndex() == 1) { if (stylePane.getSelectedIndex() == 1) {
Style s = stylePane.updateBean(); Style s = stylePane.updateBean();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
@ -110,7 +112,8 @@ public class CellStylePane extends AbstractCellAttrPane {
} }
} }
} }
stylePane.updateBorder();// border必须特别处理 // border必须特别处理
stylePane.updateBorder(selectionCellBorderObjects);
} }
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -136,8 +136,8 @@ public class CustomStylePane extends MultiTabPane<Style> {
/** /**
* *
*/ */
public void updateBorder() { public void updateBorder(Object[] selectionCellBorderObjects) {
BorderUtils.update(reportPane, ((BorderPane) paneList.get(ONE_INDEX)).update()); BorderUtils.update(reportPane, selectionCellBorderObjects, ((BorderPane) paneList.get(ONE_INDEX)).update());
} }
/** /**

5
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -38,10 +38,9 @@ public class StylePane extends UIComboBoxPane<Style> {
customStylePane.addTabChangeListener(changeListener); customStylePane.addTabChangeListener(changeListener);
} }
public void updateBorder(Object[] selectionCellBorderObjects) {
public void updateBorder() {
if (getSelectedIndex() == 0 && customStylePane.isBorderPaneSelected()) { if (getSelectedIndex() == 0 && customStylePane.isBorderPaneSelected()) {
customStylePane.updateBorder(); customStylePane.updateBorder(selectionCellBorderObjects);
} }
} }

23
designer-realize/src/main/java/com/fr/design/style/BorderUtils.java

@ -464,8 +464,13 @@ public abstract class BorderUtils {
* changed, need to support undo/redo * changed, need to support undo/redo
*/ */
public static boolean update(ElementCasePane reportPane, CellBorderStyle newCellBorderStyle) { public static boolean update(ElementCasePane reportPane, CellBorderStyle newCellBorderStyle) {
Object[] selectionCellBorderObjects = createCellBorderObject(reportPane);
return update(reportPane, selectionCellBorderObjects, newCellBorderStyle);
}
public static boolean update(ElementCasePane reportPane, Object[] selectionCellBorderObjects, CellBorderStyle newCellBorderStyle) {
boolean isBorderColorStyleChanged = false; boolean isBorderColorStyleChanged = false;
Object[] fourObjectArray = createCellBorderObject(reportPane); Object[] fourObjectArray = selectionCellBorderObjects;
if (fourObjectArray == null || fourObjectArray.length < NUMBER) { if (fourObjectArray == null || fourObjectArray.length < NUMBER) {
return false; return false;
} }
@ -526,44 +531,60 @@ public abstract class BorderUtils {
if (cellBorderStyle.getLeftStyle() != newCellBorderStyle.getLeftStyle() if (cellBorderStyle.getLeftStyle() != newCellBorderStyle.getLeftStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getLeftColor(), newCellBorderStyle.getLeftColor())) { || !ComparatorUtils.equals(cellBorderStyle.getLeftColor(), newCellBorderStyle.getLeftColor())) {
style = style.deriveBorderLeft(newCellBorderStyle.getLeftStyle(), newCellBorderStyle.getLeftColor()); style = style.deriveBorderLeft(newCellBorderStyle.getLeftStyle(), newCellBorderStyle.getLeftColor());
} else {
style = style.deriveBorderLeft(cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor());
} }
} else { } else {
if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle() if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) { || !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) {
style = style.deriveBorderLeft(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor()); style = style.deriveBorderLeft(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor());
} else {
style = style.deriveBorderLeft(cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
} }
} }
if (tmpCellElement.getColumn() + tmpCellElement.getColumnSpan() == column + columnSpan) { if (tmpCellElement.getColumn() + tmpCellElement.getColumnSpan() == column + columnSpan) {
if (cellBorderStyle.getRightStyle() != newCellBorderStyle.getRightStyle() if (cellBorderStyle.getRightStyle() != newCellBorderStyle.getRightStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getRightColor(), newCellBorderStyle.getRightColor())) { || !ComparatorUtils.equals(cellBorderStyle.getRightColor(), newCellBorderStyle.getRightColor())) {
style = style.deriveBorderRight(newCellBorderStyle.getRightStyle(), newCellBorderStyle.getRightColor()); style = style.deriveBorderRight(newCellBorderStyle.getRightStyle(), newCellBorderStyle.getRightColor());
} else {
style = style.deriveBorderRight(cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
} }
} else { } else {
if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle() if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) { || !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) {
style = style.deriveBorderRight(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor()); style = style.deriveBorderRight(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor());
} else {
style = style.deriveBorderRight(cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
} }
} }
if (tmpCellElement.getRow() == row) { if (tmpCellElement.getRow() == row) {
if (cellBorderStyle.getTopStyle() != newCellBorderStyle.getTopStyle() if (cellBorderStyle.getTopStyle() != newCellBorderStyle.getTopStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getTopColor(), newCellBorderStyle.getTopColor())) { || !ComparatorUtils.equals(cellBorderStyle.getTopColor(), newCellBorderStyle.getTopColor())) {
style = style.deriveBorderTop(newCellBorderStyle.getTopStyle(), newCellBorderStyle.getTopColor()); style = style.deriveBorderTop(newCellBorderStyle.getTopStyle(), newCellBorderStyle.getTopColor());
} else {
style = style.deriveBorderTop(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor());
} }
} else { } else {
if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle() if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) { || !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) {
style = style.deriveBorderTop(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor()); style = style.deriveBorderTop(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor());
} else {
style = style.deriveBorderTop(cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
} }
} }
if (tmpCellElement.getRow() + tmpCellElement.getRowSpan() == row + rowSpan) { if (tmpCellElement.getRow() + tmpCellElement.getRowSpan() == row + rowSpan) {
if (cellBorderStyle.getBottomStyle() != newCellBorderStyle.getBottomStyle() if (cellBorderStyle.getBottomStyle() != newCellBorderStyle.getBottomStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getBottomColor(), newCellBorderStyle.getBottomColor())) { || !ComparatorUtils.equals(cellBorderStyle.getBottomColor(), newCellBorderStyle.getBottomColor())) {
style = style.deriveBorderBottom(newCellBorderStyle.getBottomStyle(), newCellBorderStyle.getBottomColor()); style = style.deriveBorderBottom(newCellBorderStyle.getBottomStyle(), newCellBorderStyle.getBottomColor());
} else {
style = style.deriveBorderBottom(cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor());
} }
} else { } else {
if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle() if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) { || !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) {
style = style.deriveBorderBottom(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor()); style = style.deriveBorderBottom(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor());
} else {
style = style.deriveBorderBottom(cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
} }
} }
return style; return style;

Loading…
Cancel
Save