Browse Source
* commit 'a98db3ce166ba130981fd12165bc235300e1f895': 提交国际化 解决冲突 REPORT-3293 界面各个控件调整 代码修改 国际化 国际化 REPORT-3293 9.0设计器控件设置重画master
kerry
7 years ago
72 changed files with 4847 additions and 106 deletions
@ -0,0 +1,21 @@
|
||||
package com.fr.design.widget; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.gui.frpane.TreeSettingPane; |
||||
import com.fr.design.present.dict.DictionaryPane; |
||||
import com.fr.form.ui.Widget; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
public interface DataModify<T> { |
||||
|
||||
void populateBean(T ob); |
||||
|
||||
T updateBean(); |
||||
|
||||
void checkValid() throws Exception; |
||||
|
||||
DataCreatorUI dataUI(); |
||||
|
||||
JComponent toSwingComponent(); |
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.fr.design.widget; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
|
||||
/** |
||||
* Created by richie on 15/11/16. |
||||
*/ |
||||
public interface Operator { |
||||
|
||||
void did(DataCreatorUI ui, String cardName); |
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.fr.design.mainframe.widget.ui; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/4. |
||||
*/ |
||||
public class FormBasicPropertyPane extends BasicPane { |
||||
private UITextField widgetName; |
||||
|
||||
public FormBasicPropertyPane(){ |
||||
initContentPane(); |
||||
} |
||||
|
||||
protected void initContentPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
widgetName = new UITextField(); |
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("Form-Widget_Name") + ":"), widgetName}, |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
this.add(panel, BorderLayout.NORTH); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "basicProperty"; |
||||
} |
||||
|
||||
public void populate(Widget widget) { |
||||
widgetName.setText(widget.getWidgetName()); |
||||
} |
||||
|
||||
public void update(Widget widget) { |
||||
widget.setWidgetName(widgetName.getText()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fr.design.mainframe.widget.ui; |
||||
|
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/7/26. |
||||
*/ |
||||
public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane { |
||||
private UICheckBox enableCheckBox; |
||||
private UICheckBox visibleCheckBox; |
||||
|
||||
public FormBasicWidgetPropertyPane (){ |
||||
initOtherPane(); |
||||
} |
||||
|
||||
protected void initOtherPane() { |
||||
JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); |
||||
enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true); |
||||
pane2.add(enableCheckBox); |
||||
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true); |
||||
pane2.add(visibleCheckBox); |
||||
this.add(pane2, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "basicProperty"; |
||||
} |
||||
|
||||
public void populate(Widget widget) { |
||||
super.populate(widget); |
||||
enableCheckBox.setSelected(widget.isEnabled()); |
||||
visibleCheckBox.setSelected(widget.isVisible()); |
||||
} |
||||
|
||||
public void update(Widget widget) { |
||||
super.update(widget); |
||||
widget.setEnabled(enableCheckBox.isSelected()); |
||||
widget.setEnabled(visibleCheckBox.isSelected()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,214 @@
|
||||
package com.fr.design.mainframe.widget.ui; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.*; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.FormDesigner; |
||||
import com.fr.design.widget.DataModify; |
||||
import com.fr.design.widget.Operator; |
||||
import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; |
||||
import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane; |
||||
import com.fr.design.widget.ui.designer.component.WidgetBoundPane; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.container.WScaleLayout; |
||||
import com.fr.form.ui.widget.CRBoundsWidget; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/7/25. |
||||
*/ |
||||
public class FormWidgetCardPane extends AbstractAttrNoScrollPane { |
||||
private AttributeChangeListener listener2; |
||||
private FormDesigner designer; |
||||
//当前的编辑器属性定义面板
|
||||
private DataModify<Widget> currentEditorDefinePane; |
||||
private FormBasicPropertyPane widgetPropertyPane; |
||||
private JPanel attriCardPane; |
||||
|
||||
private XCreator xCreator; |
||||
private WidgetBoundPane widgetBoundPane; |
||||
|
||||
|
||||
public FormWidgetCardPane(FormDesigner designer) { |
||||
super(); |
||||
this.xCreator = findXcreator(designer); |
||||
this.designer = designer; |
||||
initComponents(); |
||||
initDefinePane(); |
||||
widgetBoundPane = createWidgetBoundPane(xCreator); |
||||
if (widgetBoundPane != null) { |
||||
attriCardPane.add(widgetBoundPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
} |
||||
|
||||
public XLayoutContainer getParent(XCreator source) { |
||||
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); |
||||
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { |
||||
container = null; |
||||
} |
||||
return container; |
||||
} |
||||
|
||||
public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) { |
||||
XLayoutContainer xLayoutContainer = getParent(xCreator); |
||||
if (xLayoutContainer == null || xCreator instanceof XWParameterLayout || xCreator instanceof XWAbsoluteLayout) { |
||||
return null; |
||||
} else if (xLayoutContainer instanceof XWAbsoluteLayout) { |
||||
return new WidgetAbsoluteBoundPane(xCreator); |
||||
} |
||||
return new WidgetBoundPane(xCreator); |
||||
} |
||||
|
||||
protected JPanel createContentPane() { |
||||
return null; |
||||
} |
||||
|
||||
public XCreator findXcreator(FormDesigner designer) { |
||||
int size = designer.getSelectionModel().getSelection().size(); |
||||
if (size == 0 || size == 1) { |
||||
XCreator creator = size == 0 ? designer.getRootComponent() : designer.getSelectionModel().getSelection() |
||||
.getSelectedCreator(); |
||||
return creator; |
||||
} else { |
||||
return null; |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 后台初始化所有事件. |
||||
*/ |
||||
public void initAllListeners() { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 后台初始化所有事件. |
||||
*/ |
||||
public void reinitAllListeners() { |
||||
initListener(this); |
||||
} |
||||
|
||||
|
||||
protected void initContentPane() { |
||||
} |
||||
|
||||
private void initComponents() { |
||||
|
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
if (xCreator.supportSetVisibleOrEnable()) { |
||||
widgetPropertyPane = new FormBasicWidgetPropertyPane(); |
||||
} else { |
||||
widgetPropertyPane = new FormBasicPropertyPane(); |
||||
} |
||||
|
||||
UIExpandablePane uiExpandablePane = new UIExpandablePane("基本", 280, 20, widgetPropertyPane); |
||||
|
||||
this.add(uiExpandablePane, BorderLayout.NORTH); |
||||
|
||||
attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
|
||||
this.add(attriCardPane, BorderLayout.CENTER); |
||||
|
||||
this.listener2 = new AttributeChangeListener() { |
||||
@Override |
||||
public void attributeChange() { |
||||
updateCreator(); |
||||
} |
||||
}; |
||||
|
||||
} |
||||
|
||||
private void initDefinePane() { |
||||
currentEditorDefinePane = null; |
||||
XCreator creator = xCreator; |
||||
if (xCreator instanceof XWScaleLayout) { |
||||
if (xCreator.acceptType(XWScaleLayout.class)) { |
||||
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { |
||||
creator = (XCreator) xCreator.getComponent(0); |
||||
} |
||||
} |
||||
} |
||||
FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, creator.toData(), new Operator() { |
||||
@Override |
||||
public void did(DataCreatorUI ui, String cardName) { |
||||
|
||||
} |
||||
}); |
||||
DataModify<Widget> definePane = rn.getDefinePane(); |
||||
|
||||
JComponent jComponent = definePane.toSwingComponent(); |
||||
|
||||
attriCardPane.add(jComponent, BorderLayout.NORTH); |
||||
currentEditorDefinePane = definePane; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "Widget"; |
||||
} |
||||
|
||||
public void populate() { |
||||
//populate之前先移除所有的监听
|
||||
removeAttributeChangeListener(); |
||||
Widget cellWidget = xCreator.toData(); |
||||
if (widgetBoundPane != null) { |
||||
widgetBoundPane.populate(); |
||||
} |
||||
if (cellWidget instanceof WScaleLayout) { |
||||
Widget crBoundsWidget = ((WScaleLayout) cellWidget).getBoundsWidget(); |
||||
currentEditorDefinePane.populateBean(((CRBoundsWidget) crBoundsWidget).getWidget()); |
||||
} else { |
||||
currentEditorDefinePane.populateBean(cellWidget); |
||||
} |
||||
widgetPropertyPane.populate(cellWidget); |
||||
reinitAllListeners(); |
||||
this.addAttributeChangeListener(listener2); |
||||
} |
||||
|
||||
|
||||
public void updateCreator() { |
||||
Widget widget = currentEditorDefinePane.updateBean(); |
||||
widgetPropertyPane.update(widget); |
||||
if (widgetBoundPane != null) { |
||||
widgetBoundPane.update(); |
||||
} |
||||
fireValueChanged(); |
||||
|
||||
if (xCreator instanceof XWScaleLayout) { |
||||
XCreator xCreator1 = xCreator.getEditingChildCreator(); |
||||
xCreator1.resetData(widget); |
||||
xCreator.removeAll(); |
||||
xCreator.add(xCreator1); |
||||
} else { |
||||
xCreator.resetData(widget); |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
/** |
||||
*检查 |
||||
*/ |
||||
public void checkValid() throws Exception { |
||||
currentEditorDefinePane.checkValid(); |
||||
} |
||||
|
||||
public void fireValueChanged() { |
||||
designer.repaint(); |
||||
} |
||||
|
||||
public String getIconPath() { |
||||
return ""; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,117 @@
|
||||
package com.fr.design.parameter; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.designer.creator.XWAbsoluteBodyLayout; |
||||
import com.fr.design.designer.creator.XWParameterLayout; |
||||
import com.fr.design.designer.properties.items.FRLayoutTypeItems; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.designer.properties.items.ItemProvider; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||
import com.fr.form.ui.container.WAbsoluteBodyLayout; |
||||
import com.fr.form.ui.container.WBodyLayoutType; |
||||
import com.fr.form.ui.container.WParameterLayout; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/2. |
||||
*/ |
||||
public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> { |
||||
private XWParameterLayout root; |
||||
private UISpinner designerWidth; |
||||
private UICheckBox displayReport; |
||||
private UITextField background; |
||||
private UITextField displayPosition; |
||||
|
||||
public RootDesignDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
this.root = (XWParameterLayout) xCreator; |
||||
initComponent(); |
||||
} |
||||
|
||||
|
||||
public void initComponent() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
designerWidth = new UISpinner(1, 1000, 1); |
||||
JPanel advancePane = createAdvancePane(); |
||||
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); |
||||
this.add(advanceExpandablePane, BorderLayout.NORTH); |
||||
JPanel layoutPane = createBoundsPane(); |
||||
// layoutPane.setLayout(FRGUIPaneFactory.createBorderLayout());
|
||||
// layoutPane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel("设计宽度"), designerWidth}, FlowLayout.LEFT, 4));
|
||||
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("Size"), 280, 20, layoutPane); |
||||
this.add(layoutExpandablePane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public JPanel createBoundsPane(){ |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("Form-Desin_Width")), designerWidth}, |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5)); |
||||
return panel; |
||||
} |
||||
|
||||
public JPanel createAdvancePane(){ |
||||
displayReport = new UICheckBox(Inter.getLocText("FR-Designer_DisplayNothingBeforeQuery")); |
||||
background = new UITextField(); |
||||
displayPosition = new UITextField(); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p,p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), background}, |
||||
new Component[]{displayReport, null }, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WidgetDisplyPosition")), displayPosition} |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5)); |
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "parameter"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(WParameterLayout ob) { |
||||
displayReport.setSelected(ob.isDelayDisplayContent()); |
||||
designerWidth.setValue(ob.getDesignWidth()); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public WParameterLayout updateBean() { |
||||
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); |
||||
wParameterLayout.setDesignWidth((int) designerWidth.getValue()); |
||||
wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); |
||||
return wParameterLayout; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,106 @@
|
||||
package com.fr.design.widget; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.gui.core.WidgetConstants; |
||||
import com.fr.design.parameter.RootDesignDefinePane; |
||||
import com.fr.design.widget.ui.designer.*; |
||||
import com.fr.design.widget.ui.designer.layout.*; |
||||
import com.fr.form.ui.*; |
||||
import com.fr.form.ui.container.*; |
||||
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; |
||||
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.bridge.BridgeMark; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : Richer |
||||
* Version: 6.5.6 |
||||
* Date : 11-11-14 |
||||
* Time : 上午11:17 |
||||
*/ |
||||
public class FormWidgetDefinePaneFactoryBase { |
||||
private static Map<Class<? extends Widget>, Appearance> defineMap = new HashMap<Class<? extends Widget>, Appearance>(); |
||||
|
||||
static { |
||||
defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + "")); |
||||
defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + "")); |
||||
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); |
||||
defineMap.put(Radio.class, new Appearance(RadioDefinePane.class, WidgetConstants.RADIO + "")); |
||||
defineMap.put(CheckBox.class, new Appearance(CheckBoxDefinePane.class, WidgetConstants.CHECKBOX + "")); |
||||
defineMap.put(TreeComboBoxEditor.class, new Appearance(TreeComboBoxEditorDefinePane.class, WidgetConstants.TREECOMBOBOX + "")); |
||||
defineMap.put(TreeEditor.class, new Appearance(TreeEditorDefinePane.class, WidgetConstants.TREE + "")); |
||||
defineMap.put(MultiFileEditor.class, new Appearance(MultiFileEditorPane.class, WidgetConstants.MULTI_FILE + "")); |
||||
defineMap.put(TextArea.class, new Appearance(TextAreaDefinePane.class, WidgetConstants.TEXTAREA + "")); |
||||
defineMap.put(Password.class, new Appearance(PasswordDefinePane.class, WidgetConstants.PASSWORD + "")); |
||||
defineMap.put(IframeEditor.class, new Appearance(IframeEditorDefinePane.class, WidgetConstants.IFRAME + "")); |
||||
defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + "")); |
||||
defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine")); |
||||
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); |
||||
defineMap.put(ListEditor.class, new Appearance(ListEditorDefinePane.class, WidgetConstants.LIST + "")); |
||||
defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + "")); |
||||
defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + "")); |
||||
defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + "")); |
||||
|
||||
defineMap.put(NoneWidget.class, new Appearance(NoneWidgetDefinePane.class, WidgetConstants.NONE + "")); |
||||
defineMap.put(Button.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + "")); |
||||
defineMap.put(FreeButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + "")); |
||||
defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"))); |
||||
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, Inter.getLocText("WLayout-Card-ToolTips"))); |
||||
if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) { |
||||
defineMap.put(StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class), new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + "")); |
||||
} |
||||
|
||||
defineMap.put(WAbsoluteLayout.class, new Appearance(FRAbsoluteLayoutDefinePane.class, Inter.getLocText("FR-Designer_AbsoluteLayout"))); |
||||
defineMap.put(WAbsoluteBodyLayout.class, new Appearance(FRAbsoluteBodyLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"))); |
||||
defineMap.put(WParameterLayout.class, new Appearance(RootDesignDefinePane.class, Inter.getLocText("FR-Designer_Para-Body"))); |
||||
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, "tab")); |
||||
defineMap.put(WTitleLayout.class, new Appearance(WTitleLayoutDefinePane.class, "tab")); |
||||
defineMap.put(Label.class, new Appearance(LabelDefinePane.class, "label")); |
||||
defineMap.put(WTabFitLayout.class, new Appearance(WTabFitLayoutDefinePane.class, "label")); |
||||
defineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap()); |
||||
} |
||||
|
||||
private FormWidgetDefinePaneFactoryBase() { |
||||
|
||||
} |
||||
|
||||
public static RN createWidgetDefinePane(XCreator creator, Widget widget, Operator operator) { |
||||
Appearance dn = defineMap.get(widget.getClass()); |
||||
DataModify<Widget> definePane = null; |
||||
try { |
||||
Constructor con = dn.getDefineClass().getConstructor(XCreator.class); |
||||
definePane = (DataModify)con.newInstance(creator); |
||||
operator.did(definePane.dataUI(), dn.getDisplayName()); |
||||
} catch (Exception e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return new RN(definePane, dn.getDisplayName()); |
||||
} |
||||
|
||||
public static class RN { |
||||
private DataModify<Widget> definePane; |
||||
private String cardName; |
||||
|
||||
public RN(DataModify<Widget> definePane, String cardName) { |
||||
this.definePane = definePane; |
||||
this.cardName = cardName; |
||||
} |
||||
|
||||
public DataModify<Widget> getDefinePane() { |
||||
return definePane; |
||||
} |
||||
|
||||
public String getCardName() { |
||||
return cardName; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.widget.DataModify; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by kerry on 17/07/28. |
||||
*/ |
||||
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> { |
||||
protected XCreator creator; |
||||
|
||||
public AbstractDataModify(){ |
||||
|
||||
} |
||||
public AbstractDataModify(XCreator xCreator){ |
||||
this.creator = xCreator; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent toSwingComponent() { |
||||
return this; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.widget.btn.ButtonDetailPane; |
||||
import com.fr.design.widget.ui.designer.btn.ButtonDetailPaneFactory; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.form.ui.FreeButton; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
public class ButtonDefinePane extends AbstractDataModify<Button> { |
||||
private ButtonDetailPane detailPane; |
||||
|
||||
public ButtonDefinePane(XCreator creator){ |
||||
super(creator); |
||||
this.initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "Button"; |
||||
} |
||||
|
||||
private void resetDetailPane(Button btn, Class cls) { |
||||
if (detailPane != null) { |
||||
remove(detailPane); |
||||
} |
||||
detailPane = ButtonDetailPaneFactory.createButtonDetailPane(cls, btn); |
||||
add(detailPane, BorderLayout.CENTER); |
||||
detailPane.addTypeChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
resetDetailPane(null, (Class) e.getSource()); |
||||
} |
||||
}); |
||||
this.updateUI(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Button btn) { |
||||
resetDetailPane(btn, btn instanceof FreeButton && !((FreeButton) btn).isCustomStyle() ? Button.class : null); |
||||
} |
||||
|
||||
@Override |
||||
public Button updateBean() { |
||||
|
||||
// resetDetailPane(btn, btn instanceof FreeButton && !((FreeButton) btn).isCustomStyle() ? Button.class : null);
|
||||
return new Button(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,51 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
|
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.ui.ButtonGroup; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
|
||||
public class ButtonGroupDictPane extends JPanel { |
||||
private UIBasicSpinner columnSpinner; |
||||
private UICheckBox adaptiveCheckbox; |
||||
private UILabel columnLabel; |
||||
|
||||
public ButtonGroupDictPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
public void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
||||
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); |
||||
this.add(adaptiveCheckbox); |
||||
|
||||
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); |
||||
this.add(columnLabel); |
||||
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); |
||||
this.add(columnSpinner); |
||||
} |
||||
|
||||
public void populate(ButtonGroup buttonGroup) { |
||||
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); |
||||
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||
columnSpinner.setValue(buttonGroup.getColumnsInRow()); |
||||
} |
||||
|
||||
public void update(ButtonGroup buttonGroup) { |
||||
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); |
||||
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||
import com.fr.form.ui.CheckBox; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
||||
private UITextField text; |
||||
private UITextField fontSizePane; |
||||
|
||||
public CheckBoxDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
iniComoponents(); |
||||
} |
||||
|
||||
private void iniComoponents() { |
||||
text = new UITextField(); |
||||
fontSizePane = new UITextField(); |
||||
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane(); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), text }, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane }, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane}, |
||||
}; |
||||
double[] rowSize = {p, p, p, p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1},{1, 3},{1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, panel); |
||||
|
||||
this.add(uiExpandablePane); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "CheckBox"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CheckBox check) { |
||||
// text.setText(check.getText());
|
||||
} |
||||
|
||||
@Override |
||||
public CheckBox updateBean() { |
||||
CheckBox box = new CheckBox(); |
||||
box.setText(text.getText()); |
||||
return box; |
||||
} |
||||
} |
@ -0,0 +1,93 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.gui.icombobox.DictionaryComboBox; |
||||
import com.fr.design.gui.icombobox.DictionaryConstants; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.ui.CheckBoxGroup; |
||||
import com.fr.form.ui.ComboCheckBox; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class CheckBoxDictPane extends JPanel { |
||||
|
||||
private DictionaryComboBox delimiterComboBox; |
||||
private UIComboBox returnTypeComboBox; |
||||
private DictionaryComboBox startComboBox; |
||||
private DictionaryComboBox endComboBox; |
||||
|
||||
private JPanel delimiterPane; |
||||
private JPanel startPane; |
||||
private JPanel endPane; |
||||
|
||||
public CheckBoxDictPane() { |
||||
JPanel returnTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); |
||||
returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")}); |
||||
returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER); |
||||
this.add(returnTypePane); |
||||
|
||||
delimiterPane =FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
UILabel label = new UILabel(Inter.getLocText("Form-Delimiter") + ":"); |
||||
delimiterPane.add(label, BorderLayout.WEST); |
||||
delimiterPane.add(delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays), BorderLayout.CENTER); |
||||
delimiterComboBox.setEditable(true); |
||||
this.add(delimiterPane); |
||||
|
||||
startPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
startPane.add(new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"), BorderLayout.WEST); |
||||
startPane.add(startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER); |
||||
startComboBox.setEditable(true); |
||||
this.add(startPane); |
||||
|
||||
endPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
endPane.add(new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"), BorderLayout.WEST); |
||||
endPane.add(endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER); |
||||
endComboBox.setEditable(true); |
||||
this.add(endPane); |
||||
|
||||
returnTypeComboBox.addActionListener(new ActionListener(){ |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkVisible(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkVisible(){ |
||||
delimiterPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); |
||||
startPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); |
||||
endPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1); |
||||
} |
||||
|
||||
public void populate(ComboCheckBox comboCheckBox) { |
||||
this.delimiterComboBox.setSelectedItem(comboCheckBox.getDelimiter()); |
||||
this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0); |
||||
this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol()); |
||||
this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol()); |
||||
checkVisible(); |
||||
} |
||||
public void update(ComboCheckBox comboCheckBox) { |
||||
comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); |
||||
comboCheckBox.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0); |
||||
comboCheckBox.setStartSymbol((String)this.startComboBox.getSelectedItem()); |
||||
comboCheckBox.setEndSymbol((String)this.endComboBox.getSelectedItem()); |
||||
} |
||||
public void populate(CheckBoxGroup checkBoxGroup) { |
||||
this.delimiterComboBox.setSelectedItem(checkBoxGroup.getDelimiter()); |
||||
this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0); |
||||
this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol()); |
||||
this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol()); |
||||
checkVisible(); |
||||
} |
||||
public void update(CheckBoxGroup checkBoxGroup) { |
||||
checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); |
||||
checkBoxGroup.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0); |
||||
checkBoxGroup.setStartSymbol((String)this.startComboBox.getSelectedItem()); |
||||
checkBoxGroup.setEndSymbol((String)this.endComboBox.getSelectedItem()); |
||||
} |
||||
} |
@ -0,0 +1,78 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
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.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.present.dict.DictionaryPane; |
||||
import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane; |
||||
import com.fr.form.ui.CheckBoxGroup; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup> { |
||||
private DictionaryPane dictPane; |
||||
|
||||
private UICheckBox checkbox; |
||||
|
||||
public CheckBoxGroupDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
|
||||
dictPane = new DictionaryPane(); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "CheckBoxGroup"; |
||||
} |
||||
|
||||
|
||||
public JPanel createOtherPane(){ |
||||
checkbox = new UICheckBox(Inter.getLocText(new String[]{"Provide", "Choose_All"})); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{checkbox, null }, |
||||
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), new UITextField()}, |
||||
}; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1},{1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); |
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubButtonGroupBean(CheckBoxGroup ob) { |
||||
this.dictPane.populateBean(ob.getDictionary()); |
||||
checkbox.setSelected(ob.isChooseAll()); |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
protected CheckBoxGroup updateSubButtonGroupBean() { |
||||
CheckBoxGroup ob = (CheckBoxGroup) creator.toData(); |
||||
|
||||
ob.setDictionary(this.dictPane.updateBean()); |
||||
ob.setChooseAll(checkbox.isSelected()); |
||||
return ob; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return dictPane; |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.present.dict.DictionaryPane; |
||||
import com.fr.form.ui.ComboBox; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> { |
||||
protected DictionaryPane dictPane; |
||||
|
||||
|
||||
public ComboBoxDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
dictPane = new DictionaryPane(); |
||||
} |
||||
|
||||
protected JPanel setForthContentPane () { |
||||
return null; |
||||
} |
||||
|
||||
protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) { |
||||
removeRepeatCheckBox.setSelected(e.isRemoveRepeat()); |
||||
this.dictPane.populateBean(e.getDictionary()); |
||||
} |
||||
|
||||
protected ComboBox updateSubCustomWritableRepeatEditorBean() { |
||||
ComboBox combo = new ComboBox(); |
||||
combo.setDictionary(this.dictPane.updateBean()); |
||||
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected()); |
||||
return combo; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "ComboBox"; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return dictPane; |
||||
} |
||||
} |
@ -0,0 +1,91 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
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.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.present.dict.DictionaryPane; |
||||
import com.fr.form.ui.ComboCheckBox; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> { |
||||
private CheckBoxDictPane checkBoxDictPane; |
||||
private DictionaryPane dictPane; |
||||
private UICheckBox supportTagCheckBox; |
||||
|
||||
public ComboCheckBoxDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
dictPane = new DictionaryPane(); |
||||
checkBoxDictPane = new CheckBoxDictPane(); |
||||
supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setForthContentPane() { |
||||
JPanel attrPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
||||
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
JPanel contenter = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
contenter.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
|
||||
attrPane.add(contenter); |
||||
//是否以标签形式显示
|
||||
JPanel tagPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); |
||||
tagPane.add(supportTagCheckBox); |
||||
contenter.add(tagPane, BorderLayout.NORTH); |
||||
|
||||
contenter.add(checkBoxDictPane, BorderLayout.WEST); |
||||
return attrPane; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) { |
||||
this.dictPane.populateBean(e.getDictionary()); |
||||
this.checkBoxDictPane.populate(e); |
||||
this.supportTagCheckBox.setSelected(e.isSupportTag()); |
||||
this.removeRepeatCheckBox.setSelected(e.isRemoveRepeat()); |
||||
} |
||||
|
||||
public JPanel createOtherPane(){ |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UICheckBox(Inter.getLocText("Form-SupportTag")), null }, |
||||
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), new UITextField()}, |
||||
}; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1},{1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); |
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
protected ComboCheckBox updateSubCustomWritableRepeatEditorBean() { |
||||
ComboCheckBox combo = new ComboCheckBox(); |
||||
combo.setSupportTag(this.supportTagCheckBox.isSelected()); |
||||
combo.setDictionary(this.dictPane.updateBean()); |
||||
checkBoxDictPane.update(combo); |
||||
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected()); |
||||
return combo; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return dictPane; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "ComboCheckBox"; |
||||
} |
||||
|
||||
} |
@ -0,0 +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();
} |
@ -0,0 +1,245 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.base.Formula; |
||||
import com.fr.data.core.FormatField; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.editor.ValueEditorPane; |
||||
import com.fr.design.editor.ValueEditorPaneFactory; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.form.ui.DateEditor; |
||||
import com.fr.general.DateUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.UtilEvalError; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Date; |
||||
|
||||
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> { |
||||
private UIComboBox returnTypeComboBox; |
||||
private UILabel sampleLabel;// preview
|
||||
private UIComboBox dateFormatComboBox; |
||||
private ValueEditorPane startDv; |
||||
private ValueEditorPane endDv; |
||||
|
||||
public DateEditorDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "Date"; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
waterMarkDictPane = new WaterMarkDictPane(); |
||||
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); |
||||
returnTypeComboBox = new UIComboBox(new String[] { Inter.getLocText("String"), Inter.getLocText("Date") }); |
||||
returnTypeComboBox.setPreferredSize(new Dimension(70, 20)); |
||||
// sample pane
|
||||
sampleLabel = new UILabel(""); |
||||
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); |
||||
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); |
||||
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); |
||||
|
||||
// content pane
|
||||
String[] arr = getDateFormateArray(); |
||||
dateFormatComboBox = new UIComboBox(arr); |
||||
dateFormatComboBox.setPreferredSize(new Dimension(150,20)); |
||||
dateFormatComboBox.addActionListener(new ActionListener(){ |
||||
public void actionPerformed(ActionEvent e){ |
||||
refreshPreviewLabel(); |
||||
} |
||||
|
||||
}); |
||||
JPanel secondPanel = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"),dateFormatComboBox,sampleLabel}, FlowLayout.LEFT, 5); |
||||
secondPanel.setPreferredSize(new Dimension(220,30)); |
||||
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||
|
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox }, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), dateFormatComboBox}, |
||||
new Component[]{null, sampleLabel}, |
||||
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv}, |
||||
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv}, |
||||
}; |
||||
double[] rowSize = {p, p,p,p,p}; |
||||
double[] columnSize = {p,f}; |
||||
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1); |
||||
|
||||
|
||||
return panel; |
||||
} |
||||
|
||||
protected JPanel setSecondContentPane(){ |
||||
return null; |
||||
} |
||||
private String[] getDateFormateArray() { |
||||
return FormatField.getInstance().getDateFormatArray(); |
||||
} |
||||
|
||||
protected JPanel initStartEndDatePane() { |
||||
JPanel rangePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
rangePane.add(new UILabel(Inter.getLocText("FS_Start_Date") + ":")); |
||||
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||
rangePane.add(startDv); |
||||
rangePane.add(new UILabel(Inter.getLocText("FS_End_Date") + ":")); |
||||
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||
rangePane.add(endDv); |
||||
|
||||
return rangePane; |
||||
} |
||||
|
||||
|
||||
private void refreshPreviewLabel() { |
||||
String text = (String) dateFormatComboBox.getSelectedItem(); |
||||
if (text != null && text.length() > 0) { |
||||
try { |
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text); |
||||
String sample = simpleDateFormat.format(new Date()); |
||||
Color c = Color.black; |
||||
if (!ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), text)) { |
||||
sample += " " + Inter.getLocText("DateFormat-Custom_Warning"); |
||||
c = Color.red; |
||||
} |
||||
this.sampleLabel.setText(sample); |
||||
this.sampleLabel.setForeground(c); |
||||
} catch (Exception exp) { |
||||
this.sampleLabel.setForeground(Color.red); |
||||
this.sampleLabel.setText(exp.getMessage()); |
||||
} |
||||
} else { |
||||
this.sampleLabel.setText(new Date().toString()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubDirectWriteEditorBean(DateEditor e) { |
||||
String formatText = e.getFormatText(); |
||||
// dateFormatComboBox.setSelectedItem(formatText);
|
||||
//
|
||||
// returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0);
|
||||
|
||||
populateStartEnd(e); |
||||
} |
||||
|
||||
@Override |
||||
protected DateEditor updateSubDirectWriteEditorBean() { |
||||
DateEditor ob = new DateEditor(); |
||||
|
||||
ob.setFormatText(this.getSimpleDateFormat().toPattern()); |
||||
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1); |
||||
|
||||
updateStartEnd(ob); |
||||
|
||||
return ob; |
||||
} |
||||
|
||||
/** |
||||
* 初始起止日期 |
||||
* @param dateWidgetEditor 日期控件 |
||||
*/ |
||||
public void populateStartEnd(DateEditor dateWidgetEditor) { |
||||
Formula startFM = dateWidgetEditor.getStartDateFM(); |
||||
Formula endFM = dateWidgetEditor.getEndDateFM(); |
||||
if (startFM != null) { |
||||
startDv.populate(startFM); |
||||
} else { |
||||
String startStr = dateWidgetEditor.getStartText(); |
||||
startDv.populate(StringUtils.isEmpty(startStr) ? null : DateUtils.string2Date(startStr, true)); |
||||
} |
||||
if (endFM != null) { |
||||
endDv.populate(endFM); |
||||
} else { |
||||
String endStr = dateWidgetEditor.getEndText(); |
||||
endDv.populate(StringUtils.isEmpty(endStr) ? null : DateUtils.string2Date(endStr, true)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新日期控件的起止日期 |
||||
* @param dateWidgetEditor 日期控件 |
||||
*/ |
||||
public void updateStartEnd(DateEditor dateWidgetEditor) { |
||||
Object startObject = startDv.update(); |
||||
Object endObject = endDv.update(); |
||||
// wei : 对公式的处理
|
||||
Calculator cal = null; |
||||
if (startObject instanceof Formula) { |
||||
cal = Calculator.createCalculator(); |
||||
Formula startFormula = (Formula) startObject; |
||||
try { |
||||
startFormula.setResult(cal.evalValue(startFormula.getContent())); |
||||
} catch (UtilEvalError e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
startObject = startFormula.getResult(); |
||||
dateWidgetEditor.setStartDateFM(startFormula); |
||||
dateWidgetEditor.setStartText(null); |
||||
} else { |
||||
try { |
||||
dateWidgetEditor.setStartText(startObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date)startObject)); |
||||
} catch(ClassCastException e) { |
||||
//wei : TODO 说明应用的公式不能转化成日期格式,应该做些处理。
|
||||
} |
||||
} |
||||
if (endObject instanceof Formula) { |
||||
cal = Calculator.createCalculator(); |
||||
Formula endFormula = (Formula) endObject; |
||||
try { |
||||
endFormula.setResult(cal.evalValue(endFormula.getContent())); |
||||
} catch (UtilEvalError e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
endObject = endFormula.getResult(); |
||||
dateWidgetEditor.setEndDateFM(endFormula); |
||||
dateWidgetEditor.setEndText(null); |
||||
} else { |
||||
try { |
||||
dateWidgetEditor.setEndText(endObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date)endObject)); |
||||
} catch(ClassCastException e) { |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
||||
private SimpleDateFormat getSimpleDateFormat() { |
||||
String text = (String) dateFormatComboBox.getSelectedItem(); |
||||
SimpleDateFormat simpleDateFormat; |
||||
if (text != null && text.length() > 0) { |
||||
try { |
||||
simpleDateFormat = new SimpleDateFormat(text); |
||||
this.sampleLabel.setText(simpleDateFormat.format(new Date())); |
||||
} catch (Exception exp) { |
||||
simpleDateFormat = new SimpleDateFormat(""); |
||||
} |
||||
} else { |
||||
simpleDateFormat = new SimpleDateFormat(""); |
||||
} |
||||
|
||||
return simpleDateFormat; |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,94 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
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.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||
import com.fr.form.ui.DirectWriteEditor; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
//richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树
|
||||
public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> { |
||||
public UICheckBox directWriteCheckBox; |
||||
protected WaterMarkDictPane waterMarkDictPane; |
||||
protected UICheckBox removeRepeatCheckBox; |
||||
|
||||
public DirectWriteEditorDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
|
||||
waterMarkDictPane = new WaterMarkDictPane(); |
||||
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat")); |
||||
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane(); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane }, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), new UITextField()}, |
||||
new Component[]{removeRepeatCheckBox, null}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane} |
||||
}; |
||||
double[] rowSize = {p, p, p, p, p, p,p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1,1},{1,1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
advancePane.add(panel, BorderLayout.NORTH); |
||||
JPanel otherPane = createOtherPane(); |
||||
if(otherPane != null){ |
||||
advancePane.add(otherPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
return advancePane; |
||||
} |
||||
|
||||
public JPanel createOtherPane(){ |
||||
return null; |
||||
} |
||||
|
||||
public JPanel setValidatePane(){ |
||||
directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); |
||||
JPanel otherContentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
||||
otherContentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); |
||||
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 5); |
||||
jPanel.setPreferredSize(new Dimension(220, 30)); |
||||
otherContentPane.add(jPanel); |
||||
return otherContentPane; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubFieldEditorBean(T e) { |
||||
this.directWriteCheckBox.setSelected(e.isDirectEdit()); |
||||
this.waterMarkDictPane.populate(e); |
||||
removeRepeatCheckBox.setSelected(e.isChartRelated()); |
||||
populateSubDirectWriteEditorBean(e); |
||||
} |
||||
|
||||
protected abstract void populateSubDirectWriteEditorBean(T e); |
||||
|
||||
@Override |
||||
protected T updateSubFieldEditorBean() { |
||||
T e = updateSubDirectWriteEditorBean(); |
||||
|
||||
e.setDirectEdit(directWriteCheckBox.isSelected()); |
||||
this.waterMarkDictPane.update(e); |
||||
|
||||
return e; |
||||
} |
||||
|
||||
protected abstract T updateSubDirectWriteEditorBean(); |
||||
} |
@ -0,0 +1,140 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.base.GraphHelper; |
||||
import com.fr.design.designer.creator.*; |
||||
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.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.FieldEditor; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { |
||||
private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30; |
||||
private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30; |
||||
protected UICheckBox allowBlankCheckBox; |
||||
// richer:错误信息,是所有控件共有的属性,所以放到这里来
|
||||
protected UITextField errorMsgTextField; |
||||
protected JPanel validatePane; |
||||
protected UISpinner fontSizePane; |
||||
|
||||
public FieldEditorDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
this.initComponents(); |
||||
} |
||||
|
||||
public FieldEditorDefinePane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); |
||||
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); |
||||
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); |
||||
fontSizePane = new UISpinner(0, 20, 1, 0); |
||||
errorMsgTextField = new UITextField(); |
||||
JPanel contentPane = this.setFirstContentPane(); |
||||
if (contentPane != null) { |
||||
UIExpandablePane uiExpandablePane = new UIExpandablePane("高级", 280, 20, contentPane); |
||||
this.add(uiExpandablePane, BorderLayout.NORTH); |
||||
} |
||||
this.addValidatePane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(T ob) { |
||||
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); |
||||
this.errorMsgTextField.setText(ob.getErrorMessage()); |
||||
this.fontSizePane.setValue(ob.getFontSize()); |
||||
populateSubFieldEditorBean(ob); |
||||
} |
||||
|
||||
protected abstract void populateSubFieldEditorBean(T ob); |
||||
|
||||
@Override |
||||
public T updateBean() { |
||||
T e = updateSubFieldEditorBean(); |
||||
|
||||
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); |
||||
e.setErrorMessage(this.errorMsgTextField.getText()); |
||||
e.setFontSize((int)fontSizePane.getValue()); |
||||
return e; |
||||
} |
||||
|
||||
|
||||
protected abstract T updateSubFieldEditorBean(); |
||||
|
||||
protected abstract JPanel setFirstContentPane(); |
||||
|
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
|
||||
protected void addValidatePane() { |
||||
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
final UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")); |
||||
allowBlankCheckBox.addItemListener(new ItemListener() { |
||||
|
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
boolean isSelected = allowBlankCheckBox.isSelected(); |
||||
uiLabel.setVisible(!isSelected); |
||||
errorMsgTextField.setVisible(!isSelected); |
||||
if (isSelected) { |
||||
uiLabel.setPreferredSize(new Dimension(0, 0)); |
||||
errorMsgTextField.setPreferredSize(new Dimension(0, 0)); |
||||
} else { |
||||
uiLabel.setPreferredSize(new Dimension(66, 20)); |
||||
errorMsgTextField.setPreferredSize(new Dimension(150, 20)); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{allowBlankCheckBox, null}, |
||||
new Component[]{uiLabel, errorMsgTextField}, |
||||
}; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1}, {1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 2); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
validatePane.add(panel, BorderLayout.NORTH); |
||||
JPanel contentPane = this.setValidatePane(); |
||||
if (contentPane != null) { |
||||
validatePane.add(contentPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 20, validatePane); |
||||
this.add(uiExpandablePane, BorderLayout.CENTER); |
||||
|
||||
} |
||||
|
||||
public XLayoutContainer getParent(XCreator source) { |
||||
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); |
||||
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { |
||||
container = null; |
||||
} |
||||
return container; |
||||
} |
||||
|
||||
public JPanel setValidatePane() { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,83 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
import com.fr.design.gui.frpane.ReportletParameterViewPane; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.IframeEditor; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.ParameterProvider; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.List; |
||||
|
||||
public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> { |
||||
private UITextField srcTextField; |
||||
private ReportletParameterViewPane parameterViewPane; |
||||
private UICheckBox horizontalCheck; |
||||
private UICheckBox verticalCheck; |
||||
|
||||
public IframeEditorDefinePane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
||||
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); |
||||
JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||
attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible"))); |
||||
attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible"))); |
||||
contentPane.add(attr); |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] rowSize = { p, p, p, p }; |
||||
double[] columnSize = { p, f }; |
||||
|
||||
Component[][] coms = { |
||||
{ horizontalCheck, null }, |
||||
{ verticalCheck, null }, |
||||
{ new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() }, |
||||
{ new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } }; |
||||
int[][] rowCount = {{1, 1},{1, 1},{1, 1}, {1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); |
||||
|
||||
contentPane.add(panel); |
||||
|
||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); |
||||
this.add(uiExpandablePane, BorderLayout.NORTH); |
||||
|
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "iframe"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(IframeEditor e) { |
||||
srcTextField.setText(e.getSrc()); |
||||
parameterViewPane.populate(e.getParameters()); |
||||
this.horizontalCheck.setSelected(e.isOverflowx()); |
||||
this.verticalCheck.setSelected(e.isOverflowy()); |
||||
} |
||||
|
||||
@Override |
||||
public IframeEditor updateBean() { |
||||
IframeEditor ob = new IframeEditor(); |
||||
ob.setSrc(srcTextField.getText()); |
||||
List<ParameterProvider> parameterList = parameterViewPane.update(); |
||||
ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()])); |
||||
ob.setOverflowx(this.horizontalCheck.isSelected()); |
||||
ob.setOverflowy(this.verticalCheck.isSelected()); |
||||
return ob; |
||||
} |
||||
} |
@ -0,0 +1,79 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
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.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||
import com.fr.form.ui.Label; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/3. |
||||
*/ |
||||
public class LabelDefinePane extends AbstractDataModify<Label> { |
||||
private FormWidgetValuePane formWidgetValuePane; |
||||
private UICheckBox isPageSetupVertically; |
||||
private UICheckBox isStyleAlignmentWrapText; |
||||
|
||||
public LabelDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
initComponent(); |
||||
} |
||||
|
||||
public void initComponent() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel advancePane = createAdvancePane(); |
||||
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); |
||||
this.add(advanceExpandablePane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public JPanel createAdvancePane() { |
||||
formWidgetValuePane = new FormWidgetValuePane(); |
||||
isPageSetupVertically = new UICheckBox(Inter.getLocText("FR-Designer_PageSetup-Vertically")); |
||||
isStyleAlignmentWrapText = new UICheckBox(Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p, p, p, p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane}, |
||||
new Component[]{isStyleAlignmentWrapText, null}, |
||||
new Component[]{isPageSetupVertically, null}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Display_Position")), new UITextField()}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), new UITextField()}, |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "label"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Label ob) { |
||||
isStyleAlignmentWrapText.setSelected(ob.isAutoLine()); |
||||
isPageSetupVertically.setSelected(ob.isVerticalCenter()); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public Label updateBean() { |
||||
Label layout = (Label) creator.toData(); |
||||
layout.setAutoLine(isStyleAlignmentWrapText.isSelected()); |
||||
layout.setVerticalCenter(isPageSetupVertically.isSelected()); |
||||
return layout; |
||||
} |
||||
} |
@ -0,0 +1,60 @@
|
||||
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; |
||||
} |
||||
} |
@ -0,0 +1,91 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.DictionaryComboBox; |
||||
import com.fr.design.gui.icombobox.DictionaryConstants; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UINumberField; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.MultiFileEditor; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> { |
||||
private DictionaryComboBox acceptType; |
||||
private UICheckBox singleFileCheckBox; |
||||
private UINumberField fileSizeField; |
||||
private UITextField fontSizeField; |
||||
|
||||
public MultiFileEditorPane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "file"; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); |
||||
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); |
||||
fileSizeField = new UINumberField(); |
||||
fontSizeField = new UITextField(); |
||||
|
||||
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
singleFilePane.add(singleFileCheckBox); |
||||
|
||||
JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||
allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
||||
allowTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":")); |
||||
allowTypePane.add(acceptType); |
||||
|
||||
JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||
fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":")); |
||||
fileSizePane.add(fileSizeField); |
||||
fileSizePane.add(new UILabel(" KB")); |
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{singleFileCheckBox, null }, |
||||
new Component[]{new UILabel(Inter.getLocText("File-Allow_Upload_Files") + ":"), acceptType}, |
||||
new Component[]{new UILabel( Inter.getLocText("File-File_Size_Limit") + ":"), fileSizeField}, |
||||
new Component[]{new UILabel( Inter.getLocText("FR-Designer_Font-Size")), fontSizeField} |
||||
}; |
||||
double[] rowSize = {p, p,p,p}; |
||||
double[] columnSize = {p,f}; |
||||
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
|
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubFieldEditorBean(MultiFileEditor e) { |
||||
// 这里存在兼容问题 getAccept可能没在待选项目中
|
||||
acceptType.setSelectedItem(e.getAccept()); |
||||
singleFileCheckBox.setSelected(e.isSingleFile()); |
||||
fileSizeField.setValue(e.getMaxSize()); |
||||
} |
||||
|
||||
@Override |
||||
protected MultiFileEditor updateSubFieldEditorBean() { |
||||
MultiFileEditor ob = new MultiFileEditor(); |
||||
ob.setAccept((String) acceptType.getSelectedItem()); |
||||
ob.setSingleFile(singleFileCheckBox.isSelected()); |
||||
ob.setMaxSize(fileSizeField.getValue()); |
||||
return ob; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.form.ui.NoneWidget; |
||||
|
||||
/** |
||||
* |
||||
* @author Administrator |
||||
* 用于处理没有控件的情况 |
||||
*/ |
||||
public class NoneWidgetDefinePane extends AbstractDataModify<NoneWidget> { |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "none"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(NoneWidget w) { |
||||
} |
||||
|
||||
@Override |
||||
public NoneWidget updateBean() { |
||||
return new NoneWidget(); |
||||
} |
||||
} |
@ -0,0 +1,313 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
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.gui.ispinner.UIBasicSpinner; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||
import com.fr.form.ui.NumberEditor; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import javax.swing.text.DefaultFormatter; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> { |
||||
public NumberEditorDefinePane(XCreator xCreator){ |
||||
super(xCreator); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
private static final long serialVersionUID = 8011242951911686805L; |
||||
private UICheckBox allowDecimalsCheckBox; |
||||
private UICheckBox allowNegativeCheckBox; |
||||
private UICheckBox setMaxValueCheckBox; |
||||
private UICheckBox setMinValueCheckBox; |
||||
private UIBasicSpinner maxValueSpinner; |
||||
private SpinnerNumberModel maxValueModel; |
||||
private UIBasicSpinner minValueSpinner; |
||||
private SpinnerNumberModel minValueModel; |
||||
private com.fr.design.editor.editor.IntegerEditor decimalLength; |
||||
private JPanel limitNumberPane; |
||||
private WaterMarkDictPane waterMarkDictPane; |
||||
|
||||
private ActionListener actionListener1 = new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
if (allowDecimalsCheckBox.isSelected()) { |
||||
limitNumberPane.setVisible(true); |
||||
} else { |
||||
limitNumberPane.setVisible(false); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
private ActionListener actionListener2 = new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
if (allowNegativeCheckBox.isSelected()) { |
||||
minValueModel.setMinimum(-Double.MAX_VALUE); |
||||
if (!setMinValueCheckBox.isSelected()) { |
||||
maxValueModel.setMinimum(-Double.MAX_VALUE); |
||||
} |
||||
} else { |
||||
minValueModel.setMinimum(0.0); |
||||
if (!setMinValueCheckBox.isSelected()) { |
||||
maxValueModel.setMinimum(0.0); |
||||
} |
||||
Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); |
||||
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); |
||||
if (minValue < 0.0) { |
||||
minValueSpinner.setValue(0.0); |
||||
} |
||||
if (maxValue < 0.0) { |
||||
maxValueSpinner.setValue(0.0); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
|
||||
private ActionListener actionListener3 = new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
if (setMaxValueCheckBox.isSelected()) { |
||||
maxValueSpinner.setEnabled(true); |
||||
Double value = new Double(0); |
||||
if (setMinValueCheckBox.isSelected()) { |
||||
Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); |
||||
if (minValue > value) { |
||||
value = minValue; |
||||
} |
||||
} |
||||
maxValueSpinner.setValue(value); |
||||
} else { |
||||
maxValueSpinner.setEnabled(false); |
||||
minValueModel.setMaximum(Double.MAX_VALUE); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
|
||||
private ActionListener actionListener4 = new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
if (setMinValueCheckBox.isSelected()) { |
||||
minValueSpinner.setEnabled(true); |
||||
Double value = new Double(0); |
||||
if (setMaxValueCheckBox.isSelected()) { |
||||
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); |
||||
if (maxValue < value) { |
||||
value = maxValue; |
||||
} |
||||
} |
||||
minValueSpinner.setValue(value); |
||||
} else { |
||||
minValueSpinner.setEnabled(false); |
||||
maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0)); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
private ChangeListener changeListener1 = new ChangeListener() { |
||||
|
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
if (setMaxValueCheckBox.isSelected()) { |
||||
if (setMinValueCheckBox.isSelected()) { |
||||
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
private ChangeListener changeListener2 = new ChangeListener() { |
||||
|
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
if (setMinValueCheckBox.isSelected()) { |
||||
if (setMaxValueCheckBox.isSelected()) { |
||||
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
public NumberEditorDefinePane() { |
||||
super(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "number"; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
// richer:数字的允许直接编辑没有意义
|
||||
waterMarkDictPane = new WaterMarkDictPane(); |
||||
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane(); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel("控件值"), formWidgetValuePane}, |
||||
new Component[]{new UILabel("水印"), waterMarkDictPane}, |
||||
new Component[]{new UILabel("字体大小"), new UITextField()} |
||||
}; |
||||
double[] rowSize = {p, p, p, p, p}; |
||||
double[] columnSize = {p,f}; |
||||
int[][] rowCount = {{1, 3},{1, 1},{1, 1}}; |
||||
JPanel advancePane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
advancePane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
|
||||
return advancePane; |
||||
} |
||||
|
||||
|
||||
public JPanel setValidatePane() { |
||||
// super.addValidatePane();
|
||||
|
||||
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); |
||||
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); |
||||
this.decimalLength.setColumns(4); |
||||
|
||||
this.allowDecimalsCheckBox.addActionListener(actionListener1); |
||||
|
||||
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); |
||||
this.allowNegativeCheckBox.addActionListener(actionListener2); |
||||
|
||||
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); |
||||
|
||||
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); |
||||
maxValueSpinner.setPreferredSize(new Dimension(120, 20)); |
||||
setNotAllowsInvalid(this.maxValueSpinner); |
||||
|
||||
this.setMaxValueCheckBox.addActionListener(actionListener3); |
||||
this.maxValueSpinner.addChangeListener(changeListener1); |
||||
|
||||
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false); |
||||
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); |
||||
minValueSpinner.setPreferredSize(new Dimension(120, 20)); |
||||
setNotAllowsInvalid(this.minValueSpinner); |
||||
|
||||
this.setMinValueCheckBox.addActionListener(actionListener4); |
||||
this.minValueSpinner.addChangeListener(changeListener2); |
||||
|
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{allowDecimalsCheckBox, null }, |
||||
new Component[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"})), decimalLength }, |
||||
new Component[]{allowNegativeCheckBox, null}, |
||||
new Component[]{setMaxValueCheckBox, maxValueSpinner}, |
||||
new Component[]{setMinValueCheckBox, minValueSpinner}, |
||||
}; |
||||
double[] rowSize = {p, p, p, p, p}; |
||||
double[] columnSize = {p,f}; |
||||
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 3); |
||||
return panel; |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void populateSubFieldEditorBean(NumberEditor e) { |
||||
allowDecimalsCheckBox.setSelected(e.isAllowDecimals()); |
||||
if (e.isAllowDecimals()) { |
||||
this.decimalLength.setValue(e.getMaxDecimalLength()); |
||||
} else { |
||||
this.limitNumberPane.setVisible(false); |
||||
} |
||||
|
||||
allowNegativeCheckBox.setSelected(e.isAllowNegative()); |
||||
if (e.getMaxValue() == Double.MAX_VALUE) { |
||||
setMaxValueCheckBox.setSelected(false); |
||||
maxValueSpinner.setValue(new Double(Double.MAX_VALUE)); |
||||
maxValueSpinner.setEnabled(false); |
||||
|
||||
} else { |
||||
setMaxValueCheckBox.setSelected(true); |
||||
maxValueSpinner.setEnabled(true); |
||||
maxValueSpinner.setValue(new Double(e.getMaxValue())); |
||||
} |
||||
|
||||
if (e.getMinValue() == -Double.MAX_VALUE) { |
||||
setMinValueCheckBox.setSelected(false); |
||||
minValueSpinner.setValue(new Double(-Double.MAX_VALUE)); |
||||
minValueSpinner.setEnabled(false); |
||||
|
||||
} else { |
||||
setMinValueCheckBox.setSelected(true); |
||||
minValueSpinner.setEnabled(true); |
||||
minValueSpinner.setValue(new Double(e.getMinValue())); |
||||
} |
||||
// this.regErrorMsgTextField.setText(e.getRegErrorMessage());
|
||||
this.waterMarkDictPane.populate(e); |
||||
} |
||||
|
||||
@Override |
||||
protected NumberEditor updateSubFieldEditorBean() { |
||||
|
||||
NumberEditor ob = new NumberEditor(); |
||||
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected()); |
||||
if (allowDecimalsCheckBox.isSelected()) { |
||||
ob.setMaxDecimalLength(this.decimalLength.getValue()); |
||||
} |
||||
|
||||
ob.setAllowNegative(allowNegativeCheckBox.isSelected()); |
||||
if (setMaxValueCheckBox.isSelected()) { |
||||
ob.setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue())); |
||||
} else { |
||||
ob.setMaxValue(Double.MAX_VALUE); |
||||
} |
||||
|
||||
if (setMinValueCheckBox.isSelected()) { |
||||
ob.setMinValue(Double.parseDouble("" + minValueSpinner.getValue())); |
||||
} else { |
||||
ob.setMinValue(-Double.MAX_VALUE); |
||||
} |
||||
|
||||
this.waterMarkDictPane.update(ob); |
||||
|
||||
// ob.setRegErrorMessage(this.regErrorMsgTextField.getText());
|
||||
|
||||
return ob; |
||||
} |
||||
|
||||
private void checkVisible() { |
||||
if (setMinValueCheckBox.isSelected()) { |
||||
minValueSpinner.setEnabled(true); |
||||
} else { |
||||
minValueSpinner.setEnabled(false); |
||||
} |
||||
|
||||
if (setMinValueCheckBox.isSelected()) { |
||||
minValueSpinner.setEnabled(true); |
||||
} else { |
||||
minValueSpinner.setEnabled(false); |
||||
} |
||||
} |
||||
|
||||
private void setNotAllowsInvalid(UIBasicSpinner jspinner) { |
||||
JComponent editor = jspinner.getEditor(); |
||||
if (editor instanceof UIBasicSpinner.DefaultEditor) { |
||||
JFormattedTextField ftf = ((UIBasicSpinner.DefaultEditor) editor).getTextField(); |
||||
ftf.setColumns(10); |
||||
JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter(); |
||||
DefaultFormatter df = (DefaultFormatter) formatter; |
||||
df.setAllowsInvalid(false); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,179 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.ConfigManager; |
||||
import com.fr.base.Parameter; |
||||
import com.fr.base.TableData; |
||||
import com.fr.design.DesignModelAdapter; |
||||
import com.fr.design.gui.icombobox.FRTreeComboBox; |
||||
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; |
||||
import com.fr.design.parameter.ParameterGroup; |
||||
import com.fr.file.DatasourceManager; |
||||
import com.fr.file.DatasourceManagerProvider; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.ParameterProvider; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.tree.DefaultMutableTreeNode; |
||||
import javax.swing.tree.DefaultTreeCellRenderer; |
||||
import javax.swing.tree.DefaultTreeModel; |
||||
import javax.swing.tree.TreePath; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 控件设置面板的“控件名”下拉框,里面是所有参数的名字 |
||||
* |
||||
* @author zhou |
||||
* |
||||
*/ |
||||
public class ParameterTreeComboBox extends FRTreeComboBox { |
||||
|
||||
public ParameterTreeComboBox() { |
||||
super(new JTree(), new DefaultTreeCellRenderer() { |
||||
@Override |
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
||||
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); |
||||
if (value instanceof DefaultMutableTreeNode) { |
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; |
||||
Object userObj = node.getUserObject(); |
||||
if (userObj instanceof String) { |
||||
this.setIcon(BaseUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif")); |
||||
} else if (userObj instanceof Parameter) { |
||||
Parameter parameter = (Parameter)userObj; |
||||
this.setText(parameter.getName()); |
||||
} |
||||
} |
||||
return this; |
||||
} |
||||
}); |
||||
this.addItemListener(new ItemListener() { |
||||
public void itemStateChanged(ItemEvent e) { |
||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||
if (e.getItem() instanceof TreePath) { |
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)((TreePath)e.getItem()).getLastPathComponent(); |
||||
if (node.getUserObject() instanceof Parameter) { |
||||
ParameterTreeComboBox.this.getEditor().setItem(((Parameter)node.getUserObject()).getName()); |
||||
} else { |
||||
ParameterTreeComboBox.this.getEditor().setItem(null); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
this.setEditable(true); |
||||
} |
||||
|
||||
public String getSelectedParameterName() { |
||||
Object obj = this.getSelectedItem(); |
||||
if (obj instanceof TreePath) { |
||||
return ((Parameter)((ExpandMutableTreeNode)((TreePath)obj).getLastPathComponent()).getUserObject()).getName(); |
||||
} |
||||
return (String)obj; |
||||
} |
||||
|
||||
@Override |
||||
public void setSelectedItem(Object o) { |
||||
if (o instanceof String) { |
||||
this.setSelectedItemString((String)o); |
||||
return; |
||||
} |
||||
this.tree.setSelectionPath((TreePath)o); |
||||
this.getModel().setSelectedItem(o); |
||||
} |
||||
|
||||
public void setSelectedParameterName(String name) { |
||||
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
||||
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode)tree.getModel().getRoot(); |
||||
DefaultMutableTreeNode leaf = rootTreeNode.getFirstLeaf(); |
||||
do { |
||||
if (leaf.getUserObject() instanceof Parameter) { |
||||
if (ComparatorUtils.equals(((Parameter) leaf.getUserObject()).getName(), name)) { |
||||
TreePath visiblePath = new TreePath(treeModel.getPathToRoot(leaf)); |
||||
tree.setSelectionPath(visiblePath); |
||||
this.setSelectedItem(visiblePath); |
||||
break; |
||||
} |
||||
} |
||||
} while ((leaf = leaf.getNextLeaf()) != null); |
||||
if (this.getSelectedItem() == null) { |
||||
((ComboBoxModel)treeModel).setSelectedItem(name); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 刷新目录树 |
||||
*/ |
||||
public void refreshTree() { |
||||
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode)tree.getModel().getRoot(); |
||||
rootTreeNode.removeAllChildren(); |
||||
addParameterTreeNode(rootTreeNode); |
||||
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
||||
if (treeModel != null) { |
||||
treeModel.reload(); |
||||
} |
||||
} |
||||
|
||||
private void addParameterTreeNode(DefaultMutableTreeNode rootTreeNode) { |
||||
ParameterGroup[] groups = getParameterGroup(); |
||||
for (ParameterGroup group : groups) { |
||||
ExpandMutableTreeNode paraTreeNode = new ExpandMutableTreeNode(group.getGroupName()); |
||||
rootTreeNode.add(paraTreeNode); |
||||
for (Parameter parameter : group.getParameter()) { |
||||
if (parameter != null) { |
||||
ExpandMutableTreeNode childTreeNode = new ExpandMutableTreeNode(parameter); |
||||
paraTreeNode.add(childTreeNode); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private ParameterGroup[] getParameterGroup() { |
||||
List<ParameterGroup> groupList = new ArrayList<ParameterGroup>(); |
||||
Parameter[] parameters; |
||||
DesignModelAdapter<?,?> model = DesignModelAdapter.getCurrentModelAdapter(); |
||||
if (model != null) { |
||||
// 报表参数
|
||||
parameters = model.getReportParameters(); |
||||
if (!ArrayUtils.isEmpty(parameters)) { |
||||
groupList.add(new ParameterGroup(Inter.getLocText("ParameterD-Report_Parameter"), parameters)); |
||||
} |
||||
// 数据源参数
|
||||
parameters = model.getTableDataParameters(); |
||||
if (!ArrayUtils.isEmpty(parameters)) { |
||||
groupList.add(new ParameterGroup(Inter.getLocText("FR-Designer_Datasource-Parameter"), parameters)); |
||||
} |
||||
} |
||||
|
||||
// 全局参数
|
||||
parameters = ConfigManager.getProviderInstance().getGlobal_Parameters(); |
||||
if (!ArrayUtils.isEmpty(parameters)) { |
||||
groupList.add(new ParameterGroup(Inter.getLocText("M_Server-Global_Parameters"), parameters)); |
||||
} |
||||
// 全局数据源参数
|
||||
parameters = new Parameter[0]; |
||||
Calculator c = Calculator.createCalculator(); |
||||
DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); |
||||
Iterator<String> nameIt = datasourceManager.getTableDataNameIterator(); |
||||
while (nameIt.hasNext()) { |
||||
TableData tableData = datasourceManager.getTableData(nameIt.next()); |
||||
ParameterProvider[] ps = tableData.getParameters(c); |
||||
if (!ArrayUtils.isEmpty(ps)) { |
||||
parameters = (Parameter[])ArrayUtils.addAll(parameters, ps); |
||||
} |
||||
} |
||||
if (!ArrayUtils.isEmpty(parameters)) { |
||||
groupList.add(new ParameterGroup(Inter.getLocText(new String[]{"Server", "Datasource-Datasource", "Parameter"}), parameters)); |
||||
} |
||||
return groupList.toArray(new ParameterGroup[0]); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.gui.frpane.RegPane; |
||||
import com.fr.form.ui.Password; |
||||
import com.fr.form.ui.TextEditor; |
||||
|
||||
public class PasswordDefinePane extends TextFieldEditorDefinePane { |
||||
|
||||
public PasswordDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
private static final long serialVersionUID = 4737910705071750562L; |
||||
|
||||
@Override |
||||
protected TextEditor newTextEditorInstance() { |
||||
return new Password(); |
||||
} |
||||
|
||||
protected RegPane createRegPane() { |
||||
return new RegPane(RegPane.PASSWORD_REG_TYPE); |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.ui.Radio; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class RadioDefinePane extends AbstractDataModify<Radio> { |
||||
public RadioDefinePane() { |
||||
this.iniComoponents(); |
||||
} |
||||
|
||||
private void iniComoponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
UILabel infoLabel = new UILabel(); |
||||
FRFont frFont = FRContext.getDefaultValues().getFRFont(); |
||||
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); |
||||
infoLabel.setText(Inter.getLocText( |
||||
"No_Editor_Property_Definition") + "."); |
||||
infoLabel.setHorizontalAlignment(SwingConstants.CENTER); |
||||
|
||||
this.add(infoLabel, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "radio"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Radio cellWidget) { |
||||
} |
||||
|
||||
@Override |
||||
public Radio updateBean() { |
||||
return new Radio(); |
||||
} |
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.present.dict.DictionaryPane; |
||||
import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane; |
||||
import com.fr.form.ui.RadioGroup; |
||||
|
||||
public class RadioGroupDefinePane extends ButtonGroupDefinePane<RadioGroup> { |
||||
private DictionaryPane dictPane; |
||||
|
||||
|
||||
public RadioGroupDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
|
||||
dictPane = new DictionaryPane(); |
||||
} |
||||
|
||||
@Override |
||||
protected RadioGroup updateSubButtonGroupBean() { |
||||
RadioGroup ob = (RadioGroup)creator.toData(); |
||||
|
||||
ob.setDictionary(this.dictPane.updateBean()); |
||||
|
||||
return ob; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "radiogroup"; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubButtonGroupBean(RadioGroup ob) { |
||||
this.dictPane.populateBean(ob.getDictionary()); |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return dictPane; |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.gui.frpane.RegPane; |
||||
import com.fr.form.ui.TextArea; |
||||
import com.fr.form.ui.TextEditor; |
||||
|
||||
|
||||
public class TextAreaDefinePane extends TextFieldEditorDefinePane { |
||||
public TextAreaDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
@Override |
||||
protected TextEditor newTextEditorInstance() { |
||||
return new TextArea(); |
||||
} |
||||
|
||||
protected RegPane createRegPane() { |
||||
return new RegPane(RegPane.TEXTAREA_REG_TYPE); |
||||
} |
||||
} |
@ -0,0 +1,128 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.gui.frpane.RegPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||
import com.fr.form.ui.TextEditor; |
||||
import com.fr.form.ui.reg.RegExp; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.StringUtils; |
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.KeyAdapter; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> { |
||||
protected RegPane regPane; |
||||
private UITextField waterMarkDictPane; |
||||
FormWidgetValuePane formWidgetValuePane; |
||||
|
||||
public TextFieldEditorDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
public TextFieldEditorDefinePane() { |
||||
super(); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
// fontSizePane = new UISpinner(0,20,1);
|
||||
regPane = createRegPane(); |
||||
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { |
||||
|
||||
@Override |
||||
public void regChangeAction() { |
||||
waterMarkDictPane.setText(""); |
||||
regPane.removeRegChangeListener(this); |
||||
} |
||||
}; |
||||
final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { |
||||
public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { |
||||
if (StringUtils.isNotEmpty(e.getPhoneRegString()) |
||||
&& StringUtils.isEmpty(waterMarkDictPane.getText())) { |
||||
waterMarkDictPane.setText(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); |
||||
regPane.addRegChangeListener(rl); |
||||
} |
||||
} |
||||
}; |
||||
regPane.addPhoneRegListener(pl); |
||||
waterMarkDictPane = new UITextField(13); |
||||
waterMarkDictPane.addKeyListener(new KeyAdapter() { |
||||
public void keyTyped(KeyEvent e) { |
||||
regPane.removePhoneRegListener(pl); |
||||
regPane.removeRegChangeListener(rl); |
||||
waterMarkDictPane.removeKeyListener(this); |
||||
} |
||||
}); |
||||
//监听填写规则下拉框的值的变化
|
||||
// regPane.getRegComboBox().addActionListener(new ActionListener() {
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem();
|
||||
//// regErrorMsgTextField.setEnabled(regExp.errorMessageEditable());
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
formWidgetValuePane = new FormWidgetValuePane(); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value"), SwingConstants.LEFT), formWidgetValuePane}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark"), SwingConstants.LEFT), waterMarkDictPane}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size"), SwingConstants.LEFT), fontSizePane} |
||||
}; |
||||
double[] rowSize = {p, p, p, p, p}; |
||||
double[] columnSize = {p,f}; |
||||
int[][] rowCount = {{1, 3},{1, 1},{1, 1}}; |
||||
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
return panel; |
||||
} |
||||
|
||||
public JPanel setValidatePane(){ |
||||
return regPane; |
||||
} |
||||
|
||||
|
||||
|
||||
protected RegPane createRegPane() { |
||||
return new RegPane(); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "text"; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubFieldEditorBean(TextEditor e) { |
||||
this.regPane.populate(e.getRegex()); |
||||
// regErrorMsgTextField.setText(e.getRegErrorMessage());
|
||||
waterMarkDictPane.setText(e.getWaterMark()); |
||||
} |
||||
|
||||
@Override |
||||
protected TextEditor updateSubFieldEditorBean() { |
||||
TextEditor ob = newTextEditorInstance(); |
||||
// ob.setRegErrorMessage(this.regErrorMsgTextField.getText());
|
||||
ob.setRegex(this.regPane.update()); |
||||
ob.setWaterMark(waterMarkDictPane.getText()); |
||||
formWidgetValuePane.update(ob); |
||||
// ob.setFontSize((int)fontSizePane.getValue());
|
||||
return ob; |
||||
} |
||||
|
||||
protected TextEditor newTextEditorInstance() { |
||||
return new TextEditor(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,78 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.gui.frpane.TreeSettingPane; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.itree.refreshabletree.TreeRootPane; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.TreeComboBoxEditor; |
||||
import com.fr.form.ui.TreeEditor; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane<TreeEditor> { |
||||
protected TreeSettingPane treeSettingPane; |
||||
protected TreeRootPane treeRootPane; |
||||
|
||||
public TreeComboBoxEditorDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected JPanel setForthContentPane() { |
||||
JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
treeRootPane = new TreeRootPane(); |
||||
content.add(treeRootPane, BorderLayout.NORTH); |
||||
treeSettingPane = new TreeSettingPane(true); |
||||
return content; |
||||
} |
||||
|
||||
public JPanel createOtherPane(){ |
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not"))}, |
||||
new Component[]{new UICheckBox(Inter.getLocText("Widget-Load_By_Async"))}, |
||||
new Component[]{new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Leaf"))}, |
||||
new Component[]{new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Path"))} |
||||
|
||||
}; |
||||
double[] rowSize = {p, p,p,p}; |
||||
double[] columnSize = {p}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
return panel; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "treecombobox"; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubCustomWritableRepeatEditorBean(TreeEditor e) { |
||||
// treeSettingPane.populate(e);
|
||||
// treeRootPane.populate(e.getTreeAttr());
|
||||
} |
||||
|
||||
@Override |
||||
protected TreeComboBoxEditor updateSubCustomWritableRepeatEditorBean() { |
||||
TreeComboBoxEditor editor = (TreeComboBoxEditor)creator.toData(); |
||||
editor.setTreeAttr(treeRootPane.update()); |
||||
return editor; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return treeSettingPane; |
||||
} |
||||
} |
@ -0,0 +1,104 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.gui.frpane.TreeSettingPane; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.gui.itree.refreshabletree.TreeRootPane; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||
import com.fr.form.ui.TreeEditor; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
|
||||
/* |
||||
* richer:tree editor |
||||
*/ |
||||
public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> { |
||||
protected TreeSettingPane treeSettingPane; |
||||
protected TreeRootPane treeRootPane; |
||||
private FormWidgetValuePane formWidgetValuePane; |
||||
|
||||
private UICheckBox removeRepeatCheckBox; |
||||
|
||||
public TreeEditorDefinePane(XCreator xCreator){ |
||||
super(xCreator); |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubFieldEditorBean(TreeEditor e) { |
||||
this.treeSettingPane.populate(e); |
||||
treeRootPane.populate(e.getTreeAttr()); |
||||
if (this.removeRepeatCheckBox != null) { |
||||
this.removeRepeatCheckBox.setSelected(e.isRemoveRepeat()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected TreeEditor updateSubFieldEditorBean() { |
||||
TreeEditor editor = treeSettingPane.updateTreeEditor(); |
||||
editor.setTreeAttr(treeRootPane.update()); |
||||
if (this.removeRepeatCheckBox != null) { |
||||
editor.setRemoveRepeat(this.removeRepeatCheckBox.isSelected()); |
||||
} |
||||
return editor; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
treeRootPane = new TreeRootPane(); |
||||
treeSettingPane = new TreeSettingPane(true); |
||||
formWidgetValuePane = new FormWidgetValuePane(); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane }, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), new UITextField()}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane} |
||||
}; |
||||
double[] rowSize = {p, p,p}; |
||||
double[] columnSize = {p,f}; |
||||
int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
jPanel.add(panel, BorderLayout.NORTH); |
||||
|
||||
JPanel otherContentPane = this.createOtherPane(); |
||||
jPanel.add(otherContentPane,BorderLayout.CENTER); |
||||
return jPanel; |
||||
} |
||||
|
||||
public JPanel createOtherPane(){ |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not"))}, |
||||
new Component[]{new UICheckBox(Inter.getLocText("Widget-Load_By_Async"))}, |
||||
new Component[]{new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Leaf"))}, |
||||
new Component[]{new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Path"))} |
||||
}; |
||||
double[] rowSize = {p, p,p,p}; |
||||
double[] columnSize = {p}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "tree"; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return treeSettingPane; |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.ui.NameWidget; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class UserEditorDefinePane extends AbstractDataModify<NameWidget> { |
||||
private NameWidget nWidget; |
||||
public UserEditorDefinePane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
UILabel infoLabel = new UILabel(); |
||||
FRFont frFont = FRContext.getDefaultValues().getFRFont(); |
||||
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); |
||||
infoLabel.setText(Inter.getLocText( |
||||
"Widget-User_Defined_Editor") + "."); |
||||
infoLabel.setHorizontalAlignment(SwingConstants.CENTER); |
||||
|
||||
this.add(infoLabel, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "name"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(NameWidget cellWidget) { |
||||
nWidget = cellWidget; |
||||
} |
||||
|
||||
@Override |
||||
public NameWidget updateBean() { |
||||
return nWidget; |
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.ui.WaterMark; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
public class WaterMarkDictPane extends JPanel{ |
||||
|
||||
private UITextField waterMarkTextField; |
||||
|
||||
public WaterMarkDictPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); |
||||
waterMarkTextField = new UITextField(); |
||||
this.add(waterMarkTextField); |
||||
} |
||||
|
||||
public void populate(WaterMark waterMark) { |
||||
this.waterMarkTextField.setText(waterMark.getWaterMark()); |
||||
} |
||||
|
||||
public void update(WaterMark waterMark) { |
||||
waterMark.setWaterMark(this.waterMarkTextField.getText()); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.form.ui.WriteAbleRepeatEditor; |
||||
|
||||
|
||||
public abstract class WritableRepeatEditorPane<E extends WriteAbleRepeatEditor> extends DirectWriteEditorDefinePane<E> { |
||||
|
||||
public WritableRepeatEditorPane(XCreator xCreator) { |
||||
super(xCreator); |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubDirectWriteEditorBean(E e) { |
||||
populateSubWritableRepeatEditorBean(e); |
||||
} |
||||
|
||||
protected abstract void populateSubWritableRepeatEditorBean(E e); |
||||
|
||||
@Override |
||||
protected E updateSubDirectWriteEditorBean() { |
||||
return updateSubWritableRepeatEditorBean(); |
||||
} |
||||
|
||||
protected abstract E updateSubWritableRepeatEditorBean(); |
||||
} |
@ -0,0 +1,51 @@
|
||||
package com.fr.design.widget.ui.designer; |
||||
|
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.ui.WriteUnableRepeatEditor; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public abstract class WriteUnableRepeatEditorPane<E extends WriteUnableRepeatEditor> extends FieldEditorDefinePane<WriteUnableRepeatEditor> { |
||||
// richer:是否去除重复的值
|
||||
protected UICheckBox removeRepeatCheckBox; |
||||
|
||||
public WriteUnableRepeatEditorPane(){ |
||||
this.initComponents(); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
||||
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); |
||||
JPanel contenter=FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); |
||||
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false); |
||||
contentPane.add(contenter); |
||||
contenter.add(removeRepeatCheckBox); |
||||
JPanel otherContentPane = this.setThirdContentPane(); |
||||
if (otherContentPane != null) |
||||
contentPane.add(otherContentPane,BorderLayout.CENTER); |
||||
return contentPane; |
||||
} |
||||
protected abstract JPanel setThirdContentPane(); |
||||
@Override |
||||
protected void populateSubFieldEditorBean(WriteUnableRepeatEditor e) { |
||||
removeRepeatCheckBox.setSelected(e.isRemoveRepeat()); |
||||
|
||||
populateSubWriteUnableRepeatBean((E)e); |
||||
} |
||||
|
||||
protected abstract void populateSubWriteUnableRepeatBean(E e); |
||||
|
||||
@Override |
||||
protected WriteUnableRepeatEditor updateSubFieldEditorBean() { |
||||
WriteUnableRepeatEditor ob = updateSubWriteUnableRepeatBean(); |
||||
ob.setRemoveRepeat(removeRepeatCheckBox.isSelected()); |
||||
|
||||
return ob; |
||||
} |
||||
|
||||
protected abstract E updateSubWriteUnableRepeatBean(); |
||||
} |
@ -0,0 +1,64 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.module.DesignModuleFactory; |
||||
import com.fr.design.widget.btn.ButtonDetailPane; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.form.ui.FreeButton; |
||||
import com.fr.form.ui.Widget; |
||||
|
||||
import com.fr.stable.bridge.BridgeMark; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. |
||||
* Author : Richer |
||||
* Version: 6.5.6 |
||||
* Date : 11-11-15 |
||||
* Time : 下午6:29 |
||||
*/ |
||||
public class ButtonDetailPaneFactory { |
||||
private static Map<String, Class> detailMap = new HashMap<String, Class>(); |
||||
|
||||
static { |
||||
detailMap.put(Button.class.getName(), DefaultButtonDetailPane.class); |
||||
detailMap.put(FreeButton.class.getName(), FreeButtonDetailPane.class); |
||||
if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) { |
||||
detailMap.put(StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class).getName(), DesignModuleFactory.getButtonDetailPaneClass()); |
||||
} |
||||
} |
||||
|
||||
public static ButtonDetailPane<Button> createButtonDetailPane(Button button) { |
||||
Class cls = detailMap.get(button.getClass().getName()); |
||||
ButtonDetailPane<Button> detailPane = null; |
||||
if (cls != null) { |
||||
try { |
||||
detailPane = (ButtonDetailPane) cls.newInstance(); |
||||
detailPane.populate(button); |
||||
} catch (Exception e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
return detailPane; |
||||
} |
||||
|
||||
public static ButtonDetailPane<Button> createButtonDetailPane(Class cls, Button button) { |
||||
if (cls == null) { |
||||
return createButtonDetailPane(button); |
||||
} |
||||
Class aa = detailMap.get(cls.getName()); |
||||
ButtonDetailPane<Button> detailPane = null; |
||||
if (aa != null) { |
||||
try { |
||||
detailPane = (ButtonDetailPane) aa.newInstance(); |
||||
detailPane.populate(button == null ? detailPane.createButton() : button); |
||||
} catch (Exception e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
return detailPane; |
||||
} |
||||
} |
@ -0,0 +1,93 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.design.designer.creator.*; |
||||
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.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||
import com.fr.design.widget.ui.designer.ButtonGroupDictPane; |
||||
import com.fr.design.widget.ui.designer.FieldEditorDefinePane; |
||||
import com.fr.design.widget.ui.designer.WaterMarkDictPane; |
||||
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||
import com.fr.form.ui.ButtonGroup; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.DocumentEvent; |
||||
import javax.swing.event.DocumentListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/5. |
||||
*/ |
||||
public abstract class ButtonGroupDefinePane<T extends ButtonGroup> extends FieldEditorDefinePane<T> { |
||||
private ButtonGroupDictPane buttonGroupDictPane; |
||||
|
||||
public ButtonGroupDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
this.initComponents(); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
buttonGroupDictPane = new ButtonGroupDictPane(); |
||||
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane(); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane }, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), new UITextField()}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont")), fontSizePane}, |
||||
new Component[]{buttonGroupDictPane, null} |
||||
}; |
||||
double[] rowSize = {p, p, p, p, p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1}}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||
advancePane.add(panel, BorderLayout.NORTH); |
||||
JPanel otherPane = createOtherPane(); |
||||
if(otherPane != null){ |
||||
advancePane.add(otherPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
return advancePane; |
||||
} |
||||
|
||||
public JPanel createOtherPane(){ |
||||
return null; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void populateSubFieldEditorBean(T e) { |
||||
this.buttonGroupDictPane.populate(e); |
||||
populateSubButtonGroupBean(e); |
||||
} |
||||
|
||||
protected abstract void populateSubButtonGroupBean(T e); |
||||
|
||||
protected abstract T updateSubButtonGroupBean(); |
||||
|
||||
@Override |
||||
protected T updateSubFieldEditorBean() { |
||||
T e = updateSubButtonGroupBean(); |
||||
this.buttonGroupDictPane.update(e); |
||||
return e; |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,143 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.base.background.ImageBackground; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.style.background.BackgroundButtonPane; |
||||
import com.fr.form.ui.FreeButton; |
||||
import com.fr.general.Background; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.TitledBorder; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class ButtonSytleDefinedPane extends BasicPane { |
||||
|
||||
// private UIComboBox buttonStyleComboBox;
|
||||
// private JPanel card;
|
||||
// private CardLayout cardLayout;
|
||||
private BackgroundPane initBackgroundPane; |
||||
private BackgroundPane overBackgroundPane; |
||||
private BackgroundPane clickBackgroundPane; |
||||
private Background initBackground; |
||||
private Background overBackground; |
||||
private Background clickBackground; |
||||
|
||||
public ButtonSytleDefinedPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
JPanel buttonStylePane = new JPanel(); |
||||
buttonStylePane.setLayout(new BorderLayout()); |
||||
initBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Initial") + ":", Inter.getLocText("FR-Designer_Initial_Background_Tips")); |
||||
overBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Over") + ":", Inter.getLocText("FR-Designer_Mouse_Move_Tips")); |
||||
clickBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Click") + ":", Inter.getLocText("FR-Designer_Mouse_Click_Tips")); |
||||
|
||||
JPanel table = FRGUIPaneFactory.createYBoxEmptyBorderPane(); |
||||
table.setBorder(new TitledBorder(Inter.getLocText(new String[]{"Custom", "Form-Button", "Style"}))); |
||||
table.add(initBackgroundPane); |
||||
table.add(overBackgroundPane); |
||||
table.add(clickBackgroundPane); |
||||
buttonStylePane.add(table, BorderLayout.WEST); |
||||
|
||||
this.add(buttonStylePane, BorderLayout.CENTER); |
||||
|
||||
} |
||||
|
||||
public void populate(FreeButton button) { |
||||
if (button == null) { |
||||
return; |
||||
} |
||||
initBackgroundPane.populate(button.getInitialBackground()); |
||||
overBackgroundPane.populate(button.getOverBackground()); |
||||
clickBackgroundPane.populate(button.getClickBackground()); |
||||
} |
||||
|
||||
public FreeButton update(FreeButton button) { |
||||
button.setCustomStyle(true); |
||||
button.setInitialBackground(initBackgroundPane.update()); |
||||
button.setOverBackground(overBackgroundPane.update()); |
||||
button.setClickBackground(clickBackgroundPane.update()); |
||||
|
||||
return button; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
class BackgroundPane extends JPanel { |
||||
private UIButton editButton; |
||||
private BackgroundButtonPane choosePane; |
||||
private Background background; |
||||
private UILabel ImagePreviewPane; |
||||
|
||||
BackgroundPane(String text, String ToolTips) { |
||||
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 150)); |
||||
|
||||
UILabel label = new UILabel(text); |
||||
label.setToolTipText(ToolTips); |
||||
label.setPreferredSize(new Dimension(100, 20)); |
||||
this.add(label); |
||||
|
||||
ImagePreviewPane = new UILabel(); |
||||
ImagePreviewPane.setPreferredSize(new Dimension(100, 20)); |
||||
this.add(ImagePreviewPane); |
||||
|
||||
editButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); |
||||
editButton.addActionListener(new ActionListener() { |
||||
|
||||
public void actionPerformed(ActionEvent e) { |
||||
choosePane = new BackgroundButtonPane(); |
||||
BasicDialog dlg = choosePane.showWindow(SwingUtilities |
||||
.getWindowAncestor(ButtonSytleDefinedPane.this)); |
||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
populate(choosePane.update()); |
||||
} |
||||
}); |
||||
if(BackgroundPane.this.background == null){ |
||||
BackgroundPane.this.background = new ColorBackground(); |
||||
} |
||||
choosePane.populate((Background) BackgroundPane.this.background); |
||||
dlg.setVisible(true); |
||||
} |
||||
}); |
||||
this.add(editButton); |
||||
} |
||||
|
||||
public void populate(Background background) { |
||||
this.background = background; |
||||
|
||||
if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) { |
||||
ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage())); |
||||
} else if(background instanceof ColorBackground && ((ColorBackground) background).getColor() != null){ |
||||
ImagePreviewPane.setIcon(null); |
||||
ImagePreviewPane.setOpaque(true); |
||||
ImagePreviewPane.setBackground(((ColorBackground) background).getColor()); |
||||
}else{ |
||||
ImagePreviewPane.setIcon(null); |
||||
ImagePreviewPane.setOpaque(false); |
||||
ImagePreviewPane.setBackground(null); |
||||
} |
||||
} |
||||
|
||||
public Background update() { |
||||
return background; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.form.ui.FreeButton; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-15 Time |
||||
* : 下午6:24 |
||||
*/ |
||||
public class DefaultButtonDetailPane extends ButtonWithHotkeysDetailPane<Button> { |
||||
|
||||
@Override |
||||
protected Component createCenterPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public FreeButton createButton() { |
||||
return new FreeButton(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public Class classType() { |
||||
return Button.class; |
||||
} |
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.IconDefinePane; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class DefaultButtonStylePane extends BasicPane { |
||||
|
||||
private UITextField buttonNameTextField; |
||||
private IconDefinePane iconPane; |
||||
private UIComboBox buttonStyleComboBox; |
||||
|
||||
public DefaultButtonStylePane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
iconPane = new IconDefinePane(); |
||||
labelPane.add(iconPane); |
||||
Component[][] n_components = { |
||||
{ new UILabel(Inter.getLocText("Text") + ":"), buttonNameTextField = new UITextField(20) }, |
||||
{ new UILabel(Inter.getLocText("Icon") + ":"), labelPane } }; |
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(n_components, new double[]{-2, -2}, new double[]{-2, -2}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void populate(Button button) { |
||||
buttonNameTextField.setText(button.getText()); |
||||
iconPane.populate(button.getIconName()); |
||||
} |
||||
|
||||
public Button update(Button button) { |
||||
button.setText(buttonNameTextField.getText()); |
||||
button.setIconName(iconPane.update()); |
||||
return button; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "default"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.design.widget.ui.designer.btn; |
||||
|
||||
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.form.ui.FreeButton; |
||||
|
||||
import java.awt.*; |
||||
|
||||
public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton> { |
||||
private ButtonSytleDefinedPane stylePane; |
||||
|
||||
@Override |
||||
protected Component createCenterPane() { |
||||
return stylePane = new ButtonSytleDefinedPane(); |
||||
} |
||||
|
||||
@Override |
||||
public FreeButton createButton() { |
||||
return new FreeButton(); |
||||
} |
||||
|
||||
@Override |
||||
public void populate(Button button) { |
||||
super.populate(button); |
||||
if(button instanceof FreeButton) { |
||||
stylePane.populate((FreeButton) button); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public FreeButton update() { |
||||
FreeButton button = super.update(); |
||||
return stylePane.update(button); |
||||
} |
||||
|
||||
@Override |
||||
public Class classType() { |
||||
return FreeButton.class; |
||||
} |
||||
} |
@ -0,0 +1,82 @@
|
||||
package com.fr.design.widget.ui.designer.component; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ibutton.UIHeadGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
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.AccessibleBackgroundEditor; |
||||
import com.fr.form.ui.*; |
||||
import com.fr.form.ui.Button; |
||||
import com.fr.general.Background; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/6. |
||||
*/ |
||||
public class BackgroundCompPane extends BasicPane { |
||||
private UIHeadGroup backgroundHead; |
||||
private AccessibleBackgroundEditor initalBackgroundEditor; |
||||
private AccessibleBackgroundEditor overBackgroundEditor; |
||||
private AccessibleBackgroundEditor clickBackgroundEditor; |
||||
|
||||
|
||||
public BackgroundCompPane() { |
||||
initComponent(); |
||||
} |
||||
|
||||
public void initComponent() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
initalBackgroundEditor = new AccessibleBackgroundEditor(); |
||||
overBackgroundEditor = new AccessibleBackgroundEditor(); |
||||
clickBackgroundEditor = new AccessibleBackgroundEditor(); |
||||
String [] titles = new String[]{"默认", "自定义"}; |
||||
|
||||
double f = TableLayout.FILL; |
||||
final double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Initial")), initalBackgroundEditor}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundEditor}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Click")), clickBackgroundEditor}, |
||||
}; |
||||
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
backgroundHead = new UIHeadGroup(titles){ |
||||
@Override |
||||
public void tabChanged(int index) { |
||||
//todo
|
||||
if (index == 1) { |
||||
panel.setVisible(true); |
||||
}else{ |
||||
panel.setVisible(false); |
||||
} |
||||
} |
||||
}; |
||||
this.add(backgroundHead, BorderLayout.NORTH); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
|
||||
} |
||||
|
||||
public void update(FreeButton btn) { |
||||
btn.setInitialBackground((Background) initalBackgroundEditor.getValue()); |
||||
btn.setOverBackground((Background) overBackgroundEditor.getValue()); |
||||
btn.setClickBackground((Background) clickBackgroundEditor.getValue()); |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return ""; |
||||
} |
||||
|
||||
public void populate(FreeButton btn) { |
||||
initalBackgroundEditor.setValue(btn.getInitialBackground()); |
||||
overBackgroundEditor.setValue(btn.getOverBackground()); |
||||
clickBackgroundEditor.setValue(btn.getClickBackground()); |
||||
} |
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.fr.design.widget.ui.designer.component; |
||||
|
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.ibutton.UIHeadGroup; |
||||
import com.fr.design.widget.ui.designer.custom.*; |
||||
import com.fr.form.ui.TextEditor; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/7/27. |
||||
*/ |
||||
public class FormWidgetValuePane extends JPanel { |
||||
private UIHeadGroup widgetValueHead; |
||||
|
||||
public FormWidgetValuePane() { |
||||
WidgetValuePane StringPane = new WidgetValueString(); |
||||
WidgetValuePane FormulaPane = new WidgetValueFormula(); |
||||
WidgetValuePane FieldPane = new WidgetValueField(); |
||||
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); |
||||
final CardLayout cardLayout = new CardLayout(); |
||||
final JPanel customPane = new JPanel(cardLayout); |
||||
customPane.add(StringPane.createWidgetValuePane(), StringPane.markTitle()); |
||||
customPane.add(FormulaPane.createWidgetValuePane(), FormulaPane.markTitle()); |
||||
customPane.add(FieldPane.createWidgetValuePane(), FieldPane.markTitle()); |
||||
|
||||
final String[] tabTitles = new String[]{StringPane.markTitle(), FormulaPane.markTitle(), FieldPane.markTitle()}; |
||||
widgetValueHead = new UIHeadGroup(tabTitles) { |
||||
@Override |
||||
public void tabChanged(int index) { |
||||
//todo
|
||||
if (index == 2) { |
||||
customPane.setPreferredSize(new Dimension(100, 50)); |
||||
} else { |
||||
customPane.setPreferredSize(new Dimension(100, 20)); |
||||
} |
||||
cardLayout.show(customPane, tabTitles[index]); |
||||
} |
||||
}; |
||||
this.add(widgetValueHead, BorderLayout.NORTH); |
||||
this.add(customPane, BorderLayout.CENTER); |
||||
|
||||
} |
||||
|
||||
public void update(TextEditor ob) { |
||||
//todo
|
||||
|
||||
} |
||||
|
||||
public void populate(TextEditor ob) { |
||||
//todo
|
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.design.widget.ui.designer.component; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.AbstractMarginWidget; |
||||
import com.fr.form.ui.PaddingMargin; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/3. |
||||
*/ |
||||
public class PaddingBoundPane extends BasicPane { |
||||
protected UISpinner top; |
||||
protected UISpinner bottom; |
||||
protected UISpinner left; |
||||
protected UISpinner right; |
||||
|
||||
public PaddingBoundPane() { |
||||
initBoundPane(); |
||||
} |
||||
|
||||
public void initBoundPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
top = new UISpinner(0, 1000, 1, 0); |
||||
bottom = new UISpinner(0, 1000, 1, 0); |
||||
left = new UISpinner(0, 1000, 1, 0); |
||||
right = new UISpinner(0, 1000, 1, 0); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p, p}; |
||||
double[] columnSize = {p, f, f}; |
||||
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Layout-Padding")), top, bottom}, |
||||
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_Top"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Bottom"), SwingConstants.CENTER)}, |
||||
new Component[]{null, left, right}, |
||||
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_Left"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Right"), SwingConstants.CENTER)}, |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
this.add(panel); |
||||
|
||||
} |
||||
|
||||
public void update(AbstractMarginWidget marginWidget) { |
||||
marginWidget.setMargin(new PaddingMargin((int)top.getValue(), (int)left.getValue(), (int)bottom.getValue(), (int)right.getValue() )); |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return ""; |
||||
} |
||||
|
||||
public void populate(AbstractMarginWidget marginWidget) { |
||||
PaddingMargin paddingMargin = marginWidget.getMargin(); |
||||
top.setValue(paddingMargin.getTop()); |
||||
bottom.setValue(paddingMargin.getBottom()); |
||||
left.setValue(paddingMargin.getLeft()); |
||||
right.setValue(paddingMargin.getRight()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,81 @@
|
||||
package com.fr.design.widget.ui.designer.component; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.designer.creator.XLayoutContainer; |
||||
import com.fr.design.designer.creator.XWAbsoluteLayout; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.container.WAbsoluteLayout; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/3. |
||||
*/ |
||||
public class WidgetAbsoluteBoundPane extends WidgetBoundPane { |
||||
protected XWAbsoluteLayout parent; |
||||
private UISpinner x; |
||||
private UISpinner y; |
||||
|
||||
public WidgetAbsoluteBoundPane(XCreator source){ |
||||
super(source); |
||||
XLayoutContainer xLayoutContainer = getParent(source); |
||||
this.parent = (XWAbsoluteLayout) xLayoutContainer; |
||||
|
||||
} |
||||
|
||||
public void initBoundPane() { |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
x = new UISpinner(0, 1200, 1); |
||||
y = new UISpinner(0, 1200, 1); |
||||
|
||||
width = new UISpinner(0, 1200, 1); |
||||
height = new UISpinner(0, 1200, 1); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Position")), x, y}, |
||||
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_X_Coordinate"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Y_Coordinate"), SwingConstants.CENTER)}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height}, |
||||
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)}, |
||||
}; |
||||
double[] rowSize = {p, p, p, p}; |
||||
double[] columnSize = {p, f, f}; |
||||
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; |
||||
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||
|
||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("Form-Component_Bounds"), 280, 20, panel); |
||||
this.add(uiExpandablePane); |
||||
} |
||||
|
||||
|
||||
public void update() { |
||||
super.update(); |
||||
Rectangle bounds = new Rectangle(creator.getBounds()); |
||||
bounds.x = (int) x.getValue(); |
||||
bounds.y = (int) y.getValue(); |
||||
if (parent == null) { |
||||
return; |
||||
} |
||||
WAbsoluteLayout wabs = parent.toData(); |
||||
wabs.setBounds(creator.toData(), bounds); |
||||
creator.setBounds(bounds); |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return ""; |
||||
} |
||||
|
||||
public void populate() { |
||||
super.populate(); |
||||
Rectangle bounds = new Rectangle(creator.getBounds()); |
||||
x.setValue(bounds.x); |
||||
y.setValue(bounds.y); |
||||
} |
||||
} |
@ -0,0 +1,77 @@
|
||||
package com.fr.design.widget.ui.designer.component; |
||||
|
||||
import com.fr.design.designer.creator.*; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
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.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/7/30. |
||||
*/ |
||||
|
||||
public class WidgetBoundPane extends BasicPane { |
||||
protected XCreator creator; |
||||
protected UISpinner width; |
||||
protected UISpinner height; |
||||
|
||||
public WidgetBoundPane(XCreator source) { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.creator = source; |
||||
initBoundPane(); |
||||
} |
||||
|
||||
public XLayoutContainer getParent(XCreator source) { |
||||
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); |
||||
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { |
||||
container = null; |
||||
} |
||||
return container; |
||||
} |
||||
|
||||
|
||||
public void initBoundPane() { |
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
width = new UISpinner(0, 1200, 1); |
||||
height = new UISpinner(0, 1200, 1); |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height}, |
||||
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)}, |
||||
}; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {p, f, f}; |
||||
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}}; |
||||
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||
|
||||
UIExpandablePane uiExpandablePane = new UIExpandablePane("尺寸", 280, 20, panel); |
||||
this.add(uiExpandablePane); |
||||
} |
||||
|
||||
|
||||
public void update() { |
||||
Rectangle bounds = new Rectangle(creator.getBounds()); |
||||
bounds.width = (int) width.getValue(); |
||||
bounds.height = (int) height.getValue(); |
||||
creator.setBounds(bounds); |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return ""; |
||||
} |
||||
|
||||
public void populate() { |
||||
Rectangle bounds = new Rectangle(creator.getBounds()); |
||||
width.setValue(bounds.width); |
||||
height.setValue(bounds.height); |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.design.widget.ui.designer.custom; |
||||
|
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/1. |
||||
*/ |
||||
public class WidgetValueField implements WidgetValuePane{ |
||||
private UITextField dataSource; |
||||
private UITextField field; |
||||
|
||||
public WidgetValueField(){ |
||||
dataSource = new UITextField(); |
||||
field = new UITextField(); |
||||
} |
||||
|
||||
public JComponent createWidgetValuePane(){ |
||||
JPanel jPanel = new JPanel(); |
||||
jPanel.setLayout(new BorderLayout(1,7)); |
||||
jPanel.add(dataSource, BorderLayout.NORTH); |
||||
jPanel.add(field, BorderLayout.CENTER); |
||||
return jPanel; |
||||
} |
||||
|
||||
public String markTitle(){ |
||||
return Inter.getLocText("FR-Designer_Widget_Field"); |
||||
} |
||||
|
||||
public void update(){ |
||||
//todo
|
||||
} |
||||
|
||||
public void populate(){ |
||||
//todo
|
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.widget.ui.designer.custom; |
||||
|
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/1. |
||||
*/ |
||||
public class WidgetValueFormula implements WidgetValuePane{ |
||||
private UITextField uiTextField; |
||||
|
||||
public WidgetValueFormula(){ |
||||
uiTextField = new UITextField(); |
||||
} |
||||
|
||||
public JComponent createWidgetValuePane(){ |
||||
return uiTextField; |
||||
} |
||||
|
||||
public String markTitle(){ |
||||
return Inter.getLocText("FR-Designer_Widget_Formula"); |
||||
} |
||||
|
||||
public void update(){ |
||||
|
||||
} |
||||
|
||||
public void populate(){ |
||||
|
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.widget.ui.designer.custom; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/1. |
||||
*/ |
||||
public interface WidgetValuePane{ |
||||
|
||||
JComponent createWidgetValuePane(); |
||||
|
||||
String markTitle(); |
||||
|
||||
void update(); |
||||
|
||||
void populate(); |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.widget.ui.designer.custom; |
||||
|
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/1. |
||||
*/ |
||||
public class WidgetValueString implements WidgetValuePane{ |
||||
private UITextField uiTextField; |
||||
|
||||
public WidgetValueString(){ |
||||
uiTextField = new UITextField(); |
||||
} |
||||
|
||||
public JComponent createWidgetValuePane(){ |
||||
return uiTextField; |
||||
} |
||||
|
||||
public String markTitle(){ |
||||
return Inter.getLocText("FR-Designer_Widget_String"); |
||||
} |
||||
|
||||
public void update(){ |
||||
|
||||
} |
||||
|
||||
public void populate(){ |
||||
|
||||
} |
||||
} |
@ -0,0 +1,219 @@
|
||||
package com.fr.design.widget.ui.designer.layout; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.*; |
||||
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; |
||||
import com.fr.design.designer.properties.items.FRLayoutTypeItems; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.FormDesigner; |
||||
import com.fr.design.mainframe.WidgetPropertyPane; |
||||
import com.fr.form.ui.container.WAbsoluteBodyLayout; |
||||
import com.fr.form.ui.container.WAbsoluteLayout; |
||||
import com.fr.form.ui.container.WBodyLayoutType; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.Arrays; |
||||
import java.util.Comparator; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/2. |
||||
*/ |
||||
public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { |
||||
private XWAbsoluteBodyLayout xwAbsoluteBodyLayout; |
||||
private WAbsoluteBodyLayout wAbsoluteBodyLayout; |
||||
private UIComboBox layoutCombox; |
||||
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE; |
||||
private static final int EACH_ROW_COUNT = 4; |
||||
|
||||
public FRAbsoluteBodyLayoutDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
this.xwAbsoluteBodyLayout = (XWAbsoluteBodyLayout) xCreator; |
||||
wAbsoluteBodyLayout = xwAbsoluteBodyLayout.toData(); |
||||
} |
||||
|
||||
|
||||
public JPanel createThirdPane() { |
||||
initLayoutComboBox(); |
||||
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[]{new UILabel(Inter.getLocText("FR-Designer_Attr_Layout_Type")), layoutCombox}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Scaling_Mode")), comboBox}, |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
return panel; |
||||
|
||||
} |
||||
|
||||
public void initLayoutComboBox() { |
||||
Item[] items = FRLayoutTypeItems.ITEMS; |
||||
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
||||
for (Item item : items) { |
||||
model.addElement(item); |
||||
} |
||||
layoutCombox = new UIComboBox(model); |
||||
layoutCombox.setSelectedIndex(1); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "absoluteBodyLayout"; |
||||
} |
||||
|
||||
public void populateSubPane(WAbsoluteLayout ob) { |
||||
// WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) ob;
|
||||
layoutCombox.setSelectedIndex(1); |
||||
} |
||||
|
||||
public WAbsoluteBodyLayout updateSubPane() { |
||||
WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) creator.toData(); |
||||
Item item = (Item) layoutCombox.getSelectedItem(); |
||||
Object value = item.getValue(); |
||||
int state = 0; |
||||
if (value instanceof Integer) { |
||||
state = (Integer) value; |
||||
} |
||||
|
||||
if (layoutType == WBodyLayoutType.ABSOLUTE) { |
||||
if (state == WBodyLayoutType.FIT.getTypeValue()) { |
||||
switch2FitBodyLayout(); |
||||
} |
||||
} |
||||
return layout; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return null; |
||||
} |
||||
|
||||
private boolean switch2FitBodyLayout() { |
||||
try { |
||||
XWFitLayout xfl = (XWFitLayout) creator.getBackupParent(); |
||||
//备份一下组件间隔
|
||||
int compInterval = xfl.toData().getCompInterval(); |
||||
Component[] components = creator.getComponents(); |
||||
|
||||
Arrays.sort(components, new ComparatorComponentLocation()); |
||||
|
||||
xfl.getLayoutAdapter().removeBean(creator, creator.getWidth(), creator.getHeight()); |
||||
xfl.remove(creator); |
||||
|
||||
for (Component comp : components) { |
||||
XCreator xCreator = (XCreator) comp; |
||||
if (xCreator.shouldScaleCreator()) { |
||||
XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight()); |
||||
xfl.add(parentPanel, xCreator.toData().getWidgetName()); |
||||
parentPanel.updateChildBound(xfl.getActualMinHeight()); |
||||
continue; |
||||
} |
||||
xfl.add(xCreator); |
||||
} |
||||
//这边计算的时候会先把组件间隔去掉
|
||||
moveComponents2FitLayout(xfl); |
||||
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); |
||||
formDesigner.getSelectionModel().setSelectedCreator(xfl); |
||||
|
||||
for (int i = 0; i < components.length; i++) { |
||||
Component comp = xfl.getComponent(i); |
||||
XCreator creator = (XCreator) comp; |
||||
creator.setBackupBound(components[i].getBounds()); |
||||
} |
||||
|
||||
//把组件间隔加上
|
||||
if (xfl.toData().getCompInterval() != compInterval) { |
||||
xfl.moveContainerMargin(); |
||||
xfl.moveCompInterval(xfl.getAcualInterval()); |
||||
xfl.toData().setCompInterval(compInterval); |
||||
xfl.addCompInterval(xfl.getAcualInterval()); |
||||
} |
||||
xfl.toData().setLayoutType(WBodyLayoutType.FIT); |
||||
return true; |
||||
} catch (Exception e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
// 把绝对布局中的元素按规则移动到自适应布局中
|
||||
// 规则:各元素按顺序放置,其中每行最多4个元素,超出则换行,各元素均分body的高度和宽度
|
||||
private void moveComponents2FitLayout(XWFitLayout xwFitLayout) { |
||||
Component[] components = xwFitLayout.getComponents(); |
||||
if (components.length == 0) { |
||||
xwFitLayout.updateBoundsWidget(); |
||||
return; |
||||
} |
||||
int layoutWidth = xwFitLayout.getWidth() - xwFitLayout.toData().getMargin().getLeft() - xwFitLayout.toData().getMargin().getRight(); |
||||
int layoutHeight = xwFitLayout.getHeight() - xwFitLayout.toData().getMargin().getTop() - xwFitLayout.toData().getMargin().getBottom(); |
||||
int leftMargin = xwFitLayout.toData().getMargin().getLeft(); |
||||
int topMargin = xwFitLayout.toData().getMargin().getTop(); |
||||
xwFitLayout.toData().setCompInterval(0); |
||||
int row = (components.length / EACH_ROW_COUNT) + (components.length % EACH_ROW_COUNT == 0 ? 0 : 1); |
||||
//最后一行的列数不定
|
||||
int column = components.length % EACH_ROW_COUNT == 0 ? EACH_ROW_COUNT : components.length % EACH_ROW_COUNT; |
||||
int componentWidth = layoutWidth / EACH_ROW_COUNT; |
||||
int componentHeight = layoutHeight / row; |
||||
for (int i = 0; i < row - 1; i++) { |
||||
for (int j = 0; j < EACH_ROW_COUNT; j++) { |
||||
components[EACH_ROW_COUNT * i + j].setBounds( |
||||
leftMargin + componentWidth * j, |
||||
topMargin + componentHeight * i, |
||||
j == EACH_ROW_COUNT - 1 ? layoutWidth - componentWidth * (EACH_ROW_COUNT - 1) : componentWidth, |
||||
componentHeight |
||||
); |
||||
} |
||||
} |
||||
//最后一行列数是特殊的,要单独处理
|
||||
int lastRowWidth = layoutWidth / column; |
||||
int lastRowHeight = layoutHeight - componentHeight * (row - 1); |
||||
for (int i = 0; i < column; i++) { |
||||
components[EACH_ROW_COUNT * (row - 1) + i].setBounds( |
||||
leftMargin + lastRowWidth * i, |
||||
topMargin + componentHeight * (row - 1), |
||||
i == column - 1 ? layoutWidth - lastRowWidth * (column - 1) : lastRowWidth, |
||||
lastRowHeight |
||||
); |
||||
} |
||||
for (int i = 0; i < components.length; i++) { |
||||
if (components[i] instanceof XWCardMainBorderLayout) { |
||||
((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth()); |
||||
((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight()); |
||||
} |
||||
xwFitLayout.dealDirections((XCreator) components[i], false); |
||||
} |
||||
xwFitLayout.updateBoundsWidget(); |
||||
} |
||||
|
||||
//以组件的位置来确定先后顺序,y小的在前,x小的在前
|
||||
private class ComparatorComponentLocation implements Comparator { |
||||
@Override |
||||
public int compare(Object o1, Object o2) { |
||||
if (((Component) o1).getY() < ((Component) o2).getY()) { |
||||
return -1; |
||||
} else if (((Component) o1).getY() > ((Component) o2).getY()) { |
||||
return 1; |
||||
} else { |
||||
if (((Component) o1).getX() < ((Component) o2).getX()) { |
||||
return -1; |
||||
} else if (((Component) o1).getX() > ((Component) o2).getX()) { |
||||
return 1; |
||||
} else { |
||||
return 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,113 @@
|
||||
package com.fr.design.widget.ui.designer.layout; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.designer.creator.XWAbsoluteLayout; |
||||
import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||
import com.fr.design.widget.ui.designer.component.WidgetBoundPane; |
||||
import com.fr.form.ui.container.WAbsoluteLayout; |
||||
import com.fr.form.ui.container.WBodyLayoutType; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/2. |
||||
*/ |
||||
public class FRAbsoluteLayoutDefinePane extends AbstractDataModify<WAbsoluteLayout> { |
||||
private XWAbsoluteLayout xwAbsoluteLayout; |
||||
private WAbsoluteLayout wAbsoluteLayout; |
||||
protected UIComboBox comboBox; |
||||
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE; |
||||
private WidgetBoundPane boundPane; |
||||
|
||||
public FRAbsoluteLayoutDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
|
||||
this.xwAbsoluteLayout = (XWAbsoluteLayout) xCreator; |
||||
wAbsoluteLayout = xwAbsoluteLayout.toData(); |
||||
initComponent(); |
||||
|
||||
} |
||||
|
||||
|
||||
public void initComponent() { |
||||
boundPane = new WidgetBoundPane(creator); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.add(boundPane, BorderLayout.NORTH); |
||||
initUIComboBox(); |
||||
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer-Widget_Area_Scaling"), 280, 20, createThirdPane()); |
||||
|
||||
this.add(layoutExpandablePane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public JPanel createThirdPane() { |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Scaling_Mode")), comboBox}, |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
return panel; |
||||
} |
||||
|
||||
|
||||
public void initUIComboBox() { |
||||
Item[] items = FRAbsoluteConstraintsItems.ITEMS; |
||||
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
||||
for (Item item : items) { |
||||
model.addElement(item); |
||||
} |
||||
comboBox = new UIComboBox(model); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "absoluteLayout"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(WAbsoluteLayout ob) { |
||||
populateSubPane(ob); |
||||
comboBox.setSelectedIndex(ob.getCompState()); |
||||
boundPane.populate(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public WAbsoluteLayout updateBean() { |
||||
WAbsoluteLayout wAbsoluteLayout = updateSubPane(); |
||||
wAbsoluteLayout.setCompState(comboBox.getSelectedIndex()); |
||||
boundPane.update(); |
||||
return wAbsoluteLayout; |
||||
|
||||
} |
||||
|
||||
public WAbsoluteLayout updateSubPane() { |
||||
return new WAbsoluteLayout(); |
||||
} |
||||
|
||||
public void populateSubPane(WAbsoluteLayout ob) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return null; |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,171 @@
|
||||
package com.fr.design.widget.ui.designer.layout; |
||||
|
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.designer.creator.XWAbsoluteBodyLayout; |
||||
import com.fr.design.designer.creator.XWFitLayout; |
||||
import com.fr.design.designer.creator.XWScaleLayout; |
||||
import com.fr.design.designer.properties.items.FRFitConstraintsItems; |
||||
import com.fr.design.designer.properties.items.FRLayoutTypeItems; |
||||
import com.fr.design.designer.properties.items.Item; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.FormDesigner; |
||||
import com.fr.design.mainframe.FormSelectionUtils; |
||||
import com.fr.design.mainframe.WidgetPropertyPane; |
||||
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.container.WAbsoluteBodyLayout; |
||||
import com.fr.form.ui.container.WAbsoluteLayout; |
||||
import com.fr.form.ui.container.WBodyLayoutType; |
||||
import com.fr.form.ui.container.WFitLayout; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/2. |
||||
*/ |
||||
public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> { |
||||
private XWFitLayout xWFitLayout; |
||||
private WFitLayout wFitLayout; |
||||
private UIComboBox layoutComboBox; |
||||
private UIComboBox adaptComboBox; |
||||
private UISpinner componentIntervel; |
||||
private PaddingBoundPane paddingBound; |
||||
private UITextField background; |
||||
|
||||
public FRFitLayoutDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
this.xWFitLayout = (XWFitLayout) xCreator; |
||||
wFitLayout = xWFitLayout.toData(); |
||||
initComponent(); |
||||
} |
||||
|
||||
|
||||
public void initComponent() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel advancePane = createAdvancePane(); |
||||
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); |
||||
this.add(advanceExpandablePane, BorderLayout.NORTH); |
||||
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Layout"), 280, 20, createLayoutPane()); |
||||
this.add(layoutExpandablePane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public JPanel createAdvancePane() { |
||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
background = new UITextField(); |
||||
paddingBound = new PaddingBoundPane(); |
||||
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), background}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); |
||||
jp2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
jPanel.add(paddingBound, BorderLayout.CENTER); |
||||
jPanel.add(jp2, BorderLayout.NORTH); |
||||
return jPanel; |
||||
} |
||||
|
||||
public JPanel createLayoutPane() { |
||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS); |
||||
adaptComboBox = initUIComboBox(FRFitConstraintsItems.ITEMS); |
||||
componentIntervel = new UISpinner(0, 100, 1, 0); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p}; |
||||
double[] columnSize = {p, f}; |
||||
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Attr_Layout_Type")), layoutComboBox}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Scale")), adaptComboBox}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentIntervel} |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
jPanel.add(panel, BorderLayout.CENTER); |
||||
|
||||
return jPanel; |
||||
} |
||||
|
||||
|
||||
public UIComboBox initUIComboBox(Item[] items) { |
||||
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
||||
for (Item item : items) { |
||||
model.addElement(item); |
||||
} |
||||
return new UIComboBox(model); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "fitLayout"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(WFitLayout ob) { |
||||
background.setText("test"); |
||||
paddingBound.populate(ob); |
||||
layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue()); |
||||
adaptComboBox.setSelectedIndex(ob.getCompState()); |
||||
componentIntervel.setValue(ob.getCompInterval()); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public WFitLayout updateBean() { |
||||
WFitLayout layout = (WFitLayout) creator.toData(); |
||||
paddingBound.update(layout); |
||||
Item item = (Item) layoutComboBox.getSelectedItem(); |
||||
Object value = item.getValue(); |
||||
int state = 0; |
||||
if (value instanceof Integer) { |
||||
state = (Integer) value; |
||||
} |
||||
try { |
||||
if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { |
||||
WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); |
||||
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); |
||||
Component[] components = xWFitLayout.getComponents(); |
||||
xWFitLayout.removeAll(); |
||||
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); |
||||
xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); |
||||
for (Component component : components) { |
||||
XCreator xCreator = (XCreator) component; |
||||
//部分控件被ScaleLayout包裹着,绝对布局里面要放出来
|
||||
if (xCreator.acceptType(XWScaleLayout.class)) { |
||||
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { |
||||
component = xCreator.getComponent(0); |
||||
component.setBounds(xCreator.getBounds()); |
||||
} |
||||
} |
||||
xwAbsoluteBodyLayout.add(component); |
||||
} |
||||
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); |
||||
formDesigner.getSelectionModel().setSelectedCreators( |
||||
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); |
||||
} |
||||
} catch (Exception e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
|
||||
} |
||||
//todo 验证下
|
||||
layout.setLayoutType(WBodyLayoutType.parse(state)); |
||||
layout.setCompState(adaptComboBox.getSelectedIndex()); |
||||
layout.setCompInterval((int)componentIntervel.getValue()); |
||||
return layout; |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.widget.ui.designer.layout; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/2. |
||||
*/ |
||||
public class WCardMainLayoutDefinePane extends AbstractDataModify<WCardMainBorderLayout> { |
||||
|
||||
public WCardMainLayoutDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
this.setPreferredSize(new Dimension(0,0)); |
||||
} |
||||
|
||||
public void initComponent() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "cardMainLayout"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(WCardMainBorderLayout ob) { |
||||
|
||||
} |
||||
|
||||
|
||||
@Override |
||||
public WCardMainBorderLayout updateBean() { |
||||
WCardMainBorderLayout layout = (WCardMainBorderLayout)creator.toData(); |
||||
return layout; |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
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.layout.FRGUIPaneFactory; |
||||
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; |
||||
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
||||
import com.fr.general.Inter; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/5. |
||||
*/ |
||||
public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> { |
||||
private PaddingBoundPane paddingBoundPane; |
||||
|
||||
public WTabFitLayoutDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
initComponent(); |
||||
} |
||||
|
||||
public void initComponent() { |
||||
paddingBoundPane = new PaddingBoundPane(); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, paddingBoundPane); |
||||
this.add(advanceExpandablePane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "tabFitLayout"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(WTabFitLayout ob) { |
||||
|
||||
} |
||||
|
||||
|
||||
@Override |
||||
public WTabFitLayout updateBean() { |
||||
WTabFitLayout layout = (WTabFitLayout) creator.toData(); |
||||
return layout; |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
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.layout.FRGUIPaneFactory; |
||||
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; |
||||
import com.fr.form.ui.container.WTitleLayout; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/3. |
||||
*/ |
||||
public class WTitleLayoutDefinePane extends AbstractDataModify<WTitleLayout> { |
||||
private PaddingBoundPane paddingBoundPane; |
||||
private UICheckBox displayECToolBar; |
||||
public WTitleLayoutDefinePane(XCreator xCreator) { |
||||
super(xCreator); |
||||
initComponent(); |
||||
} |
||||
|
||||
public void initComponent() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); |
||||
paddingBoundPane = new PaddingBoundPane(); |
||||
displayECToolBar = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Display_Report_Tool")); |
||||
advancePane.add(paddingBoundPane, BorderLayout.NORTH); |
||||
advancePane.add(displayECToolBar, BorderLayout.CENTER); |
||||
this.add(advanceExpandablePane); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "titleLayout"; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(WTitleLayout ob) { |
||||
paddingBoundPane.populate(ob); |
||||
// displayECToolBar.setSelected(ob.ds);
|
||||
} |
||||
|
||||
|
||||
@Override |
||||
public WTitleLayout updateBean() { |
||||
WTitleLayout layout = (WTitleLayout)creator.toData(); |
||||
return layout; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue