kerry
7 years ago
37 changed files with 1516 additions and 560 deletions
@ -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); |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
} |
@ -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); |
||||||
|
} |
||||||
|
} |
@ -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 { |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -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); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,39 +1,92 @@ |
|||||||
package com.fr.design.widget.ui.designer.layout; |
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.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.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.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 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. |
* Created by ibm on 2017/8/2. |
||||||
*/ |
*/ |
||||||
public class WCardMainLayoutDefinePane extends AbstractDataModify<WCardMainBorderLayout> { |
public class WCardMainLayoutDefinePane extends AbstractDataModify<WCardMainBorderLayout> { |
||||||
|
private AccessibleCardTagWLayoutBorderStyleEditor accessibleCardTagWLayoutBorderStyleEditor; |
||||||
|
private UICheckBox setCarousel; |
||||||
|
private UISpinner carouselInterval; |
||||||
|
private JPanel IntervalPane; |
||||||
|
|
||||||
public WCardMainLayoutDefinePane(XCreator xCreator) { |
public WCardMainLayoutDefinePane(XCreator xCreator) { |
||||||
super(xCreator); |
super(xCreator); |
||||||
this.setPreferredSize(new Dimension(0,0)); |
initComponent(); |
||||||
} |
} |
||||||
|
|
||||||
public void initComponent() { |
public void initComponent() { |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
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 |
@Override |
||||||
public String title4PopupWindow() { |
public String title4PopupWindow() { |
||||||
return "cardMainLayout"; |
return "tabFitLayout"; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void populateBean(WCardMainBorderLayout ob) { |
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 |
@Override |
||||||
public WCardMainBorderLayout updateBean() { |
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; |
return layout; |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -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…
Reference in new issue