Browse Source

REPORT-16346 优化一些UI上突出的一些重复创建的界面

research/11.0
vito 5 years ago
parent
commit
1261ddbaba
  1. 2
      designer-base/src/main/java/com/fr/design/DesignState.java
  2. 65
      designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java
  3. 20
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  4. 104
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  5. 10
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  6. 39
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  7. 19
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionModel.java
  8. 73
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  9. 56
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  10. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  11. 22
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  12. 1
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  13. 9
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  14. 20
      designer-realize/src/main/java/com/fr/start/Designer.java
  15. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  16. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java

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

@ -1,9 +1,7 @@
package com.fr.design; package com.fr.design;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.workspace.WorkContext;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.

65
designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java

@ -10,38 +10,37 @@ import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
public class QuestionAction extends UpdateAction public class QuestionAction extends UpdateAction {
{
public QuestionAction() {
public QuestionAction() this.setMenuKeySet(QUESTIONS);
{ this.setMenuKeySet(QUESTIONS); this.setName(getMenuKeySet().getMenuName());
this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/question.png"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/question.png"));
}
}
@Override
@Override public void actionPerformed(ActionEvent arg0) {
public void actionPerformed(ActionEvent arg0) String url = CloudCenter.getInstance().acquireUrlByKind("bbs.questions");
{ BrowseUtils.browser(url);
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.questions"); }
BrowseUtils.browser(url);
} public static final MenuKeySet QUESTIONS = new MenuKeySet() {
public static final MenuKeySet QUESTIONS = new MenuKeySet() { @Override
@Override public char getMnemonic() {
public char getMnemonic() { return 'Q';
return 'Q'; }
}
@Override
@Override public String getMenuName() {
public String getMenuName() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Questions");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Questions"); }
}
@Override
@Override public KeyStroke getKeyStroke() {
public KeyStroke getKeyStroke() { return null;
return null; }
} };
};
} }

20
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -1,12 +1,10 @@
package com.fr.design.gui.iprogressbar; package com.fr.design.gui.iprogressbar;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -19,7 +17,7 @@ import java.awt.Frame;
/** /**
* 加载进度弹窗 * 加载进度弹窗
*/ */
public class ProgressDialog extends UIDialog { public class ProgressDialog extends JDialog {
private JProgressBar progressBar; private JProgressBar progressBar;
private JDialog centerDialog; private JDialog centerDialog;
private JLabel text; private JLabel text;
@ -47,6 +45,7 @@ public class ProgressDialog extends UIDialog {
progressBar.setBorderPainted(false); progressBar.setBorderPainted(false);
progressBar.setOpaque(false); progressBar.setOpaque(false);
progressBar.setBorder(null); progressBar.setBorder(null);
progressBar.setMaximum(1000);
panel.add(progressBar, BorderLayout.CENTER); panel.add(progressBar, BorderLayout.CENTER);
text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER); text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER);
FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334)); FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334));
@ -54,12 +53,6 @@ public class ProgressDialog extends UIDialog {
panel.add(text, BorderLayout.SOUTH); panel.add(text, BorderLayout.SOUTH);
panel.setVisible(true); panel.setVisible(true);
centerDialog.getContentPane().add(panel); centerDialog.getContentPane().add(panel);
}
@Override
public void checkValid() throws Exception {
} }
@Override @Override
@ -72,11 +65,20 @@ public class ProgressDialog extends UIDialog {
progressBar.setValue(value); progressBar.setValue(value);
} }
public void setProgressMaximum(int value) {
progressBar.setMaximum(value);
}
public int getProgressMaximum() {
return progressBar.getMaximum();
}
@Override @Override
public void dispose() { public void dispose() {
centerDialog.dispose(); centerDialog.dispose();
super.dispose(); super.dispose();
} }
public void updateLoadingText(String text) { public void updateLoadingText(String text) {
this.text.setText(text); this.text.setText(text);
} }

104
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -63,6 +63,7 @@ import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -169,6 +170,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private WindowAdapter windowAdapter = new WindowAdapter() { private WindowAdapter windowAdapter = new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) { public void windowOpened(WindowEvent e) {
} }
@ -194,6 +196,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private JComponent closeButton = new JComponent() { private JComponent closeButton = new JComponent() {
@Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND); g.setColor(UIConstants.NORMAL_BACKGROUND);
@ -205,6 +208,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private MouseListener closeMouseListener = new MouseAdapter() { private MouseListener closeMouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
closeMode = UIConstants.CLOSE_PRESS_AUTHORITY; closeMode = UIConstants.CLOSE_PRESS_AUTHORITY;
@ -212,6 +216,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint(); closeButton.repaint();
} }
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
closeMode = UIConstants.CLOSE_OF_AUTHORITY; closeMode = UIConstants.CLOSE_OF_AUTHORITY;
@ -219,6 +224,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint(); closeButton.repaint();
} }
@Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY; closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
@ -226,12 +232,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint(); closeButton.repaint();
} }
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (DesignModeContext.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
closeAuthorityEditing(); closeAuthorityEditing();
} }
} }
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY; closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
@ -255,6 +263,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.setLayout(new BorderLayout()); basePane.setLayout(new BorderLayout());
toolbarPane = new JPanel() { toolbarPane = new JPanel() {
@Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
@ -266,7 +275,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST); eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST);
eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eastCenterPane.add(combineUp = combineUpTooBar(null), BorderLayout.NORTH); combineUpTooBar();
eastCenterPane.add(combineUp, BorderLayout.NORTH);
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST); panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST);
panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER);
@ -300,6 +310,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.addComponentListener(new ComponentAdapter() { this.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
reCalculateFrameSize(); reCalculateFrameSize();
@ -316,14 +327,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
initMenuPane(); initMenuPane();
this.progressDialog = new ProgressDialog(this); this.progressDialog = new ProgressDialog(this);
} }
public void resizeFrame() { public void resizeFrame() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite();
reCalculateFrameSize(); reCalculateFrameSize();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize();
} }
public void closeAuthorityEditing() { public void closeAuthorityEditing() {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
WestRegionContainerPane.getInstance().replaceDownPane( WestRegionContainerPane.getInstance().replaceDownPane(
@ -333,7 +344,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint(); needToAddAuhtorityPaint();
refreshDottedLine(); refreshDottedLine();
fireAuthorityStateToNomal(); fireAuthorityStateToNormal();
EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this); EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this);
} }
@ -603,13 +614,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 退出权限编辑时将所有的做过权限编辑的状态作为一个状态赋给报报表主体 * 退出权限编辑时将所有的做过权限编辑的状态作为一个状态赋给报报表主体
*/ */
private void fireAuthorityStateToNomal() { private void fireAuthorityStateToNormal() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) { for (JTemplate<?, ?> jTemplate : opendedTemplate) {
// 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表 // 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表
if (opendedTemplate.get(i).isDoSomethingInAuthority()) { if (jTemplate.isDoSomethingInAuthority()) {
opendedTemplate.get(i).fireAuthorityStateToNomal(); jTemplate.fireAuthorityStateToNomal();
} }
} }
} }
@ -619,31 +630,47 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.closeMode = closeMode; this.closeMode = closeMode;
} }
private UIToolbar combineUpTooBar(JComponent[] toolbar4Form) { /**
* 创建上工具栏
*/
private void combineUpTooBar() {
combineUp = new UIToolbar(FlowLayout.LEFT); combineUp = new UIToolbar(FlowLayout.LEFT);
combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR));
combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2));
setUpUpToolBar(null);
}
/**
* 重置上工具栏
*/
private void resetCombineUpTooBar(JComponent[] toolbar4Form) {
combineUp.removeAll();
setUpUpToolBar(toolbar4Form);
}
/**
* 填充上工具栏的中的工具
*
* @param toolbar4Form 目标组件
*/
private void setUpUpToolBar(@Nullable JComponent[] toolbar4Form) {
UIButton[] fixButtons = ad.createUp(); UIButton[] fixButtons = ad.createUp();
for (int i = 0; i < fixButtons.length; i++) { for (UIButton fixButton : fixButtons) {
combineUp.add(fixButtons[i]); combineUp.add(fixButton);
} }
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
combineUp.addSeparator(new Dimension(2, 16)); combineUp.addSeparator(new Dimension(2, 16));
if (toolbar4Form != null) { if (toolbar4Form != null) {
for (int i = 0; i < toolbar4Form.length; i++) { for (JComponent jComponent : toolbar4Form) {
combineUp.add(toolbar4Form[i]); combineUp.add(jComponent);
} }
} }
} }
//添加分享按钮 //添加分享按钮
addShareButton(); addShareButton();
//添加插件中的按钮 //添加插件中的按钮
addExtraButtons(); addExtraButtons();
return combineUp;
} }
private void addExtraButtons() { private void addExtraButtons() {
@ -655,8 +682,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
UIButton[] extraButtons = jt.createExtraButtons(); UIButton[] extraButtons = jt.createExtraButtons();
for (int i = 0; i < extraButtons.length; i++) { for (UIButton extraButton : extraButtons) {
combineUp.add(extraButtons[i]); combineUp.add(extraButton);
} }
if (extraButtons.length > 0) { if (extraButtons.length > 0) {
combineUp.addSeparator(new Dimension(2, 16)); combineUp.addSeparator(new Dimension(2, 16));
@ -672,8 +699,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
combineUp.addSeparator(new Dimension(2, 16)); combineUp.addSeparator(new Dimension(2, 16));
UIButton[] shareButtons = jt.createShareButton(); UIButton[] shareButtons = jt.createShareButton();
for (int i = 0; i < shareButtons.length; i++) { for (UIButton shareButton : shareButtons) {
combineUp.add(shareButtons[i]); combineUp.add(shareButton);
} }
} }
@ -710,25 +737,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
DesignState designState = new DesignState(plus); DesignState designState = new DesignState(plus);
MenuManager.getInstance().setMenus4Designer(designState); MenuManager.getInstance().setMenus4Designer(designState);
if (menuBar != null) { if (menuBar == null) {
menuPane.remove(menuBar); menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER);
} } else {
menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER); ad.resetJMenuBar(menuBar, plus);
if (combineUp != null) {
eastCenterPane.remove(combineUp);
combineUp = null;
} }
// 保存撤销那些按钮的面板 resetCombineUpTooBar(ad.resetUpToolBar(plus));
eastCenterPane.add(combineUp = combineUpTooBar(ad.resetUpToolBar(plus)), BorderLayout.NORTH);
if (toolbarComponent != null) {
toolbarPane.remove(toolbarComponent);
}
// 颜色,字体那些按钮的工具栏 // 颜色,字体那些按钮的工具栏
toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); if (toolbarComponent == null) {
toolbarPane.add(toolbarComponent = ad.resetToolBar(null, plus), BorderLayout.CENTER);
} else {
ad.resetToolBar(toolbarComponent, plus);
}
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();
this.validate(); this.validate();
@ -751,7 +773,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts();
for (ShortCut shortCut : extraShortCuts) { for (ShortCut shortCut : extraShortCuts) {
if (shortCut instanceof AbstractTemplateTreeShortCutProvider) { if (shortCut instanceof AbstractTemplateTreeShortCutProvider) {
((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing()); shortCut.notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing());
} }
} }
} }
@ -949,6 +971,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* *
* @param e 事件 * @param e 事件
*/ */
@Override
public void targetModified(TargetModifiedEvent e) { public void targetModified(TargetModifiedEvent e) {
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();
@ -959,6 +982,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* *
* @param jt 模板 * @param jt 模板
*/ */
@Override
public void templateClosed(JTemplate<?, ?> jt) { public void templateClosed(JTemplate<?, ?> jt) {
} }
@ -968,6 +992,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* *
* @param jt 模板 * @param jt 模板
*/ */
@Override
public void templateOpened(JTemplate<?, ?> jt) { public void templateOpened(JTemplate<?, ?> jt) {
} }
@ -977,6 +1002,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* *
* @param jt 模板 * @param jt 模板
*/ */
@Override
public void templateSaved(JTemplate<?, ?> jt) { public void templateSaved(JTemplate<?, ?> jt) {
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();

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

@ -210,15 +210,17 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
/** /**
* 添加VcsAction * 添加VcsAction
*
* @param toolbarDef * @param toolbarDef
*/ */
private void addVcsAction(ToolBarDef toolbarDef) { private void addVcsAction(ToolBarDef toolbarDef) {
if (VcsHelper.getInstance().needInit()) { if (VcsHelper.getInstance().needInit()) {
vcsAction = new VcsAction(); vcsAction = new VcsAction();
if (FineClusterConfig.getInstance().isCluster()) {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote")); if (WorkContext.getCurrent().isLocal()) {
} else {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title")); vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title"));
} else {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote"));
} }
toolbarDef.addShortCut(vcsAction); toolbarDef.addShortCut(vcsAction);
@ -367,8 +369,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
if (WorkContext.getCurrent() != null) { if (WorkContext.getCurrent() != null) {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
//当前环境为远程环境时 //当前环境为远程环境时

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

@ -47,20 +47,20 @@ import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.imenu.UIMenuBar;
import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.mainframe.ToolBarNewTemplatePane;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleAction; import com.fr.general.locale.LocaleAction;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.context.PluginRuntime;
@ -72,6 +72,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.start.OemHandler; import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.Nullable;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JMenuBar; import javax.swing.JMenuBar;
@ -197,14 +198,30 @@ public abstract class ToolBarMenuDock {
*/ */
public final JMenuBar createJMenuBar(ToolBarMenuDockPlus plus) { public final JMenuBar createJMenuBar(ToolBarMenuDockPlus plus) {
UIMenuBar jMenuBar = new UIMenuBar() { UIMenuBar jMenuBar = new UIMenuBar() {
private Dimension dim;
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); if (dim == null) {
dim.height = MENUBAR_HEIGHT; dim = super.getPreferredSize();
dim.height = MENUBAR_HEIGHT;
}
return dim; return dim;
} }
}; };
resetJMenuBar(jMenuBar, plus);
return jMenuBar;
}
/**
* 重置菜单栏
*
* @param jMenuBar 当前菜单栏
* @param plus 对象
*/
public final void resetJMenuBar(JMenuBar jMenuBar, ToolBarMenuDockPlus plus) {
jMenuBar.removeAll();
this.menus = menus(plus); this.menus = menus(plus);
try { try {
OemProcessor oemProcessor = OemHandler.findOem(); OemProcessor oemProcessor = OemHandler.findOem();
@ -218,13 +235,12 @@ public abstract class ToolBarMenuDock {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
this.menus = menus(plus); this.menus = menus(plus);
} }
for (int i = 0; i < menus.length; i++) { for (MenuDef menu : menus) {
menus[i].setHasRecMenu(true); menu.setHasRecMenu(true);
UIMenu subMenu = menus[i].createJMenu(); UIMenu subMenu = menu.createJMenu();
jMenuBar.add(subMenu); jMenuBar.add(subMenu);
menus[i].updateMenu(); menu.updateMenu();
} }
return jMenuBar;
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -585,7 +601,7 @@ public abstract class ToolBarMenuDock {
* @param plus 对象 * @param plus 对象
* @return 工具栏 * @return 工具栏
*/ */
public JComponent resetToolBar(JComponent toolbarComponent, ToolBarMenuDockPlus plus) { public JComponent resetToolBar(@Nullable JComponent toolbarComponent, ToolBarMenuDockPlus plus) {
ToolBarDef[] plusToolBarDefs = plus.toolbars4Target(); ToolBarDef[] plusToolBarDefs = plus.toolbars4Target();
UIToolbar toolBar; UIToolbar toolBar;
if (toolbarComponent instanceof UIToolbar) { if (toolbarComponent instanceof UIToolbar) {
@ -599,8 +615,7 @@ public abstract class ToolBarMenuDock {
toolBarDef = new ToolBarDef(); toolBarDef = new ToolBarDef();
if (plusToolBarDefs != null) { if (plusToolBarDefs != null) {
for (int i = 0; i < plusToolBarDefs.length; i++) { for (ToolBarDef def : plusToolBarDefs) {
ToolBarDef def = plusToolBarDefs[i];
for (int di = 0, dlen = def.getShortCutCount(); di < dlen; di++) { for (int di = 0, dlen = def.getShortCutCount(); di < dlen; di++) {
toolBarDef.addShortCut(def.getShortCut(di)); toolBarDef.addShortCut(def.getShortCut(di));
} }

19
designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionModel.java

@ -32,15 +32,22 @@ public class UpdateActionModel {
* @param action * @param action
*/ */
private void setSearchKey(String parentName, UpdateAction action) { private void setSearchKey(String parentName, UpdateAction action) {
StringBuffer buffer = new StringBuffer();
if (actionName == null) { if (actionName == null) {
return; return;
} }
buffer.append(parentName).append(SEPARATOR).append(PinyinHelper.convertToPinyinString(parentName, "", PinyinFormat.WITHOUT_TONE)) String buffer = parentName +
.append(SEPARATOR).append(PinyinHelper.getShortPinyin(parentName)).append(SEPARATOR) SEPARATOR +
.append(actionName).append(SEPARATOR).append(PinyinHelper.convertToPinyinString(actionName, "", PinyinFormat.WITHOUT_TONE)) PinyinHelper.convertToPinyinString(parentName, "", PinyinFormat.WITHOUT_TONE) +
.append(SEPARATOR).append(PinyinHelper.getShortPinyin(actionName)).append(action.getSearchText()); SEPARATOR +
this.searchKey = buffer.toString().toLowerCase(); PinyinHelper.getShortPinyin(parentName) +
SEPARATOR +
actionName +
SEPARATOR +
PinyinHelper.convertToPinyinString(actionName, "", PinyinFormat.WITHOUT_TONE) +
SEPARATOR +
PinyinHelper.getShortPinyin(actionName) +
action.getSearchText();
this.searchKey = buffer.toLowerCase();
} }
/** /**

73
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -5,24 +5,27 @@ package com.fr.start;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleEvent;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import javax.swing.SwingUtilities;
import java.awt.Window; import java.awt.Window;
import java.io.File; import java.io.File;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -31,17 +34,17 @@ import java.lang.reflect.Method;
* The main class of Report Designer. * The main class of Report Designer.
*/ */
public abstract class BaseDesigner extends ToolBarMenuDock { public abstract class BaseDesigner extends ToolBarMenuDock {
private static final int LOAD_TREE_MAXNUM = 10; private static final int LOAD_TREE_MAXNUM = 10;
private final String[] args; private final String[] args;
public BaseDesigner(String[] args) { public BaseDesigner(String[] args) {
this.args = args; this.args = args;
init(); init();
} }
private void init() { private void init() {
// 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到 // 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到
DesignUtils.initLookAndFeel(); DesignUtils.initLookAndFeel();
@ -49,27 +52,60 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
createDesignerFrame(); createDesignerFrame();
} }
public void show() { public void show() {
collectUserInformation(); if (DesignerLaunchStatus.getStatus() == DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
showDesignerFrame(false); refreshTemplateTree();
} else {
EventDispatcher.listen(DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
refreshTemplateTree();
}
});
}
});
}
EventDispatcher.listen(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// 打开上次的文件
showDesignerFrame(false);
DesignerContext.getDesignerFrame().resizeFrame();
EventDispatcher.asyncFire(DesignerLaunchStatus.OPEN_LAST_FILE_COMPLETE);
}
});
}
});
EventDispatcher.listen(DesignerLaunchStatus.OPEN_LAST_FILE_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
collectUserInformation();
}
});
// 启动界面
DesignerContext.getDesignerFrame().setVisible(true);
}
private void refreshTemplateTree() {
//TODO: 2019-06-14 这里有啥作用? //TODO: 2019-06-14 这里有啥作用?
DesignerContext.getDesignerFrame().refreshEnv(); DesignerContext.getDesignerFrame().refreshEnv();
for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) { for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) {
TemplateTreePane.getInstance().getTemplateFileTree().refresh(); TemplateTreePane.getInstance().getTemplateFileTree().refresh();
} }
DesignerContext.getDesignerFrame().setVisible(true);
DesignerContext.getDesignerFrame().resizeFrame();
} }
private void createDesignerFrame() { private void createDesignerFrame() {
new DesignerFrame(this); new DesignerFrame(this);
} }
private void showDesignerFrame(boolean isException) { private void showDesignerFrame(boolean isException) {
try { try {
FILE file = null; FILE file = null;
@ -94,8 +130,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
} }
} }
} else { } else {
file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX + DesignerEnvManager.getEnvManager().getLastOpenFile());
+ DesignerEnvManager.getEnvManager().getLastOpenFile());
} }
DesignerFrame df = DesignerContext.getDesignerFrame(); DesignerFrame df = DesignerContext.getDesignerFrame();
isException = openFile(df, isException, file); isException = openFile(df, isException, file);
@ -134,7 +169,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
df.getSelectedJTemplate().requestGridFocus(); df.getSelectedJTemplate().requestGridFocus();
return isException; return isException;
} }
private void enableFullScreenMode(Window window) { private void enableFullScreenMode(Window window) {
String className = "com.apple.eawt.FullScreenUtilities"; String className = "com.apple.eawt.FullScreenUtilities";
String methodName = "setWindowCanFullScreen"; String methodName = "setWindowCanFullScreen";

56
designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

@ -1,25 +1,32 @@
package com.fr.start.server; package com.fr.start.server;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.iprogressbar.ProgressDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/** /**
* 内置服务器启动监视器 * 内置服务器启动监视器
* Created by zack on 2018/8/21. *
* @author zack
* @date 2018/8/21
*/ */
public class FineEmbedServerMonitor { public class FineEmbedServerMonitor {
private int progress; private int progress;
private static final int COMPLETE = 100;//启动完成 private static final int STEP = 1;
private static final int STEP = 5;//随便设置一个假的进度条 /**
private static final int STEP_HEARTBEAT = 2000;//2秒更新进度 * 40ms更新进度
*/
private static final int STEP_HEARTBEAT = 40;
private static volatile FineEmbedServerMonitor monitor; private static volatile FineEmbedServerMonitor monitor;
private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog();
private FineEmbedServerMonitor() { private FineEmbedServerMonitor() {
} }
@ -29,7 +36,7 @@ public class FineEmbedServerMonitor {
@Override @Override
public void on(Event event, Null aNull) { public void on(Event event, Null aNull) {
getInstance().reset(); getInstance().reset();
DesignerContext.getDesignerFrame().hideProgressDialog(); DesignerContext.getDesignerFrame().disposeProgressDialog();
} }
}); });
} }
@ -46,7 +53,7 @@ public class FineEmbedServerMonitor {
} }
public int getProgress() { public int getProgress() {
if (progress == COMPLETE) { if (progress == progressBar.getProgressMaximum()) {
return progress; return progress;
} else { } else {
progress += STEP; progress += STEP;
@ -55,7 +62,7 @@ public class FineEmbedServerMonitor {
} }
public void setComplete() { public void setComplete() {
this.progress = COMPLETE; this.progress = progressBar.getProgressMaximum();
} }
public void reset() { public void reset() {
@ -63,29 +70,28 @@ public class FineEmbedServerMonitor {
} }
public boolean isComplete() { public boolean isComplete() {
return this.progress == COMPLETE; return this.progress >= progressBar.getProgressMaximum();
} }
public void monitor() { public void monitor() {
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("FineEmbedServerMonitor")); final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1,
service.submit(new Runnable() { new NamedThreadFactory("FineEmbedServerMonitor"));
scheduler.scheduleAtFixedRate(new Runnable() {
@Override @Override
public void run() { public void run() {
while (!isComplete()) { if (isComplete()) {
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) { scheduler.shutdown();
DesignerContext.getDesignerFrame().showProgressDialog(); DesignerContext.getDesignerFrame().hideProgressDialog();
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server")); return;
} }
DesignerContext.getDesignerFrame().updateProgress(getProgress()); if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
try { DesignerContext.getDesignerFrame().showProgressDialog();
Thread.sleep(STEP_HEARTBEAT); DesignerContext.getDesignerFrame().getProgressDialog()
} catch (InterruptedException ignore) { .updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"));
}
} }
DesignerContext.getDesignerFrame().hideProgressDialog(); DesignerContext.getDesignerFrame().updateProgress(getProgress());
} }
}); }, 0, STEP_HEARTBEAT, TimeUnit.MILLISECONDS);
service.shutdown();
} }
} }

2
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -188,7 +188,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
value = value > SHOWVALMAX ? SHOWVALMAX : value; value = value > SHOWVALMAX ? SHOWVALMAX : value;
value = value < SHOWVALMIN ? SHOWVALMIN : value; value = value < SHOWVALMIN ? SHOWVALMIN : value;
JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jf.resolution = (int) value; jf.setResolution((int) value);
jf.getFormDesign().setResolution((int) value); jf.getFormDesign().setResolution((int) value);
jf.getFormDesign().getArea().resolution = (int) value; jf.getFormDesign().getArea().resolution = (int) value;
reCalculateRoot(value, true); reCalculateRoot(value, true);

22
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -117,6 +117,7 @@ import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.JScrollBar; import javax.swing.JScrollBar;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.Adjustable; import java.awt.Adjustable;
import java.awt.Dimension; import java.awt.Dimension;
@ -527,7 +528,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
try { try {
//旧选中内容编辑器释放模板对象 //旧选中内容编辑器释放模板对象
QuickEditor editor = this.getCurrentEditor(); QuickEditor editor = this.getCurrentEditor();
if(editor != null){ if (editor != null) {
editor.release(); editor.release();
} }
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
@ -853,15 +854,20 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
*/ */
public void fireSelectionChangeListener() { public void fireSelectionChangeListener() {
// Guaranteed to return a non-null array // Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList(); final Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying SwingUtilities.invokeLater(new Runnable() {
// those that are interested in this event @Override
for (int i = listeners.length - 2; i >= 0; i -= 2) { public void run() {
if (listeners[i] == SelectionListener.class) { // Process the listeners last to first, notifying
((SelectionListener) listeners[i + 1]).selectionChanged(new SelectionEvent(this)); // those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == SelectionListener.class) {
((SelectionListener) listeners[i + 1]).selectionChanged(new SelectionEvent(this));
}
}
} }
} });
} }
/** /**

1
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -90,7 +90,6 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet; import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.module.Module; import com.fr.stable.module.Module;

9
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.errorinfo; package com.fr.design.mainframe.errorinfo;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.mainframe.SiteCenterToken; import com.fr.design.mainframe.SiteCenterToken;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.CommonIOUtils; import com.fr.general.CommonIOUtils;
@ -24,6 +25,8 @@ import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* Created by Administrator on 2017/7/24 0024. * Created by Administrator on 2017/7/24 0024.
@ -81,8 +84,8 @@ public class ErrorInfoUploader {
return; return;
} }
ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("ErrorInfoUploader"));
Thread updateThread = new Thread(new Runnable() { es.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
String localCacheFilePath = StableUtils.pathJoin(ProductConstants.getEnvHome(), "solution", "solution.zip"); String localCacheFilePath = StableUtils.pathJoin(ProductConstants.getEnvHome(), "solution", "solution.zip");
@ -92,7 +95,7 @@ public class ErrorInfoUploader {
} }
} }
}); });
updateThread.start(); es.shutdown();
} }
private void downloadSolution(File localCacheZip) { private void downloadSolution(File localCacheZip) {

20
designer-realize/src/main/java/com/fr/start/Designer.java

@ -82,6 +82,7 @@ public class Designer extends BaseDesigner {
private UIButton saveButton; private UIButton saveButton;
private UIButton undo; private UIButton undo;
private UIButton redo; private UIButton redo;
private UIButton[] upToolBar;
private UIPreviewButton run; private UIPreviewButton run;
public Designer(String[] args) { public Designer(String[] args) {
@ -94,7 +95,7 @@ public class Designer extends BaseDesigner {
* @param args 参数 * @param args 参数
*/ */
public static void main(String[] args) { public static void main(String[] args) {
StopWatch watch = new StopWatch(); StopWatch watch = new StopWatch();
watch.start(); watch.start();
//启动运行时 //启动运行时
@ -210,11 +211,17 @@ public class Designer extends BaseDesigner {
*/ */
@Override @Override
public UIButton[] createUp() { public UIButton[] createUp() {
return new UIButton[]{createSaveButton(), createUndoButton(), createRedoButton()}; if (upToolBar == null) {
createSaveButton();
createUndoButton();
createRedoButton();
return upToolBar = new UIButton[]{saveButton, undo, redo};
}
return upToolBar;
} }
private UIButton createSaveButton() { private void createSaveButton() {
saveButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/save.png")); saveButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/save.png"));
saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName()); saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName());
saveButton.set4ToolbarButton(); saveButton.set4ToolbarButton();
@ -227,11 +234,10 @@ public class Designer extends BaseDesigner {
jt.requestFocus(); jt.requestFocus();
} }
}); });
return saveButton;
} }
private UIButton createUndoButton() { private void createUndoButton() {
undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png")); undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png"));
undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName());
undo.set4ToolbarButton(); undo.set4ToolbarButton();
@ -244,10 +250,9 @@ public class Designer extends BaseDesigner {
} }
} }
}); });
return undo;
} }
private UIButton createRedoButton() { private void createRedoButton() {
redo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/redo.png")); redo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/redo.png"));
redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName()); redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName());
redo.set4ToolbarButton(); redo.set4ToolbarButton();
@ -260,7 +265,6 @@ public class Designer extends BaseDesigner {
} }
} }
}); });
return redo;
} }
private void createRunButton(UILargeToolbar largeToolbar) { private void createRunButton(UILargeToolbar largeToolbar) {

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

@ -16,12 +16,10 @@ public class DesignerStartup extends Activator {
@Override @Override
@Metrics @Metrics
public void start() { public void start() {
startSub(PreStartActivator.class); startSub(PreStartActivator.class);
getSub("parallel").start(); getSub("parallel").start();
//designer模块启动好后,查看demo //designer模块启动好后,查看demo
browserDemo(); browserDemo();
startSub(DesignerShowActivator.class);
startSub(StartFinishActivator.class); startSub(StartFinishActivator.class);
FineRuntime.startFinish(); FineRuntime.startFinish();
} }

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

@ -6,7 +6,6 @@ import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
@ -22,7 +21,6 @@ public class DesignerWorkspaceActivator extends Activator {
public void start() { public void start() {
registerEnvListener(); registerEnvListener();
startServer(WorkContext.getCurrent());
} }
/** /**

Loading…
Cancel
Save