neil 8 years ago
parent
commit
19b23f813e
  1. 2
      designer_base/src/com/fr/design/write/submit/CustomJobPane.java
  2. 14
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  3. 80
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  4. 38
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  5. 12
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

2
designer_base/src/com/fr/design/write/submit/CustomJobPane.java

@ -1 +1 @@
package com.fr.design.write.submit; import com.fr.data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.formula.JavaEditorPane; import com.fr.design.gui.frpane.ObjectProperiesPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicDialog; data.AbstractClassJob; data.AbstractClassJob; data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; data.AbstractClassJob; import com.fr.design.beans.BasicBeanPane; data.AbstractClassJob; import com.fr.design.formula.JavaEditorPane; data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; data.AbstractClassJob; import com.fr.design.gui.ibutton.UIButton; data.AbstractClassJob; import com.fr.design.gui.itextarea.UITextArea; data.AbstractClassJob; import com.fr.design.gui.itextfield.UITextField; data.AbstractClassJob; import com.fr.design.layout.FRGUIPaneFactory; data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; /** * Author : Shockway * Date: 13-7-29 * Time: 下午6:48 */ public abstract class CustomJobPane extends BasicBeanPane { protected UITextField classNameTextField; protected ObjectProperiesPane objectProperiesPane; public static final int DEFAULT_LENGTH = 30; data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; public CustomJobPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); classNameTextField = new UITextField(getLengthOfTextField()); reportletNamePane.add(classNameTextField); data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; UIButton browserButton = new UIButton(Inter.getLocText("FR-Designer_Select_panel")); browserButton.setPreferredSize(new Dimension( browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; UIButton editButton = new UIButton(Inter.getLocText("FR-Designer_Edit_panel")); editButton.setPreferredSize(new Dimension( browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; reportletNamePane.add(browserButton); reportletNamePane.add(editButton); data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; browserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { final ClassNameSelectPane bPane = new ClassNameSelectPane(); bPane.setClassPath(classNameTextField.getText()); bPane.showWindow( SwingUtilities.getWindowAncestor(getWindowAncestor()), new DialogActionAdapter() { public void doOk() { classNameTextField.setText(bPane.getClassPath()); checkAddButtonEnable(); } }).setVisible(true); } }); editButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_SUBMIT_JOB); final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(CustomJobPane.this), new DialogActionAdapter() { public void doOk() { classNameTextField.setText(javaEditorPane.getClassText()); checkAddButtonEnable(); } }); javaEditorPane.addSaveActionListener(new ActionListener() { @Override import com.fr.design.gui.itextarea.UITextArea; dlg.doOK(); import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; }); dlg.setVisible(true); } import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.ibutton.UIButton; data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; reportletNamePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_ClassName_panel"), null)); import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextfield.UITextField; data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.layout.FRGUIPaneFactory; objectProperiesPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Property_panel"), null)); import com.fr.design.gui.itextfield.UITextField; data.AbstractClassJob; data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.beans.BasicBeanPane; JPanel dsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); dsPane.add(area); dsPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Description_panel"), null)); this.add(dsPane, BorderLayout.SOUTH); checkAddButtonEnable(); } public int getLengthOfTextField() { return DEFAULT_LENGTH; } protected String title4PopupWindow() { return "CustomJob"; } protected Component getWindowAncestor() { return this; } @Override public void populateBean(Object ob) { if (ob instanceof AbstractClassJob) { AbstractClassJob cj = (AbstractClassJob) ob; this.classNameTextField.setText(cj.getClassName()); this.objectProperiesPane.populateBean(cj.getPropertyMap()); checkAddButtonEnable(); } } /** * 添加按钮可用 */ public void checkAddButtonEnable() { objectProperiesPane.enableAddButton(StringUtils.isNotEmpty(classNameTextField.getText())); } /** * 重置 */ public void reset() { this.classNameTextField.setText(null); this.checkAddButtonEnable(); } }
package com.fr.design.write.submit; import com.fr.base.GraphHelper; import com.fr.data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.FRGUIPaneFactory; data.AbstractClassJob; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.formula.JavaEditorPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.gui.frpane.ObjectProperiesPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicDialog; data.AbstractClassJob; data.AbstractClassJob; data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; data.AbstractClassJob; import com.fr.design.beans.BasicBeanPane; data.AbstractClassJob; import com.fr.design.formula.JavaEditorPane; data.AbstractClassJob; import com.fr.design.gui.frpane.ObjectProperiesPane; data.AbstractClassJob; import com.fr.design.gui.ibutton.UIButton; data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.gui.itextarea.UITextArea; data.AbstractClassJob; import com.fr.design.gui.itextfield.UITextField; data.AbstractClassJob; import com.fr.design.layout.FRGUIPaneFactory; data.AbstractClassJob; import com.fr.design.dialog.BasicDialog; */ public abstract class CustomJobPane extends BasicBeanPane { protected UITextField classNameTextField; protected ObjectProperiesPane objectProperiesPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.frpane.ObjectProperiesPane; public CustomJobPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); classNameTextField = new UITextField(getLengthOfTextField()); data.AbstractClassJob; /** data.AbstractClassJob; * Author : Shockway data.AbstractClassJob; * Date: 13-7-29 data.AbstractClassJob; * Time: 下午6:48 data.AbstractClassJob; */ data.AbstractClassJob; public abstract class CustomJobPane extends BasicBeanPane { data.AbstractClassJob; protected UITextField classNameTextField; data.AbstractClassJob; protected ObjectProperiesPane objectProperiesPane; data.AbstractClassJob; public static final int DEFAULT_LENGTH = 30; data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; data.AbstractClassJob; public CustomJobPane() { data.AbstractClassJob; this.setLayout(FRGUIPaneFactory.createBorderLayout()); data.AbstractClassJob; JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); data.AbstractClassJob; classNameTextField = new UITextField(getLengthOfTextField()); data.AbstractClassJob; reportletNamePane.add(classNameTextField); data.AbstractClassJob; UIButton browserButton = new UIButton(Inter.getLocText("FR-Designer_Select_panel")); data.AbstractClassJob; browserButton.setPreferredSize(new Dimension( data.AbstractClassJob; browserButton.getPreferredSize().width, data.AbstractClassJob; classNameTextField.getPreferredSize().height)); data.AbstractClassJob; UIButton editButton = new UIButton(Inter.getLocText("FR-Designer_Edit_panel")); data.AbstractClassJob; editButton.setPreferredSize(new Dimension( data.AbstractClassJob; browserButton.getPreferredSize().width, data.AbstractClassJob; classNameTextField.getPreferredSize().height)); data.AbstractClassJob; reportletNamePane.add(browserButton); data.AbstractClassJob; reportletNamePane.add(editButton); data.AbstractClassJob; browserButton.addActionListener(new ActionListener() { data.AbstractClassJob; public void actionPerformed(ActionEvent evt) { data.AbstractClassJob; final ClassNameSelectPane bPane = new ClassNameSelectPane(); data.AbstractClassJob; bPane.setClassPath(classNameTextField.getText()); data.AbstractClassJob; bPane.showWindow( data.AbstractClassJob; SwingUtilities.getWindowAncestor(getWindowAncestor()), data.AbstractClassJob; new DialogActionAdapter() { data.AbstractClassJob; public void doOk() { data.AbstractClassJob; classNameTextField.setText(bPane.getClassPath()); checkAddButtonEnable(); data.AbstractClassJob; checkAddButtonEnable(); data.AbstractClassJob; } data.AbstractClassJob; }).setVisible(true); data.AbstractClassJob; } data.AbstractClassJob; }); data.AbstractClassJob; editButton.addActionListener(new ActionListener() { data.AbstractClassJob; @Override data.AbstractClassJob; public void actionPerformed(ActionEvent e) { data.AbstractClassJob; final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_SUBMIT_JOB); data.AbstractClassJob; final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(CustomJobPane.this), data.AbstractClassJob; new DialogActionAdapter() { data.AbstractClassJob; public void doOk() { data.AbstractClassJob; classNameTextField.setText(javaEditorPane.getClassText()); data.AbstractClassJob; } data.AbstractClassJob; }); data.AbstractClassJob; javaEditorPane.addSaveActionListener(new ActionListener() { data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; data.AbstractClassJob; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; data.AbstractClassJob; import com.fr.design.gui.itextarea.UITextArea; data.AbstractClassJob; import com.fr.design.gui.itextarea.UITextArea; data.AbstractClassJob; data.AbstractClassJob; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import java.awt.*; import com.fr.design.beans.BasicBeanPane; "), null)); this.add(dsPane, BorderLayout.SOUTH); checkAddButtonEnable(); } public int getLengthOfTextField() { return DEFAULT_LENGTH; } protected String title4PopupWindow() { return "CustomJob"; } protected Component getWindowAncestor() { return this; } @Override public void populateBean(Object ob) { if (ob instanceof AbstractClassJob) { AbstractClassJob cj = (AbstractClassJob) ob; this.classNameTextField.setText(cj.getClassName()); this.objectProperiesPane.populateBean(cj.getPropertyMap()); checkAddButtonEnable(); } } /** * 添加按钮可用 */ public void checkAddButtonEnable() { objectProperiesPane.enableAddButton(StringUtils.isNotEmpty(classNameTextField.getText())); } /** * 重置 */ public void reset() { this.classNameTextField.setText(null); this.checkAddButtonEnable(); } }

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

@ -33,6 +33,7 @@ public class XCardAddButton extends XButton{
private static final int INDEX = 0;
private static final int DEFAULT_BUTTON_WIDTH = 80;
private static Icon ADD_ICON = BaseUtils.readIcon("/com/fr/design/form/images/add.png");
private Icon addIcon = ADD_ICON;
@ -88,12 +89,12 @@ public class XCardAddButton extends XButton{
// addbutton对应的XWCardLayout和XWCardTagLayout暂未存入到xml中,重新打开之后先根据父子层获取
if(cardLayout == null && tagLayout ==null ){
initRalateLayout();
initRelateLayout();
}
int index = cardLayout.toData().getWidgetCount();
//添加新的tab,并将原来的设为未选中状态
setTabUnselectd();
setTabUnselected();
addTab(index);
this.tagLayout.adjustComponentWidth();
@ -109,7 +110,7 @@ public class XCardAddButton extends XButton{
LayoutUtils.layoutRootContainer(designer.getRootComponent());
}
private void initRalateLayout(){
private void initRelateLayout(){
XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent();
this.tagLayout = titleLayout.getTagPart();
@ -128,7 +129,7 @@ public class XCardAddButton extends XButton{
}
//将原来的tab页设置为未选中状态
private void setTabUnselectd(){
private void setTabUnselected(){
for(int i=0;i<this.tagLayout.getComponentCount();i++){
WCardTagLayout layout = (WCardTagLayout) this.tagLayout.toData();
CardSwitchButton button = layout.getSwitchButton(i);
@ -145,13 +146,12 @@ public class XCardAddButton extends XButton{
CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName);
//设置标题
titleButton.setText(getTabTitleName());
titleButton.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
titleButton.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout);
titleButton.setCustomStyle(true);
titleButton.setShowButton(true);
showButton.setBackupParent(tagLayout);
this.tagLayout.setCurrentCard(titleButton);
this.tagLayout.setTabFitIndex(index);
this.tagLayout.add(showButton);
@ -189,4 +189,4 @@ public class XCardAddButton extends XButton{
public XLayoutContainer getTopLayout() {
return this.getBackupParent().getTopLayout();
}
}
}

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

@ -3,13 +3,6 @@
*/
package com.fr.design.designer.creator.cardlayout;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
import java.util.*;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
@ -25,6 +18,7 @@ import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.JForm;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle;
@ -34,6 +28,13 @@ import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
import java.util.HashMap;
import java.util.Map;
/**
*
*
@ -42,11 +43,11 @@ import com.fr.general.Inter;
public class XCardSwitchButton extends XButton {
private static final int LEFT_GAP = 16;
private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
private static Icon MOUSE_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
//设置的图片类型
private static final String COLORBACKGROUNDTYPE = "ColorBackground";
private static final String DEFAULTTYPE = "default";
private static final String COLOR_BACKGROUND_TYPE = "ColorBackground";
private static final String DEFAULT_TYPE = "default";
private static final String DEFAULT_FONT_NAME = "SimSun";
//默认颜色
@ -75,7 +76,7 @@ public class XCardSwitchButton extends XButton {
private boolean isCustomStyle;
private UILabel label;
private Icon closeIcon = MOUSE_COLSE;
private Icon closeIcon = MOUSE_CLOSE;
public XWCardTagLayout getTagLayout() {
return tagLayout;
@ -144,16 +145,17 @@ public class XCardSwitchButton extends XButton {
//关闭重新打开,相关的layout未存到xml中,初始化
if(cardLayout == null){
initRalateLayout(this);
initRelateLayout(this);
}
//获取当前tab的index
XCardSwitchButton button = this;
CardSwitchButton currentButton = (CardSwitchButton) button.toData();
int index = currentButton.getIndex();
int maxIndex = cardLayout.getComponentCount() - 1;
//点击删除图标时
if (isSeletectedClose(e,designer)) {
if (isSelectedClose(e, designer)) {
//当删除到最后一个tab时,删除整个tab布局
if(tagLayout.getComponentCount() <= MIN_SIZE){
deleteTabLayout(selectionModel, designer);
@ -169,22 +171,44 @@ public class XCardSwitchButton extends XButton {
//将当前tab按钮改为选中状态
changeButtonState(index);
// 切换到当前tab按钮对应的tabFitLayout
XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
XCardSwitchButton xCardSwitchButton = (XCardSwitchButton) this.tagLayout.getComponent(index);
tabFitLayout.setxCardSwitchButton(xCardSwitchButton);
selectionModel.setSelectedCreator(tabFitLayout);
if (editingMouseListener.stopEditing()) {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer,
this);
editingMouseListener.startEditing(this,
adapter.getDesignerEditor(), adapter);
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this);
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter);
}
setTabsAndAdjust();
if(SwingUtilities.isRightMouseButton(e)){
showPopupMenu(editingMouseListener, e, index, maxIndex);
}
}
private void showPopupMenu(EditingMouseListener editingMouseListener, MouseEvent e, int index, int maxIndex) {
JPopupMenu jPopupMenu = new JPopupMenu();
Action first = new TabMoveFirstAction(editingMouseListener.getDesigner(), this);
Action prev = new TabMovePrevAction(editingMouseListener.getDesigner(), this);
Action next = new TabMoveNextAction(editingMouseListener.getDesigner(), this);
Action end = new TabMoveEndAction(editingMouseListener.getDesigner(), this);
if (index == 0){
first.setEnabled(false);
prev.setEnabled(false);
}
if (index == maxIndex){
next.setEnabled(false);
end.setEnabled(false);
}
jPopupMenu.add(first);
jPopupMenu.add(prev);
jPopupMenu.add(next);
jPopupMenu.add(end);
GUICoreUtils.showPopupMenu(jPopupMenu, editingMouseListener.getDesigner(), e.getX(), e.getY());
}
//删除card,同时修改其他switchbutton和tabfit的index
private void deleteCard(XCardSwitchButton button,int index){
String titleName = button.getContentLabel().getText();
@ -216,7 +240,7 @@ public class XCardSwitchButton extends XButton {
//SwitchButton对应的XWCardLayout和XWCardTagLayout暂未存到xml中,重新打开时根据父子层关系获取
private void initRalateLayout(XCardSwitchButton button){
private void initRelateLayout(XCardSwitchButton button){
this.tagLayout = (XWCardTagLayout)this.getBackupParent();
XWCardTitleLayout titleLayout = (XWCardTitleLayout) this.tagLayout.getBackupParent();
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout)titleLayout.getBackupParent();
@ -224,7 +248,7 @@ public class XCardSwitchButton extends XButton {
}
//是否进入点击关闭按钮区域
private boolean isSeletectedClose(MouseEvent e,FormDesigner designer){
private boolean isSelectedClose(MouseEvent e, FormDesigner designer){
int diff = designer.getArea().getHorScrollBar().getValue();
@ -276,7 +300,7 @@ public class XCardSwitchButton extends XButton {
super.paintComponent(g);
setTabsAndAdjust();
Graphics2D g2d = (Graphics2D) g;
drawBackgorund();
drawBackground();
drawTitle();
Dimension panelSize = this.getContentLabel().getSize();
this.getContentBackground().paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight()));
@ -289,13 +313,13 @@ public class XCardSwitchButton extends XButton {
}
//画背景
private void drawBackgorund(){
private void drawBackground(){
CardSwitchButton button = (CardSwitchButton)this.toData();
Background currentBackground;
currentBackground = this.getSelectBackground();
//这边就是button的背景图片,图片的是image,默认的是color,所以不应该是针对null的判断
String type = currentBackground != null? currentBackground.getBackgroundType() : DEFAULTTYPE;
if (type.equals(COLORBACKGROUNDTYPE) || type.equals(DEFAULTTYPE)) {
String type = currentBackground != null? currentBackground.getBackgroundType() : DEFAULT_TYPE;
if (type.equals(COLOR_BACKGROUND_TYPE) || type.equals(DEFAULT_TYPE)) {
ColorBackground background;
if(button.isShowButton()){
this.rebuid();
@ -314,7 +338,7 @@ public class XCardSwitchButton extends XButton {
CardSwitchButton button = (CardSwitchButton) this.toData();
this.setButtonText(button.getText());
if (this.cardLayout == null) {
initRalateLayout(this);
initRelateLayout(this);
}
LayoutBorderStyle style = this.cardLayout.toData().getBorderStyle();
@ -427,4 +451,4 @@ public class XCardSwitchButton extends XButton {
super.initXCreatorProperties();
label = this.getContentLabel();
}
}
}

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

@ -255,7 +255,12 @@ public class XWCardLayout extends XLayoutContainer {
creator.setDirections(null);
WCardLayout layout = this.toData();
Widget w = creator.toData();
layout.addWidget(w);
for (int i = 0, count = this.getComponentCount(); i < count; i++) {
if (creator == this.getComponent(i)) {
layout.addWidget(w, i);
}
}
}
@Override
@ -277,8 +282,28 @@ public class XWCardLayout extends XLayoutContainer {
* @throws IntrospectionException
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = null;
return ArrayUtils.addAll(getDefaultDescriptor(), crp);
//嵌套的tab组件,内层的不支持轮播属性,屏蔽属性表
if(!isNested()) {
CRPropertyDescriptor[] crp = ((WCardLayout) data).isCarousel() ? getisCarousel() : getisnotCarousel();
return ArrayUtils.addAll(getDefaultDescriptor(), crp);
}else{
return getDefaultDescriptor();
}
}
/**
* 判断当前tab组件是不是嵌套的
* @return 嵌套与否
*/
private boolean isNested() {
XCreator xCreator = (XCreator)this.getBackupParent().getParent();
while (xCreator != null) {
if (xCreator.acceptType(XWCardMainBorderLayout.class)) {
return true;
}
xCreator = (XCreator) xCreator.getParent();
}
return false;
}
public CRPropertyDescriptor[] getisCarousel() throws IntrospectionException {
@ -325,7 +350,7 @@ public class XWCardLayout extends XLayoutContainer {
@Override
public void propertyChange(){
WCardLayout cardLayout = toData();
changeRalateSwitchCardname(cardLayout.getWidgetName());
changeRelateSwitchCardName(cardLayout.getWidgetName());
}
}),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
@ -375,8 +400,8 @@ public class XWCardLayout extends XLayoutContainer {
}
}
//修改相关SwtchButton所绑定的cardLayout控件名
private void changeRalateSwitchCardname(String cardLayoutName) {
//修改相关SwitchButton所绑定的cardLayout控件名
private void changeRelateSwitchCardName(String cardLayoutName) {
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout) this.getBackupParent();
WCardMainBorderLayout border = borderLayout.toData();
WCardTitleLayout titleLayout = border.getTitlePart();
@ -399,7 +424,6 @@ public class XWCardLayout extends XLayoutContainer {
SelectionModel selectionModel = designer.getSelectionModel();
selectionModel.setSelectedCreator(mainLayout);
selectionModel.deleteSelection();
return;
}
@Override
public void setBorder(Border border) {

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

@ -25,11 +25,12 @@ import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter;
@ -118,7 +119,8 @@ public class XWTabFitLayout extends XWFitLayout {
* @throws IntrospectionException
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = null;
checkButonType();
CRPropertyDescriptor[] crp = ((WTabFitLayout) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle();
return ArrayUtils.addAll(defaultDescriptor(), crp);
}
@ -226,6 +228,12 @@ public class XWTabFitLayout extends XWFitLayout {
private void checkButonType() {
if (this.xCardSwitchButton == null) {
//假如为空,默认获取第一个tab的cardBtn属性
try {
xCardSwitchButton = (XCardSwitchButton) ((XWCardMainBorderLayout) this.getTopLayout()).getTitlePart().getTagPart().getComponent(0);
}catch (Exception e){
FRLogger.getLogger().error(e.getMessage());
}
return;
}
boolean isStyle = ((WTabFitLayout) data).isCustomStyle();

Loading…
Cancel
Save