Browse Source

Merge branch 'feature/10.0' of ssh://code.fineres.com:7999/~tommy/design into feature/10.0

feature/10.0
kuangshuai 4 years ago
parent
commit
69446e23c9
  1. 18
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 26
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  3. 14
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  4. 1
      designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  6. 17
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  7. 6
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  8. 14
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  9. 25
      designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java
  10. 2
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  11. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  12. 20
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  13. 27
      designer-realize/src/main/java/com/fr/design/mainframe/TemplateLockedHandler.java
  14. 2
      designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java
  15. 24
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  16. 2
      designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java
  17. 2
      designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java
  18. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java

18
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -117,7 +117,7 @@ public class EnvChangeEntrance {
@Override @Override
public void show() { public void show() {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} }
}); });
return false; return false;
@ -155,7 +155,7 @@ public class EnvChangeEntrance {
public void show() { public void show() {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Error"), Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE, ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")); UIManager.getIcon("OptionPane.errorIcon"));
} }
@ -171,7 +171,7 @@ public class EnvChangeEntrance {
FineLoggerFactory.getLogger().error(exception.getMessage(), exception); FineLoggerFactory.getLogger().error(exception.getMessage(), exception);
strategy.showTip(() -> FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), strategy.showTip(() -> FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Error"), Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE, ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon"))); UIManager.getIcon("OptionPane.errorIcon")));
} }
@ -191,7 +191,7 @@ public class EnvChangeEntrance {
if (ComparatorUtils.equals(result, TestConnectionResult.AUTH_FAILED)) { if (ComparatorUtils.equals(result, TestConnectionResult.AUTH_FAILED)) {
strategy.showTip(() -> FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), strategy.showTip(() -> FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Error"), Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE, ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon"))); UIManager.getIcon("OptionPane.errorIcon")));
} else { } else {
@ -553,4 +553,14 @@ public class EnvChangeEntrance {
interface PopTip { interface PopTip {
void show(); void show();
} }
private static class SuccessPopTip implements PopTip {
@Override
public void show() {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Success"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
FineJOptionPane.INFORMATION_MESSAGE);
}
}
} }

26
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -6,7 +6,6 @@ import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist; import com.fr.data.api.StoreProcedureAssist;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.ForbiddenUpdateAction;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.TableDataCreatorProducer; import com.fr.design.data.datapane.TableDataCreatorProducer;
import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.datapane.TableDataNameObjectCreator;
@ -25,16 +24,20 @@ import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.gui.ibutton.UILockButton;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DockingView; import com.fr.design.mainframe.DockingView;
import com.fr.design.menu.LineSeparator; import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.util.HashSet;
import java.util.Set;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
@ -61,6 +64,16 @@ import java.util.Objects;
* Time: 16:23 * Time: 16:23
*/ */
public abstract class BasicTableDataTreePane extends DockingView implements ResponseDataSourceChange { public abstract class BasicTableDataTreePane extends DockingView implements ResponseDataSourceChange {
private static final Set<String> FORBIDDEN_SET = new HashSet<>();
static {
FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Edit"));
FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Remove"));
FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Preview"));
FORBIDDEN_SET.add(Toolkit.i18nText("Fine-Design_Basic_Action_Add"));
}
protected static final int PROCEDURE_NAME_INDEX = 4; protected static final int PROCEDURE_NAME_INDEX = 4;
protected static final int TEMPLATE_TABLE_DATA = 0; protected static final int TEMPLATE_TABLE_DATA = 0;
protected static final int SERVER_TABLE_DATA = 1; protected static final int SERVER_TABLE_DATA = 1;
@ -69,6 +82,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
protected UIHeadGroup buttonGroup; protected UIHeadGroup buttonGroup;
protected String[] allDSNames; protected String[] allDSNames;
protected ConnectionTableAction connectionTableAction; protected ConnectionTableAction connectionTableAction;
protected ToolBarDef toolbarDef;
private String type = ""; private String type = "";
@ -399,7 +413,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
return prefix + count; return prefix + count;
} }
protected class PreviewTableDataAction extends ForbiddenUpdateAction { protected class PreviewTableDataAction extends UpdateAction {
private TableDataTree dataTree; private TableDataTree dataTree;
public PreviewTableDataAction(TableDataTree dataTree) { public PreviewTableDataAction(TableDataTree dataTree) {
@ -482,4 +496,12 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
} }
public void refreshToolBar() {
toolbarDef.refreshToolBar(FORBIDDEN_SET);
}
public void checkEnable() {
}
} }

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

@ -1,12 +1,10 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.BaseUtils;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.TableDataSourceDependent; import com.fr.data.impl.TableDataSourceDependent;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.ForbiddenUpdateAction;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataTreePane;
@ -102,7 +100,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
removeAction = new RemoveAction(); removeAction = new RemoveAction();
previewTableDataAction = new PreviewTableDataAction(dataTree); previewTableDataAction = new PreviewTableDataAction(dataTree);
connectionTableAction = new ConnectionTableAction(); connectionTableAction = new ConnectionTableAction();
ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction); toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction, SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction);
UIToolbar toolBar = ToolBarDef.createJToolBar(); UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR));
@ -244,7 +242,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
dg.setVisible(true); dg.setVisible(true);
} }
private class EditAction extends ForbiddenUpdateAction { private class EditAction extends UpdateAction {
public EditAction() { public EditAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
this.setMnemonic('E'); this.setMnemonic('E');
@ -261,7 +259,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
} }
} }
private class RemoveAction extends ForbiddenUpdateAction { private class RemoveAction extends UpdateAction {
public RemoveAction() { public RemoveAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"));
@ -343,8 +341,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
dataTree.refresh(); dataTree.refresh();
} }
@Override
public void checkEnable() {
this.checkButtonEnabled();
}
public void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName) { public void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName) {
final NamePane nPanel = uPanel.asNamePane(); final NamePane nPanel = uPanel.asNamePane();

1
designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java

@ -25,6 +25,7 @@ public class ClassFilter implements Filter<String> {
static { static {
FILTER_SET.add("java.awt.image.BufferedImage"); FILTER_SET.add("java.awt.image.BufferedImage");
FILTER_SET.add("sun.awt.AppContext"); FILTER_SET.add("sun.awt.AppContext");
FILTER_SET.add("com.fr.poly.creator.ECBlockCreator");
} }
@Override @Override

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

@ -12,6 +12,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -821,6 +822,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
((UIToolbar ) toolbarComponent).refreshUIToolBar(); ((UIToolbar ) toolbarComponent).refreshUIToolBar();
} }
combineUp.refreshUIToolBar(); combineUp.refreshUIToolBar();
this.ad.updateEnable();
} }
public JComponent getToolbarComponent() { public JComponent getToolbarComponent() {

17
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -6,12 +6,14 @@ package com.fr.design.mainframe;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode; import com.fr.design.base.mode.DesignerMode;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
@ -97,6 +99,11 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
DesignerContext.getDesignerFrame().refreshUIToolBar(); DesignerContext.getDesignerFrame().refreshUIToolBar();
DesignerFrameFileDealerPane.getInstance().stateChange(); DesignerFrameFileDealerPane.getInstance().stateChange();
EastRegionContainerPane.getInstance().updateAllPropertyPane(); EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.refreshToolBar();
}
checkLoadingPane(); checkLoadingPane();
layeredPane.moveToFront(loadingPane); layeredPane.moveToFront(loadingPane);
} }
@ -110,12 +117,22 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
layeredPane.moveToFront(transparentPane); layeredPane.moveToFront(transparentPane);
DesignerContext.getDesignerFrame().refreshUIToolBar(); DesignerContext.getDesignerFrame().refreshUIToolBar();
EastRegionContainerPane.getInstance().updateAllPropertyPane(); EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.refreshToolBar();
}
} }
public void hideCover() { public void hideCover() {
transparentPane.stop(); transparentPane.stop();
layeredPane.moveToFront(component); layeredPane.moveToFront(component);
EastRegionContainerPane.getInstance().updateAllPropertyPane(); EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
BasicTableDataTreePane dataTreePane = (BasicTableDataTreePane) downPane;
dataTreePane.checkEnable();
}
} }
protected JTemplate<?, ?> getSelectedJTemplate() { protected JTemplate<?, ?> getSelectedJTemplate() {

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

@ -169,6 +169,12 @@ public abstract class ToolBarMenuDock {
} }
} }
public void updateEnable() {
for (int i = 0, count = ArrayUtils.getLength(menus); i < count; i++) {
menus[i].updateEnable();
}
}
/** /**
* 更新toolbar * 更新toolbar
*/ */

