Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~mata.li/design into release/10.0

bugfix/10.0
Mata.Li 6 years ago
parent
commit
30ca69f5a2
  1. 2
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 26
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  3. 8
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java
  4. 16
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  5. 16
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  6. 4
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  7. 11
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  8. 29
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  9. 9
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java
  10. 4
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java
  11. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java
  12. 4
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java
  13. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java
  14. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java
  15. 4
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java

2
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -112,7 +112,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private Color paginationLineColor = Color.black; // line color of paper
private boolean supportCellEditorDef = false;
private boolean isDragPermited = false;
private Locale language = Locale.SIMPLIFIED_CHINESE;
private Locale language = Locale.getDefault();
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true;
private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT;

26
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -17,6 +17,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
@ -36,8 +37,8 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
private JDialog dialog;
private UILabel uiLabel;
// 编码转换.
private UIComboBox newCharSetComboBox;
private String oirginalCharSet = null;
private UIComboBox charSetComboBox;
private String originalCharSet = null;
// Database pane
public DatabaseConnectionPane() {
@ -50,7 +51,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK"));
cancelButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
String[] defaultEncode = new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encode_Auto")};
newCharSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY));
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
this.add(northPane, BorderLayout.NORTH);
@ -72,7 +73,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
new ModLineBorder(ModLineBorder.TOP),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced")
));
chartSetPane.add(GUICoreUtils.createNamedPane(newCharSetComboBox, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_New_Charset") + ":"));
chartSetPane.add(GUICoreUtils.createNamedPane(charSetComboBox, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":"));
}
protected abstract JPanel mainPanel();
@ -81,8 +82,12 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
@Override
public void populateBean(com.fr.data.impl.Connection ob) {
this.oirginalCharSet = ob.getOriginalCharsetName();
this.newCharSetComboBox.setSelectedItem(ob.getNewCharsetName());
this.originalCharSet = ob.getOriginalCharsetName();
if (StringUtils.isBlank(originalCharSet)) {
this.charSetComboBox.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encode_Auto"));
} else {
this.charSetComboBox.setSelectedItem(ob.getOriginalCharsetName());
}
populateSubDatabaseConnectionBean((E) ob);
}
@ -93,11 +98,14 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
public com.fr.data.impl.Connection updateBean() {
E ob = updateSubDatabaseConnectionBean();
ob.setOriginalCharsetName(this.oirginalCharSet);
if (this.newCharSetComboBox.getSelectedIndex() == 0) {
ob.setOriginalCharsetName(this.originalCharSet);
if (this.charSetComboBox.getSelectedIndex() == 0) {
ob.setNewCharsetName(null);
ob.setOriginalCharsetName(null);
} else {
ob.setNewCharsetName((String) this.newCharSetComboBox.getSelectedItem());
ob.setNewCharsetName(EncodeConstants.ENCODING_GBK);
ob.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem()));
}
return ob;

8
designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java

@ -125,7 +125,7 @@ public class JNDIDefPane extends JPanel {
}
// Properties.
Hashtable<String, String> contextHashtable = jndiDatabase.getContextHashtable();
Map<String, String> contextHashtable = jndiDatabase.getContextHashtable();
Object INITIAL_CONTEXT_FACTORY = contextHashtable.get(Context.INITIAL_CONTEXT_FACTORY);
this.JNDIFactoryComboBox.setSelectedItem(INITIAL_CONTEXT_FACTORY == null ? "" : INITIAL_CONTEXT_FACTORY);
@ -148,7 +148,7 @@ public class JNDIDefPane extends JPanel {
populateContextAttributes(contextHashtable, this.APPLET_TF, Context.APPLET);
}
private void populateContextAttributes(Hashtable<String, String> properties, UITextField textField, String contextAttr) {
private void populateContextAttributes(Map<String, String> properties, UITextField textField, String contextAttr) {
String PROVIDER_URL = properties.get(contextAttr);
if (PROVIDER_URL != null) {
textField.setText(PROVIDER_URL);
@ -160,7 +160,7 @@ public class JNDIDefPane extends JPanel {
jndiDatabase.setJNDIName(this.jndiNameTextField.getText());
Hashtable<String, String> contextHashtable = jndiDatabase.getContextHashtable();
Map<String, String> contextHashtable = jndiDatabase.getContextHashtable();
String factoryString = (String)this.JNDIFactoryComboBox.getEditor().getItem();
if (factoryString != null && factoryString.trim().length() > 0) {
@ -186,7 +186,7 @@ public class JNDIDefPane extends JPanel {
return jndiDatabase;
}
private void updateContextAttributes(Hashtable<String, String> contextHashtable, UITextField textField, String contextAttr) {
private void updateContextAttributes(Map<String, String> contextHashtable, UITextField textField, String contextAttr) {
String tValue = textField.getText();
if (tValue != null && tValue.trim().length() > 0) {
contextHashtable.put(contextAttr, tValue);

16
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -206,8 +206,7 @@ public class MutilTempalteTabPane extends JComponent {
openedTemplate.remove(jTemplate);
closeFormat(jTemplate);
HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate);
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(jTemplate.getPath());
closeAndFreeLock(jTemplate);
}
}
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
@ -221,7 +220,6 @@ public class MutilTempalteTabPane extends JComponent {
if (openedTemplate.size() == 1) {
closeOther.setEnabled(false);
}
return closeOther;
}
@ -698,11 +696,19 @@ public class MutilTempalteTabPane extends JComponent {
private void closeTpl(@Nonnull JTemplate<?, ?> specifiedTemplate, @Nonnull String fileName) {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath());
closeAndFreeLock(specifiedTemplate);
activeTemplate(fileName);
}
private void closeAndFreeLock(@Nonnull JTemplate<?, ?> template) {
FILE file = template.getEditingFILE();
// 只有是环境内的文件,才执行释放锁
if (file != null && file.isEnvFile()) {
// release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath());
}
}
/**
* 关闭模板
*

16
designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java

@ -667,18 +667,10 @@ public class UIBasicMenuItemUI extends MenuItemUI {
}
private void installFont(final String prefix, final JComponent menuItem) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
if (menuItem == null) {
return;
}
LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font");
}
});
thread.setName("UIBasicMenuItemUI");
thread.setDaemon(true);
thread.start();
if (menuItem == null) {
return;
}
LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font");
}
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon,

4
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -69,10 +69,8 @@ public class EnvFileTree extends RefreshableJTree {
if (treeNode.hasFullAuthority()) {
if (lock != null && !node.getUserID().equals(lock)) {
name = name + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked", "(", ")");
this.setIcon(FileTreeIcon.getIcon(node));
} else {
this.setIcon(FileTreeIcon.getIcon(node, false));
}
this.setIcon(FileTreeIcon.getIcon(node));
} else {
this.setIcon(FileTreeIcon.getFolderHalfImageIcon());
}

11
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -3,6 +3,7 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.BaseUtils;
import com.fr.design.icon.LockIcon;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext;
@ -125,8 +126,16 @@ public class FileTreeIcon {
return FOLDER_HALF_IMAGE_ICON;
}
/**
* 获取文件节点对应的图标
*
* @param node 文件节点
* @return 文件节点的图标
*/
public static Icon getIcon(FileNode node) {
return getIcon(node, node.getLock() != null);
// 如果文件节点锁不为空且不是当前用户锁定的该模板,那么模板ICON 提示用户当前文件节点被锁
boolean showLock = node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock());
return getIcon(node, showLock);
}
public static Icon getIcon(FileNode node, boolean isShowLock) {

29
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -32,6 +32,7 @@ import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo;
@ -56,6 +57,8 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -587,6 +590,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (isCancelOperation(chooseResult)) {
return false;
}
// 源文件
FILE sourceFile = editingFILE;
if (isOkOperation(chooseResult)) {
boolean access = false;
@ -596,13 +601,33 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (!access) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE);
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"),
JOptionPane.WARNING_MESSAGE);
return false;
}
// 目标文件
editingFILE = fileChooser.getSelectedFILE();
}
return saveNewFile(editingFILE, oldName);
boolean lockedTarget = WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath());
if (lockedTarget) {
boolean saved = saveNewFile(editingFILE, oldName);
// 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉
if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) {
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath());
}
return saved;
} else {
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"),
JOptionPane.WARNING_MESSAGE);
return false;
}
}
protected boolean saveNewFile(FILE editingFILE, String oldName) {

9
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java

@ -30,6 +30,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane {
private int patternIndex = 0; // pattern setIndex.
private final static int DEFAULT_DIM_HEIGHT = 210;
private final static Color DEFAULT_FOREGROUND = Color.lightGray;
private final static Color DEFAULT_BACKGROUND = Color.black;
private ColorSelectBox foregroundColorPane;
private ColorSelectBox backgroundColorPane;
private PatternButton[] patternButtonArray;
@ -52,7 +54,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane {
}
foregroundColorPane = new ColorSelectBox(60);
backgroundColorPane = new ColorSelectBox(60);
foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND);
foregroundColorPane.setSelectObject(DEFAULT_BACKGROUND);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
@ -219,7 +222,7 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane {
@Override
public void reset() {
patternButtonArray[0].setSelected(true);
foregroundColorPane.setSelectObject(null);
backgroundColorPane.setSelectObject(null);
foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND);
backgroundColorPane.setSelectObject(DEFAULT_BACKGROUND);
}
}

