Browse Source

REPORT-2615 多种tab布局风格

master
kerry 7 years ago
parent
commit
c990da3001
  1. 7
      designer_base/src/com/fr/design/locale/designer.properties
  2. 7
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  3. 9
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  4. 9
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  5. 9
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  6. 7
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  7. 42
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java
  8. 99
      designer_base/src/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java
  9. 37
      designer_base/src/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java
  10. 29
      designer_base/src/com/fr/design/mainframe/widget/wrappers/TemplateStyleWrapper.java
  11. 24
      designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java
  12. 4
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java
  13. 21
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  14. 3
      designer_form/src/com/fr/design/designer/beans/painters/FRBorderLayoutPainter.java
  15. 3
      designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java
  16. 25
      designer_form/src/com/fr/design/designer/creator/XWHorizontalBoxLayout.java
  17. 8
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  18. 117
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  19. 26
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  20. 121
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  21. 239
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  22. 48
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTitleLayout.java
  23. 23
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  24. 10
      designer_form/src/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  25. 24
      designer_form/src/com/fr/design/form/layout/FRFlowLayout.java
  26. 36
      designer_form/src/com/fr/design/form/layout/FRHorizontalLayout.java
  27. 34
      designer_form/src/com/fr/design/form/layout/FRVerticalLayout.java
  28. 85
      designer_form/src/com/fr/design/gui/xpane/CardTagLayoutBorderPane.java
  29. 639
      designer_form/src/com/fr/design/gui/xpane/LayoutBorderPane.java
  30. 12
      designer_form/src/com/fr/design/mainframe/FormSelection.java
  31. 8
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  32. 2
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  33. 6
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  34. 76
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java
  35. 50
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardLayoutDefinePane.java
  36. 63
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java
  37. 114
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

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

@ -2153,3 +2153,10 @@ FR-Designer_Move_Up=Move up
FR-Designer_Move_Down=Move down
FR-Designer_Move_To_Top=Move to top
FR-Designer_Move_To_Bottom=Move to bottom
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

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

@ -2152,3 +2152,10 @@ FR-Designer_Move_Up=Move up
FR-Designer_Move_Down=Move down
FR-Designer_Move_To_Top=Move to top
FR-Designer_Move_To_Bottom=Move to bottom
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

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

@ -2152,4 +2152,11 @@ FR-Designer_Format_JavaScript=Format Code
FR-Designer_Move_Up=
FR-Designer_Move_Down=
FR-Designer_Move_To_Top=
FR-Designer_Move_To_Bottom=
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=

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

@ -2152,4 +2152,11 @@ FR-Designer_Format_JavaScript=Format Code
FR-Designer_Move_Up=
FR-Designer_Move_Down=
FR-Designer_Move_To_Top=
FR-Designer_Move_To_Bottom=
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=

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

@ -2152,4 +2152,11 @@ FR-Designer_Format_JavaScript=\u683C\u5F0F\u5316\u4EE3\u7801
FR-Designer_Move_Up=\u4E0A\u79FB\u4E00\u5C42
FR-Designer_Move_Down=\u4E0B\u79FB\u4E00\u5C42
FR-Designer_Move_To_Top=\u7F6E\u4E8E\u9876\u5C42
FR-Designer_Move_To_Bottom=\u7F6E\u4E8E\u5E95\u5C42
FR-Designer_Move_To_Bottom=\u7F6E\u4E8E\u5E95\u5C42
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

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

@ -2152,3 +2152,10 @@ FR-Designer_Move_Up=\u4E0A\u79FB\u4E00\u5C64
FR-Designer_Move_Down=\u4E0B\u79FB\u4E00\u5C64
FR-Designer_Move_To_Top=\u7F6E\u65BC\u9802\u5C64
FR-Designer_Move_To_Bottom=\u7F6E\u65BC\u5E95\u5C64
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

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.base.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.base.BannerTemplateStyle;
import com.fr.base.BookMarkTemplateStyle;
import com.fr.base.CardTemplateStyle;
import com.fr.base.DefaultTemplateStyle;
import com.fr.base.MenuTemplateStyle;
import com.fr.base.PentagonTemplateStyle;
import com.fr.base.TrapezoidTemplateStyle;
import com.fr.design.dialog.BasicPane;
import com.fr.base.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.base.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 {
}
}

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);

117
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);
}
@ -383,64 +403,37 @@ public class XCardSwitchButton extends XButton {
public XLayoutContainer getTopLayout() {
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);

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

@ -1,5 +1,5 @@
/**
*
*
*/
package com.fr.design.designer.creator.cardlayout;
@ -15,25 +15,31 @@ 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;
/**
* card布局主体框架
*
*
*
*
* @date: 2014-12-9-下午9:59:31
*/
public class XWCardMainBorderLayout extends XWBorderLayout{
private static final int CENTER = 1;
private static final int NORTH = 0;
public static final Color DEFAULT_BORDER_COLOR = new Color(210,210,210);
@ -43,7 +49,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
private static final int EDIT_BTN_WIDTH = 60;
private static final int EDIT_BTN_HEIGHT = 24;
/**
* 构造函数
*/
@ -53,38 +59,54 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
/**
* 获取当前组件里的控件
*
*
* @return 控件
*
*
*
* @date 2014-12-10-下午1:46:33
*
*
*/
public WCardMainBorderLayout toData() {
return (WCardMainBorderLayout) super.toData();
}
/**
* 添加标题区域
*
*
* @param title 标题区域
*
*
*
* @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区域
*
*
* @param card card区域
*
*
*
* @date 2014-12-10-下午1:50:37
*
*
*/
public void addCardPart(XWCardLayout card){
this.add(card, WBorderLayout.CENTER);
@ -93,11 +115,17 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
public XWCardLayout getCardPart(){
return this.getComponentCount() == TITLE_STYLE ? (XWCardLayout)this.getComponent(CENTER) : (XWCardLayout)this.getComponent(NORTH);
}
public XWCardTitleLayout getTitlePart(){
Component[] components = this.getComponents();
for(Component component : components){
if(component instanceof XWCardTitleLayout){
return (XWCardTitleLayout)component;
}
}
return (XWCardTitleLayout)this.getComponent(NORTH);
}
/**
* 控件树里需要隐藏xwcardmainLayout返回其子组件xwcardLayout
* 标题样式下this.getComponent(1)==xwcardLayout
@ -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;
}
return this;
}
/**
* 控件树不显示此组件
* @param path 控件树list
@ -122,7 +144,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
public void notShowInComponentTree(ArrayList<Component> path) {
path.remove(LAYOUT_INDEX);
}
@Override
public ArrayList<XWTabFitLayout> getTargetChildrenList() {
ArrayList<XWTabFitLayout> tabLayoutList = new ArrayList<XWTabFitLayout>();
@ -133,7 +155,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
}
return tabLayoutList;
}
/**
* 重新调整子组件的宽度
* @param width 宽度
@ -164,7 +186,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
}
}
}
/**
* 重新调整子组件的高度
* @param height 高度
@ -198,7 +220,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
tabLayout.adjustCreatorsHeight(percent);
}
}
}
public void paint(Graphics g) {
@ -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;
/**
@ -43,6 +46,11 @@ public class XWCardTitleLayout extends XWBorderLayout {
public XWCardTitleLayout(WCardTitleLayout widget, Dimension initSize) {
super(widget, initSize);
}
public WTabDisplayPosition getDisplayPosition(){
return ((WCardTagLayout)this.getTagPart().toData()).getDisplayPosition();
}
/**
* 将WLayout转换为XLayoutContainer
@ -102,6 +110,29 @@ public class XWCardTitleLayout extends XWBorderLayout {
public void addNewButton(XCardAddButton addBtn){
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);
}
}

85
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.
@ -41,7 +28,8 @@ public class CardTagLayoutBorderPane extends LayoutBorderPane {
public CardTagLayoutBorderPane(){
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);
}
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 populateBorderType(){
return;
}
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();
}
});
this.getTitleBackgroundPane().populateBean(widgetTitle.getBackground());
this.getTitleBackgroundPane().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
paintPreviewPane();
}
});
paintPreviewPane();
protected void populateTitle(){
return;
}
}

639
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;
/**
@ -97,47 +121,47 @@ public class LayoutBorderPane extends BasicPane {
private int minNumber = 0;
private double maxNumber = 100;
private int iconWidth = 32;
public LayoutBorderStyle getBorderStyle() {
return borderStyle;
}
return borderStyle;
}
public void setBorderStyle(LayoutBorderStyle borderStyle) {
this.borderStyle = borderStyle;
}
public void setBorderStyle(LayoutBorderStyle borderStyle) {
this.borderStyle = borderStyle;
}
public LayoutBorderPreviewPane getLayoutBorderPreviewPane() {
return layoutBorderPreviewPane;
}
public LayoutBorderPreviewPane getLayoutBorderPreviewPane() {
return layoutBorderPreviewPane;
}
public void setLayoutBorderPreviewPane(
LayoutBorderPreviewPane layoutBorderPreviewPane) {
this.layoutBorderPreviewPane = layoutBorderPreviewPane;
}
public void setLayoutBorderPreviewPane(
LayoutBorderPreviewPane layoutBorderPreviewPane) {
this.layoutBorderPreviewPane = layoutBorderPreviewPane;
}
public UIComboBox getBorderTypeCombo() {
return borderTypeCombo;
}
public UIComboBox getBorderTypeCombo() {
return borderTypeCombo;
}
public void setBorderTypeCombo(UIComboBox borderTypeCombo) {
this.borderTypeCombo = borderTypeCombo;
}
public void setBorderTypeCombo(UIComboBox borderTypeCombo) {
this.borderTypeCombo = borderTypeCombo;
}
public UIComboBox getBorderStyleCombo() {
return borderStyleCombo;
}
public UIComboBox getBorderStyleCombo() {
return borderStyleCombo;
}
public void setBorderStyleCombo(UIComboBox borderStyleCombo) {
this.borderStyleCombo = borderStyleCombo;
}
public void setBorderStyleCombo(UIComboBox borderStyleCombo) {
this.borderStyleCombo = borderStyleCombo;
}
public LineComboBox getCurrentLineCombo() {
return currentLineCombo;
}
public LineComboBox getCurrentLineCombo() {
return currentLineCombo;
}
public void setCurrentLineCombo(LineComboBox currentLineCombo) {
this.currentLineCombo = currentLineCombo;
}
public void setCurrentLineCombo(LineComboBox currentLineCombo) {
this.currentLineCombo = currentLineCombo;
}
public UISpinner getBorderCornerSpinner() {
@ -150,162 +174,162 @@ public class LayoutBorderPane extends BasicPane {
public UIColorButton getCurrentLineColorPane() {
return currentLineColorPane;
}
return currentLineColorPane;
}
public void setCurrentLineColorPane(UIColorButton currentLineColorPane) {
this.currentLineColorPane = currentLineColorPane;
}
public void setCurrentLineColorPane(UIColorButton currentLineColorPane) {
this.currentLineColorPane = currentLineColorPane;
}
public BackgroundSpecialPane getBackgroundPane() {
return backgroundPane;
}
public BackgroundSpecialPane getBackgroundPane() {
return backgroundPane;
}
public void setBackgroundPane(BackgroundSpecialPane backgroundPane) {
this.backgroundPane = backgroundPane;
}
public void setBackgroundPane(BackgroundSpecialPane backgroundPane) {
this.backgroundPane = backgroundPane;
}
public UINumberDragPane getNumberDragPane() {
return numberDragPane;
}
public UINumberDragPane getNumberDragPane() {
return numberDragPane;
}
public void setNumberDragPane(UINumberDragPane numberDragPane) {
this.numberDragPane = numberDragPane;
}
public void setNumberDragPane(UINumberDragPane numberDragPane) {
this.numberDragPane = numberDragPane;
}
public TinyFormulaPane getFormulaPane() {
return formulaPane;
}
public TinyFormulaPane getFormulaPane() {
return formulaPane;
}
public void setFormulaPane(TinyFormulaPane formulaPane) {
this.formulaPane = formulaPane;
}
public void setFormulaPane(TinyFormulaPane formulaPane) {
this.formulaPane = formulaPane;
}
public UIComboBox getFontNameComboBox() {
return fontNameComboBox;
}
public UIComboBox getFontNameComboBox() {
return fontNameComboBox;
}
public void setFontNameComboBox(UIComboBox fontNameComboBox) {
this.fontNameComboBox = fontNameComboBox;
}
public void setFontNameComboBox(UIComboBox fontNameComboBox) {
this.fontNameComboBox = fontNameComboBox;
}
public UIComboBox getFontSizeComboBox() {
return fontSizeComboBox;
}
public UIComboBox getFontSizeComboBox() {
return fontSizeComboBox;
}
public void setFontSizeComboBox(UIComboBox fontSizeComboBox) {
this.fontSizeComboBox = fontSizeComboBox;
}
public void setFontSizeComboBox(UIComboBox fontSizeComboBox) {
this.fontSizeComboBox = fontSizeComboBox;
}
public UIColorButton getColorSelectPane() {
return colorSelectPane;
}
public UIColorButton getColorSelectPane() {
return colorSelectPane;
}
public void setColorSelectPane(UIColorButton colorSelectPane) {
this.colorSelectPane = colorSelectPane;
}
public void setColorSelectPane(UIColorButton colorSelectPane) {
this.colorSelectPane = colorSelectPane;
}
public UIToggleButton getBold() {
return bold;
}
public UIToggleButton getBold() {
return bold;
}
public void setBold(UIToggleButton bold) {
this.bold = bold;
}
public void setBold(UIToggleButton bold) {
this.bold = bold;
}
public UIToggleButton getItalic() {
return italic;
}
public UIToggleButton getItalic() {
return italic;
}
public void setItalic(UIToggleButton italic) {
this.italic = italic;
}
public void setItalic(UIToggleButton italic) {
this.italic = italic;
}
public UIToggleButton getUnderline() {
return underline;
}
public UIToggleButton getUnderline() {
return underline;
}
public void setUnderline(UIToggleButton underline) {
this.underline = underline;
}
public void setUnderline(UIToggleButton underline) {
this.underline = underline;
}
public LineComboBox getUnderlineCombo() {
return underlineCombo;
}
public LineComboBox getUnderlineCombo() {
return underlineCombo;
}
public void setUnderlineCombo(LineComboBox underlineCombo) {
this.underlineCombo = underlineCombo;
}
public void setUnderlineCombo(LineComboBox underlineCombo) {
this.underlineCombo = underlineCombo;
}
public UIButtonGroup gethAlignmentPane() {
return hAlignmentPane;
}
public UIButtonGroup gethAlignmentPane() {
return hAlignmentPane;
}
public void sethAlignmentPane(UIButtonGroup hAlignmentPane) {
this.hAlignmentPane = hAlignmentPane;
}
public void sethAlignmentPane(UIButtonGroup hAlignmentPane) {
this.hAlignmentPane = hAlignmentPane;
}
public BackgroundNoImagePane getTitleBackgroundPane() {
return titleBackgroundPane;
}
public BackgroundNoImagePane getTitleBackgroundPane() {
return titleBackgroundPane;
}
public void setTitleBackgroundPane(BackgroundNoImagePane titleBackgroundPane) {
this.titleBackgroundPane = titleBackgroundPane;
}
public void setTitleBackgroundPane(BackgroundNoImagePane titleBackgroundPane) {
this.titleBackgroundPane = titleBackgroundPane;
}
public UIScrollPane getTitlePane() {
return titlePane;
}
public UIScrollPane getTitlePane() {
return titlePane;
}
public void setTitlePane(UIScrollPane titlePane) {
this.titlePane = titlePane;
}
public void setTitlePane(UIScrollPane titlePane) {
this.titlePane = titlePane;
}
public int getMinNumber() {
return minNumber;
}
public int getMinNumber() {
return minNumber;
}
public void setMinNumber(int minNumber) {
this.minNumber = minNumber;
}
public void setMinNumber(int minNumber) {
this.minNumber = minNumber;
}
public double getMaxNumber() {
return maxNumber;
}
public double getMaxNumber() {
return maxNumber;
}
public void setMaxNumber(double maxNumber) {
this.maxNumber = maxNumber;
}
public void setMaxNumber(double maxNumber) {
this.maxNumber = maxNumber;
}
public int getIconWidth() {
return iconWidth;
}
public int getIconWidth() {
return iconWidth;
}
public void setIconWidth(int iconWidth) {
this.iconWidth = iconWidth;
}
public void setIconWidth(int iconWidth) {
this.iconWidth = iconWidth;
}
public final static int[] BORDER_LINE_STYLE_ARRAY = new int[]{
public final static int[] BORDER_LINE_STYLE_ARRAY = new int[]{
Constants.LINE_NONE,
Constants.LINE_THIN, //1px
Constants.LINE_MEDIUM, //2px
Constants.LINE_THICK, //3px
};
};
public final static String[] BORDER_TYPE = new String[]{Inter.getLocText("FR-Designer-Widget-Style_Standard"), Inter.getLocText("FR-Designer-Widget-Style_Custom")};
public final static String[] BORDER_STYLE= new String[]{Inter.getLocText("FR-Designer-Widget-Style_Common"), Inter.getLocText("FR-Designer-Widget-Style_Shadow")};
private final static Dimension BUTTON_SIZE = new Dimension(24, 20);
public LayoutBorderPane() {
this.initComponents();
}
protected void initComponents() {
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(defaultPane, BorderLayout.CENTER);
@ -318,7 +342,7 @@ public class LayoutBorderPane extends BasicPane {
borderPane.setBorder(BorderFactory.createEmptyBorder(10, 4, 10, 4));
layoutBorderPreviewPane = new LayoutBorderPreviewPane(borderStyle);
borderPane.add(layoutBorderPreviewPane, BorderLayout.CENTER);
JPanel rightPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -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,22 +380,43 @@ 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},
}, rowSize, columnSize, 10);
}, rowSize, columnSize, 10);
rightTopContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12));
UIScrollPane rightTopPane = new UIScrollPane(rightTopContentPane);
rightTopPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer-Widget-Style_Frame"),null));
rightTopPane.setPreferredSize(rightTopPane.getPreferredSize());
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);
}
}
});
}
@ -452,8 +487,8 @@ public class LayoutBorderPane extends BasicPane {
titlePane.setVisible(false);
return titlePane;
}
protected JPanel initFontButtonPane(){
colorSelectPane = new UIColorButton();
@ -524,8 +559,8 @@ public class LayoutBorderPane extends BasicPane {
title.setPosition((Integer)hAlignmentPane.getSelectedItem());
title.setBackground(titleBackgroundPane.update());
style.setTitle(title);
return style;
}
return style;
}
protected FRFont updateItalicBold(FRFont frFont) {
int italic_bold = frFont.getStyle();
@ -547,10 +582,10 @@ public class LayoutBorderPane extends BasicPane {
}
public void populate(LayoutBorderStyle style) {
if(this.borderStyle == null) {
borderStyle = new LayoutBorderStyle();
}
this.borderStyle.setStyle(style);
if(this.borderStyle == null) {
borderStyle = new LayoutBorderStyle();
}
this.borderStyle.setStyle(style);
populateBorder();
@ -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
@ -610,7 +649,7 @@ public class LayoutBorderPane extends BasicPane {
populateFourmula(widgetTitle);
populateFont(widgetTitle);
underline.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
@ -631,10 +670,10 @@ public class LayoutBorderPane extends BasicPane {
paintPreviewPane();
}
});
titleBackgroundPane.populateBean(widgetTitle.getBackground());
titleBackgroundPane.populateBean(widgetTitle.getBackground());
this.titleBackgroundPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
@ -716,27 +755,27 @@ public class LayoutBorderPane extends BasicPane {
};
}
private void populateFourmula(WidgetTitle widgetTitle) {
this.formulaPane.populateBean(widgetTitle.getTextObject().toString());
this.formulaPane.getUITextField().getDocument()
.addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
paintPreviewPane();
}
@Override
public void removeUpdate(DocumentEvent e) {
paintPreviewPane();
}
@Override
public void changedUpdate(DocumentEvent e) {
paintPreviewPane();
}
});
}
private void populateFourmula(WidgetTitle widgetTitle) {
this.formulaPane.populateBean(widgetTitle.getTextObject().toString());
this.formulaPane.getUITextField().getDocument()
.addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
paintPreviewPane();
}
@Override
public void removeUpdate(DocumentEvent e) {
paintPreviewPane();
}
@Override
public void changedUpdate(DocumentEvent e) {
paintPreviewPane();
}
});
}
protected JPanel createVerButtonPane(JToggleButton noBorder, String text) {
@ -747,119 +786,119 @@ public class LayoutBorderPane extends BasicPane {
return verPane;
}
protected class VerButtonPane extends JPanel {
JToggleButton noBorder;
BorderButton normalBorder;
BorderButton RoundedBorder;
ButtonGroup group;
private VerButtonPane () {
setLayout(new FlowLayout(FlowLayout.CENTER));
setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
group = new ButtonGroup();
noBorder = new BorderButton(NO_BORDERS);
normalBorder = new BorderButton(RIGHTANGLE_BORDERS);
RoundedBorder = new BorderButton(ROUNDED_BORDERS);
group.add(noBorder);
group.add(normalBorder);
group.add(RoundedBorder);
JToggleButton noBorder;
BorderButton normalBorder;
BorderButton RoundedBorder;
ButtonGroup group;
private VerButtonPane () {
setLayout(new FlowLayout(FlowLayout.CENTER));
setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
group = new ButtonGroup();
noBorder = new BorderButton(NO_BORDERS);
normalBorder = new BorderButton(RIGHTANGLE_BORDERS);
RoundedBorder = new BorderButton(ROUNDED_BORDERS);
group.add(noBorder);
group.add(normalBorder);
group.add(RoundedBorder);
// add(createVerButtonPane(noBorder, Inter.getLocText("None")));
// add(createVerButtonPane(normalBorder, Inter.getLocText("Border-Style-Normal")));
// add(createVerButtonPane(RoundedBorder, Inter.getLocText("Border-Style-Radius")));
}
public void populate(LayoutBorderStyle style) {
if(style.getBorder() == Constants.LINE_NONE) {
group.setSelected(noBorder.getModel(), true);
} else if(style.getBorderRadius() != NO_RADIUS) {
}
public void populate(LayoutBorderStyle style) {
if(style.getBorder() == Constants.LINE_NONE) {
group.setSelected(noBorder.getModel(), true);
} else if(style.getBorderRadius() != NO_RADIUS) {
group.setSelected(RoundedBorder.getModel(), true);
} else {
group.setSelected(normalBorder.getModel(), true);
}
}
}
private class BorderButton extends JToggleButton {
private BorderButton(int border) {
super();
this.setIcon(new BorderButtonIcon(border));
addBorderActionListener(border);
setPreferredSize(new Dimension(32, 32));
this.setBorder(new UIRoundedBorder(new Color(220, 220, 220), 1, 5));
this.setRolloverEnabled(true);
}
@Override
public Border getBorder() {
ButtonModel model = getModel();
if (this.isSelected()) {
return null;
}
if (isRolloverEnabled() && model.isRollover()) {
return new UIRoundedBorder(new Color(148, 148, 148), 1, 5);
}
return super.getBorder();
}
@Override
public void updateUI() {
setUI(new BorderToggleButtonUI());
}
private void addBorderActionListener(final int border) {
addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if (border == 0) {
borderStyle.reset();
} else {
borderStyle.setColor(currentLineColorPane.getColor());
borderStyle.setBorder(currentLineCombo.getSelectedLineStyle());
borderStyle.setBorderRadius((int)borderCornerSpinner.getValue());
}
group.setSelected(normalBorder.getModel(), true);
}
}
}
private class BorderButton extends JToggleButton {
private BorderButton(int border) {
super();
this.setIcon(new BorderButtonIcon(border));
addBorderActionListener(border);
setPreferredSize(new Dimension(32, 32));
this.setBorder(new UIRoundedBorder(new Color(220, 220, 220), 1, 5));
this.setRolloverEnabled(true);
}
@Override
public Border getBorder() {
ButtonModel model = getModel();
if (this.isSelected()) {
return null;
}
if (isRolloverEnabled() && model.isRollover()) {
return new UIRoundedBorder(new Color(148, 148, 148), 1, 5);
}
return super.getBorder();
}
@Override
public void updateUI() {
setUI(new BorderToggleButtonUI());
}
private void addBorderActionListener(final int border) {
addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if (border == 0) {
borderStyle.reset();
} else {
borderStyle.setColor(currentLineColorPane.getColor());
borderStyle.setBorder(currentLineCombo.getSelectedLineStyle());
borderStyle.setBorderRadius((int)borderCornerSpinner.getValue());
}
layoutBorderPreviewPane.repaint();
}
});
}
}
private class BorderToggleButtonUI extends BasicToggleButtonUI {
@Override
public void paint(Graphics g, JComponent c) {
paintBackground(g, (AbstractButton) c);
super.paint(g, c);
}
private void paintBackground(Graphics g, AbstractButton b) {
if (b.isContentAreaFilled()) {
Dimension size = b.getSize();
Background background = new GradientBackground(new Color(247, 247, 247), new Color(228, 228, 228),
GradientBackground.TOP2BOTTOM);
background.paint(g, new RoundRectangle2D.Double(2, 2, size.width - 4, size.height - 4, 5, 5));
}
}
private void paintBorder(Graphics g, Color lineColor, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(lineColor);
g2d.drawRoundRect(0, 0, width - 1, height - 1, 5, 5);
g2d.setColor(Color.WHITE);
g2d.drawRoundRect(1, 1, width - 3, height - 3, 5, 5);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
@Override
protected void paintButtonPressed(Graphics g, AbstractButton b) {
Dimension size = b.getSize();
paintBorder(g, new Color(78,143,203), size.height, size.width);
}
}
}
});
}
}
private class BorderToggleButtonUI extends BasicToggleButtonUI {
@Override
public void paint(Graphics g, JComponent c) {
paintBackground(g, (AbstractButton) c);
super.paint(g, c);
}
private void paintBackground(Graphics g, AbstractButton b) {
if (b.isContentAreaFilled()) {
Dimension size = b.getSize();
Background background = new GradientBackground(new Color(247, 247, 247), new Color(228, 228, 228),
GradientBackground.TOP2BOTTOM);
background.paint(g, new RoundRectangle2D.Double(2, 2, size.width - 4, size.height - 4, 5, 5));
}
}
private void paintBorder(Graphics g, Color lineColor, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(lineColor);
g2d.drawRoundRect(0, 0, width - 1, height - 1, 5, 5);
g2d.setColor(Color.WHITE);
g2d.drawRoundRect(1, 1, width - 3, height - 3, 5, 5);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
@Override
protected void paintButtonPressed(Graphics g, AbstractButton b) {
Dimension size = b.getSize();
paintBorder(g, new Color(78,143,203), size.height, size.width);
}
}
// Icon to display in shortcut setting buttons
private class BorderButtonIcon implements Icon {
@ -883,13 +922,13 @@ public class LayoutBorderPane extends BasicPane {
g.drawRect(3, 3, this.getIconWidth() - 7, this.getIconHeight() - 7);
} else if (display == LayoutBorderPane.ROUNDED_BORDERS) {
g.setColor(Color.black);
g.drawRoundRect(3, 3, this.getIconWidth() - 7, this.getIconHeight() - 7, 6, 6);
g.drawRoundRect(3, 3, this.getIconWidth() - 7, this.getIconHeight() - 7, 6, 6);
}
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer-Widget_Style");
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer-Widget_Style");
}
}

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.base.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("显示位置"), displayPositionGroup},
new Component[]{new UILabel("背景"), backgroundEditor},
new Component[]{fontLabel, frFontPane},
new Component[]{new UILabel("文本方向"), 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