kerry
7 years ago
16 changed files with 365 additions and 46 deletions
@ -1 +1,56 @@ |
|||||||
package com.fr.design.widget.ui.designer;
import com.fr.base.GraphHelper;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.CustomWriteAbleRepeatEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Author : Shockway
* Date: 13-9-18
* Time: 下午2:17
*/
public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> {
private UICheckBox customDataCheckBox;
private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30;
private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30;
public CustomWritableRepeatEditorPane(XCreator xCreator) {
super(xCreator);
}
public JPanel setValidatePane(){
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false);
this.customDataCheckBox.setPreferredSize(
new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT));
JPanel otherContentPane = super.setValidatePane();
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5));
return otherContentPane;
}
protected void populateSubWritableRepeatEditorBean(T e) {
this.customDataCheckBox.setSelected(e.isCustomData());
populateSubCustomWritableRepeatEditorBean(e);
}
protected abstract void populateSubCustomWritableRepeatEditorBean(T e);
protected T updateSubWritableRepeatEditorBean() {
T e = updateSubCustomWritableRepeatEditorBean();
e.setCustomData(this.customDataCheckBox.isSelected());
return e;
}
protected abstract T updateSubCustomWritableRepeatEditorBean();
} |
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.GraphHelper; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.form.ui.CustomWriteAbleRepeatEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Author : Shockway |
||||||
|
* Date: 13-9-18 |
||||||
|
* Time: 下午2:17 |
||||||
|
*/ |
||||||
|
public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> { |
||||||
|
|
||||||
|
private UICheckBox customDataCheckBox; |
||||||
|
private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; |
||||||
|
private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; |
||||||
|
|
||||||
|
public CustomWritableRepeatEditorPane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JPanel setValidatePane(){ |
||||||
|
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); |
||||||
|
this.customDataCheckBox.setPreferredSize( |
||||||
|
new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); |
||||||
|
JPanel otherContentPane = super.setValidatePane(); |
||||||
|
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); |
||||||
|
return otherContentPane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void populateSubWritableRepeatEditorBean(T e) { |
||||||
|
this.customDataCheckBox.setSelected(e.isCustomData()); |
||||||
|
populateSubCustomWritableRepeatEditorBean(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubCustomWritableRepeatEditorBean(T e); |
||||||
|
|
||||||
|
protected T updateSubWritableRepeatEditorBean() { |
||||||
|
T e = updateSubCustomWritableRepeatEditorBean(); |
||||||
|
e.setCustomData(this.customDataCheckBox.isSelected()); |
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract T updateSubCustomWritableRepeatEditorBean(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.component; |
||||||
|
|
||||||
|
import com.fr.general.Background; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/7. |
||||||
|
*/ |
||||||
|
public class MouseActionBackground { |
||||||
|
|
||||||
|
private Background initialBackground; |
||||||
|
private Background overBackground; |
||||||
|
private Background clickBackground; |
||||||
|
|
||||||
|
public MouseActionBackground(Background initialBackground, Background overBackground, Background clickBackground){ |
||||||
|
this.initialBackground = initialBackground; |
||||||
|
this.overBackground = overBackground; |
||||||
|
this.clickBackground = clickBackground; |
||||||
|
} |
||||||
|
|
||||||
|
public Background getInitialBackground() { |
||||||
|
return initialBackground; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInitialBackground(Background initialBackground) { |
||||||
|
this.initialBackground = initialBackground; |
||||||
|
} |
||||||
|
|
||||||
|
public Background getOverBackground() { |
||||||
|
return overBackground; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOverBackground(Background overBackground) { |
||||||
|
this.overBackground = overBackground; |
||||||
|
} |
||||||
|
|
||||||
|
public Background getClickBackground() { |
||||||
|
return clickBackground; |
||||||
|
} |
||||||
|
|
||||||
|
public void setClickBackground(Background clickBackground) { |
||||||
|
this.clickBackground = clickBackground; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,58 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.layout; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEditor; |
||||||
|
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; |
||||||
|
import com.fr.form.ui.ElementCaseEditor; |
||||||
|
import com.fr.form.web.FormToolBarManager; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/7. |
||||||
|
*/ |
||||||
|
public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseEditor> { |
||||||
|
private PaddingBoundPane paddingBoundPane; |
||||||
|
private AccessibleElementCaseToolBarEditor elementCaseToolBarEditor; |
||||||
|
|
||||||
|
public ElementEditorDefinePane(XCreator xCreator){ |
||||||
|
super(xCreator); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected JPanel createCenterPane(){ |
||||||
|
paddingBoundPane = new PaddingBoundPane(); |
||||||
|
elementCaseToolBarEditor = new AccessibleElementCaseToolBarEditor(); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1}, {1, 1}}; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{paddingBoundPane, null}, |
||||||
|
new Component[]{new UILabel("报表块工具栏"), elementCaseToolBarEditor} |
||||||
|
}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
protected ElementCaseEditor updateSubBean(){ |
||||||
|
ElementCaseEditor elementCaseEditor = (ElementCaseEditor)creator.toData(); |
||||||
|
paddingBoundPane.update(elementCaseEditor); |
||||||
|
elementCaseEditor.setToolBars((FormToolBarManager[])elementCaseToolBarEditor.getValue()); |
||||||
|
return elementCaseEditor; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubBean(ElementCaseEditor ob){ |
||||||
|
paddingBoundPane.populate(ob); |
||||||
|
elementCaseToolBarEditor.setValue(ob.getToolBars()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,85 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.layout; |
||||||
|
|
||||||
|
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); |
||||||
|
initComponent(); |
||||||
|
} |
||||||
|
|
||||||
|
public void initComponent() { |
||||||
|
carouselInterval = new UISpinner(0, 20, 1, 0); |
||||||
|
accessibleCardTagWLayoutBorderStyleEditor = new AccessibleCardTagWLayoutBorderStyleEditor(); |
||||||
|
accessibleCardTagWLayoutBorderStyleEditor.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||||
|
JPanel accessibleCardlayout = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
accessibleCardlayout.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||||
|
accessibleCardlayout.add(accessibleCardTagWLayoutBorderStyleEditor, BorderLayout.CENTER); |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
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, 18, 7); |
||||||
|
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 "tabFitLayout"; |
||||||
|
} |
||||||
|
|
||||||
|
@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; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue