Browse Source

REPORT-19464 【匹配移动端】TAB下菜单式图标优化2

research/11.0
Bruce.Deng 5 years ago
parent
commit
ec9f79560f
  1. 2
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  2. 26
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java
  3. 10
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

2
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -213,7 +213,7 @@ public class FRGUIPaneFactory {
public static JPanel createMediumHGapFlowInnerContainer_M_Pane_First0() { public static JPanel createMediumHGapFlowInnerContainer_M_Pane_First0() {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new FRLeftFlowLayout(0, 20, 5)); jp.setLayout(new FRLeftFlowLayout(0, 5, 0));
return jp; return jp;
} }

26
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java

@ -11,6 +11,8 @@ import com.fr.design.web.CustomIconPane;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -33,6 +35,7 @@ import java.util.ArrayList;
public class TabIconConfigPane extends JPanel { public class TabIconConfigPane extends JPanel {
private UIButton editIconButton; private UIButton editIconButton;
private UIButton deleteIconButton;
private String curIconName; private String curIconName;
private IconButton selectIconButton; private IconButton selectIconButton;
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>(); private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>();
@ -43,7 +46,7 @@ public class TabIconConfigPane extends JPanel {
public void initComp(int count) { public void initComp(int count) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); JPanel panel = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0();
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
@ -63,12 +66,28 @@ public class TabIconConfigPane extends JPanel {
curIconName = cip.update(); curIconName = cip.update();
setShowIconImage(); setShowIconImage();
TabIconConfigPane.this.repaint(); TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(true);
} }
}); });
editDialog.setVisible(true); editDialog.setVisible(true);
} }
}); });
editIconButton.setEnabled(false); editIconButton.setEnabled(false);
deleteIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Delete"));
deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
deleteIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(deleteIconButton);
deleteIconButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
curIconName = "";
setShowIconImage();
TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(false);
}
});
deleteIconButton.setEnabled(false);
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
JPanel northPane = new JPanel(); JPanel northPane = new JPanel();
@ -163,6 +182,11 @@ public class TabIconConfigPane extends JPanel {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
selectIconButton = this; selectIconButton = this;
editIconButton.setEnabled(true); editIconButton.setEnabled(true);
if (StringUtils.equals("", this.getIconName())) {
deleteIconButton.setEnabled(false);
} else {
deleteIconButton.setEnabled(true);
}
TabIconConfigPane.this.repaint();// repaint TabIconConfigPane.this.repaint();// repaint
} }

10
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -433,7 +433,7 @@ public class CustomIconPane extends BasicPane {
JPanel imagePane = new JPanel(); JPanel imagePane = new JPanel();
imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0));
showImageLabel = new UILabel(); showImageLabel = new UILabel();
showImageLabel.setPreferredSize(new Dimension(20, 20)); showImageLabel.setPreferredSize(new Dimension(50, 50));
imagePane.add(showImageLabel); imagePane.add(showImageLabel);
imagePane.add(browseButton); imagePane.add(browseButton);
Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}}; Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}};
@ -450,12 +450,12 @@ public class CustomIconPane extends BasicPane {
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) { if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) {
String path = jf.getSelectedFile().getAbsolutePath(); String path = jf.getSelectedFile().getAbsolutePath();
// 将图片转化到16 × 16大小 // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path); Image image = BaseUtils.readImage(path);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH, BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(image.getWidth(null) >= 48 ? IconManager.DEFAULT_ICONWIDTH + 32 : image.getWidth(null),
IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); image.getHeight(null) >= 48 ? IconManager.DEFAULT_ICONHEIGHT + 32 : image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics(); Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); g2d.drawImage(image, 0, 0, image.getWidth(null) >= 48 ? IconManager.DEFAULT_ICONWIDTH + 32 : image.getWidth(null), image.getHeight(null) >= 48 ? IconManager.DEFAULT_ICONHEIGHT + 32 : image.getHeight(null), null);
bufferedImage.flush(); bufferedImage.flush();
g2d.dispose(); g2d.dispose();
iconImage = bufferedImage; iconImage = bufferedImage;

Loading…
Cancel
Save