Browse Source

Merge pull request #5401 in DESIGN/design from feature/10.0 to feature/big-screen

* commit 'fba20ae59545fb5d8e14bb9eb7961eed052f0809':
  REPORT-57238 解决自动间距计算不正确的问题
  REPORT-55756 设计器界面移动时,工具栏保持停留原位置,没有随着移动,这个看下要不要优化下。鼠标再回到设计画布就好了
feature/big-screen
superman 3 years ago
parent
commit
0ae9827a9a
  1. 18
      designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java
  2. 8
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  3. 4
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 7
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  5. 16
      designer-form/src/main/java/com/fr/design/mainframe/MultiSelectionArrangement.java
  6. 8
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

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

@ -4,6 +4,8 @@ import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
@ -28,7 +30,7 @@ public class PluginClassRefreshManager {
@Override
public void on(PluginEvent event) {
// 重载模版之前 触发下hide
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange();
fireTabChange();
// 兼容之前版本特性
for (String tag : context) {
if (event.getContext().contain(tag)) {
@ -53,12 +55,24 @@ public class PluginClassRefreshManager {
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener);
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange();
fireTabChange();
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
};
public void fireTabChange() {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
template.fireTabChange();
}
});
}
}
public static PluginClassRefreshManager getInstance() {
return INSTANCE;

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

@ -275,6 +275,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//刷新FixedPopupPane的位置
EastRegionContainerPane.getInstance().freshCurrentPopupPane();
}
@Override
public void componentMoved(ComponentEvent e) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
template.refreshFormDesigner();
}
}
});
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.setVisible(false);

4
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -221,6 +221,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// do nothing
}
public void refreshFormDesigner() {
// do nothing
}
/**
* @deprecated move to cloud ops pluginleft only for compatible

7
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -1135,4 +1135,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
formDesign.hidePopup();
}
}
@Override
public void refreshFormDesigner() {
if (formDesign != null) {
formDesign.repaint();
}
}
}

16
designer-form/src/main/java/com/fr/design/mainframe/MultiSelectionArrangement.java

@ -69,6 +69,7 @@ public class MultiSelectionArrangement {
// 水平分布,自动,间距由selectedCreators和border共同计算而来
public void horizontalAutoDistribution() {
sortHorizontal();
int gap = calculateHorizontalGap();
horizontalDistribution(gap);
}
@ -80,7 +81,6 @@ public class MultiSelectionArrangement {
}
private void horizontalDistribution(int gap) {
sortHorizontal();
for (int i = 1; i < selectedCreators.size() - 1; i++) {
XCreator creator = selectedCreators.get(i);
XCreator preCreator = selectedCreators.get(i - 1);
@ -90,7 +90,6 @@ public class MultiSelectionArrangement {
}
private void reSizeRecByHorizontal(int gap) {
sortHorizontal();
int width = 0;
for (XCreator creator : selectedCreators) {
width += creator.getWidth();
@ -138,10 +137,14 @@ public class MultiSelectionArrangement {
for (XCreator creator : selectedCreators) {
sum += creator.getWidth();
}
return (rec.width - sum) / (selectedCreators.size() - 1);
XCreator head = selectedCreators.get(0);
XCreator tail = selectedCreators.get(selectedCreators.size() - 1);
int distanceBetweenHeadAndTailCreators = Math.abs(head.getX() - tail.getX()) + tail.getWidth();
return (distanceBetweenHeadAndTailCreators - sum) / (selectedCreators.size() - 1);
}
public void verticalAutoDistribution() {
sortVertical();
int gap = calculateVerticalGap();
verticalDistribution(gap);
}
@ -152,7 +155,6 @@ public class MultiSelectionArrangement {
}
private void verticalDistribution(int gap) {
sortVertical();
for (int i = 1; i < selectedCreators.size() - 1; i++) {
XCreator creator = selectedCreators.get(i);
XCreator preCreator = selectedCreators.get(i - 1);
@ -162,7 +164,6 @@ public class MultiSelectionArrangement {
}
private void reSizeRecByVertical(int gap) {
sortVertical();
int height = 0;
for (XCreator creator : selectedCreators) {
height += creator.getHeight();
@ -209,7 +210,10 @@ public class MultiSelectionArrangement {
for (XCreator creator : selectedCreators) {
sum += creator.getHeight();
}
return (rec.height - sum) / (selectedCreators.size() - 1);
XCreator head = selectedCreators.get(0);
XCreator tail = selectedCreators.get(selectedCreators.size() - 1);
int distanceBetweenHeadAndTailCreators = Math.abs(head.getY() - tail.getY()) + tail.getHeight();
return (distanceBetweenHeadAndTailCreators - sum) / (selectedCreators.size() - 1);
}
private void update() {

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

@ -1238,4 +1238,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
designer.hidePopup();
}
}
@Override
public void refreshFormDesigner() {
FormDesigner designer = (FormDesigner) parameterPane.getParaDesigner();
if (designer != null) {
designer.repaint();
}
}
}

Loading…
Cancel
Save