14
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -293,6 +293,10 @@ public class MenuDef extends ShortCut {
} }
} }
public void updateEnable() {
setEnabled(checkEnable());
}
/** /**
* 更新菜单 * 更新菜单
* *
@ -406,14 +410,13 @@ public class MenuDef extends ShortCut {
toolBar.add(this.createUIButton()); toolBar.add(this.createUIButton());
} }
private boolean checkEnable(JComponent component) { private boolean checkEnable() {
if (FORBIDDEN_SET.contains(component.getName())) { if (FORBIDDEN_SET.contains(this.getName())) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
boolean flag = true; boolean flag = true;
if (template != null) { if (template != null) {
flag = template.checkEnable(); flag = template.checkEnable();
} }
component.setEnabled(flag);
if (!flag) { if (!flag) {
return false; return false;
} }
@ -442,9 +445,6 @@ public class MenuDef extends ShortCut {
if (!(source instanceof JMenu)) { if (!(source instanceof JMenu)) {
return; return;
} }
if (!checkEnable(createJMenu())) {
return;
}
MenuDef.this.updateMenu(); MenuDef.this.updateMenu();
} }
}; };
@ -454,7 +454,7 @@ public class MenuDef extends ShortCut {
public void mouseReleased(MouseEvent evt) { public void mouseReleased(MouseEvent evt) {
Object source = evt.getSource(); Object source = evt.getSource();
UIButton button = (UIButton) source; UIButton button = (UIButton) source;
if (!checkEnable(button)) { if (!button.isEnabled()) {
return; return;
} }
if (isEastAttr) { if (isEastAttr) {

25
designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java

@ -1,7 +1,11 @@
package com.fr.design.menu; package com.fr.design.menu;
import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.mainframe.JTemplate;
import java.util.Set;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
@ -82,4 +86,25 @@ public class ToolBarDef {
} }
} }
public void refreshToolBar(Set<String> set) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
for (int i = 0; i < getShortCutCount(); i++) {
ShortCut shortCut = getShortCut(i);
if (shortCut instanceof MenuDef) {
MenuDef menuDef = (MenuDef) shortCut;
if (set.contains(menuDef.getName())) {
menuDef.setEnabled(template.checkEnable());
}
}
if (shortCut instanceof UpdateAction) {
UpdateAction updateAction = (UpdateAction) shortCut;
if (set.contains(updateAction.getName())) {
updateAction.setEnabled(template.checkEnable());
}
}
}
}
}
} }

2
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -235,6 +235,8 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
} else { } else {
container.add(creator, creator.toData().getWidgetName(),0); container.add(creator, creator.toData().getWidgetName(),0);
} }
//这边将组件添加到container后,需要做下layout处理,否则其内部的一些组件的宽高可能为0,从而导致在updateChildBounds的时候出现问题
LayoutUtils.layoutRootContainer(creator);
XWAbsoluteLayout layout = (XWAbsoluteLayout) container; XWAbsoluteLayout layout = (XWAbsoluteLayout) container;
layout.updateBoundsWidget(creator); layout.updateBoundsWidget(creator);
updateCreatorBackBound(); updateCreatorBackBound();

2
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -121,7 +121,7 @@ public class XWFitLayout extends XLayoutContainer {
* 更新组件的backupBound * 更新组件的backupBound
* 拖动滑块改变容器大小改变的是界面显示大小更新bound再次拖入或拉伸边框用到 * 拖动滑块改变容器大小改变的是界面显示大小更新bound再次拖入或拉伸边框用到
*/ */
private void updateCreatorsBackupBound() { public void updateCreatorsBackupBound() {
for (int i=0,size=this.getComponentCount(); i<size; i++) { for (int i=0,size=this.getComponentCount(); i<size; i++) {
Component comp = this.getComponent(i); Component comp = this.getComponent(i);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;

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

@ -36,6 +36,7 @@ import javax.swing.event.ChangeListener;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.Adjustable; import java.awt.Adjustable;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Insets; import java.awt.Insets;
@ -268,8 +269,26 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} }
} }
LayoutUtils.layoutContainer(root); LayoutUtils.layoutContainer(root);
updateCreatorsBackupBound(root);
} }
/**
* 给所有自适应布局内部的组件设置backupBounds
* @param creator
*/
private void updateCreatorsBackupBound(XCreator creator) {
if (creator.acceptType(XWFitLayout.class)) {
((XWFitLayout) creator).updateCreatorsBackupBound();
}
for (int i = 0; i < creator.getComponentCount(); i++) {
Component object = creator.getComponent(i);
if(object instanceof XCreator){
updateCreatorsBackupBound((XCreator) object);
}
}
}
//设置宽度的控件及响应事件 //设置宽度的控件及响应事件
private void addWidthPaneListener() { private void addWidthPaneListener() {
widthPane.addActionListener( widthPane.addActionListener(
@ -449,7 +468,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
layout.setContainerPercent(1.0); layout.setContainerPercent(1.0);
traverAndAdjust(layout, 0.0); traverAndAdjust(layout, 0.0);
layout.adjustCreatorsWhileSlide(0.0); layout.adjustCreatorsWhileSlide(0.0);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小 // 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
Dimension d = new Dimension(layout.getWidth(), layout.getHeight()); Dimension d = new Dimension(layout.getWidth(), layout.getHeight());

27
designer-realize/src/main/java/com/fr/design/mainframe/TemplateLockedHandler.java

@ -0,0 +1,27 @@
package com.fr.design.mainframe;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.util.UIUtil;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/5/14
*/
public class TemplateLockedHandler {
public static void generateTipAndRefresh() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine_Designer_Remote_Design_Locked_Message"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
FineJOptionPane.WARNING_MESSAGE);
DesignerFrameFileDealerPane.getInstance().refresh();
}
});
}
}

