Browse Source

Merge remote-tracking branch 'origin/fbp/release' into fbp/release

fbp/release
Destiny.Lin 1 month ago
parent
commit
f1fde6c900
  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.row;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.flex;
public class IconDefinePane extends BasicPane {
@ -66,8 +68,9 @@ public class IconDefinePane extends BasicPane {
showIconImageLable.setIcon(null);
}
});
JPanel iconButtonPane = row(LayoutConstants.HORIZONTAL_GAP, cell(this.showIconImageLable), cell(this.editIconButton), cell(this.removeIconButton)).getComponent();
JPanel iconButtonPane = row(LayoutConstants.HORIZONTAL_GAP, cell(this.showIconImageLable),
column(flex(), row(LayoutConstants.HORIZONTAL_GAP, cell(this.editIconButton), cell(this.removeIconButton)), flex())
).getComponent();
iconButtonPane.setBorder(new ScaledEmptyBorder(0,0,0,0));
this.setLayout(new BorderLayout());
this.add(iconButtonPane, BorderLayout.CENTER);
@ -92,16 +95,6 @@ public class IconDefinePane extends BasicPane {
setShowIconImage();
}
/**
* 直接更新icon
* @param iconName
* @param icon
*/
public void populateIcon(String iconName, Icon icon) {
this.curIconName = iconName;
showIconImageLable.setIcon(icon);
}
public String update() {
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.text.setSelected(button.isShowText());
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;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.gui.ibutton.UIButton;
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.gui.core.WidgetOption;
import com.fr.form.ui.Widget;
import com.fr.stable.StringUtils;
import com.fr.form.ui.WidgetInfoConfig;
import java.awt.Insets;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.Icon;
import javax.swing.ImageIcon;
public class ToolBarButton extends UIButton implements MouseListener {
private Widget widget;
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) {
this(null, icon, widget);
@ -30,15 +36,30 @@ public class ToolBarButton extends UIButton implements MouseListener {
public ToolBarButton(String text, Icon icon, Widget widget) {
super(text, icon);
this.widget = widget;
//直接设置Icon图标
setIcon(icon);
if (icon instanceof LazyIcon) {
setDisabledIcon(((LazyIcon) icon).disabled());
if (widget instanceof com.fr.form.ui.Button) {
com.fr.form.ui.Button button = (com.fr.form.ui.Button) widget;
String iconName = button.getIconName();
if (StringUtils.isNotEmpty(iconName)) {
Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName);
if (iimage != null) {
setIcon(new ImageIcon(iimage));
}
}
}
this.addMouseListener(this);
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.repaint();
}
// this.getFToolBar().setBackground(toolbar.getBackground());
this.getFToolBar().setBackground(toolbar.getBackground());
this.getFToolBar().setDefault(toolbar.isDefault());
this.getFToolBar().setButtonBgColorMode(toolbar.getButtonBgColorMode());
setPopulateFinished(true);

Loading…
Cancel
Save