Browse Source

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

fix-lag
Henry.Wang 3 years ago
parent
commit
68a65cfee9
  1. 26
      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. 9
      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

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

@ -40,28 +40,18 @@ public class UIToolbar extends JToolBar {
} }
} }
public void refreshUIToolBar() { public Map<Component, Boolean> getComponentState() {
refreshUIToolBar(false); Map<Component, Boolean> componentState = new HashMap<>();
}
public void refreshUIToolBar(boolean forbid) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
for (int i = 0; i < getComponentCount(); i++) { for (int i = 0; i < getComponentCount(); i++) {
Component component = getComponents()[i]; Component component = getComponent(i);
if (forbid) {
componentState.put(component, component.isEnabled()); 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());
}
} }
return componentState;
} }
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.JPanel;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Insets; import java.awt.Insets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author shine * @author shine
@ -96,7 +100,7 @@ public class CenterRegionContainerPane extends JPanel {
} }
private ToolBarMenuDock getToolBarMenuDock() { public ToolBarMenuDock getToolBarMenuDock() {
return DesignerContext.getDesignerFrame().getToolBarMenuDock(); return DesignerContext.getDesignerFrame().getToolBarMenuDock();
} }
@ -267,16 +271,13 @@ public class CenterRegionContainerPane extends JPanel {
return centerTemplateCardPane; return centerTemplateCardPane;
} }
protected void refreshUIToolBar() { public Map<Component, Boolean> getToolbarComponentState() {
refreshUIToolBar(false); Map<Component, Boolean> toolbarComponentState = new HashMap<>();
}
protected void refreshUIToolBar(boolean forbid) {
if (toolbarComponent instanceof UIToolbar) { if (toolbarComponent instanceof UIToolbar) {
((UIToolbar) toolbarComponent).refreshUIToolBar(); toolbarComponentState.putAll(((UIToolbar) toolbarComponent).getComponentState());
} }
combineUp.refreshUIToolBar(forbid); toolbarComponentState.putAll(combineUp.getComponentState());
getToolBarMenuDock().updateEnable(); return toolbarComponentState;
} }
} }

9
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() { public DesktopCardPane getCenterTemplateCardPane() {
return CenterRegionContainerPane.getInstance().getCenterTemplateCardPane(); return CenterRegionContainerPane.getInstance().getCenterTemplateCardPane();
} }
public void refreshUIToolBar() {
refreshUIToolBar(false);
}
public void refreshUIToolBar(boolean forbid) {
CenterRegionContainerPane.getInstance().refreshUIToolBar(forbid);
}
/** /**
* 初始menuPane的方法 方便OEM时修改该组件 * 初始menuPane的方法 方便OEM时修改该组件
*/ */

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.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 com.fr.design.gui.itoolbar.UIToolbar;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; 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 TransparentPane transparentPane = new TransparentPane();
private OpenLoadingPane loadingPane = new OpenLoadingPane(); private OpenLoadingPane loadingPane = new OpenLoadingPane();
private OpenFailedPane failedPane = new OpenFailedPane(); private OpenFailedPane failedPane = new OpenFailedPane();
Map<Component, Boolean> backUpToolbarComponentState = new HashMap<>();
private JLayeredPane layeredPane = new JLayeredPane() { private JLayeredPane layeredPane = new JLayeredPane() {
@Override @Override
public void doLayout() { public void doLayout() {
@ -103,7 +109,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
} }
private void showOpenStatus() { private void showOpenStatus() {
DesignerContext.getDesignerFrame().refreshUIToolBar(); forbidToolBar();
DesignerFrameFileDealerPane.getInstance().stateChange(); DesignerFrameFileDealerPane.getInstance().stateChange();
EastRegionContainerPane.getInstance().updateAllPropertyPane(); EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane(); JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
@ -120,9 +126,9 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
} }
public void showCover() { public void showCover() {
forbidToolBar();
transparentPane.start(); transparentPane.start();
layeredPane.moveToFront(transparentPane); layeredPane.moveToFront(transparentPane);
DesignerContext.getDesignerFrame().refreshUIToolBar(true);
EastRegionContainerPane.getInstance().updateAllPropertyPane(); EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane(); JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) { if (downPane instanceof BasicTableDataTreePane) {
@ -132,6 +138,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
} }
public void hideCover() { public void hideCover() {
recoverToolBar();
transparentPane.stop(); transparentPane.stop();
layeredPane.moveToFront(component); layeredPane.moveToFront(component);
EastRegionContainerPane.getInstance().updateAllPropertyPane(); 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() { protected JTemplate<?, ?> getSelectedJTemplate() {
return component; 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); this.template.setSaving(false);
// 恢复界面 // 恢复界面
if (slowly && ComparatorUtils.equals(this.template.getName(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getName())) { if (slowly && ComparatorUtils.equals(this.template.getName(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getName())) {
DesignerContext.getDesignerFrame().refreshUIToolBar();
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().hideCover(); DesignerContext.getDesignerFrame().getCenterTemplateCardPane().hideCover();
} }
DesignerFrameFileDealerPane.getInstance().stateChange(); DesignerFrameFileDealerPane.getInstance().stateChange();

Loading…
Cancel
Save