Browse Source

Pull request #15081: REPORT-137558 && REPORT-137547 && REPORT-137533 fix:图标及工具栏背景编辑设计器显示问题修复

Merge in DESIGN/design from ~RICHARD.FANG/design:fbp/release to fbp/release

* commit 'edb11bc89785f98c4f2cbbe083aa4c1d52d189d1':
  REPORT-137558 && REPORT-137547 && REPORT-137533 fix:图标及浏览器背景编辑设计器显示问题修复
fbp/merge
Richard.Fang-方超 2 months ago
parent
commit
0f17e1a222
  1. 17
      designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java
  2. 2
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  3. 31
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java
  4. 2
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java

17
designer-base/src/main/java/com/fr/design/widget/IconDefinePane.java

@ -23,6 +23,8 @@ import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.flex;
public class IconDefinePane extends BasicPane { public class IconDefinePane extends BasicPane {
@ -66,8 +68,9 @@ public class IconDefinePane extends BasicPane {
showIconImageLable.setIcon(null); showIconImageLable.setIcon(null);
} }
}); });
JPanel iconButtonPane = row(LayoutConstants.HORIZONTAL_GAP, cell(this.showIconImageLable),
JPanel iconButtonPane = row(LayoutConstants.HORIZONTAL_GAP, cell(this.showIconImageLable), cell(this.editIconButton), cell(this.removeIconButton)).getComponent(); column(flex(), row(LayoutConstants.HORIZONTAL_GAP, cell(this.editIconButton), cell(this.removeIconButton)), flex())
).getComponent();
iconButtonPane.setBorder(new ScaledEmptyBorder(0,0,0,0)); iconButtonPane.setBorder(new ScaledEmptyBorder(0,0,0,0));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(iconButtonPane, BorderLayout.CENTER); this.add(iconButtonPane, BorderLayout.CENTER);
@ -92,16 +95,6 @@ public class IconDefinePane extends BasicPane {
setShowIconImage(); setShowIconImage();
} }
/**
* 直接更新icon
* @param iconName
* @param icon
*/
public void populateIcon(String iconName, Icon icon) {
this.curIconName = iconName;
showIconImageLable.setIcon(icon);
}
public String update() { public String update() {
return this.curIconName; return this.curIconName;
} }

2
designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java

@ -667,7 +667,7 @@ public class EditToolBar extends BasicPane {
this.icon.setSelected(button.isShowIcon()); this.icon.setSelected(button.isShowIcon());
this.text.setSelected(button.isShowText()); this.text.setSelected(button.isShowText());
this.nameField.setText(button.getText()); this.nameField.setText(button.getText());
this.iconPane.populateIcon(((Button) widget).getIconName(), icon); this.iconPane.populate(((Button) widget).getIconName());
} }
/** /**

31
designer-realize/src/main/java/com/fr/design/webattr/ToolBarButton.java

@ -1,6 +1,6 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -8,16 +8,22 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.stable.StringUtils;
import com.fr.form.ui.WidgetInfoConfig;
import java.awt.Insets; import java.awt.Insets;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon;
public class ToolBarButton extends UIButton implements MouseListener { public class ToolBarButton extends UIButton implements MouseListener {
private Widget widget; private Widget widget;
private WidgetOption no; private WidgetOption no;
private final int ICON_WIDTH = FineUIScale.scale(16);
private final int ICON_HEIGHT = FineUIScale.scale(16);
public ToolBarButton(Icon icon, Widget widget) { public ToolBarButton(Icon icon, Widget widget) {
this(null, icon, widget); this(null, icon, widget);
@ -30,15 +36,30 @@ public class ToolBarButton extends UIButton implements MouseListener {
public ToolBarButton(String text, Icon icon, Widget widget) { public ToolBarButton(String text, Icon icon, Widget widget) {
super(text, icon); super(text, icon);
this.widget = widget; this.widget = widget;
//直接设置Icon图标 if (widget instanceof com.fr.form.ui.Button) {
setIcon(icon); com.fr.form.ui.Button button = (com.fr.form.ui.Button) widget;
if (icon instanceof LazyIcon) { String iconName = button.getIconName();
setDisabledIcon(((LazyIcon) icon).disabled()); if (StringUtils.isNotEmpty(iconName)) {
Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName);
if (iimage != null) {
setIcon(new ImageIcon(iimage));
}
}
} }
this.addMouseListener(this); this.addMouseListener(this);
setMargin(new Insets(0, 0, 0, 0)); setMargin(new Insets(0, 0, 0, 0));
} }
@Override
public void setIcon(Icon icon) {
if (icon instanceof ImageIcon) {
//自定义上传的图标在设计器工具栏显示需要按照16*16进行缩放
Image originalImage = ((ImageIcon) icon).getImage();
Image scaledImage = originalImage.getScaledInstance(ICON_WIDTH, ICON_HEIGHT, Image.SCALE_SMOOTH);
icon = new ImageIcon(scaledImage);
}
super.setIcon(icon);
}
/** /**
* 改变按钮的权限细粒度状态 * 改变按钮的权限细粒度状态

2
designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java

@ -154,7 +154,7 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
this.validate(); this.validate();
this.repaint(); this.repaint();
} }
// this.getFToolBar().setBackground(toolbar.getBackground()); this.getFToolBar().setBackground(toolbar.getBackground());
this.getFToolBar().setDefault(toolbar.isDefault()); this.getFToolBar().setDefault(toolbar.isDefault());
this.getFToolBar().setButtonBgColorMode(toolbar.getButtonBgColorMode()); this.getFToolBar().setButtonBgColorMode(toolbar.getButtonBgColorMode());
setPopulateFinished(true); setPopulateFinished(true);

Loading…
Cancel
Save