Browse Source

REPORT-55187【组件背景分离】组件复用-body和参数面板里的控件(frm参面和body 以及 cpt参面),应该也有只显示锁按钮的工具栏,现在是没有工具栏的

子功能: 组件尺寸比例锁定 & 组件工具栏
【问题原因】
工具栏按显示条件更新

【改动思路】
修改工具栏按钮的显示条件:
1. 编辑按钮仅在当前控件为标题控件(图表块/报表块)时可见
2. 比例锁定按钮仅在当前控件所在布局为绝对布局时可见
3. 设置按钮仅在当前控件为可复用组件时可见
4. 所有按钮在拖拽时不显示
4. 若没有按钮显示,则工具栏整体不显示

【review建议】

(cherry picked from commit 6a7996edba76858a8b99386fc40ba95cfea8a640)
feature/10.0
Starryi 3 years ago
parent
commit
f601add966
  1. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  2. 15
      designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java
  3. 4
      designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java
  4. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

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

@ -778,7 +778,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
int extraY = (int) (bounds.y * designer.getScale());
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.updatePane(designer);
popup.setVisible(selected && accept);
popup.setVisible(selected && accept && popup.hasVisibleButtons());
popup.setRelativeBounds(bounds);
}

15
designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java

@ -4,6 +4,7 @@ import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.VerticalFlowLayout;
@ -58,7 +59,7 @@ public class PopupControlPanel extends JPanel {
addButton(toggleButton, 1);
addButton(settingButton, 2);
setButtonVisible(editButton, true);
setButtonVisible(editButton, false);
setButtonVisible(toggleButton, false);
setButtonVisible(settingButton, false);
}
@ -139,7 +140,7 @@ public class PopupControlPanel extends JPanel {
if (index > 0) {
getComponent(2 * index - 1).setVisible(false);
}
buttons.get(index).setVisible(true);
buttons.get(index).setVisible(visible);
if (!visible) {
// 如果当前按钮设置为不可见,且在当前按钮之前的其他按钮也不可见,则下一个可见按钮前无分割线
@ -192,6 +193,7 @@ public class PopupControlPanel extends JPanel {
}
public void updatePane(FormDesigner designer) {
setButtonVisible(editButton, creator.acceptType(XWTitleLayout.class));
setButtonVisible(settingButton, creator.isShared());
setButtonVisible(toggleButton, AdapterBus.searchLayoutAdapter(designer, creator) instanceof FRAbsoluteLayoutAdapter);
toggleButton.setSelected(creator.toData().isAspectRatioLocked());
@ -199,6 +201,15 @@ public class PopupControlPanel extends JPanel {
updateDimension();
}
public boolean hasVisibleButtons() {
for (int i = 0; i < buttons.size(); i++) {
if (buttons.get(i).isVisible()) {
return true;
}
}
return false;
}
private void updateDimension() {
int height = 0;
for (int i = 0; i < buttons.size(); i++) {

4
designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java

@ -34,6 +34,10 @@ public class SelectedPopupDialog extends JDialog {
this.setSize(controlPanel.getDefaultDimension());
}
public boolean hasVisibleButtons() {
return controlPanel.hasVisibleButtons();
}
public void setRelativeBounds(Rectangle rectangle) {
this.controlPanel.setRelativeBounds(rectangle);
}

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

@ -326,7 +326,7 @@ public class FormDesignerUI extends ComponentUI {
}
creator.paintBorder(g, creatorBounds);
// 拖拽时不绘制
creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging() && creator.acceptType(XWTitleLayout.class));
creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging());
}
}

Loading…
Cancel
Save