4
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java

@ -12,6 +12,7 @@ import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane {
@ -84,7 +85,8 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
int panelWidth = dimension.width;
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FRFont frFont = this.getTabFontConfig().getFont();
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount();

2
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java

@ -27,6 +27,7 @@ import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.util.ArrayList;
@ -151,6 +152,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
int panelWidth = dimension.width;
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FRFont frFont = this.getTabFontConfig().getFont();
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout();

4
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

@ -208,8 +208,10 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
MobileTemplateStyle ob = updateSubStyle();
ob.setCustom(custom.getSelectedIndex() == 1);
ob.setInitialColor(initialColorBox.getSelectObject());
TabFontConfig config = ob.getTabFontConfig();
TabFontConfig config = new TabFontConfig();
config.setSelectColor(ob.getTabFontConfig().getSelectColor());
config.setFont(fontConfPane.update());
ob.setTabFontConfig(config);
return ob;
}

2
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java

@ -24,6 +24,7 @@ import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
private NewColorSelectBox initDotColor;
@ -131,6 +132,7 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
Dimension dimension = this.getSize();
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FRFont frFont = this.getTabFontConfig().getFont();
g2d.setFont(frFont);
g2d.setColor(frFont.getForeground());

6
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java

@ -10,6 +10,7 @@ import com.fr.design.mainframe.widget.MobileTabFontConfPane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.TabFontConfig;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
@ -97,7 +98,10 @@ public abstract class StyleDefinePaneWithSelectConf extends MobileTemplateStyleD
public MobileTemplateStyle updateSubStyle() {
MobileTemplateStyle mobileTemplateStyle = updateStyleWithSelectConf();
mobileTemplateStyle.setSelectColor(selectColorBox.getSelectObject());
mobileTemplateStyle.getTabFontConfig().setSelectColor(selectFontColor.getColor());
TabFontConfig config = new TabFontConfig();
config.setFont(mobileTemplateStyle.getTabFontConfig().getFont());
config.setSelectColor(selectFontColor.getColor());
mobileTemplateStyle.setTabFontConfig(config);
return mobileTemplateStyle;
}

4
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java

@ -27,6 +27,7 @@ import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Stroke;
public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
@ -171,7 +172,8 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
int panelWidth = dimension.width;
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FRFont frFont = this.getTabFontConfig().getFont();
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount();

Loading…
Cancel
Save