kerry
7 years ago
27 changed files with 844 additions and 672 deletions
@ -1 +1 @@ |
|||||||
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);
}
// @Override
// protected JPanel setThirdContentPane() {
// JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
// contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
// JPanel otherContentPane = this.setForthContentPane();
// if (otherContentPane != null) {
// contentPane.add(otherContentPane,BorderLayout.CENTER);
// }
// return contentPane;
// }
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 abstract JPanel setForthContentPane();
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,47 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.data.Dictionary; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; |
||||||
|
import com.fr.form.ui.DictContainedCustomWriteAbleEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/6. |
||||||
|
*/ |
||||||
|
public abstract class DictEditorDefinePane<T extends DictContainedCustomWriteAbleEditor> extends CustomWritableRepeatEditorPane<T> { |
||||||
|
private AccessibleDictionaryEditor dictionaryEditor; |
||||||
|
|
||||||
|
|
||||||
|
public DictEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected Component[] createDictPane(){ |
||||||
|
dictionaryEditor = new AccessibleDictionaryEditor(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictionaryEditor}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubCustomWritableRepeatEditorBean(T e) { |
||||||
|
populateSubDictionaryEditorBean(e); |
||||||
|
dictionaryEditor.setValue(e.getDictionary()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected T updateSubCustomWritableRepeatEditorBean() { |
||||||
|
T e = updateSubDictionaryEditorBean(); |
||||||
|
e.setDictionary((Dictionary) dictionaryEditor.getValue()); |
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubDictionaryEditorBean(T e); |
||||||
|
|
||||||
|
protected abstract T updateSubDictionaryEditorBean(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.style.FRFontPane; |
||||||
|
import com.fr.design.widget.ui.designer.component.BackgroundCompPane; |
||||||
|
import com.fr.form.ui.FreeButton; |
||||||
|
import com.fr.general.FRFont; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/6. |
||||||
|
*/ |
||||||
|
public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> { |
||||||
|
private BackgroundCompPane backgroundCompPane; |
||||||
|
private FRFontPane frFontPane; |
||||||
|
|
||||||
|
public FreeButtonDefinePane(XCreator xcreator) { |
||||||
|
super(xcreator); |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createBackgroundComp() { |
||||||
|
backgroundCompPane = new BackgroundCompPane(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background") + ":"), backgroundCompPane}; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createFontPane(){ |
||||||
|
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font")); |
||||||
|
fontLabel.setVerticalAlignment(SwingConstants.TOP); |
||||||
|
frFontPane = new FRFontPane(); |
||||||
|
return new Component[]{fontLabel, frFontPane}; |
||||||
|
} |
||||||
|
|
||||||
|
public void populateSubButtonPane(FreeButton e) { |
||||||
|
backgroundCompPane.populate(e); |
||||||
|
FRFont frFont = e.getFont(); |
||||||
|
if(frFont!=null){ |
||||||
|
frFontPane.populateBean(e.getFont()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public FreeButton updateSubButtonPane() { |
||||||
|
FreeButton freeButton = (FreeButton) creator.toData(); |
||||||
|
backgroundCompPane.update(freeButton); |
||||||
|
frFontPane.update(freeButton.getFont()); |
||||||
|
return freeButton; |
||||||
|
} |
||||||
|
} |
@ -1,60 +0,0 @@ |
|||||||
package com.fr.design.widget.ui.designer; |
|
||||||
|
|
||||||
import com.fr.design.data.DataCreatorUI; |
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.present.dict.DictionaryPane; |
|
||||||
import com.fr.form.ui.ListEditor; |
|
||||||
import com.fr.general.Inter; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
public class ListEditorDefinePane extends WriteUnableRepeatEditorPane<ListEditor> { |
|
||||||
private UICheckBox needHeadCheckBox; |
|
||||||
private DictionaryPane dictPane; |
|
||||||
|
|
||||||
public ListEditorDefinePane() { |
|
||||||
this.initComponents(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void initComponents() { |
|
||||||
super.initComponents(); |
|
||||||
dictPane = new DictionaryPane(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected JPanel setThirdContentPane() { |
|
||||||
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
||||||
JPanel centerPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); |
|
||||||
centerPane.add(needHeadCheckBox = new UICheckBox(Inter.getLocText("List-Need_Head"))); |
|
||||||
contenter.add(centerPane); |
|
||||||
return contenter; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return "List"; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void populateSubWriteUnableRepeatBean(ListEditor e) { |
|
||||||
needHeadCheckBox.setSelected(e.isNeedHead()); |
|
||||||
this.dictPane.populateBean(e.getDictionary()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected ListEditor updateSubWriteUnableRepeatBean() { |
|
||||||
ListEditor ob = new ListEditor(); |
|
||||||
|
|
||||||
ob.setNeedHead(needHeadCheckBox.isSelected()); |
|
||||||
ob.setDictionary(this.dictPane.updateBean()); |
|
||||||
|
|
||||||
return ob; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public DataCreatorUI dataUI() { |
|
||||||
return dictPane; |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue