Browse Source

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

bugfix/10.0
alex.sung 6 years ago
parent
commit
a9577306d1
  1. 41
      designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java
  2. 9
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 10
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  4. 4
      designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java
  5. 4
      designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java
  6. 10
      designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java
  7. 10
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  8. 23
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  9. 5
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  10. 31
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  11. 37
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsDateEditor.java
  12. 32
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java
  13. 9
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  14. 30
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  15. 39
      designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseComponent.java
  16. 32
      designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseDialog.java
  17. 36
      designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseOpener.java
  18. 38
      designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabasePane.java
  19. BIN
      designer-base/src/main/resources/com/fr/design/images/bbs/facebook.png
  20. 57
      designer-base/src/main/resources/com/fr/design/upm/database/database.js
  21. 2
      designer-realize/src/main/java/com/fr/start/SplashContext.java

41
designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java

@ -0,0 +1,41 @@
package com.fr.design.actions.community;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
public class FacebookFansAction extends UpAction {
public FacebookFansAction() {
this.setMenuKeySet(FACEBOOKFANS);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/facebook.png"));
}
@Override
public void actionPerformed(ActionEvent arg0) {
BrowseUtils.browser(CloudCenter.getInstance().acquireUrlByKind("facebook.fans.tw"));
}
public static final MenuKeySet FACEBOOKFANS = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'F';
}
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_FaceBook_Fans");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

9
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -138,6 +138,7 @@ public class PreferencePane extends BasicPane {
private UISpinner cachingTemplateSpinner;
private UICheckBox openDebugComboBox;
private UICheckBox useOptimizedUPMCheckbox;
private UICheckBox useUniverseDBMCheckbox;
private UICheckBox joinProductImproveCheckBox;
private UICheckBox autoPushUpdateCheckBox;
@ -197,6 +198,11 @@ public class PreferencePane extends BasicPane {
upmSelectorPane.add(useOptimizedUPMCheckbox);
advancePane.add(upmSelectorPane);
JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
dbmSelectorPane.add(useUniverseDBMCheckbox);
advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox);
@ -639,6 +645,8 @@ public class PreferencePane extends BasicPane {
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImproveCheckBox.setSelected(designerEnvManager.isJoinProductImprove());
@ -737,6 +745,7 @@ public class PreferencePane extends BasicPane {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
}
@Override

10
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -1,6 +1,7 @@
package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
@ -12,6 +13,7 @@ import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.upm.database.UniverseDatabaseOpener;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor;
@ -58,6 +60,14 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
UniverseDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}
}
private void openDesignDatabaseManager() {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ConnectionConfig datasourceManager = ConnectionConfig.getInstance();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {

4
designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java

@ -153,6 +153,10 @@ public class DateEditor extends Editor<Date> {
this.uiDatePicker.setSelectedItem(new Date());
}
public UIDatePicker getUiDatePicker() {
return uiDatePicker;
}
/**
* Request focus
*/

4
designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java

@ -1,6 +1,7 @@
package com.fr.design.gui.date;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
@ -9,7 +10,7 @@ import java.util.Date;
public class SingleObjectComboBoxModel extends AbstractListModel implements ComboBoxModel {
private SimpleDateFormat dateFormat;
private String selectedDate = "";
private String selectedDate = StringUtils.EMPTY;
public SingleObjectComboBoxModel() {
}
@ -28,6 +29,7 @@ public class SingleObjectComboBoxModel extends AbstractListModel implements Comb
public void setSelectedItem(Object anItem) {
if (anItem == null) {
selectedDate = StringUtils.EMPTY;
return;
}
if (anItem instanceof Date) {

10
designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java

@ -6,6 +6,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
@ -157,8 +158,12 @@ public class UIDatePicker extends UIComboBox implements Serializable {
* 设置当前选择的日期
*/
public void setSelectedDate(Date date) throws ParseException {
if (date == null) {
this.setSelectedItem(null);
} else {
this.setSelectedItem(dateFormat.format(date));
}
}
public void setSelectedItem(Object anObject) {
model.setSelectedItem(anObject);
@ -215,7 +220,10 @@ public class UIDatePicker extends UIComboBox implements Serializable {
try {
String strDate = comboBox.getSelectedItem().toString();
synchronized (this) {
Date selectionDate = dateFormat.parse(strDate);
Date selectionDate = new Date();
if (StringUtils.isNotBlank(strDate)) {
selectionDate = dateFormat.parse(strDate);
}
calendarPanel.setSelectedDate(selectionDate);
calendarPanel.updateHMS();
}

10
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -228,16 +228,6 @@ public class TemplateFileTree extends EnvFileTree {
if (fileNodes == null) {
fileNodes = new FileNode[0];
}
// FileNodeFilter过滤
if (filter != null) {
List<FileNode> list = new ArrayList<FileNode>();
for (FileNode fileNode : fileNodes) {
if (filter.accept(fileNode)) {
list.add(fileNode);
}
}
fileNodes = list.toArray(new FileNode[list.size()]);
}
Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return fileNodes;

23
designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java

@ -20,8 +20,10 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.event.EventDispatcher;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.plugin.ExtraClassManager;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
@ -94,11 +96,11 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
imageLayoutComboBox = new UIComboBox(LAYOUT);
initTextRotationCombox();
Icon[][] hAlignmentIconArray = {{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}};
Icon[][] hAlignmentIconArray = {{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}};
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"),
@ -106,9 +108,9 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
vPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
Icon[][] vAlignmentIconArray = {{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}};
Icon[][] vAlignmentIconArray = {{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}};
Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM};
vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment);
vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")});
@ -210,9 +212,11 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private JPanel basicPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
UILabel horizontalLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal") + " ", SwingConstants.LEFT);
UIComponentUtils.setLineWrap(horizontalLabel);
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal") + " ", SwingConstants.LEFT), hPaneContainer},
new Component[]{horizontalLabel, hPaneContainer},
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.RIGHT), vPaneContainer},
new Component[]{null, null}
@ -304,6 +308,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
*
* @param style the new style.
*/
@Override
public void populateBean(Style style) {
hAlignmentPane.setSelectedItem(BaseUtils.getAlignment4Horizontal(style));
vAlignmentPane.setSelectedItem(style.getVerticalAlignment());

5
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -13,6 +13,7 @@ import com.fr.design.actions.community.BBSAction;
import com.fr.design.actions.community.BugAction;
import com.fr.design.actions.community.CenterAction;
import com.fr.design.actions.community.CusDemandAction;
import com.fr.design.actions.community.FacebookFansAction;
import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction;
@ -151,7 +152,6 @@ public abstract class ToolBarMenuDock {
}
};
private static final String FINEREPORT = "FineReport";
private static final int MENUBAR_HEIGHT = 22;
private static final List<PluginEventListener> PLUGIN_LISTENERS = new ArrayList<>();
@ -543,6 +543,9 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new CusDemandAction());
shortCuts.add(new CenterAction());
shortCuts.add(new SignAction());
if (Locale.TAIWAN.equals(GeneralContext.getLocale())) {
shortCuts.add(new FacebookFansAction());
}
return shortCuts.toArray(new ShortCut[shortCuts.size()]);
}

31
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.analysis.cloud.DateUtils;
import com.fr.design.dialog.UIDialog;
import com.fr.design.editor.editor.DateEditor;
import com.fr.design.gui.date.UIDatePicker;
@ -14,6 +15,7 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -45,7 +47,7 @@ public class FileVersionDialog extends UIDialog {
upBox.setBorder(VcsHelper.EMPTY_BORDER);
upBox.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_buildTime") + " "));
upBox.add(Box.createHorizontalGlue());
dateEditor = new DateEditor(new Date(), true, StringUtils.EMPTY, UIDatePicker.STYLE_CN_DATE1);
dateEditor = new VcsDateEditor(new Date(), true, StringUtils.EMPTY, UIDatePicker.STYLE_CN_DATE1);
upBox.add(dateEditor);
Box downBox = Box.createHorizontalBox();
downBox.setBorder(VcsHelper.EMPTY_BORDER);
@ -62,8 +64,10 @@ public class FileVersionDialog extends UIDialog {
@Override
public void actionPerformed(ActionEvent e) {
FileVersionDialog.this.setVisible(false);
Date date = dateEditor.getValue();
List<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, date, new Date(date.getTime() + DELAY), textField.getText());
Date editorDate = dateEditor.getValue();
Date start = editorDate == null ? new Date(0) : editorDate;
Date end = editorDate == null ? DateUtils.getLastHour() : new Date(start.getTime() + DELAY);
List<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, start, end, textField.getText());
FileVersionTable.getInstance().updateModel(1, vcsEntities);
}
@ -74,16 +78,29 @@ public class FileVersionDialog extends UIDialog {
FileVersionDialog.this.setVisible(false);
}
});
VcsLabel resetLabel = new VcsLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_resetValue"), VcsHelper.COPY_VERSION_BTN_COLOR);
resetLabel.setBorder(BorderFactory.createEmptyBorder(10, 160, 0, 10));
resetLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dateEditor.setValue(null);
textField.setText(null);
FileVersionDialog.this.repaint();
}
});
panel.add(upBox, BorderLayout.NORTH);
panel.add(downBox, BorderLayout.CENTER);
panel.add(buttonPane, BorderLayout.SOUTH);
add(panel);
setSize(new Dimension(230, 105));
centerWindow(this);
JPanel filterPane = new JPanel(new BorderLayout());
filterPane.add(resetLabel, BorderLayout.NORTH);
filterPane.add(panel, BorderLayout.CENTER);
add(filterPane);
setSize(new Dimension(230, 125));
centerWindow(frame);
}
private void centerWindow(Window window) {
window.setLocation(0, 95);
this.setLocation(window.getX(), 95);
}

37
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsDateEditor.java

@ -0,0 +1,37 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.editor.editor.DateEditor;
import com.fr.log.FineLoggerFactory;
import java.text.ParseException;
import java.util.Date;
/**
* Created by XiaXiang on 2019/5/14.
*/
public class VcsDateEditor extends DateEditor {
private Date tempValue;
public VcsDateEditor(Date value, boolean format, String name, int dateFormat) {
super(value, format, name, dateFormat);
this.tempValue = value;
}
@Override
public Date getValue() {
if (tempValue == null) {
return null;
}
return super.getValue();
}
@Override
public void setValue(Date value) {
this.tempValue = value;
try {
getUiDatePicker().setSelectedDate(value);
} catch (ParseException parseException) {
FineLoggerFactory.getLogger().error(parseException.getMessage(), parseException);
}
}
}

32
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java

@ -0,0 +1,32 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
import java.awt.Color;
import java.awt.Graphics;
/**
* Created by XiaXiang on 2019/5/15.
*/
public class VcsLabel extends ActionLabel {
public VcsLabel(String text, Color color) {
super(text);
this.setForeground(color);
}
public void paintComponent(Graphics g) {
if (ui != null) {
Graphics scratchGraphics = (g == null) ? null : g.create();
try {
ui.update(scratchGraphics, this);
}
finally {
scratchGraphics.dispose();
}
}
}
}

9
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -52,6 +52,8 @@ public class ModernUIPane<T> extends BasicPane {
toolbar.add(openDebugButton);
UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload"));
toolbar.add(reloadButton);
UIButton closeButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Close_Window"));
toolbar.add(closeButton);
openDebugButton.addActionListener(new ActionListener() {
@Override
@ -66,6 +68,13 @@ public class ModernUIPane<T> extends BasicPane {
browser.reloadIgnoringCache();
}
});
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false);
}
});
BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222");
initializeBrowser();
add(new BrowserView(browser), BorderLayout.CENTER);

30
designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -10,6 +10,7 @@ import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.exe.GetInstalledPluginsExecutor;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
import com.fr.design.extra.exe.GetPluginFromStoreExecutor;
import com.fr.design.extra.exe.GetPluginPrefixExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
@ -107,6 +108,12 @@ public class UpmBridge {
callback.invoke(window, StringUtils.EMPTY);
}
@JSBridge
public void getPluginPrefix(final JSFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginPrefixExecutor());
task.execute();
}
/**
* 在线获取插件分类
*
@ -403,4 +410,27 @@ public class UpmBridge {
FineLoggerFactory.getLogger().info(e.getMessage());
}
}
/**
* 使用系统浏览器打开网页
* @param url 要打开的网页
*/
@JSBridge
public void openShopUrlAtWebBrowser(String url) {
if (Desktop.isDesktopSupported()) {
try {
//创建一个URI实例,注意不是URL
URI uri = URI.create(url);
//获取当前系统桌面扩展
Desktop desktop = Desktop.getDesktop();
//判断系统桌面是否支持要执行的功能
if (desktop.isSupported(Desktop.Action.BROWSE)) {
//获取系统默认浏览器打开链接
desktop.browse(uri);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}

39
designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseComponent.java

@ -0,0 +1,39 @@
package com.fr.design.upm.database;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
import com.fr.web.struct.impl.FineUI;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniverseDatabaseComponent extends AssembleComponent {
public static final UniverseDatabaseComponent KEY = new UniverseDatabaseComponent();
private UniverseDatabaseComponent() {
}
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("/com/fr/design/upm/database/database.js");
}
@Override
public StylePath style(RequestClient req) {
return StylePath.EMPTY;
}
@Override
public Atom[] refer() {
return new Atom[]{
FineUI.KEY
};
}
}

32
designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseDialog.java

@ -0,0 +1,32 @@
package com.fr.design.upm.database;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniverseDatabaseDialog extends UIDialog {
public UniverseDatabaseDialog(Frame frame, BasicPane pane) {
super(frame);
setUndecorated(true);
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(new Dimension(800, 500));
GUICoreUtils.centerWindow(this);
setResizable(false);
}
@Override
public void checkValid() throws Exception {
}
}

36
designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseOpener.java

@ -0,0 +1,36 @@
package com.fr.design.upm.database;
import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext;
import javax.swing.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniverseDatabaseOpener {
private static UIDialog dialog = null;
public static UIDialog getDialog() {
return dialog;
}
public static void showUniverseDatabaseDialog() {
UniverseDatabasePane upmPane = new UniverseDatabasePane();
if (dialog == null) {
dialog = new UniverseDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
}
public static void closeWindow() {
if (dialog != null) {
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setVisible(false);
dialog = null;
}
}
}

38
designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabasePane.java

@ -0,0 +1,38 @@
package com.fr.design.upm.database;
import com.fr.design.dialog.BasicPane;
import com.fr.design.ui.ModernUIPane;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniverseDatabasePane extends BasicPane {
private ModernUIPane<Object> modernUIPane;
@Override
protected String title4PopupWindow() {
return "Database";
}
public UniverseDatabasePane() {
setLayout(new BorderLayout());
modernUIPane = new ModernUIPane.Builder<Object>()
.withComponent(UniverseDatabaseComponent.KEY)
.prepare(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
}
})
.build();
add(modernUIPane, BorderLayout.CENTER);
}
}

BIN
designer-base/src/main/resources/com/fr/design/images/bbs/facebook.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

57
designer-base/src/main/resources/com/fr/design/upm/database/database.js

@ -0,0 +1,57 @@
window.addEventListener("load", function (ev) {
var combo1 = BI.createWidget({
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
text: "选项1",
width: 300,
items: [
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项1",
value: 1
},
text: "选项1",
value: 1,
lgap: 10
},
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项2",
value: 2
},
lgap: 10,
text: "选项2",
value: 2
},
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项3",
value: 3
},
lgap: 10,
text: "选项3",
value: 3
}
]
}
]
});
BI.createWidget({
type:"bi.absolute",
element: "body",
items: [{
el: combo1,
left: 100,
top: 100
}]
});
});

2
designer-realize/src/main/java/com/fr/start/SplashContext.java

@ -167,7 +167,7 @@ public class SplashContext {
private static String getSplashPath() {
Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
if (Locale.US.equals(locale) || Locale.KOREA.equals(locale)) {
if (Locale.US.equals(locale) || Locale.KOREA.equals(locale) || Locale.TAIWAN.equals(locale)) {
return "/com/fr/design/images/splash_10_en.gif";
} else if (Locale.JAPAN.equals(locale)) {
return "/com/fr/design/images/splash_10_jp.gif";

Loading…
Cancel
Save