Browse Source

REPORT-58513 设计器-表单保存-工具栏新引擎转化按钮变为可用

fix-lag
Henry.Wang 3 years ago
parent
commit
68a65cfee9
  1. 30
      designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java
  2. 19
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  3. 11
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 27
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  5. 1
      designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java

30
designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java

@ -40,28 +40,18 @@ public class UIToolbar extends JToolBar {
}
}
public void refreshUIToolBar() {
refreshUIToolBar(false);
public Map<Component, Boolean> getComponentState() {
Map<Component, Boolean> componentState = new HashMap<>();
for (int i = 0; i < getComponentCount(); i++) {
Component component = getComponent(i);
componentState.put(component, component.isEnabled());
}
return componentState;
}
public void refreshUIToolBar(boolean forbid) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
for (int i = 0; i < getComponentCount(); i++) {
Component component = getComponents()[i];
if (forbid) {
componentState.put(component, component.isEnabled());
component.setEnabled(false);
} else {
Boolean enable = componentState.get(component);
if (enable != null) {
component.setEnabled(enable);
componentState.remove(component);
} else {
component.setEnabled(template.checkEnable());
}
}
}
public static void resetComponentState(Map<Component, Boolean> componentState) {
for (Component component : componentState.keySet()) {
component.setEnabled(componentState.get(component));
}
}
}

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

@ -19,10 +19,14 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.MatteBorder;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Insets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @author shine
@ -96,7 +100,7 @@ public class CenterRegionContainerPane extends JPanel {
}
private ToolBarMenuDock getToolBarMenuDock() {
public ToolBarMenuDock getToolBarMenuDock() {
return DesignerContext.getDesignerFrame().getToolBarMenuDock();
}
@ -267,16 +271,13 @@ public class CenterRegionContainerPane extends JPanel {
return centerTemplateCardPane;
}
protected void refreshUIToolBar() {
refreshUIToolBar(false);
}
protected void refreshUIToolBar(boolean forbid) {
public Map<Component, Boolean> getToolbarComponentState() {
Map<Component, Boolean> toolbarComponentState = new HashMap<>();
if (toolbarComponent instanceof UIToolbar) {
((UIToolbar) toolbarComponent).refreshUIToolBar();
toolbarComponentState.putAll(((UIToolbar) toolbarComponent).getComponentState());
}
combineUp.refreshUIToolBar(forbid);
getToolBarMenuDock().updateEnable();
toolbarComponentState.putAll(combineUp.getComponentState());
return toolbarComponentState;
}
}

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

@ -361,18 +361,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public DesktopCardPane getCenterTemplateCardPane() {
return CenterRegionContainerPane.getInstance().getCenterTemplateCardPane();
}
public void refreshUIToolBar() {
refreshUIToolBar(false);
}
public void refreshUIToolBar(boolean forbid) {
CenterRegionContainerPane.getInstance().refreshUIToolBar(forbid);
}
/**
* 初始menuPane的方法 方便OEM时修改该组件
*/
@ -1044,7 +1035,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt != null) {
if (jt != null) {
DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath());
}

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

@ -10,11 +10,14 @@ import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.gui.itoolbar.UIToolbar;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.HashMap;
import java.util.Map;
/**
@ -33,6 +36,9 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
private TransparentPane transparentPane = new TransparentPane();
private OpenLoadingPane loadingPane = new OpenLoadingPane();
private OpenFailedPane failedPane = new OpenFailedPane();
Map<Component, Boolean> backUpToolbarComponentState = new HashMap<>();
private JLayeredPane layeredPane = new JLayeredPane() {
@Override
public void doLayout() {
@ -103,7 +109,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
private void showOpenStatus() {
DesignerContext.getDesignerFrame().refreshUIToolBar();
forbidToolBar();
DesignerFrameFileDealerPane.getInstance().stateChange();
EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
@ -120,9 +126,9 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
public void showCover() {
forbidToolBar();
transparentPane.start();
layeredPane.moveToFront(transparentPane);
DesignerContext.getDesignerFrame().refreshUIToolBar(true);
EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
@ -132,6 +138,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
public void hideCover() {
recoverToolBar();
transparentPane.stop();
layeredPane.moveToFront(component);
EastRegionContainerPane.getInstance().updateAllPropertyPane();
@ -142,6 +149,22 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
}
private void forbidToolBar() {
CenterRegionContainerPane centerRegionContainerPane = CenterRegionContainerPane.getInstance();
backUpToolbarComponentState = centerRegionContainerPane.getToolbarComponentState();
for (Component component : backUpToolbarComponentState.keySet()) {
component.setEnabled(false);
}
centerRegionContainerPane.getToolBarMenuDock().updateEnable();
}
private void recoverToolBar() {
UIToolbar.resetComponentState(backUpToolbarComponentState);
backUpToolbarComponentState.clear();
CenterRegionContainerPane centerRegionContainerPane = CenterRegionContainerPane.getInstance();
centerRegionContainerPane.getToolBarMenuDock().updateEnable();
}
protected JTemplate<?, ?> getSelectedJTemplate() {
return component;
}

1
designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java

@ -70,7 +70,6 @@ public class SaveWorker extends SwingWorker<Boolean, Void> {
this.template.setSaving(false);
// 恢复界面
if (slowly && ComparatorUtils.equals(this.template.getName(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getName())) {
DesignerContext.getDesignerFrame().refreshUIToolBar();
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().hideCover();
}
DesignerFrameFileDealerPane.getInstance().stateChange();

Loading…
Cancel
Save