Browse Source

Merge pull request #1034 in DESIGN/design from ~BRUCE.DENG/design:feature/10.0 to feature/10.0

* commit '6e65fd6e0a9ee8190fad98dfbe6d35ff4d1baf2f':
  REPORT-19464 【匹配移动端】TAB下菜单式图标优化2
  REPORT-19464 【匹配移动端】TAB下菜单式图标优化2
  REPORT-19464 【匹配移动端】TAB下菜单式图标优化2
  REPORT-19464 【匹配移动端】TAB下菜单式图标优化2
research/11.0
Bruce.Deng 5 years ago
parent
commit
6da411e565
  1. 12
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  2. 22
      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

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

@ -217,6 +217,18 @@ public class FRGUIPaneFactory {
return jp;
}
/**
* 创建一个靠左空边框面板间隔小firsthgap 为0
*
* @return JPanel对象
*/
public static JPanel createTinyHGapFlowInnerContainer_M_Pane_First0() {
JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new FRLeftFlowLayout(0, 5, 0));
return jp;
}
/**
* 创建一个靠左空边框面板间隔中等
*

22
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.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -33,6 +35,7 @@ import java.util.ArrayList;
public class TabIconConfigPane extends JPanel {
private UIButton editIconButton;
private UIButton deleteIconButton;
private String curIconName;
private IconButton selectIconButton;
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>();
@ -43,7 +46,7 @@ public class TabIconConfigPane extends JPanel {
public void initComp(int count) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
JPanel panel = FRGUIPaneFactory.createTinyHGapFlowInnerContainer_M_Pane_First0();
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
@ -63,12 +66,28 @@ public class TabIconConfigPane extends JPanel {
curIconName = cip.update();
setShowIconImage();
TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(true);
}
});
editDialog.setVisible(true);
}
});
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);
JPanel northPane = new JPanel();
@ -163,6 +182,7 @@ public class TabIconConfigPane extends JPanel {
public void actionPerformed(ActionEvent evt) {
selectIconButton = this;
editIconButton.setEnabled(true);
deleteIconButton.setEnabled(StringUtils.isNotEmpty(this.getIconName()));
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();
imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0));
showImageLabel = new UILabel();
showImageLabel.setPreferredSize(new Dimension(20, 20));
showImageLabel.setPreferredSize(new Dimension(50, 50));
imagePane.add(showImageLabel);
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}};
@ -450,12 +450,12 @@ public class CustomIconPane extends BasicPane {
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) {
String path = jf.getSelectedFile().getAbsolutePath();
// 将图片转化到16 × 16大小
// 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH,
IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH),
Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null);
g2d.drawImage(image, 0, 0, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), null);
bufferedImage.flush();
g2d.dispose();
iconImage = bufferedImage;

Loading…
Cancel
Save