2
designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java

@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.mainframe.TemplateLockedHandler;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exception.DecryptTemplateException; import com.fr.exception.DecryptTemplateException;
@ -68,6 +69,7 @@ class CptApp extends AbstractWorkBookApp {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp); FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp);
} catch (TplLockedException exp) { } catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
TemplateLockedHandler.generateTipAndRefresh();
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Report_NS_Exception_ReadError") + file, exp); FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Report_NS_Exception_ReadError") + file, exp);
} }

24
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -10,6 +10,7 @@ import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.TemplateLockedHandler;
import com.fr.design.worker.open.OpenResult; import com.fr.design.worker.open.OpenResult;
import com.fr.design.worker.open.OpenWorker; import com.fr.design.worker.open.OpenWorker;
import com.fr.exception.DecryptTemplateException; import com.fr.exception.DecryptTemplateException;
@ -18,6 +19,7 @@ import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -57,20 +59,33 @@ class FormApp extends AbstractAppProvider {
@Override @Override
public JTemplate<?, ?> call() throws Exception { public JTemplate<?, ?> call() throws Exception {
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, return compatibleForm(result.getBaseBook(), result.getRef(), tplFile, classType);
new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class);
} }
}); });
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "..."); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "...");
worker.start(tplFile.getPath()); worker.start(tplFile.getPath());
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
if (result != null) { if (result != null) {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, return compatibleForm(result.getBaseBook(), new Parameter[0], tplFile, classType);
new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class);
} }
return emptyForm; return emptyForm;
} }
/**
* 兼容外部注册的frm类型
*
* @return
*/
private JTemplate<Form, ?> compatibleForm(Form form, Parameter[] parameters, FILE tplFile, HashMap<String, Class> classType) {
if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG).getName(), JForm.class)) {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{form, tplFile, parameters}, classType, BaseJForm.class);
} else {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{form, tplFile}, classType, BaseJForm.class);
}
}
@Override @Override
public Form asIOFile(FILE file) { public Form asIOFile(FILE file) {
@ -92,6 +107,7 @@ class FormApp extends AbstractAppProvider {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp); FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp);
} catch (TplLockedException exp) { } catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
TemplateLockedHandler.generateTipAndRefresh();
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error("Failed to generate frm from " + file, exp); FineLoggerFactory.getLogger().error("Failed to generate frm from " + file, exp);
return null; return null;

2
designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.app;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.TemplateLockedHandler;
import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.RemoteDesignPermissionDeniedException;
import com.fr.exception.TplLockedException; import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -30,6 +31,7 @@ class XlsApp extends AbstractWorkBookApp {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp); FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp);
} catch (TplLockedException exp) { } catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
TemplateLockedHandler.generateTipAndRefresh();
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error("Failed to generate xls from " + tplFile, exp); FineLoggerFactory.getLogger().error("Failed to generate xls from " + tplFile, exp);
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.app;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.TemplateLockedHandler;
import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.RemoteDesignPermissionDeniedException;
import com.fr.exception.TplLockedException; import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -31,6 +32,7 @@ class XlsxApp extends AbstractWorkBookApp {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp); FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp);
} catch (TplLockedException exp) { } catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
TemplateLockedHandler.generateTipAndRefresh();
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error("Failed to generate xlsx from " + tplFile, exp); FineLoggerFactory.getLogger().error("Failed to generate xlsx from " + tplFile, exp);
} }

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

@ -52,7 +52,6 @@ public class DesignerWorkspaceActivator extends Activator {
@Override @Override
public void on(Event event, Workspace workspace) { public void on(Event event, Workspace workspace) {
WorkspaceChangeLoadingDialog.showDialog();
PluginClassRefreshManager.getInstance().removePluginListener(); PluginClassRefreshManager.getInstance().removePluginListener();
HistoryTemplateListCache.getInstance().stash(); HistoryTemplateListCache.getInstance().stash();
} }
@ -64,7 +63,6 @@ public class DesignerWorkspaceActivator extends Activator {
@Override @Override
public void on(Event event, Workspace workspace) { public void on(Event event, Workspace workspace) {
HistoryTemplateListCache.getInstance().load();
PluginClassRefreshManager.getInstance().addPluginListener(); PluginClassRefreshManager.getInstance().addPluginListener();
WorkspaceChangeLoadingDialog.hideDialog(); WorkspaceChangeLoadingDialog.hideDialog();
} }

Loading…
Cancel
Save