Browse Source

merge

master
plough 7 years ago
parent
commit
64b27fe39b
  1. 2
      designer/src/com/fr/design/actions/utils/DeprecatedActionManager.java
  2. 2
      designer/src/com/fr/grid/selection/FloatSelection.java
  3. 2
      designer_base/src/com/fr/design/constants/UIConstants.java
  4. 274
      designer_base/src/com/fr/design/gui/imenu/UIHeadMenu.java
  5. 237
      designer_base/src/com/fr/design/gui/imenu/UIMenu.java
  6. 2
      designer_base/src/com/fr/design/gui/imenu/UIMenuItem.java
  7. 4
      designer_base/src/com/fr/design/gui/imenu/UIMenuUI.java
  8. 24
      designer_base/src/com/fr/design/gui/imenu/UIPopupMenu.java
  9. 2
      designer_base/src/com/fr/design/gui/imenu/UIPopupMenuSeparatorUI.java
  10. 9
      designer_base/src/com/fr/design/gui/imenu/UIScrollPopUpMenu.java
  11. BIN
      designer_base/src/com/fr/design/images/control/clear.png
  12. BIN
      designer_base/src/com/fr/design/images/control/remove.png
  13. 8
      designer_base/src/com/fr/design/locale/designer.properties
  14. 8
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  15. 8
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  16. 8
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  17. 8
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  18. 8
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  19. 1
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  20. 42
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java
  21. 99
      designer_base/src/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java
  22. 37
      designer_base/src/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java
  23. 29
      designer_base/src/com/fr/design/mainframe/widget/wrappers/TemplateStyleWrapper.java
  24. 12
      designer_base/src/com/fr/design/menu/MenuDef.java
  25. 37
      designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java
  26. 24
      designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java
  27. 4
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java
  28. 21
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  29. 3
      designer_form/src/com/fr/design/designer/beans/painters/FRBorderLayoutPainter.java
  30. 3
      designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java
  31. 25
      designer_form/src/com/fr/design/designer/creator/XWHorizontalBoxLayout.java
  32. 8
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  33. 113
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  34. 26
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  35. 77
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  36. 239
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  37. 48
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTitleLayout.java
  38. 23
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  39. 10
      designer_form/src/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  40. 24
      designer_form/src/com/fr/design/form/layout/FRFlowLayout.java
  41. 36
      designer_form/src/com/fr/design/form/layout/FRHorizontalLayout.java
  42. 34
      designer_form/src/com/fr/design/form/layout/FRVerticalLayout.java
  43. 71
      designer_form/src/com/fr/design/gui/xpane/CardTagLayoutBorderPane.java
  44. 75
      designer_form/src/com/fr/design/gui/xpane/LayoutBorderPane.java
  45. 12
      designer_form/src/com/fr/design/mainframe/FormSelection.java
  46. 8
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  47. 2
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  48. 6
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  49. 76
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java
  50. 50
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardLayoutDefinePane.java
  51. 63
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java
  52. 114
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

2
designer/src/com/fr/design/actions/utils/DeprecatedActionManager.java

@ -49,7 +49,7 @@ public class DeprecatedActionManager {
*/
public static UIMenu getClearMenu(ElementCasePane ePane) {
UIMenu clearMenu = new UIMenu(Inter.getLocText("M_Edit-Clear"));
clearMenu.setIcon(UIConstants.BLACK_ICON);
clearMenu.setIcon(BaseUtils.readIcon("/com/fr/design/images/control/clear.png"));
clearMenu.setMnemonic('a');
ClearAction ReportComponentAction = new ClearAllAction(ePane);

2
designer/src/com/fr/grid/selection/FloatSelection.java

@ -117,7 +117,7 @@ public class FloatSelection extends Selection {
@Override
public JPopupMenu createPopupMenu(ElementCasePane ePane) {
JPopupMenu popup = new UIPopupMenu();
UIPopupMenu popup = new UIPopupMenu();
if (BaseUtils.isAuthorityEditing()) {
popup.add(new CleanAuthorityAction(ePane).createMenuItem());
return popup;

2
designer_base/src/com/fr/design/constants/UIConstants.java

@ -79,6 +79,8 @@ public interface UIConstants {
public static final Color COMBOBOX_BTN_NORMAL = new Color(0xD9DADD);
public static final Color COMBOBOX_BTN_ROLLOVER = new Color(0xC8C9CD);
public static final Color COMBOBOX_BTN_PRESS = new Color(0xD8F2FD);
public static final Color UIPOPUPMENU_LINE_COLOR = new Color(0xC8C9CD);
public static final Color UIPOPUPMENU_BACKGROUND = new Color(0xEDEDEE);
public static final Color LINE_COLOR = new Color(153, 153, 153);
public static final Color FONT_COLOR = new Color(51, 51, 51);
public static final Color LIGHT_BLUE = new Color(182, 217, 253);

274
designer_base/src/com/fr/design/gui/imenu/UIHeadMenu.java

@ -0,0 +1,274 @@
package com.fr.design.gui.imenu;
import com.fr.design.constants.UIConstants;
import com.fr.design.utils.gui.GUIPaintUtils;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
public class UIHeadMenu extends UIMenu {
private static final float REC = 8f;
private JPopupMenu popupMenu;
public UIHeadMenu(String name) {
super(name);
}
public JPopupMenu getPopupMenu() {
ensurePopupMenuCreated();
popupMenu.setBackground(UIConstants.NORMAL_BACKGROUND);
popupMenu.setBorder(new Border() {
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
int rec = (int) REC;
GUIPaintUtils.paintShapeBorder(g2d, x, y, width, height, rec);
if (!(UIHeadMenu.this.getParent() instanceof JPopupMenu)) {
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.drawLine(1, 0, UIHeadMenu.this.getWidth() - 2, 0);
}
}
@Override
public boolean isBorderOpaque() {
return false;
}
@Override
public Insets getBorderInsets(Component c) {
return new Insets(5, 2, 10, 10);
}
});
return popupMenu;
}
protected void ensurePopupMenuCreated() {
if (popupMenu == null) {
this.popupMenu = new JPopupMenu() {
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
float wdith = getWidth();
float heigth = getHeight();
Shape shape = GUIPaintUtils.paintShape(g2d, wdith, heigth, REC);
g2d.setClip(shape);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
super.paintComponent(g2d);
}
};
popupMenu.setInvoker(this);
popupListener = createWinListener(popupMenu);
}
}
/**
*画界面
*/
@Override
public void updateUI() {
setUI(new UIMenuUI());
}
/**
* 判断popupmeu是否隐藏
* @return 如果隐藏 返回true
*/
public boolean isPopupMenuVisible() {
ensurePopupMenuCreated();
return popupMenu.isVisible();
}
/**
* 设置popupmenu位置
* @param x
* @param y
*/
public void setMenuLocation(int x, int y) {
super.setMenuLocation(x, y);
if (popupMenu != null) {
popupMenu.setLocation(x, y);
}
}
/**
* 向popupmenu添加 JMenuItem
* @param menuItem 菜单项
* @return 菜单项
*/
public JMenuItem add(JMenuItem menuItem) {
ensurePopupMenuCreated();
return popupMenu.add(menuItem);
}
/**
* 添加组件
* @param c 组件
* @return 组件
*/
public Component add(Component c) {
ensurePopupMenuCreated();
popupMenu.add(c);
return c;
}
/**
* 向指定位置添加组件
* @param c 组件
* @param index 位置
* @return 组件
*/
public Component add(Component c, int index) {
ensurePopupMenuCreated();
popupMenu.add(c, index);
return c;
}
/**
* 添加分隔符
*/
public void addSeparator() {
ensurePopupMenuCreated();
popupMenu.addSeparator();
}
/**
* 添加menuitem到指定位置
* @param s 字符
* @param pos 位置
*/
public void insert(String s, int pos) {
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
ensurePopupMenuCreated();
popupMenu.insert(new JMenuItem(s), pos);
}
/**
* 添加么会特么到指定位置
* @param mi 菜单项
* @param pos 位置
* @return 菜单项
*/
public JMenuItem insert(JMenuItem mi, int pos) {
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
ensurePopupMenuCreated();
popupMenu.insert(mi, pos);
return mi;
}
/**
* 添加到指定位置
* @param a 事件
* @param pos 位置
* @return 菜单项
*/
public JMenuItem insert(Action a, int pos) {
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
ensurePopupMenuCreated();
JMenuItem mi = new JMenuItem(a);
mi.setHorizontalTextPosition(JButton.TRAILING);
mi.setVerticalTextPosition(JButton.CENTER);
popupMenu.insert(mi, pos);
return mi;
}
/**
* 添加分隔符到指定位置
* @param index 指定位置
*/
public void insertSeparator(int index) {
if (index < 0) {
throw new IllegalArgumentException("index less than zero.");
}
ensurePopupMenuCreated();
popupMenu.insert(new JPopupMenu.Separator(), index);
}
/**
* 移除
* @param item 菜单项
*/
public void remove(JMenuItem item) {
if (popupMenu != null) {
popupMenu.remove(item);
}
}
/**
* 移除指定位置菜单项
* @param pos 指定位置
*/
public void remove(int pos) {
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
if (pos > getItemCount()) {
throw new IllegalArgumentException("index greater than the number of items.");
}
if (popupMenu != null) {
popupMenu.remove(pos);
}
}
/**
* 移除组件
* @param c 组件
*/
public void remove(Component c) {
if (popupMenu != null) {
popupMenu.remove(c);
}
}
/**
* 移除所有
*/
public void removeAll() {
if (popupMenu != null) {
popupMenu.removeAll();
}
}
/**
* 组件总数
* @return 组件总数
*/
public int getMenuComponentCount() {
return (popupMenu == null) ? 0 : popupMenu.getComponentCount();
}
/**
* 指定位置组件
* @param n 指定位置
* @return 组件
*/
public Component getMenuComponent(int n) {
return (popupMenu == null) ? null : popupMenu.getComponent(n);
}
/**
* 所有组件
* @return 所有组件
*/
public Component[] getMenuComponents() {
return (popupMenu == null) ? new Component[0] : popupMenu.getComponents();
}
}

237
designer_base/src/com/fr/design/gui/imenu/UIMenu.java

@ -6,8 +6,12 @@ import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
public class UIMenu extends JMenu {
private static final float REC = 8f;
private JPopupMenu popupMenu;
public UIMenu(String name) {
super(name);
setName(name);
@ -24,14 +28,17 @@ public class UIMenu extends JMenu {
}
public JPopupMenu getPopupMenu() {
JPopupMenu popupMenu = super.getPopupMenu();
popupMenu.setBackground(UIConstants.NORMAL_BACKGROUND);
ensurePopupMenuCreated();
popupMenu.setOpaque(false);
popupMenu.setBorder(new Border() {
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
g.setColor(UIConstants.LINE_COLOR);
g.drawRect(x, y, width - 1, height - 1);
Graphics2D g2d = (Graphics2D) g;
int rec = (int) REC;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR);
g2d.drawRoundRect(x, y, width - 1, height - 1,rec, rec);
if (!(UIMenu.this.getParent() instanceof JPopupMenu)) {
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.drawLine(1, 0, UIMenu.this.getWidth() - 2, 0);
@ -51,8 +58,230 @@ public class UIMenu extends JMenu {
return popupMenu;
}
protected void ensurePopupMenuCreated() {
if (popupMenu == null) {
this.popupMenu = new JPopupMenu() {
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int rec = (int) REC;
Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), REC, REC);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(UIConstants.NORMAL_BACKGROUND);
g2d.fillRoundRect(0, 0, getWidth(), getHeight(), rec, rec);
g2d.setClip(shape);
super.paintComponent(g2d);
}
};
popupMenu.setInvoker(this);
popupListener = createWinListener(popupMenu);
}
}
/**
*画界面
*/
@Override
public void updateUI() {
setUI(new UIMenuUI());
}
/**
* 判断popupmeu是否隐藏
* @return 如果隐藏 返回true
*/
public boolean isPopupMenuVisible() {
ensurePopupMenuCreated();
return popupMenu.isVisible();
}
/**
* 设置popupmenu位置
* @param x
* @param y
*/
public void setMenuLocation(int x, int y) {
super.setMenuLocation(x, y);
if (popupMenu != null) {
popupMenu.setLocation(x, y);
}
}
/**
* 向popupmenu添加 JMenuItem
* @param menuItem 菜单项
* @return 菜单项
*/
public JMenuItem add(JMenuItem menuItem) {
ensurePopupMenuCreated();
return popupMenu.add(menuItem);
}
/**
* 添加组件
* @param c 组件
* @return 组件
*/
public Component add(Component c) {
ensurePopupMenuCreated();
popupMenu.add(c);
return c;
}
/**
* 向指定位置添加组件
* @param c 组件
* @param index 位置
* @return 组件
*/
public Component add(Component c, int index) {
ensurePopupMenuCreated();
popupMenu.add(c, index);
return c;
}
/**
* 添加分隔符
*/
public void addSeparator() {
ensurePopupMenuCreated();
popupMenu.addSeparator();
}
/**
* 添加menuitem到指定位置
* @param s 字符
* @param pos 位置
*/
public void insert(String s, int pos) {
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
ensurePopupMenuCreated();
popupMenu.insert(new JMenuItem(s), pos);
}
/**
* 添加么会特么到指定位置
* @param mi 菜单项
* @param pos 位置
* @return 菜单项
*/
public JMenuItem insert(JMenuItem mi, int pos) {
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
ensurePopupMenuCreated();
popupMenu.insert(mi, pos);
return mi;
}
/**
* 添加到指定位置
* @param a 事件
* @param pos 位置
* @return 菜单项
*/
public JMenuItem insert(Action a, int pos) {
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
ensurePopupMenuCreated();
JMenuItem mi = new JMenuItem(a);
mi.setHorizontalTextPosition(JButton.TRAILING);
mi.setVerticalTextPosition(JButton.CENTER);
popupMenu.insert(mi, pos);
return mi;
}
/**
* 添加分隔符到指定位置
* @param index 指定位置
*/
public void insertSeparator(int index) {
if (index < 0) {
throw new IllegalArgumentException("index less than zero.");
}
ensurePopupMenuCreated();
popupMenu.insert(new JPopupMenu.Separator(), index);
}
/**
* 移除
* @param item 菜单项
*/
public void remove(JMenuItem item) {
if (popupMenu != null) {
popupMenu.remove(item);
}
}
/**
* 移除指定位置菜单项
* @param pos 指定位置
*/
public void remove(int pos) {
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
if (pos > getItemCount()) {
throw new IllegalArgumentException("index greater than the number of items.");
}
if (popupMenu != null) {
popupMenu.remove(pos);
}
}
/**
* 移除组件
* @param c 组件
*/
public void remove(Component c) {
if (popupMenu != null) {
popupMenu.remove(c);
}
}
/**
* 移除所有
*/
public void removeAll() {
if (popupMenu != null) {
popupMenu.removeAll();
}
}
/**
* 组件总数
* @return 组件总数
*/
public int getMenuComponentCount() {
return (popupMenu == null) ? 0 : popupMenu.getComponentCount();
}
/**
* 指定位置组件
* @param n 指定位置
* @return 组件
*/
public Component getMenuComponent(int n) {
return (popupMenu == null) ? null : popupMenu.getComponent(n);
}
/**
* 所有组件
* @return 所有组件
*/
public Component[] getMenuComponents() {
return (popupMenu == null) ? new Component[0] : popupMenu.getComponents();
}
}

2
designer_base/src/com/fr/design/gui/imenu/UIMenuItem.java

@ -95,7 +95,7 @@ public class UIMenuItem extends JMenuItem{
} else {
// *** paint the text normally
if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) {
g.setColor(selectionForeground); // Uses protected field.
g.setColor(Color.WHITE); // Uses protected field.
}
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text,
-1, textRect.x, textRect.y + fm.getAscent());

4
designer_base/src/com/fr/design/gui/imenu/UIMenuUI.java

@ -72,8 +72,8 @@ public class UIMenuUI extends BasicMenuUI {
}
} else {
// *** paint the text normally
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
g.setColor(selectionForeground); // Uses protected field.
if (model.isArmed() || (menuItem instanceof JMenu && menuItem.isSelected() && menuItem.getIcon() != null)) {
g.setColor(Color.WHITE); // Uses protected field.
}
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
mnemIndex, textRect.x, textRect.y + fm.getAscent());

24
designer_base/src/com/fr/design/gui/imenu/UIPopupMenu.java

@ -1,23 +1,37 @@
package com.fr.design.gui.imenu;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import javax.swing.JPopupMenu;
import javax.swing.*;
import com.fr.design.constants.UIConstants;
public class UIPopupMenu extends JPopupMenu{
private static final float REC = 8f;
private boolean onlyText = false;
public UIPopupMenu() {
super();
setBackground(UIConstants.NORMAL_BACKGROUND);
}
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Shape shape = null;
shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), REC, REC);
g2d.setClip(shape);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
super.paintComponent(g2d);
}
@Override
protected void paintBorder(Graphics g) {
g.setColor(UIConstants.LINE_COLOR);
g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
Graphics2D g2d = (Graphics2D) g;
int rec = (int) REC;
g2d.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, rec, rec);
}
@Override

2
designer_base/src/com/fr/design/gui/imenu/UIPopupMenuSeparatorUI.java

@ -23,7 +23,7 @@ public class UIPopupMenuSeparatorUI extends MetalSeparatorUI {
public void paint(Graphics g, JComponent c) {
Dimension s = c.getSize();
g.setColor(UIConstants.FONT_COLOR);
g.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR);
g.drawLine(2, 1, s.width - 3, 1);
}
}

9
designer_base/src/com/fr/design/gui/imenu/UIScrollPopUpMenu.java

@ -1,6 +1,7 @@
package com.fr.design.gui.imenu;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import java.awt.*;
@ -16,12 +17,13 @@ import java.awt.event.MouseWheelListener;
*/
public class UIScrollPopUpMenu extends UIPopupMenu {
private static final int MAX_SHOW_NUM = 27;
private static final float REC = 8f;
private UIScrollBar scrollBar;
public UIScrollPopUpMenu() {
super();
setOpaque(false);
setLayout(new ScrollPopupMenuLayout());
super.add(getScrollBar());
addMouseWheelListener(new MouseWheelListener() {
@ -39,6 +41,11 @@ public class UIScrollPopUpMenu extends UIPopupMenu {
public void paintChildren(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int rec = (int) REC;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(UIConstants.NORMAL_BACKGROUND);
g2d.fillRoundRect(1, 1, getWidth() - 2, getHeight() - 2, rec, rec);
Insets insets = getInsets();
g.clipRect(insets.left, insets.top, getWidth(), getHeight() - insets.top - insets.bottom);
super.paintChildren(g);

BIN
designer_base/src/com/fr/design/images/control/clear.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

BIN
designer_base/src/com/fr/design/images/control/remove.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 167 B

8
designer_base/src/com/fr/design/locale/designer.properties

@ -2153,3 +2153,11 @@ FR-Designer_Move_Up=Move up(F)
FR-Designer_Move_Down=Move down(B)
FR-Designer_Move_To_Top=Move to top(T)
FR-Designer_Move_To_Bottom=Move to bottom(K)
FR-Designer_Tab_Style_Template=Style Template
FR-Designer_Tab_Template_One=Template One
FR-Designer_Tab_Template_Two=Template Two
FR-Designer_Tab_Template_Three=Template Three
FR-Designer_Tab_Template_Four=Template Four
FR-Designer_Tab_Template_Five=Template Five
FR-Designer_Tab_Template_Six=Template Six
FR-Designer_Tab_Display_Position=Display Position

8
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2152,3 +2152,11 @@ FR-Designer_Move_Up=Move up(F)
FR-Designer_Move_Down=Move down(B)
FR-Designer_Move_To_Top=Move to top(T)
FR-Designer_Move_To_Bottom=Move to bottom(K)
FR-Designer_Tab_Style_Template=Style Template
FR-Designer_Tab_Template_One=Template One
FR-Designer_Tab_Template_Two=Template Two
FR-Designer_Tab_Template_Three=Template Three
FR-Designer_Tab_Template_Four=Template Four
FR-Designer_Tab_Template_Five=Template Five
FR-Designer_Tab_Template_Six=Template Six
FR-Designer_Tab_Display_Position=Display Position

8
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2153,3 +2153,11 @@ FR-Designer_Move_Up=
FR-Designer_Move_Down=
FR-Designer_Move_To_Top=
FR-Designer_Move_To_Bottom=
FR-Designer_Tab_Style_Template=
FR-Designer_Tab_Template_One=
FR-Designer_Tab_Template_Two=
FR-Designer_Tab_Template_Three=
FR-Designer_Tab_Template_Four=
FR-Designer_Tab_Template_Five=
FR-Designer_Tab_Template_Six=
FR-Designer_Tab_Display_Position=

8
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2153,3 +2153,11 @@ FR-Designer_Move_Up=
FR-Designer_Move_Down=
FR-Designer_Move_To_Top=
FR-Designer_Move_To_Bottom=
FR-Designer_Tab_Style_Template=
FR-Designer_Tab_Template_One=
FR-Designer_Tab_Template_Two=
FR-Designer_Tab_Template_Three=
FR-Designer_Tab_Template_Four=
FR-Designer_Tab_Template_Five=
FR-Designer_Tab_Template_Six=
FR-Designer_Tab_Display_Position=

8
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2153,3 +2153,11 @@ FR-Designer_Move_Up=\u4E0A\u79FB\u4E00\u5C42(F)
FR-Designer_Move_Down=\u4E0B\u79FB\u4E00\u5C42(B)
FR-Designer_Move_To_Top=\u7F6E\u4E8E\u9876\u5C42(T)
FR-Designer_Move_To_Bottom=\u7F6E\u4E8E\u5E95\u5C42(K)
FR-Designer_Tab_Style_Template=\u6837\u5F0F\u6A21\u677F
FR-Designer_Tab_Template_One=\u6A21\u677F\u4E00
FR-Designer_Tab_Template_Two=\u6A21\u677F\u4E8C
FR-Designer_Tab_Template_Three=\u6A21\u677F\u4E09
FR-Designer_Tab_Template_Four=\u6A21\u677F\u56DB
FR-Designer_Tab_Template_Five=\u6A21\u677F\u4E94
FR-Designer_Tab_Template_Six=\u6A21\u677F\u516D
FR-Designer_Tab_Display_Position=\u663E\u793A\u4F4D\u7F6E

8
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2152,3 +2152,11 @@ FR-Designer_Move_Up=\u4E0A\u79FB\u4E00\u5C64(F)
FR-Designer_Move_Down=\u4E0B\u79FB\u4E00\u5C64(B)
FR-Designer_Move_To_Top=\u7F6E\u65BC\u9802\u5C64(T)
FR-Designer_Move_To_Bottom=\u7F6E\u65BC\u5E95\u5C64(K)
FR-Designer_Tab_Style_Template=\u6A23\u5F0F\u6A21\u677F
FR-Designer_Tab_Template_One=\u6A21\u677F\u4E00
FR-Designer_Tab_Template_Two=\u6A21\u677F\u4E8C
FR-Designer_Tab_Template_Three=\u6A21\u677F\u4E09
FR-Designer_Tab_Template_Four=\u6A21\u677F\u56DB
FR-Designer_Tab_Template_Five=\u6A21\u677F\u4E94
FR-Designer_Tab_Template_Six=\u6A21\u677F\u516D
FR-Designer_Tab_Display_Position=\u986F\u793A\u4F4D\u7F6E

1
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -180,6 +180,7 @@ public abstract class ToolBarMenuDock {
this.menus = menus(plus);
for (int i = 0; i < menus.length; i++) {
menus[i].setHasRecMenu(true);
UIMenu subMenu = menus[i].createJMenu();
jMenuBar.add(subMenu);
menus[i].updateMenu();

42
designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java

@ -0,0 +1,42 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.design.mainframe.widget.wrappers.TemplateStyleWrapper;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
/**
* Created by kerry on 2017/11/23.
*/
public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor {
private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400);
private TemplateStylePane stylePane;
public AccessibleTemplateStyleEditor() {
super(new TemplateStyleWrapper());
}
@Override
protected void showEditorPane() {
if (stylePane == null) {
stylePane = new TemplateStylePane();
stylePane.setPreferredSize(DEFAULT_DIMENSION);
}
BasicDialog dlg = stylePane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
setValue(stylePane.update());
fireStateChanged();
}
});
stylePane.populate((TemplateStyle) getValue());
dlg.setVisible(true);
}
}

99
designer_base/src/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java

@ -0,0 +1,99 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.general.cardtag.BannerTemplateStyle;
import com.fr.general.cardtag.BookMarkTemplateStyle;
import com.fr.general.cardtag.CardTemplateStyle;
import com.fr.general.cardtag.DefaultTemplateStyle;
import com.fr.general.cardtag.MenuTemplateStyle;
import com.fr.general.cardtag.PentagonTemplateStyle;
import com.fr.general.cardtag.TrapezoidTemplateStyle;
import com.fr.design.dialog.BasicPane;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Created by kerry on 2017/11/23.
*/
public class TemplateStylePane extends BasicPane {
private DefaultListModel listModel;
private JList styleList;
private TemplateStylePreviewPane previewPane = new TemplateStylePreviewPane(new DefaultTemplateStyle());
public TemplateStylePane(){
init();
}
public void init(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
listModel = new DefaultListModel();
listModel.addElement(new DefaultTemplateStyle());
listModel.addElement(new CardTemplateStyle());
listModel.addElement(new BookMarkTemplateStyle());
listModel.addElement(new PentagonTemplateStyle());
listModel.addElement(new MenuTemplateStyle());
listModel.addElement(new TrapezoidTemplateStyle());
listModel.addElement(new BannerTemplateStyle());
styleList = new JList(listModel);
styleList.setCellRenderer(render);
JPanel westPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
westPane.add(styleList, BorderLayout.CENTER);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
westPane.setPreferredSize(new Dimension(100, 500));
centerPane.setPreferredSize(new Dimension(300, 500));
centerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Preview"), null));
centerPane.add(previewPane);
styleList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
previewPane.repaint((TemplateStyle) styleList.getSelectedValue());
}
});
this.add(westPane, BorderLayout.WEST);
this.add(centerPane, BorderLayout.CENTER);
}
public static ListCellRenderer render = new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof TemplateStyle) {
TemplateStyle l = (TemplateStyle) value;
this.setText(l.toString());
}
return this;
}
};
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Tab_Style_Template");
}
public void populate(TemplateStyle templateStyle) {
previewPane.repaint(templateStyle);
for(int i = 0; i< listModel.getSize(); i++){
if((listModel.getElementAt(i).toString()).equals(templateStyle.toString())){
styleList.setSelectedIndex(i);
return;
}
}
styleList.setSelectedIndex(0);
}
public TemplateStyle update() {
return (TemplateStyle) styleList.getSelectedValue();
}
}

37
designer_base/src/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java

@ -0,0 +1,37 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.base.BaseUtils;
import com.fr.general.cardtag.TemplateStyle;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
/**
* Created by kerry on 2017/12/11.
*/
public class TemplateStylePreviewPane extends JPanel {
private static final int WIDTH = 540;
private static final int HEIGHT = 500;
private TemplateStyle templateStyle;
public TemplateStylePreviewPane(TemplateStyle templateStyle){
this.templateStyle = templateStyle;
}
public void repaint (TemplateStyle templateStyle){
this.templateStyle = templateStyle;
super.repaint();
}
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g.create();
Image image = BaseUtils.readImage(templateStyle.getPreview());
g2d.drawImage(image, 0, 0, WIDTH, HEIGHT, null);
}
}

29
designer_base/src/com/fr/design/mainframe/widget/wrappers/TemplateStyleWrapper.java

@ -0,0 +1,29 @@
package com.fr.design.mainframe.widget.wrappers;
import com.fr.design.Exception.ValidationException;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
import com.fr.stable.StringUtils;
/**
* Created by kerry on 2017/11/23.
*/
public class TemplateStyleWrapper implements Encoder, Decoder {
@Override
public String encode(Object v) {
if (v == null) {
return StringUtils.EMPTY;
}
return v.toString();
}
@Override
public Object decode(String txt) {
return null;
}
@Override
public void validate(String txt) throws ValidationException {
}
}

12
designer_base/src/com/fr/design/menu/MenuDef.java

@ -2,10 +2,7 @@ package com.fr.design.menu;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupEastAttrMenu;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.imenu.UIScrollMenu;
import com.fr.design.gui.imenu.*;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
@ -41,6 +38,7 @@ public class MenuDef extends ShortCut {
protected UIButton createdButton;
protected JPopupMenu popupMenu;
private boolean hasScrollSubMenu;
private boolean isHeadMenu;
private String anchor;
@ -88,6 +86,10 @@ public class MenuDef extends ShortCut {
this.hasScrollSubMenu = scrollSubMenu;
}
public void setHasRecMenu(boolean headMenu) {
this.isHeadMenu = headMenu;
}
public String getIconPath() {
return iconPath;
}
@ -186,6 +188,8 @@ public class MenuDef extends ShortCut {
if (createdJMenu == null) {
if (hasScrollSubMenu) {
createdJMenu = new UIScrollMenu(this.getName());
} else if (isHeadMenu){
createdJMenu = new UIHeadMenu(this.getName());
} else {
createdJMenu = new UIMenu(this.getName());
}

37
designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java

@ -5,6 +5,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants;
import java.awt.*;
import java.awt.geom.GeneralPath;
import java.awt.geom.RoundRectangle2D;
public class GUIPaintUtils {
@ -202,4 +203,40 @@ public class GUIPaintUtils {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
/**
* 自定义popMenu画法,一种下面两圆角矩形
*
*/
public static final Shape paintShape(Graphics2D g2, float width, float height, float REC) {
REC = REC / 2;
float recdir = (float) (REC - (REC / Math.sqrt(2)));
GeneralPath gp1 = new GeneralPath();
gp1.moveTo(0f, 0f);
gp1.lineTo(width, 0f);
gp1.lineTo(width, height - REC);
gp1.quadTo(width - recdir, height - recdir, width - REC, height);
gp1.lineTo(REC, height);
gp1.quadTo(recdir, height - recdir, 0, height - REC);
gp1.closePath();
return gp1;
}
/**
* 自定义popMenu边框画法,一种下面两圆角矩形
*
*/
public static final void paintShapeBorder(Graphics2D g2, int x, int y, int width, int height, int rec) {
g2.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR);
width = width - 1;
height = height - 1;
rec = rec / 2;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g2.drawLine(x, y, x + width, y);
g2.drawLine(x + width, y, x + width, y + height - rec);
g2.drawArc(x + width - (rec / 2), y + height - (rec / 2), rec / 2, rec / 2, 0, 90);
g2.drawLine(x + width - rec, y + height, x + rec, y + height);
g2.drawArc(x - (rec / 2), y + height - (rec / 2), rec / 2, rec / 2, 0, 90);
g2.drawLine(x, y + height - rec, x, y);
}
}

24
designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java

@ -9,8 +9,11 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by plough on 2017/8/7.
@ -69,4 +72,21 @@ public class WidgetBoundsPaneFactory {
boundsPane.add(centerPanel, BorderLayout.CENTER);
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 230, 24, boundsPane);
}
public static UIExpandablePane createCardTagBoundPane(UISpinner width) {
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width},
};
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 280, 24, boundsPane);
}
}

4
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java

@ -4,6 +4,7 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.general.ComparatorUtils;
import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.beans.HoverPainter;
@ -35,6 +36,9 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter {
* @param creator 组件
*/
public void fix(XCreator creator) {
if(creator.acceptType(XWCardTagLayout.class)){
creator = (XCreator) creator.getParent();
}
FRBorderLayout layout = (FRBorderLayout)container.getFRLayout();
Object constraints = layout.getConstraints(creator);
if (ComparatorUtils.equals(constraints, BorderLayout.NORTH)) {

21
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -13,6 +13,7 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FRFitLayoutConstraints;
import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel;
@ -20,10 +21,13 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils;
import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
@ -281,9 +285,22 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
backupBound.y -= rec.y;
XWCardLayout cardLayout = mainLayout.getCardPart();
LayoutBorderStyle style = cardLayout.toData().getBorderStyle();
XWCardTitleLayout xwCardTitleLayout = mainLayout.getTitlePart();
Dimension titleDimension = xwCardTitleLayout.getSize();
// 当tab布局为标题样式时,才需要处理标题栏高度产生的影响
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
backupBound.y -= WCardMainBorderLayout.TAB_HEIGHT;
WTabDisplayPosition wTabDisplayPosition = xwCardTitleLayout.getDisplayPosition();
switch (wTabDisplayPosition){
case TOP_POSITION:
backupBound.y -= titleDimension.height;
break;
case LEFT_POSITION:
backupBound.x -= titleDimension.width;
break;
default:
return backupBound;
}
}
return backupBound;
}

3
designer_form/src/com/fr/design/designer/beans/painters/FRBorderLayoutPainter.java

@ -18,6 +18,9 @@ public class FRBorderLayoutPainter extends AbstractPainter {
@Override
public void paint(Graphics g, int startX, int startY) {
if(hotspot_bounds == null){
return;
}
super.paint(g, startX, startY);
int x = hotspot.x;
int y = hotspot.y;

3
designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java

@ -237,6 +237,9 @@ public class XCreatorUtils {
Container c = creator.getParent();
while (c != null) {
XCreator crea = (XCreator) c;
if(crea.acceptType(XWCardTitleLayout.class)){
return (XLayoutContainer) c.getParent();
}
if (crea.isDedicateContainer()) {
return (XLayoutContainer) c.getParent();
}

25
designer_form/src/com/fr/design/designer/creator/XWHorizontalBoxLayout.java

@ -8,8 +8,7 @@ import java.awt.Dimension;
import java.awt.event.ContainerEvent;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRHorizontalLayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.form.layout.FRFlowLayout;
import com.fr.design.form.layout.FRHorizontalLayout;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WHorizontalBoxLayout;
@ -20,6 +19,16 @@ import com.fr.form.ui.container.WHorizontalBoxLayout;
*/
public class XWHorizontalBoxLayout extends XLayoutContainer {
public FRFlowLayout getFrFlowLayout() {
return frFlowLayout;
}
public void setFrFlowLayout(FRFlowLayout frFlowLayout) {
this.frFlowLayout = frFlowLayout;
}
private FRFlowLayout frFlowLayout ;
public XWHorizontalBoxLayout(WHorizontalBoxLayout widget, Dimension initSize) {
super(widget, initSize);
}
@ -46,7 +55,8 @@ public class XWHorizontalBoxLayout extends XLayoutContainer {
@Override
protected void initLayoutManager() {
this.setLayout(new FRHorizontalLayout(toData().getAlignment(), toData().getHgap(), toData().getVgap()));
this.frFlowLayout = new FRHorizontalLayout(toData().getAlignment(), toData().getHgap(), toData().getVgap());
this.setLayout(frFlowLayout);
}
@Override
@ -60,7 +70,7 @@ public class XWHorizontalBoxLayout extends XLayoutContainer {
for (int i = 0, count = this.getComponentCount(); i < count; i++) {
if (creator == this.getComponent(i)) {
wlayout.addWidget(wgt, i);
wlayout.setWidthAtWidget(wgt, creator.getWidth());
frFlowLayout.componentAdded(e, wlayout);
}
}
this.recalculateChildrenPreferredSize();
@ -70,7 +80,7 @@ public class XWHorizontalBoxLayout extends XLayoutContainer {
protected Dimension calculatePreferredSize(Widget wgt) {
// 注意这里计算PreferredSize的时候需要取当前容器的实际大小
// 高度是自适应的,直接就写成0了
return new Dimension(this.toData().getWidthAtWidget(wgt), 0);
return frFlowLayout.calculatePreferredSize(this.toData(), wgt);
}
// 在添加的时候需要把可拉伸的方向确定,所以重写了add方法
@ -80,13 +90,12 @@ public class XWHorizontalBoxLayout extends XLayoutContainer {
if (comp == null) {
return null;
}
XCreator creator = (XCreator) comp;
creator.setDirections(new int[]{Direction.LEFT, Direction.RIGHT});
frFlowLayout.setDirections(comp);
return comp;
}
@Override
public LayoutAdapter getLayoutAdapter() {
return new FRHorizontalLayoutAdapter(this);
return frFlowLayout.getLayoutAdapter(this);
}
}

8
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java

@ -1,6 +1,9 @@
package com.fr.design.designer.creator.cardlayout;
import java.awt.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
@ -106,7 +109,7 @@ public class XCardAddButton extends XButton{
FormHierarchyTreePane.getInstance().refreshRoot();
//将焦点切换到新增的tab对应的tabfitLayout上
showNewTab(editingMouseListener,index);
tagLayout.setTabsAndAdjust();
LayoutUtils.layoutRootContainer(designer.getRootComponent());
}
@ -151,7 +154,6 @@ public class XCardAddButton extends XButton{
titleButton.setCustomStyle(true);
titleButton.setShowButton(true);
showButton.setBackupParent(tagLayout);
this.tagLayout.setCurrentCard(titleButton);
this.tagLayout.setTabFitIndex(index);
this.tagLayout.add(showButton);

113
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -4,13 +4,12 @@
package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.XButton;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel;
@ -23,17 +22,26 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.WTabTextDirection;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
import java.util.HashMap;
import java.util.Map;
/**
*
@ -65,8 +73,6 @@ public class XCardSwitchButton extends XButton {
// tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量
private static final int FONT_SIZE_ADJUST = 2;
private static final int SIDE_OFFSET = 57;
private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout;
@ -118,6 +124,7 @@ public class XCardSwitchButton extends XButton {
public XCardSwitchButton(CardSwitchButton widget, Dimension initSize) {
super(widget, initSize);
}
public XCardSwitchButton(CardSwitchButton widget, Dimension initSize,
@ -180,7 +187,6 @@ public class XCardSwitchButton extends XButton {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this);
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter);
}
setTabsAndAdjust();
if(SwingUtilities.isRightMouseButton(e)){
showPopupMenu(editingMouseListener, e, index, maxIndex);
}
@ -211,7 +217,7 @@ public class XCardSwitchButton extends XButton {
private void deleteCard(XCardSwitchButton button,int index){
String titleName = button.getContentLabel().getText();
int value = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_ConfirmDialog_Content") + "“" + titleName + "”",
Inter.getLocText("FR-Designer_ConfirmDialog_Title"),JOptionPane.YES_NO_OPTION);
Inter.getLocText("FR-Designer_ConfirmDialog_Title"), JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}
@ -296,7 +302,6 @@ public class XCardSwitchButton extends XButton {
public void paintComponent(Graphics g) {
super.paintComponent(g);
setTabsAndAdjust();
Graphics2D g2d = (Graphics2D) g;
drawBackground();
drawTitle();
@ -334,7 +339,22 @@ public class XCardSwitchButton extends XButton {
//画标题
private void drawTitle() {
CardSwitchButton button = (CardSwitchButton) this.toData();
this.setButtonText(button.getText());
String titleText = button.getText();
if(tagLayout != null){
WCardTagLayout wCardTagLayout = (WCardTagLayout) tagLayout.toData();
StringBuilder titleString = new StringBuilder();
//竖向处理
if(ComparatorUtils.equals(wCardTagLayout.getTextDirection(), WTabTextDirection.TEXT_VER_DIRECTION)){
titleString.append("<html>");
for(int i = 0; i < titleText.length(); i++){
titleString.append(titleText.charAt(i)).append("<br/>");
}
titleString.append("</html>");
titleText = titleString.toString();
}
}
this.setButtonText(titleText);
if (this.cardLayout == null) {
initRelateLayout(this);
}
@ -384,63 +404,36 @@ public class XCardSwitchButton extends XButton {
return this.getBackupParent().getTopLayout();
}
public void setTabsAndAdjust() {
if (this.tagLayout == null) {
return;
}
int tabLength = this.tagLayout.getComponentCount();
Map<Integer, Integer> cardWidth = new HashMap<>();
Map<Integer, Integer> cardHeight = new HashMap<>();
for (int i = 0; i < tabLength; i++) {
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton tempCard = (CardSwitchButton) temp.toData();
String tempText = tempCard.getText();
Font f = tempCard.getFont();
FontMetrics fm = GraphHelper.getFontMetrics(f);
cardWidth.put(i,fm.stringWidth(tempText));
cardHeight.put(i,fm.getHeight());
}
adjustTabs(tabLength, cardWidth, cardHeight);
}
public void adjustTabs(int tabLength, Map<Integer, Integer> width, Map<Integer, Integer> height) {
if (width == null) {
return;
}
int tempX = 0;
for (int i = 0; i < tabLength; i++) {
Rectangle rectangle = this.tagLayout.getComponent(i).getBounds();
Integer cardWidth = width.get(i) + SIDE_OFFSET;
//先用这边的固定高度
Integer cardHeight = DEFAULT_BUTTON_HEIGHT;
rectangle.setSize(cardWidth, cardHeight);
rectangle.setBounds(tempX, 0, cardWidth, cardHeight);
tempX += cardWidth;
this.tagLayout.getComponent(i).setBounds(rectangle);
Dimension dimension = new Dimension();
dimension.setSize(cardWidth, cardHeight);
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData();
FRFont frFont = cardSwitchButton.getFont();
UILabel label = temp.getContentLabel();
label.setSize(dimension);
label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution()));
label.setForeground(frFont.getForeground());
temp.setContentLabel(label);
temp.setSize(dimension);
temp.setPreferredSize(new Dimension(cardWidth, cardHeight));
}
}
@Override
public void doLayout() {
super.doLayout();
setTabsAndAdjust();
}
/**
* 控件树里需要隐藏xwcardmainLayout返回其子组件xwcardLayout
* 标题样式下this.getComponent(1)==xwcardLayout
* 标准样式下this.getComponent(0)==xwcardLayout
* @return 子组件xwcardLayout
*/
@Override
public XCreator getXCreator() {
//根据index获取对应的tabFitLayout
int index = ((CardSwitchButton) this.toData()).getIndex();
return (XCreator) cardLayout.getComponent(index);
}
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
label = this.getContentLabel();
}
public void firePropertyChange() {
super.firePropertyChange();
tagLayout.setTabsAndAdjust();
repaint();
}
}

26
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -8,7 +8,11 @@ import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRCardLayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.form.layout.FRCardLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.FormDesigner;
@ -16,7 +20,11 @@ import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.CardTagWLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.editors.DoubleEditor;
import com.fr.form.ui.*;
import com.fr.form.ui.CardAddButton;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WLayout;
@ -30,7 +38,9 @@ import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ContainerEvent;
import java.beans.IntrospectionException;
@ -67,7 +77,7 @@ public class XWCardLayout extends XLayoutContainer {
*
*/
public String createDefaultName() {
return "tabpane";
return "cardlayout";
}
/**
@ -146,10 +156,12 @@ public class XWCardLayout extends XLayoutContainer {
//主结构是一个borderlayout, 标签部分是north, card部分为center
WCardMainBorderLayout border = new WCardMainBorderLayout();
XWCardMainBorderLayout xMainBorder = new XWCardMainBorderLayout(border, dimension);
//将子WCardBorder的style设置到父容器上
LayoutBorderStyle style = (this.toData()).getBorderStyle();
border.setBorderStyle(style);
this.setBackupParent(xMainBorder);
XWCardTitleLayout titlePart = this.initTitlePart(widgetName, xMainBorder);
xMainBorder.addTitlePart(titlePart);
xMainBorder.addTitlePart(titlePart, WBorderLayout.NORTH);
return xMainBorder;
}
@ -188,7 +200,7 @@ public class XWCardLayout extends XLayoutContainer {
private XWCardTagLayout initTagPart(String widgetName, XWCardTitleLayout xTitle){
Dimension dimension = new Dimension();
//放置标题的tab流式布局
WCardTagLayout tagLayout = new WCardTagLayout();
WCardTagLayout tagLayout = new WCardTagLayout("tabpane" + widgetName.replaceAll(createDefaultName(), ""));
XWCardTagLayout xTag = new XWCardTagLayout(tagLayout, dimension, this);
xTag.setBackupParent(xTitle);

77
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -15,12 +15,18 @@ import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.IOUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Inter;
import java.awt.*;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
@ -73,10 +79,26 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
* @date 2014-12-10-下午1:50:56
*
*/
public void addTitlePart(XWCardTitleLayout title){
this.add(title, WBorderLayout.NORTH);
public void addTitlePart(XWCardTitleLayout title, String position){
toData().setTabPosition(position);
this.add(title, position);
}
public void add(Component comp, String position) {
super.add(comp, position);
}
/**
* 切换到非添加状态
*
* @return designer 表单设计器
*/
public void stopAddingState(FormDesigner designer){
designer.stopAddingState();
return;
}
/**
* 添加card区域
*
@ -95,6 +117,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
}
public XWCardTitleLayout getTitlePart(){
Component[] components = this.getComponents();
for(Component component : components){
if(component instanceof XWCardTitleLayout){
return (XWCardTitleLayout)component;
}
}
return (XWCardTitleLayout)this.getComponent(NORTH);
}
@ -106,15 +134,9 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
*/
@Override
public XCreator getXCreator() {
switch(this.getComponentCount()){
case TITLE_STYLE:
return (XCreator)this.getComponent(TITLE_STYLE-1);
case NORMAL_STYLE:
return (XCreator)this.getComponent(NORMAL_STYLE-1);
default:
return this;
}
}
/**
* 控件树不显示此组件
* @param path 控件树list
@ -275,4 +297,35 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
return this;
}
}
/**
* data属性改变触发其他操作
*
*/
public void firePropertyChange(){
getCardPart().initStyle();
}
public void resetTabDisplayPosition(WTabDisplayPosition wTabDisplayPosition){
XWCardTitleLayout xwCardTitleLayout = getTitlePart();
xwCardTitleLayout.resetNewBtnPosition(wTabDisplayPosition);
switch (wTabDisplayPosition){
case TOP_POSITION:
this.addTitlePart(getTitlePart(),WBorderLayout.NORTH);
break;
case LEFT_POSITION:
this.addTitlePart(getTitlePart(),WBorderLayout.WEST);
break;
case BOTTOM_POSITION:
this.addTitlePart(getTitlePart(),WBorderLayout.SOUTH);
break;
case RIGHT_POSITION:
this.addTitlePart(getTitlePart(),WBorderLayout.EAST);
break;
default:
break;
}
this.addCardPart((XWCardLayout)this.getComponent(0));
}
}

239
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -3,26 +3,47 @@
*/
package com.fr.design.designer.creator.cardlayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.border.Border;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRHorizontalLayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRVerticalLayoutAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWHorizontalBoxLayout;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.form.layout.FRFlowLayout;
import com.fr.design.form.layout.FRHorizontalLayout;
import com.fr.design.form.layout.FRVerticalLayout;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
/**
* @date: 2014-11-25-下午3:11:14
@ -39,6 +60,12 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
private int tabFitIndex = 0;
private CardSwitchButton currentCard;
private static final int WIDTH_SIDE_OFFSET = 57;
private static final int HEIGHT_SIDE_OFFSET = 20;
private static final int DEFAULT_BUTTON_HEIGHT = 40;
public CardSwitchButton getCurrentCard() {
return currentCard;
}
@ -75,14 +102,14 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
public XWCardTagLayout(WCardTagLayout widget, Dimension initSize) {
super(widget, initSize);
initLayoutManager();
}
/**
* 构造函数
*/
public XWCardTagLayout(WCardTagLayout widget, Dimension initSize, XWCardLayout cardLayout) {
super(widget, initSize);
this(widget, initSize);
this.cardLayout = cardLayout;
}
@ -109,19 +136,20 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
WTabFitLayout fitLayout = new WTabFitLayout(widgetName, tabFitIndex, currentCard);
fitLayout.setTabNameIndex(getTabNameIndex());
XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension());
tabFitLayout.setxCardSwitchButton((XCardSwitchButton)this.getComponent(0));
tabFitLayout.setBackupParent(cardLayout);
cardLayout.add(tabFitLayout, widgetName);
this.cardLayout.toData().setShowIndex(index);
cardLayout.showCard();
}
private void initCardLayout() {
XWCardTitleLayout titleLayout = (XWCardTitleLayout) this.getBackupParent();
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout) titleLayout.getBackupParent();
this.cardLayout = borderLayout.getCardPart();
}
/**
* 将WLayout转换为XLayoutContainer
*/
@ -132,6 +160,7 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
for (int i = 0; i < layout.getWidgetCount(); i++) {
Widget wgt = layout.getWidget(i);
if (wgt != null) {
initLayoutManager();
XWidgetCreator comp = (XWidgetCreator) XCreatorUtils.createXCreator(wgt, calculatePreferredSize(wgt));
this.add(comp, i);
comp.setBackupParent(this);
@ -140,6 +169,10 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
isRefreshing = false;
}
public String createDefaultName() {
return "tabpane";
}
/**
* 切换到非添加状态
*
@ -195,15 +228,9 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
FormDesigner designer = editingMouseListener.getDesigner();
SelectionModel selectionModel = editingMouseListener.getSelectionModel();
XWCardTitleLayout titleLayout = (XWCardTitleLayout) this.getBackupParent();
if (titleLayout != null) {
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) titleLayout.getBackupParent();
if (mainLayout != null) {
XWCardLayout cardLayout = mainLayout.getCardPart();
selectionModel.setSelectedCreator(cardLayout);
}
if (e.getClickCount() <= 1) {
selectionModel.selectACreatorAtMouseEvent(e);
}
if (editingMouseListener.stopEditing()) {
if (this != designer.getRootComponent()) {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this);
@ -212,8 +239,198 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
}
}
public int[] getDirections() {
return ((XCreator)getParent()).getDirections();
}
public Rectangle getBounds() {
return this.getParent().getBounds();
}
@Override
public XLayoutContainer getTopLayout() {
return this.getBackupParent().getTopLayout();
}
public void notShowInComponentTree(ArrayList<Component> path) {
path.remove(0);
}
@Override
public void doLayout() {
//设置布局
super.doLayout();
}
@Override
protected void initLayoutManager() {
FRFlowLayout frFlowLayout;
if (isHori()) {
frFlowLayout = new FRHorizontalLayout(((WCardTagLayout)toData()).getAlignment(), toData().getHgap(), toData().getVgap());
}else{
frFlowLayout = new FRVerticalLayout(((WCardTagLayout)toData()).getAlignment(), toData().getHgap(), toData().getVgap());
}
this.setFrFlowLayout(frFlowLayout);
this.setLayout(frFlowLayout);
}
@Override
public LayoutAdapter getLayoutAdapter() {
if (isHori()) {
return new FRHorizontalLayoutAdapter(this);
}else{
return new FRVerticalLayoutAdapter(this);
}
}
private boolean isHori(){
WTabDisplayPosition displayPosition = ((WCardTagLayout)this.toData()).getDisplayPosition();
if(displayPosition == null){
displayPosition = WTabDisplayPosition.TOP_POSITION;
}
return ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION);
}
/**
* data属性改变触发其他操作
*
*/
public void firePropertyChange() {
WCardTagLayout wCardTagLayout = (WCardTagLayout) this.toData();
((XWCardMainBorderLayout) getTopLayout()).resetTabDisplayPosition(wCardTagLayout.getDisplayPosition());
//重置内部组件的大小和位置
initLayoutManager();
setTabsAndAdjust();
repaint();
}
public void setTabsAndAdjust() {
WCardTagLayout wCardTagLayout = (WCardTagLayout)this.toData();
int tabLength = this.getComponentCount();
Map<Integer, Integer> cardWidth = new HashMap<>();
Map<Integer, Integer> cardHeight = new HashMap<>();
for (int i = 0; i < tabLength; i++) {
XCardSwitchButton temp = (XCardSwitchButton) this.getComponent(i);
CardSwitchButton tempCard = (CardSwitchButton) temp.toData();
String tempText = tempCard.getText();
Font f = tempCard.getFont();
FontMetrics fm = GraphHelper.getFontMetrics(f);
switch (wCardTagLayout.getTextDirection()){
case TEXT_HORI_DERECTION:
cardWidth.put(i,fm.stringWidth(tempText));
cardHeight.put(i,fm.getHeight());
break;
case TEXT_VER_DIRECTION:
int perHeight = fm.getHeight();
int wordCount = tempText.length();
if(tempText.length() !=0 ){
cardWidth.put(i,fm.stringWidth(tempText)/tempText.length());
}else {
cardWidth.put(i, 0);
}
cardHeight.put(i,(perHeight+3)*wordCount);
break;
default:
break;
}
}
if(isHori()){
adjustTabsH(tabLength, cardWidth, cardHeight);
}else {
adjustTabsV(tabLength, cardWidth, cardHeight);
}
}
public void adjustTabsH(int tabLength, Map<Integer, Integer> width, Map<Integer, Integer> height) {
if (width == null) {
return;
}
//调整XWCardTagLayout的高度
int tempX = 0;
int maxHeight = DEFAULT_BUTTON_HEIGHT;
for (int i = 0; i < tabLength; i++) {
Rectangle rectangle = this.getComponent(i).getBounds();
Integer cardWidth = width.get(i) + WIDTH_SIDE_OFFSET;
Integer cardHeight = height.get(i)+ HEIGHT_SIDE_OFFSET ;
if(cardHeight < DEFAULT_BUTTON_HEIGHT){
cardHeight = DEFAULT_BUTTON_HEIGHT;
}
maxHeight = maxHeight > cardHeight ? maxHeight : cardHeight ;
rectangle.setBounds(tempX, 0, cardWidth, cardHeight);
tempX += cardWidth;
XCardSwitchButton temp = (XCardSwitchButton) this.getComponent(i);
setTabBtnSize(cardWidth, cardHeight, temp);
}
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
XLayoutContainer parent = this.getBackupParent();
Rectangle parentBounds = new Rectangle(parent.getBounds());
parentBounds.height = maxHeight;
parent.setBounds(parentBounds);
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(formDesigner, parent);
if (layoutAdapter != null) {
parent.setBackupBound(parent.getBounds());
layoutAdapter.fix(parent);
}
}
public void setTabBtnSize(int cardWidth, int cardHeight, XCardSwitchButton temp){
Dimension dimension = new Dimension();
dimension.setSize(cardWidth, cardHeight);
CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData();
FRFont frFont = cardSwitchButton.getFont();
UILabel label = temp.getContentLabel();
label.setSize(dimension);
label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution()));
label.setForeground(frFont.getForeground());
temp.setContentLabel(label);
temp.setSize(dimension);
temp.setPreferredSize(new Dimension(cardWidth, cardHeight));
}
public void adjustTabsV(int tabLength, Map<Integer, Integer> width, Map<Integer, Integer> height) {
if (width == null) {
return;
}
int tempY = 0;
int maxWidth = DEFAULT_BUTTON_HEIGHT;
for (int i = 0; i < tabLength; i++) {
Rectangle rectangle = this.getComponent(i).getBounds();
Integer cardWidth = width.get(i) + WIDTH_SIDE_OFFSET;
maxWidth = maxWidth > cardWidth ? maxWidth : cardWidth;
//先用这边的固定高度
Integer cardHeight = height.get(i) + HEIGHT_SIDE_OFFSET;
if(cardWidth < DEFAULT_BUTTON_HEIGHT){
cardWidth = DEFAULT_BUTTON_HEIGHT;
}
if(cardHeight < DEFAULT_BUTTON_HEIGHT){
cardHeight = DEFAULT_BUTTON_HEIGHT;
}
rectangle.setBounds(0, tempY, cardWidth, cardHeight);
tempY += cardHeight;
XCardSwitchButton temp = (XCardSwitchButton) this.getComponent(i);
setTabBtnSize(cardWidth, cardHeight, temp);
}
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
XLayoutContainer parent = this.getBackupParent();
Rectangle parentBounds = new Rectangle(parent.getBounds());
parentBounds.width = maxWidth;
parent.setBounds(parentBounds);
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(formDesigner, parent);
if (layoutAdapter != null) {
parent.setBackupBound(parent.getBounds());
layoutAdapter.fix(parent);
}
}
}

48
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTitleLayout.java

@ -11,6 +11,7 @@ import javax.swing.border.Border;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout;
@ -19,6 +20,8 @@ import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
/**
@ -44,6 +47,11 @@ public class XWCardTitleLayout extends XWBorderLayout {
super(widget, initSize);
}
public WTabDisplayPosition getDisplayPosition(){
return ((WCardTagLayout)this.getTagPart().toData()).getDisplayPosition();
}
/**
* 将WLayout转换为XLayoutContainer
*/
@ -103,6 +111,29 @@ public class XWCardTitleLayout extends XWBorderLayout {
this.add(addBtn, WBorderLayout.EAST);
}
public void resetNewBtnPosition(WTabDisplayPosition wTabDisplayPosition){
XCardAddButton xCardAddButton = (XCardAddButton) this.getComponent(0);
switch (wTabDisplayPosition){
case TOP_POSITION:
this.add(xCardAddButton, WBorderLayout.EAST);
break;
case LEFT_POSITION:
this.add(xCardAddButton, WBorderLayout.SOUTH);
break;
case BOTTOM_POSITION:
this.add(xCardAddButton, WBorderLayout.EAST);
break;
case RIGHT_POSITION:
this.add(xCardAddButton, WBorderLayout.SOUTH);
break;
default:
break;
}
//需要重新添加一次保证组件顺序不变(重新初始化CardTagLayout改变内部布局)
XWCardTagLayout xwCardTagLayout = (XWCardTagLayout) this.getComponent(0);
this.addTagPart(xwCardTagLayout);
}
/**
* 切换到非添加状态
*
@ -134,10 +165,8 @@ public class XWCardTitleLayout extends XWBorderLayout {
FormDesigner designer = editingMouseListener.getDesigner();
SelectionModel selectionModel = editingMouseListener.getSelectionModel();
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) this.getBackupParent();
if(mainLayout != null){
XWCardLayout cardLayout = mainLayout.getCardPart();
selectionModel.setSelectedCreator(cardLayout);
if (e.getClickCount() <= 1) {
selectionModel.selectACreatorAtMouseEvent(e);
}
if (editingMouseListener.stopEditing()) {
@ -152,4 +181,15 @@ public class XWCardTitleLayout extends XWBorderLayout {
public XLayoutContainer getTopLayout() {
return this.getBackupParent().getTopLayout();
}
public String createDefaultName() {
return "tabpane";
}
@Override
public XCreator getXCreator() {
return (XCreator)this.getComponent(1);
}
}

23
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -1,5 +1,6 @@
package com.fr.design.designer.creator.cardlayout;
import com.fr.base.GraphHelper;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
@ -37,6 +38,9 @@ import java.beans.IntrospectionException;
public class XWTabFitLayout extends XWFitLayout {
private static final int MIN_SIZE = 1;
private static final int WIDTH_SIDE_OFFSET = 57;
// tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件
// 这里先将拖拽之前的宽高先做备份
private static final Color NORMAL_GRAL = new Color(236,236,236);
@ -539,6 +543,15 @@ public class XWTabFitLayout extends XWFitLayout {
public void firePropertyChange(){
checkButonType();
//根据字体长度设置tab宽度
setCardSwitchBtnSize();
XWCardLayout cardLayout = (XWCardLayout) this.getBackupParent();
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) cardLayout.getBackupParent();
XWCardTitleLayout titleLayout = mainLayout.getTitlePart();
// //放置tab按钮的tagLayout
XWCardTagLayout tagLayout = titleLayout.getTagPart();
tagLayout.setTabsAndAdjust();
initialBackground = ((WTabFitLayout) data).getInitialBackground();
overBackground = ((WTabFitLayout) data).getOverBackground();
clickBackground = ((WTabFitLayout)data).getClickBackground();
@ -554,4 +567,14 @@ public class XWTabFitLayout extends XWFitLayout {
cardSwitchButton.setClickBackground(clickBackground);
}
}
public void setCardSwitchBtnSize(){
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
Font f = cardSwitchButton.getFont();
FontMetrics fm = GraphHelper.getFontMetrics(f);
int width = fm.stringWidth(cardSwitchButton.getText())+ WIDTH_SIDE_OFFSET;
xCardSwitchButton.setPreferredSize(new Dimension(width, xCardSwitchButton.getHeight()));
}
}

10
designer_form/src/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java

@ -6,6 +6,7 @@ import java.awt.Dimension;
import javax.swing.Icon;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
@ -23,7 +24,14 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
if (value instanceof XCreator) {
setText(((XCreator) value).toData().getWidgetName());
String name = ((XCreator) value).toData().getWidgetName();
//树节点上不显示此控件
if(value instanceof XWCardLayout){
this.setSize(new Dimension(0, 0));
this.setPreferredSize(new Dimension(0, 0));
return this;
}
setText(name);
Icon icon = XCreatorUtils.getCreatorIcon((XCreator) value);
if (icon != null) {
setIcon(icon);

24
designer_form/src/com/fr/design/form/layout/FRFlowLayout.java

@ -1,10 +1,16 @@
package com.fr.design.form.layout;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.creator.XWHorizontalBoxLayout;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WHorizontalBoxLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.event.ContainerEvent;
public abstract class FRFlowLayout implements LayoutManager, FRLayoutManager, java.io.Serializable {
@ -52,6 +58,24 @@ public abstract class FRFlowLayout implements LayoutManager, FRLayoutManager, ja
protected abstract void moveComponents(Container target, Insets insets, int total);
public void componentAdded(ContainerEvent e, WHorizontalBoxLayout wlayout){
}
public Dimension calculatePreferredSize(WHorizontalBoxLayout wlayout, Widget widget){
return new Dimension();
}
public void setDirections(Component component){
}
public abstract LayoutAdapter getLayoutAdapter(XWHorizontalBoxLayout xwHorizontalBoxLayout) ;
public void adjustComponents(Component component){
}
@Override
public void addLayoutComponent(String name, Component comp) {

36
designer_form/src/com/fr/design/form/layout/FRHorizontalLayout.java

@ -3,9 +3,20 @@
*/
package com.fr.design.form.layout;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRHorizontalLayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWHorizontalBoxLayout;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WHorizontalBoxLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ContainerEvent;
/**
* @author richer
@ -70,4 +81,29 @@ public class FRHorizontalLayout extends FRFlowLayout {
}
return total;
}
public void componentAdded(ContainerEvent e, WHorizontalBoxLayout wlayout){
XWidgetCreator creator = (XWidgetCreator) e.getChild();
Widget wgt = creator.toData();
wlayout.setWidthAtWidget(wgt, creator.getWidth());
}
public Dimension calculatePreferredSize(WHorizontalBoxLayout wlayout, Widget widget){
return new Dimension(wlayout.getWidthAtWidget(widget), 0);
}
public void setDirections(Component component){
XCreator creator = (XCreator) component;
creator.setDirections(new int[]{Direction.LEFT, Direction.RIGHT});
}
public LayoutAdapter getLayoutAdapter(XWHorizontalBoxLayout xwHorizontalBoxLayout){
return new FRHorizontalLayoutAdapter(xwHorizontalBoxLayout);
}
public void adjustComponents(Component component){
}
}

34
designer_form/src/com/fr/design/form/layout/FRVerticalLayout.java

@ -3,9 +3,20 @@
*/
package com.fr.design.form.layout;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRVerticalLayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWHorizontalBoxLayout;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WHorizontalBoxLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ContainerEvent;
/**
@ -73,4 +84,27 @@ public class FRVerticalLayout extends FRFlowLayout {
}
return total;
}
public void componentAdded(ContainerEvent e, WHorizontalBoxLayout wlayout){
XWidgetCreator creator = (XWidgetCreator) e.getChild();
Widget wgt = creator.toData();
wlayout.setWidthAtWidget(wgt, creator.getHeight());
}
public Dimension calculatePreferredSize(WHorizontalBoxLayout wlayout, Widget widget){
return new Dimension(0, wlayout.getWidthAtWidget(widget));
}
public void setDirections(Component component){
XCreator creator = (XCreator) component;
creator.setDirections(new int[]{Direction.TOP, Direction.BOTTOM});
}
public LayoutAdapter getLayoutAdapter(XWHorizontalBoxLayout xwHorizontalBoxLayout){
return new FRVerticalLayoutAdapter(xwHorizontalBoxLayout);
}
}

71
designer_form/src/com/fr/design/gui/xpane/CardTagLayoutBorderPane.java

@ -4,19 +4,11 @@
package com.fr.design.gui.xpane;
import java.awt.BorderLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Utils;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
@ -25,14 +17,9 @@ import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.stable.Constants;
/**
* CardTagLayoutBorderPane Pane.
@ -42,6 +29,7 @@ public class CardTagLayoutBorderPane extends LayoutBorderPane {
initComponents();
}
protected UIScrollPane initRightBottomPane(){
this.setFontSizeComboBox(new UIComboBox(FRFontPane.FONT_SIZES));
this.setFontNameComboBox(new UIComboBox(Utils.getAvailableFontFamilyNames4Report()));
@ -90,66 +78,35 @@ public class CardTagLayoutBorderPane extends LayoutBorderPane {
JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
defaultPane.add(rightPane, BorderLayout.EAST);
rightPane.add(initRightBottomPane(), BorderLayout.CENTER);
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (!jTemplate.isJWorkBook() && ((JForm)jTemplate).isSelectRootPane()){
//界面上表单主体只有背景和透明度可以设置
rightPane.add(initBodyRightTopPane(), BorderLayout.NORTH);
} else {
rightPane.add(initRightTopPane(), BorderLayout.NORTH);
}
protected JComponent[] getBorderTypeComp(){
return new JComponent[]{null, null};
}
protected JComponent[] getBorderCornerSpinnerComp(){
return new JComponent[]{null, null};
}
protected void switchBorderType(){
return;
}
public LayoutBorderStyle update() {
LayoutBorderStyle style = new LayoutBorderStyle();
style.setType(this.getBorderTypeCombo().getSelectedIndex());
style.setBorderStyle(this.getBorderStyleCombo().getSelectedIndex());
style.setBorder(this.getCurrentLineCombo().getSelectedLineStyle());
style.setColor(this.getCurrentLineColorPane().getColor());
style.setBackground(this.getBackgroundPane().update());
style.setAlpha((float)(this.getNumberDragPane().updateBean()/this.getMaxNumber()));
WidgetTitle title = style.getTitle() == null ? new WidgetTitle() : style.getTitle();
title.setTextObject("title");
FRFont frFont = title.getFrFont();
frFont = frFont.applySize((Integer)this.getFontSizeComboBox().getSelectedItem());
frFont = frFont.applyName(this.getFontNameComboBox().getSelectedItem().toString());
frFont = frFont.applyForeground(this.getColorSelectPane().getColor());
frFont = updateItalicBold(frFont);
int line = this.getUnderline().isSelected() ? this.getUnderlineCombo().getSelectedLineStyle() : Constants.LINE_NONE;
frFont = frFont.applyUnderline(line);
title.setFrFont(frFont);
title.setBackground(this.getTitleBackgroundPane().update());
style.setTitle(title);
return style;
}
protected void populateTitle(){
WidgetTitle widgetTitle = this.getBorderStyle() == null ? new WidgetTitle() : this.getBorderStyle().getTitle();
widgetTitle = widgetTitle == null ? new WidgetTitle() : widgetTitle;
populateFont(widgetTitle);
this.getUnderline().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
paintPreviewPane();
}
});
this.getUnderlineCombo().addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
paintPreviewPane();
protected void populateBorderType(){
return;
}
});
this.getTitleBackgroundPane().populateBean(widgetTitle.getBackground());
this.getTitleBackgroundPane().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
paintPreviewPane();
}
});
paintPreviewPane();
protected void populateTitle(){
return;
}
}

75
designer_form/src/com/fr/design/gui/xpane/LayoutBorderPane.java

@ -14,7 +14,11 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.*;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -37,15 +41,35 @@ import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.basic.BasicToggleButtonUI;
import java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.RoundRectangle2D;
/**
@ -336,17 +360,7 @@ public class LayoutBorderPane extends BasicPane {
}
protected UIScrollPane initRightTopPane(){
this.borderTypeCombo = new UIComboBox(BORDER_TYPE);
this.borderTypeCombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(borderTypeCombo.getSelectedIndex() == 0){
titlePane.setVisible(false);
} else {
titlePane.setVisible(true);
currentLineCombo.setSelectedItem(Constants.LINE_THIN);
}
}
});
switchBorderType();
this.borderStyleCombo = new UIComboBox(BORDER_STYLE);
this.currentLineCombo = new LineComboBox(BORDER_LINE_STYLE_ARRAY);
this.currentLineColorPane = new UIColorButton(null);
@ -366,11 +380,11 @@ public class LayoutBorderPane extends BasicPane {
double[] rowSize = {p,p,p,p,p,p,p,p};
double[] columnSize = { p, MAX_WIDTH};
JPanel rightTopContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Frame_Style")), borderTypeCombo},
getBorderTypeComp(),
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Render_Style")), borderStyleCombo},
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Border_Line")), currentLineCombo},
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Border_Color")), buttonPane},
{new UILabel(Inter.getLocText("plugin-ChartF_Radius")+":"),borderCornerSpinner},
getBorderCornerSpinnerComp(),
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Body_Background")), backgroundPane},
{new UILabel(""),new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Alpha"))},
{new UILabel(""),transparencyPane},
@ -382,6 +396,27 @@ public class LayoutBorderPane extends BasicPane {
return rightTopPane;
}
protected JComponent[] getBorderTypeComp(){
return new JComponent[]{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Frame_Style")), borderTypeCombo};
}
protected JComponent[] getBorderCornerSpinnerComp(){
return new JComponent[]{new UILabel(Inter.getLocText("plugin-ChartF_Radius")+":"),borderCornerSpinner};
}
protected void switchBorderType(){
this.borderTypeCombo = new UIComboBox(BORDER_TYPE);
this.borderTypeCombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(borderTypeCombo.getSelectedIndex() == 0){
titlePane.setVisible(false);
} else {
titlePane.setVisible(true);
currentLineCombo.setSelectedItem(Constants.LINE_THIN);
}
}
});
}
@ -558,7 +593,7 @@ public class LayoutBorderPane extends BasicPane {
}
protected void populateBorder(){
protected void populateBorderType(){
this.borderTypeCombo.setSelectedIndex(borderStyle.getType());
this.borderTypeCombo.addItemListener(new ItemListener() {
@Override
@ -566,6 +601,10 @@ public class LayoutBorderPane extends BasicPane {
paintPreviewPane();
}
});
}
protected void populateBorder(){
populateBorderType();
this.borderStyleCombo.setSelectedIndex(borderStyle.getBorderStyle());
this.borderStyleCombo.addItemListener(new ItemListener() {
@Override

12
designer_form/src/com/fr/design/mainframe/FormSelection.java

@ -8,7 +8,14 @@ import com.fr.base.FRContext;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XComponent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.form.ui.Widget;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
@ -224,6 +231,9 @@ public class FormSelection {
int size = selection.size();
if (size == 1) {
XCreator creator = selection.get(0);
if(creator.acceptType(XWCardTagLayout.class)){
creator = (XCreator)selection.get(0).getParent();
}
creator.setBounds(rec);
if (creator.acceptType(XWParameterLayout.class)) {
designer.setParaHeight((int) rec.getHeight());

8
designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -10,6 +10,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.foldablepane.UIExpandablePane;
@ -22,6 +23,7 @@ import com.fr.design.widget.FormWidgetDefinePaneFactoryBase;
import com.fr.design.widget.Operator;
import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetCardTagBoundPane;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout;
@ -73,10 +75,12 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) {
XLayoutContainer xLayoutContainer = getParent(xCreator);
if (xLayoutContainer == null || xCreator instanceof XWParameterLayout || xCreator instanceof XWAbsoluteLayout) {
if (xLayoutContainer == null || xCreator.acceptType(XWParameterLayout.class) || xCreator.acceptType(XWAbsoluteLayout.class)) {
return null;
} else if (xLayoutContainer instanceof XWAbsoluteLayout) {
} else if (xLayoutContainer.acceptType(XWAbsoluteLayout.class)) {
return new WidgetAbsoluteBoundPane(xCreator);
} else if(xCreator.acceptType(XWCardTagLayout.class)){
return new WidgetCardTagBoundPane(xCreator);
}
return new WidgetBoundPane(xCreator);
}

2
designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java

@ -12,6 +12,7 @@ import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.*;
import com.fr.form.ui.container.*;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory;
@ -64,6 +65,7 @@ public class FormWidgetDefinePaneFactoryBase {
defineMap.put(WAbsoluteBodyLayout.class, new Appearance(FRAbsoluteBodyLayoutDefinePane.class, "wAbsoluteBodyLayout"));
defineMap.put(WParameterLayout.class, new Appearance(RootDesignDefinePane.class, "wParameterLayout"));
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, "wCardMainBorderLayout"));
defineMap.put(WCardTagLayout.class, new Appearance(WCardTagLayoutDefinePane.class, "wCardMainBorderLayout"));
defineMap.put(WCardLayout.class, new Appearance(WCardLayoutDefinePane.class, "wCardLayout"));
defineMap.put(Label.class, new Appearance(LabelDefinePane.class, "label"));
defineMap.put(WTabFitLayout.class, new Appearance(WTabFitLayoutDefinePane.class, "wTabFitLayout"));

6
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -8,6 +8,7 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
@ -44,6 +45,9 @@ public class WidgetBoundPane extends BasicPane {
}
public XLayoutContainer getParent(XCreator source) {
if(source.acceptType(XWCardTagLayout.class)){
return (XLayoutContainer)source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
@ -122,7 +126,6 @@ public class WidgetBoundPane extends BasicPane {
difference = bounds.width - w;
bounds.width = w;
}
width.setValue(bounds.width);
wabs.setBounds(creator.toData(), bounds);
adjustComponents(bounds, difference, 0);
}
@ -144,7 +147,6 @@ public class WidgetBoundPane extends BasicPane {
difference = bounds.height - h;
bounds.height = h;
}
height.setValue(bounds.height);
wabs.setBounds(creator.toData(), bounds);
adjustComponents(bounds, difference, 1);
}

76
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java

@ -0,0 +1,76 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import java.awt.Rectangle;
/**
* Created by kerry on 2017/12/4.
*/
public class WidgetCardTagBoundPane extends WidgetBoundPane {
private UISpinner cardTagWidth ;
public WidgetCardTagBoundPane(XCreator source) {
super(source);
}
@Override
public void initBoundPane() {
cardTagWidth = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
cardTagWidth.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
this.add(WidgetBoundsPaneFactory.createCardTagBoundPane(cardTagWidth));
}
@Override
public void update() {
if (parent == null) {
return;
}
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle parentBounds = new Rectangle(parent.getBounds());
WCardTagLayout tagLayout = (WCardTagLayout)creator.toData();
WTabDisplayPosition displayPosition = tagLayout.getDisplayPosition();
if( ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION)){
parentBounds.height = (int)cardTagWidth.getValue();
}else{
parentBounds.width = (int)cardTagWidth.getValue();
}
parent.setBounds(parentBounds);
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(formDesigner, parent);
if (layoutAdapter != null) {
parent.setBackupBound(parent.getBounds());
layoutAdapter.fix(parent);
}
}
@Override
protected String title4PopupWindow() {
return "absoluteBound";
}
@Override
public void populate() {
WCardTagLayout tagLayout = (WCardTagLayout)creator.toData();
Rectangle bounds = new Rectangle(creator.getBounds());
WTabDisplayPosition displayPosition = tagLayout.getDisplayPosition();
if( ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION)){
cardTagWidth.setValue(bounds.height);
}else{
cardTagWidth.setValue(bounds.width);
}
}
}

50
designer_form/src/com/fr/design/widget/ui/designer/layout/WCardLayoutDefinePane.java

@ -1,32 +1,15 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleCardTagWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WCardLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by ibm on 2017/8/7.
*/
public class WCardLayoutDefinePane extends AbstractDataModify<WCardLayout> {
private AccessibleCardTagWLayoutBorderStyleEditor accessibleCardTagWLayoutBorderStyleEditor;
private UICheckBox setCarousel;
private UISpinner carouselInterval;
private JPanel IntervalPane;
public WCardLayoutDefinePane(XCreator xCreator) {
super(xCreator);
@ -35,31 +18,6 @@ public class WCardLayoutDefinePane extends AbstractDataModify<WCardLayout> {
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
carouselInterval = new UISpinner(0, 20, 1, 0);
accessibleCardTagWLayoutBorderStyleEditor = new AccessibleCardTagWLayoutBorderStyleEditor();
JPanel accessibleCardlayout = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel stylePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), accessibleCardTagWLayoutBorderStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
stylePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
accessibleCardlayout.add(stylePane, BorderLayout.CENTER);
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, accessibleCardlayout);
final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
setCarousel = new UICheckBox(Inter.getLocText("FR-Designer_setCarousel"));
IntervalPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{
new UILabel(Inter.getLocText("FR-Designer_carouselInterval")), carouselInterval}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
IntervalPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel.add(setCarousel, BorderLayout.NORTH);
jPanel.add(IntervalPane, BorderLayout.CENTER);
setCarousel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IntervalPane.setVisible(setCarousel.isSelected());
}
});
UIExpandablePane setCarouselPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Tab_carousel"), 280, 20, jPanel);
this.add(advanceExpandablePane, BorderLayout.NORTH);
this.add(setCarouselPane, BorderLayout.CENTER);
}
@Override
@ -69,19 +27,13 @@ public class WCardLayoutDefinePane extends AbstractDataModify<WCardLayout> {
@Override
public void populateBean(WCardLayout ob) {
accessibleCardTagWLayoutBorderStyleEditor.setValue(ob.getBorderStyle());
setCarousel.setSelected(ob.isCarousel());
IntervalPane.setVisible(ob.isCarousel());
carouselInterval.setValue(ob.getCarouselInterval());
}
@Override
public WCardLayout updateBean() {
WCardLayout layout = (WCardLayout) creator.toData();
layout.setBorderStyle((LayoutBorderStyle) accessibleCardTagWLayoutBorderStyleEditor.getValue());
layout.setCarousel(setCarousel.isSelected());
layout.setCarouselInterval((int)carouselInterval.getValue());
return layout;
}
}

63
designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java

@ -1,39 +1,92 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleCardTagWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import java.awt.*;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by ibm on 2017/8/2.
*/
public class WCardMainLayoutDefinePane extends AbstractDataModify<WCardMainBorderLayout> {
private AccessibleCardTagWLayoutBorderStyleEditor accessibleCardTagWLayoutBorderStyleEditor;
private UICheckBox setCarousel;
private UISpinner carouselInterval;
private JPanel IntervalPane;
public WCardMainLayoutDefinePane(XCreator xCreator) {
super(xCreator);
this.setPreferredSize(new Dimension(0,0));
initComponent();
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
carouselInterval = new UISpinner(0, 20, 1, 0);
accessibleCardTagWLayoutBorderStyleEditor = new AccessibleCardTagWLayoutBorderStyleEditor();
JPanel accessibleCardlayout = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel stylePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), accessibleCardTagWLayoutBorderStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
stylePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
accessibleCardlayout.add(stylePane, BorderLayout.CENTER);
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, accessibleCardlayout);
final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
setCarousel = new UICheckBox(Inter.getLocText("FR-Designer_setCarousel"));
IntervalPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{
new UILabel(Inter.getLocText("FR-Designer_carouselInterval")), carouselInterval}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
IntervalPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel.add(setCarousel, BorderLayout.NORTH);
jPanel.add(IntervalPane, BorderLayout.CENTER);
setCarousel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IntervalPane.setVisible(setCarousel.isSelected());
}
});
UIExpandablePane setCarouselPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Tab_carousel"), 280, 20, jPanel);
this.add(advanceExpandablePane, BorderLayout.NORTH);
this.add(setCarouselPane, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "cardMainLayout";
return "tabFitLayout";
}
@Override
public void populateBean(WCardMainBorderLayout ob) {
WCardLayout cardLayout = ob.getCardPart();
accessibleCardTagWLayoutBorderStyleEditor.setValue(ob.getBorderStyle());
setCarousel.setSelected(cardLayout.isCarousel());
IntervalPane.setVisible(ob.isCarousel());
carouselInterval.setValue(cardLayout.getCarouselInterval());
}
@Override
public WCardMainBorderLayout updateBean() {
WCardMainBorderLayout layout = (WCardMainBorderLayout)creator.toData();
WCardMainBorderLayout layout = (WCardMainBorderLayout) creator.toData();
layout.setBorderStyle((LayoutBorderStyle) accessibleCardTagWLayoutBorderStyleEditor.getValue());
WCardLayout wCardLayout = layout.getCardPart();
wCardLayout.setCarousel(setCarousel.isSelected());
wCardLayout.setCarouselInterval((int)carouselInterval.getValue());
return layout;
}
}

114
designer_form/src/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

@ -0,0 +1,114 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleImgBackgroundEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.WTabTextDirection;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by kerry on 2017/11/16.
*/
public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout> {
private AccessibleImgBackgroundEditor backgroundEditor;
private FRFontPane frFontPane;
private UIButtonGroup displayPositionGroup;
private UIButtonGroup textDirectionGroup;
private AccessibleTemplateStyleEditor templateStyleEditor;
public WCardTagLayoutDefinePane(XCreator xCreator) {
super(xCreator);
initComponent();
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
backgroundEditor = new AccessibleImgBackgroundEditor();
templateStyleEditor = new AccessibleTemplateStyleEditor();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font"));
fontLabel.setVerticalAlignment(SwingConstants.TOP);
frFontPane = new FRFontPane();
displayPositionGroup = new UIButtonGroup(WTabDisplayPosition.getStringArray());
textDirectionGroup = new UIButtonGroup(WTabTextDirection.getStringArray());
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Tab_Style_Template")), templateStyleEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Tab_Display_Position")), displayPositionGroup},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), backgroundEditor},
new Component[]{fontLabel, frFontPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_StyleAlignment_Text_Rotation")), textDirectionGroup}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
jPanel.add(panel, BorderLayout.CENTER);
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, jPanel);
this.add(advanceExpandablePane, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "tabFitLayout";
}
@Override
public void populateBean(WCardTagLayout ob) {
//标题背景和字体属性设置在WCardLayout上做兼容
XLayoutContainer topLayout = creator.getTopLayout();
LayoutBorderStyle layoutBorderStyle = ((XWCardMainBorderLayout)topLayout).getCardPart().toData().getBorderStyle();
displayPositionGroup.setSelectedIndex(ob.getDisplayPosition().getType());
textDirectionGroup.setSelectedIndex(ob.getTextDirection().getType());
backgroundEditor.setValue(layoutBorderStyle.getTitle().getBackground());
templateStyleEditor.setValue(ob.getTemplateStyle());
FRFont frFont = layoutBorderStyle.getTitle().getFrFont();
if (frFont != null) {
frFontPane.populateBean(frFont);
}
}
@Override
public WCardTagLayout updateBean() {
//标题背景和字体属性设置在WCardLayout上做兼容
XLayoutContainer topLayout = creator.getTopLayout();
LayoutBorderStyle layoutBorderStyle = ((XWCardMainBorderLayout)topLayout).getCardPart().toData().getBorderStyle();
FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont();
layoutBorderStyle.getTitle().setBackground((Background) backgroundEditor.getValue());
layoutBorderStyle.getTitle().setFrFont(frFontPane.update(frFont));
WCardTagLayout layout = (WCardTagLayout) creator.toData();
layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex()));
layout.setTextDirection(WTabTextDirection.parse(textDirectionGroup.getSelectedIndex()));
layout.setTemplateStyle((TemplateStyle) templateStyleEditor.getValue());
return layout;
}
}
Loading…
Cancel
Save