Browse Source

REPORT-576 tabpane属性添加,添加一个轮播属性

master
PanLi320 8 years ago
parent
commit
37d3840a81
  1. 4
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  2. 90
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

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

@ -147,11 +147,11 @@ public class XCardAddButton extends XButton{
//设置标题
titleButton.setText(getTabTitleName());
titleButton.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
XCardSwitchButton showButton = new XCardSwitchButton(titleButton,dimension,cardLayout,tagLayout);
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);

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

@ -6,13 +6,16 @@ package com.fr.design.designer.creator.cardlayout;
import com.fr.base.background.ColorBackground;
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.form.layout.FRCardLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.FormDesigner;
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.renderer.LayoutBorderStyleRenderer;
import com.fr.design.mainframe.widget.editors.DoubleEditor;
import com.fr.form.ui.*;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout;
@ -22,6 +25,7 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
@ -39,6 +43,8 @@ public class XWCardLayout extends XLayoutContainer {
private CardLayout cardLayout;
private boolean initFlag = true;
private static final int NORTH = 0;
private FormDesigner designer;
//默认蓝色标题背景
private static final Color TITLE_COLOR = new Color(51, 132, 240);
@ -197,6 +203,7 @@ public class XWCardLayout extends XLayoutContainer {
CardSwitchButton firstBtn = new CardSwitchButton(widgetName);
firstBtn.setText(Inter.getLocText("FR-Designer_Title") + 0);
firstBtn.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
firstBtn.setCustomStyle(true);
xTag.setCurrentCard(firstBtn);
XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1), this, xTag);
xFirstBtn.setBackupParent(xTag);
@ -271,27 +278,68 @@ public class XWCardLayout extends XLayoutContainer {
* @throws IntrospectionException
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")).setPropertyChangeListener(new PropertyChangeAdapter(){
@Override
public void propertyChange(){
WCardLayout cardLayout = toData();
changeRalateSwitchCardname(cardLayout.getWidgetName());
}
}),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
CardTagWLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
CRPropertyDescriptor[] crp = ((WCardLayout) data).isCarousel() ? getisCarousel() : getisnotCarousel();
return ArrayUtils.addAll(getDefaultDescriptor(), crp);
}
public CRPropertyDescriptor[] getisCarousel() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("carousel", this.data.getClass())
.setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_setCarousel"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Tab_carousel")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
}),
new CRPropertyDescriptor("carouselInterval", this.data.getClass())
.setEditorClass(DoubleEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_carouselInterval"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Tab_carousel")
};
}
public CRPropertyDescriptor[] getisnotCarousel() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("carousel", this.data.getClass())
.setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_setCarousel"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Tab_carousel")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
})
};
}
public CRPropertyDescriptor[] getDefaultDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")).setPropertyChangeListener(new PropertyChangeAdapter(){
@Override
public void propertyChange(){
WCardLayout cardLayout = toData();
changeRalateSwitchCardname(cardLayout.getWidgetName());
}
}),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
CardTagWLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
initStyle();
}
}),
};
@Override
public void propertyChange() {
initStyle();
}
})
};
}
//初始化样式

Loading…
Cancel
Save