yaoh.wu
7 years ago
125 changed files with 9413 additions and 3944 deletions
@ -1,45 +1,70 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
import java.awt.event.KeyListener; |
import java.awt.event.KeyListener; |
||||||
|
|
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
|
|
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.form.ui.WaterMark; |
import com.fr.form.ui.WaterMark; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
|
|
||||||
public class WaterMarkDictPane extends JPanel{ |
public class WaterMarkDictPane extends JPanel { |
||||||
|
|
||||||
private UITextField waterMarkTextField; |
private UITextField waterMarkTextField; |
||||||
|
|
||||||
public WaterMarkDictPane() { |
public WaterMarkDictPane() { |
||||||
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
this.setLayout(new BorderLayout()); |
||||||
this.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); |
|
||||||
this.add(new UILabel(Inter.getLocText("WaterMark") + ":")); |
// this.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
|
||||||
waterMarkTextField = new UITextField(13); |
// this.add(new UILabel(Inter.getLocText("WaterMark") + ":"));
|
||||||
this.add(waterMarkTextField); |
waterMarkTextField = new UITextField(13); |
||||||
} |
|
||||||
|
UILabel emptyLabel = new UILabel(); |
||||||
public void populate(WaterMark waterMark) { |
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 33, 0, 0)); |
||||||
this.waterMarkTextField.setText(waterMark.getWaterMark()); |
|
||||||
} |
double f = TableLayout.FILL; |
||||||
public void addInputKeyListener(KeyListener kl) { |
double p = TableLayout.PREFERRED; |
||||||
this.waterMarkTextField.addKeyListener(kl); |
Component[][] components = new Component[][]{ |
||||||
} |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), emptyLabel, waterMarkTextField}, |
||||||
public void removeInputKeyListener(KeyListener kl) { |
}; |
||||||
this.waterMarkTextField.removeKeyListener(kl); |
double[] rowSize = {p}; |
||||||
} |
double[] columnSize = {p, p, f}; |
||||||
public void update(WaterMark waterMark) { |
int[][] rowCount = {{1, 1}}; |
||||||
waterMark.setWaterMark(this.waterMarkTextField.getText()); |
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
} |
// JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
|
||||||
public void setWaterMark(String waterMark) { |
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0)); |
||||||
this.waterMarkTextField.setText(waterMark); |
this.add(panel, BorderLayout.CENTER); |
||||||
} |
} |
||||||
public String getWaterMark() { |
|
||||||
return this.waterMarkTextField.getText(); |
public void populate(WaterMark waterMark) { |
||||||
} |
this.waterMarkTextField.setText(waterMark.getWaterMark()); |
||||||
|
} |
||||||
|
|
||||||
|
public void addInputKeyListener(KeyListener kl) { |
||||||
|
this.waterMarkTextField.addKeyListener(kl); |
||||||
|
} |
||||||
|
|
||||||
|
public void removeInputKeyListener(KeyListener kl) { |
||||||
|
this.waterMarkTextField.removeKeyListener(kl); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(WaterMark waterMark) { |
||||||
|
waterMark.setWaterMark(this.waterMarkTextField.getText()); |
||||||
|
} |
||||||
|
|
||||||
|
public void setWaterMark(String waterMark) { |
||||||
|
this.waterMarkTextField.setText(waterMark); |
||||||
|
} |
||||||
|
|
||||||
|
public String getWaterMark() { |
||||||
|
return this.waterMarkTextField.getText(); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 177 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 250 B |
@ -0,0 +1,50 @@ |
|||||||
|
package com.fr.design.mainframe.widget; |
||||||
|
|
||||||
|
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.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by plough on 2017/8/7. |
||||||
|
*/ |
||||||
|
public class BasicPropertyPane extends BasicPane { |
||||||
|
protected UITextField widgetName; |
||||||
|
|
||||||
|
public BasicPropertyPane(){ |
||||||
|
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("FR-Designer_Widget_Name")), widgetName}, |
||||||
|
}; |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); |
||||||
|
this.add(panel, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
public UITextField getWidgetNameField() { |
||||||
|
return widgetName; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "basicProperty"; |
||||||
|
} |
||||||
|
} |
@ -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,52 @@ |
|||||||
|
package com.fr.design.widget; |
||||||
|
|
||||||
|
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.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by plough on 2017/8/7. |
||||||
|
*/ |
||||||
|
public class WidgetBoundsPaneFactory { |
||||||
|
|
||||||
|
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
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, 15)); |
||||||
|
|
||||||
|
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 280, 24, panel); |
||||||
|
} |
||||||
|
|
||||||
|
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
|
||||||
|
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, 15)); |
||||||
|
|
||||||
|
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 230, 24, panel); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.fr.design.mainframe.widget.ui; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.widget.BasicPropertyPane; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/4. |
||||||
|
*/ |
||||||
|
public class FormBasicPropertyPane extends BasicPropertyPane { |
||||||
|
|
||||||
|
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,224 @@ |
|||||||
|
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.container.WTitleLayout; |
||||||
|
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.acceptType(XWScaleLayout.class)) { |
||||||
|
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { |
||||||
|
creator = (XCreator) xCreator.getComponent(0); |
||||||
|
} |
||||||
|
} |
||||||
|
if(xCreator.acceptType(XWTitleLayout.class)){ |
||||||
|
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 if(cellWidget instanceof WTitleLayout){ |
||||||
|
CRBoundsWidget crBoundsWidget = ((WTitleLayout) cellWidget).getBodyBoundsWidget(); |
||||||
|
currentEditorDefinePane.populateBean(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 if(xCreator instanceof XWTitleLayout){ |
||||||
|
XCreator xCreator1 = ((XWTitleLayout) xCreator).getXCreator(0); |
||||||
|
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,121 @@ |
|||||||
|
package com.fr.design.parameter; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.designer.creator.XWParameterLayout; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor; |
||||||
|
import com.fr.design.widget.ui.designer.AbstractDataModify; |
||||||
|
import com.fr.form.ui.container.WParameterLayout; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
|
||||||
|
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 AccessibleBackgroundEditor background; |
||||||
|
private UIButtonGroup hAlignmentPane; |
||||||
|
|
||||||
|
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(); |
||||||
|
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 AccessibleBackgroundEditor(); |
||||||
|
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
||||||
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
||||||
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),}; |
||||||
|
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
||||||
|
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); |
||||||
|
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Left") |
||||||
|
, Inter.getLocText("FR-Designer-StyleAlignment_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Right")}); |
||||||
|
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")), hAlignmentPane} |
||||||
|
}; |
||||||
|
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) { |
||||||
|
background.setValue(ob.getBackground()); |
||||||
|
displayReport.setSelected(ob.isDelayDisplayContent()); |
||||||
|
designerWidth.setValue(ob.getDesignWidth()); |
||||||
|
hAlignmentPane.setSelectedIndex(ob.getPosition()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public WParameterLayout updateBean() { |
||||||
|
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); |
||||||
|
wParameterLayout.setDesignWidth((int) designerWidth.getValue()); |
||||||
|
wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); |
||||||
|
wParameterLayout.setBackground(wParameterLayout.getBackground()); |
||||||
|
wParameterLayout.setPosition(hAlignmentPane.getSelectedIndex()); |
||||||
|
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(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(FreeButtonDefinePane.class, WidgetConstants.BUTTON + "")); |
||||||
|
defineMap.put(FreeButton.class, new Appearance(FreeButtonDefinePane.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(ElementCaseEditor.class, new Appearance(ElementEditorDefinePane.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(WCardLayout.class, new Appearance(WCardLayoutDefinePane.class, "tablayout")); |
||||||
|
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,92 @@ |
|||||||
|
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.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.widget.accessibles.AccessibleIconEditor; |
||||||
|
import com.fr.design.widget.btn.ButtonConstants; |
||||||
|
import com.fr.form.ui.Button; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.StableUtils; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public abstract class ButtonDefinePane<T extends Button> extends AbstractDataModify<T> { |
||||||
|
private UITextField hotkeysTextField; |
||||||
|
private UITextField buttonNameTextField; |
||||||
|
private AccessibleIconEditor iconPane; |
||||||
|
|
||||||
|
|
||||||
|
public ButtonDefinePane(XCreator creator){ |
||||||
|
super(creator); |
||||||
|
this.initComponent(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponent() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double rowSize[] = {p, p, p, p, p, p, p}; |
||||||
|
double columnSize[] = {p, f}; |
||||||
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||||
|
iconPane = new AccessibleIconEditor(); |
||||||
|
hotkeysTextField = new UITextField(); |
||||||
|
buttonNameTextField = new UITextField(); |
||||||
|
Component[] backgroundCompPane = createBackgroundComp(); |
||||||
|
Component[] frFont = createFontPane(); |
||||||
|
UILabel backgroundLabel = new UILabel(Inter.getLocText("FR-Designer_Background")); |
||||||
|
backgroundLabel.setVerticalAlignment(SwingConstants.TOP); |
||||||
|
Component[][] n_components = { |
||||||
|
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField}, |
||||||
|
backgroundCompPane, |
||||||
|
frFont, |
||||||
|
{new UILabel(Inter.getLocText("FR-Designer_Icon" + ":")), iconPane}, |
||||||
|
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField} |
||||||
|
}; |
||||||
|
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); |
||||||
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, 10, 8); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |
||||||
|
UIExpandablePane advancedPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, panel); |
||||||
|
this.add(advancedPane); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "Button"; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createBackgroundComp(){ |
||||||
|
return new Component[]{null, null}; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createFontPane(){ |
||||||
|
return new Component[]{null, null}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(T btn) { |
||||||
|
hotkeysTextField.setText(btn.getHotkeys()); |
||||||
|
buttonNameTextField.setText(btn.getLabelName()); |
||||||
|
iconPane.setValue(btn.getIconName()); |
||||||
|
populateSubButtonPane(btn); |
||||||
|
} |
||||||
|
|
||||||
|
public abstract void populateSubButtonPane(T e); |
||||||
|
|
||||||
|
public abstract T updateSubButtonPane(); |
||||||
|
|
||||||
|
@Override |
||||||
|
public T updateBean() { |
||||||
|
T btn = updateSubButtonPane(); |
||||||
|
btn.setHotkeys(hotkeysTextField.getText()); |
||||||
|
btn.setLabelName(buttonNameTextField.getText()); |
||||||
|
btn.setIconName((String)iconPane.getValue()); |
||||||
|
return btn; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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,70 @@ |
|||||||
|
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.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.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 UISpinner fontSizePane; |
||||||
|
private FormWidgetValuePane formWidgetValuePane; |
||||||
|
|
||||||
|
public CheckBoxDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
iniComoponents(); |
||||||
|
} |
||||||
|
|
||||||
|
private void iniComoponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
text = new UITextField(); |
||||||
|
fontSizePane = new UISpinner(0, 20, 1, 0); |
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
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()); |
||||||
|
fontSizePane.setValue(check.getFontSize()); |
||||||
|
formWidgetValuePane.populate(check); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public CheckBox updateBean() { |
||||||
|
CheckBox box = (CheckBox)creator.toData(); |
||||||
|
box.setText(text.getText()); |
||||||
|
box.setFontSize((int)fontSizePane.getValue()); |
||||||
|
formWidgetValuePane.update(box); |
||||||
|
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,97 @@ |
|||||||
|
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.ibutton.UIHeadGroup; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.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 UIHeadGroup returnType; |
||||||
|
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"})); |
||||||
|
final String[] tabTitles = new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")}; |
||||||
|
returnType = new UIHeadGroup(tabTitles) { |
||||||
|
@Override |
||||||
|
public void tabChanged(int index) { |
||||||
|
CheckBoxGroup combo = (CheckBoxGroup) creator.toData(); |
||||||
|
//todo
|
||||||
|
if (index == 1) { |
||||||
|
combo.setReturnString(true); |
||||||
|
} else { |
||||||
|
combo.setReturnString(false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
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")), returnType}, |
||||||
|
}; |
||||||
|
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) { |
||||||
|
if (ob.isReturnString()) { |
||||||
|
returnType.setSelectedIndex(1); |
||||||
|
} else { |
||||||
|
returnType.setSelectedIndex(0); |
||||||
|
} |
||||||
|
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,53 @@ |
|||||||
|
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.form.ui.ComboBox; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> { |
||||||
|
private UICheckBox removeRepeatCheckBox; |
||||||
|
private UITextField waterMarkField; |
||||||
|
|
||||||
|
public ComboBoxDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
public UICheckBox createRepeatCheckBox(){ |
||||||
|
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat")); |
||||||
|
return removeRepeatCheckBox; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createWaterMarkPane() { |
||||||
|
waterMarkField = new UITextField(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkField}; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubDictionaryEditorBean(ComboBox ob){ |
||||||
|
removeRepeatCheckBox.setSelected(ob.isRemoveRepeat()); |
||||||
|
formWidgetValuePane.populate(ob); |
||||||
|
} |
||||||
|
|
||||||
|
protected ComboBox updateSubDictionaryEditorBean(){ |
||||||
|
ComboBox combo = (ComboBox) creator.toData(); |
||||||
|
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected()); |
||||||
|
formWidgetValuePane.update(combo); |
||||||
|
return combo; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "ComboBox"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,100 @@ |
|||||||
|
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.ibutton.UIHeadGroup; |
||||||
|
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.form.ui.ComboCheckBox; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class ComboCheckBoxDefinePane extends DictEditorDefinePane<ComboCheckBox> { |
||||||
|
private UICheckBox supportTagCheckBox; |
||||||
|
private UIHeadGroup returnType; |
||||||
|
private UITextField waterMarkDictPane; |
||||||
|
private UICheckBox removeRepeatCheckBox; |
||||||
|
|
||||||
|
public ComboCheckBoxDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
public UICheckBox createRepeatCheckBox(){ |
||||||
|
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat")); |
||||||
|
return removeRepeatCheckBox; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createWaterMarkPane() { |
||||||
|
waterMarkDictPane = new UITextField(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JPanel createOtherPane(){ |
||||||
|
supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true); |
||||||
|
|
||||||
|
final String[] tabTitles = new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")}; |
||||||
|
returnType = new UIHeadGroup(tabTitles) { |
||||||
|
@Override |
||||||
|
public void tabChanged(int index) { |
||||||
|
ComboCheckBox combo = (ComboCheckBox) creator.toData(); |
||||||
|
//todo
|
||||||
|
if (index == 1) { |
||||||
|
combo.setReturnString(true); |
||||||
|
} else { |
||||||
|
combo.setReturnString(false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{supportTagCheckBox, null }, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), returnType}, |
||||||
|
}; |
||||||
|
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; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubDictionaryEditorBean(ComboCheckBox ob){ |
||||||
|
if (ob.isReturnString()) { |
||||||
|
returnType.setSelectedIndex(1); |
||||||
|
} else { |
||||||
|
returnType.setSelectedIndex(0); |
||||||
|
} |
||||||
|
waterMarkDictPane.setText(ob.getWaterMark()); |
||||||
|
formWidgetValuePane.populate(ob); |
||||||
|
this.supportTagCheckBox.setSelected(ob.isSupportTag()); |
||||||
|
this.removeRepeatCheckBox.setSelected(ob.isRemoveRepeat()); |
||||||
|
} |
||||||
|
|
||||||
|
protected ComboCheckBox updateSubDictionaryEditorBean(){ |
||||||
|
ComboCheckBox combo = (ComboCheckBox) creator.toData(); |
||||||
|
formWidgetValuePane.update(combo); |
||||||
|
combo.setWaterMark(waterMarkDictPane.getText()); |
||||||
|
combo.setSupportTag(this.supportTagCheckBox.isSelected()); |
||||||
|
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected()); |
||||||
|
return combo; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "ComboCheckBox"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.GraphHelper; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.form.ui.CustomWriteAbleRepeatEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Author : Shockway |
||||||
|
* Date: 13-9-18 |
||||||
|
* Time: 下午2:17 |
||||||
|
*/ |
||||||
|
public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> { |
||||||
|
|
||||||
|
private UICheckBox customDataCheckBox; |
||||||
|
private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; |
||||||
|
private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; |
||||||
|
|
||||||
|
public CustomWritableRepeatEditorPane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JPanel setValidatePane(){ |
||||||
|
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); |
||||||
|
this.customDataCheckBox.setPreferredSize( |
||||||
|
new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); |
||||||
|
JPanel otherContentPane = super.setValidatePane(); |
||||||
|
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); |
||||||
|
return otherContentPane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void populateSubWritableRepeatEditorBean(T e) { |
||||||
|
this.customDataCheckBox.setSelected(e.isCustomData()); |
||||||
|
populateSubCustomWritableRepeatEditorBean(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubCustomWritableRepeatEditorBean(T e); |
||||||
|
|
||||||
|
protected T updateSubWritableRepeatEditorBean() { |
||||||
|
T e = updateSubCustomWritableRepeatEditorBean(); |
||||||
|
e.setCustomData(this.customDataCheckBox.isSelected()); |
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract T updateSubCustomWritableRepeatEditorBean(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,265 @@ |
|||||||
|
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.ibutton.UIHeadGroup; |
||||||
|
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.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.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; |
||||||
|
private WaterMarkDictPane waterMarkDictPane; |
||||||
|
private FormWidgetValuePane formWidgetValuePane; |
||||||
|
private UISpinner fontSizePane; |
||||||
|
private UIHeadGroup formatHeader; |
||||||
|
|
||||||
|
public DateEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "Date"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setFirstContentPane() { |
||||||
|
waterMarkDictPane = new WaterMarkDictPane(); |
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
fontSizePane = new UISpinner(0, 20, 1, 0); |
||||||
|
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()); |
||||||
|
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane("示例"); |
||||||
|
previewPane.add(sampleLabel); |
||||||
|
// 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(); |
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||||
|
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null); |
||||||
|
initFormatHeader(); |
||||||
|
|
||||||
|
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-Engine_Format") + ":"), dateFormatComboBox}, |
||||||
|
new Component[]{null, previewPane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark") + ":"), waterMarkDictPane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox} |
||||||
|
|
||||||
|
}; |
||||||
|
double[] rowSize = {p, p, p, p, p, p, p, p, p, p}; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {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; |
||||||
|
} |
||||||
|
|
||||||
|
protected void initFormatHeader() { |
||||||
|
String [] tabTitles = getDateFormateArray(); |
||||||
|
formatHeader = new UIHeadGroup(tabTitles){ |
||||||
|
protected void tabChanged(int newSelectedIndex) { |
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
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); |
||||||
|
formWidgetValuePane.populate(e); |
||||||
|
populateStartEnd(e); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected DateEditor updateSubDirectWriteEditorBean() { |
||||||
|
DateEditor ob = new DateEditor(); |
||||||
|
|
||||||
|
ob.setFormatText(this.getSimpleDateFormat().toPattern()); |
||||||
|
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1); |
||||||
|
formWidgetValuePane.update(ob); |
||||||
|
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,47 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.data.Dictionary; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; |
||||||
|
import com.fr.form.ui.DictContainedCustomWriteAbleEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/6. |
||||||
|
*/ |
||||||
|
public abstract class DictEditorDefinePane<T extends DictContainedCustomWriteAbleEditor> extends CustomWritableRepeatEditorPane<T> { |
||||||
|
private AccessibleDictionaryEditor dictionaryEditor; |
||||||
|
|
||||||
|
|
||||||
|
public DictEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected Component[] createDictPane(){ |
||||||
|
dictionaryEditor = new AccessibleDictionaryEditor(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictionaryEditor}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void populateSubCustomWritableRepeatEditorBean(T e) { |
||||||
|
populateSubDictionaryEditorBean(e); |
||||||
|
dictionaryEditor.setValue(e.getDictionary()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected T updateSubCustomWritableRepeatEditorBean() { |
||||||
|
T e = updateSubDictionaryEditorBean(); |
||||||
|
e.setDictionary((Dictionary) dictionaryEditor.getValue()); |
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubDictionaryEditorBean(T e); |
||||||
|
|
||||||
|
protected abstract T updateSubDictionaryEditorBean(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,100 @@ |
|||||||
|
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.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 FormWidgetValuePane formWidgetValuePane; |
||||||
|
|
||||||
|
public DirectWriteEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel setFirstContentPane() { |
||||||
|
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
Component[] removeRepeatPane = new Component[]{createRepeatCheckBox(), null}; |
||||||
|
Component[] dicPane = createDictPane(); |
||||||
|
Component[] waterMarkComponent = createWaterMarkPane(); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane }, |
||||||
|
dicPane, |
||||||
|
removeRepeatPane, |
||||||
|
waterMarkComponent, |
||||||
|
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 UICheckBox createRepeatCheckBox(){ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createWaterMarkPane() { |
||||||
|
return new Component[]{null, null}; |
||||||
|
} |
||||||
|
|
||||||
|
protected Component[] createDictPane(){ |
||||||
|
return new Component[]{null, null}; |
||||||
|
} |
||||||
|
|
||||||
|
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()); |
||||||
|
populateSubDirectWriteEditorBean(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void populateSubDirectWriteEditorBean(T e); |
||||||
|
|
||||||
|
@Override |
||||||
|
protected T updateSubFieldEditorBean() { |
||||||
|
T e = updateSubDirectWriteEditorBean(); |
||||||
|
e.setDirectEdit(directWriteCheckBox.isSelected()); |
||||||
|
|
||||||
|
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,56 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.style.FRFontPane; |
||||||
|
import com.fr.design.widget.ui.designer.component.BackgroundCompPane; |
||||||
|
import com.fr.design.widget.ui.designer.component.MouseActionBackground; |
||||||
|
import com.fr.form.ui.FreeButton; |
||||||
|
import com.fr.general.FRFont; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by ibm on 2017/8/6. |
||||||
|
*/ |
||||||
|
public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> { |
||||||
|
private BackgroundCompPane backgroundCompPane; |
||||||
|
private FRFontPane frFontPane; |
||||||
|
|
||||||
|
public FreeButtonDefinePane(XCreator xcreator) { |
||||||
|
super(xcreator); |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createBackgroundComp() { |
||||||
|
backgroundCompPane = new BackgroundCompPane(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background") + ":"), backgroundCompPane}; |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createFontPane() { |
||||||
|
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font")); |
||||||
|
fontLabel.setVerticalAlignment(SwingConstants.TOP); |
||||||
|
frFontPane = new FRFontPane(); |
||||||
|
return new Component[]{fontLabel, frFontPane}; |
||||||
|
} |
||||||
|
|
||||||
|
public void populateSubButtonPane(FreeButton e) { |
||||||
|
MouseActionBackground mouseActionBackground = new MouseActionBackground(e.getInitialBackground(), e.getOverBackground(), e.getClickBackground()); |
||||||
|
backgroundCompPane.populate(mouseActionBackground); |
||||||
|
FRFont frFont = e.getFont(); |
||||||
|
if (frFont != null) { |
||||||
|
frFontPane.populateBean(e.getFont()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public FreeButton updateSubButtonPane() { |
||||||
|
FreeButton freeButton = (FreeButton) creator.toData(); |
||||||
|
MouseActionBackground mouseActionBackground = backgroundCompPane.update(); |
||||||
|
freeButton.setInitialBackground(mouseActionBackground.getInitialBackground()); |
||||||
|
freeButton.setOverBackground(mouseActionBackground.getOverBackground()); |
||||||
|
freeButton.setClickBackground(mouseActionBackground.getClickBackground()); |
||||||
|
frFontPane.update(freeButton.getFont()); |
||||||
|
return freeButton; |
||||||
|
} |
||||||
|
} |
@ -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,100 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.style.FRFontPane; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; |
||||||
|
import com.fr.form.ui.Label; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
|
||||||
|
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; |
||||||
|
private UIButtonGroup hAlignmentPane; |
||||||
|
private FRFontPane frFontPane; |
||||||
|
|
||||||
|
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(creator.toData(), false); |
||||||
|
isPageSetupVertically = new UICheckBox(Inter.getLocText("FR-Designer_PageSetup-Vertically")); |
||||||
|
isStyleAlignmentWrapText = new UICheckBox(Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")); |
||||||
|
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
||||||
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
||||||
|
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),}; |
||||||
|
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
||||||
|
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); |
||||||
|
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Left") |
||||||
|
, Inter.getLocText("FR-Designer-StyleAlignment_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Right")}); |
||||||
|
frFontPane = new FRFontPane(); |
||||||
|
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}}; |
||||||
|
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font-Size")); |
||||||
|
fontLabel.setVerticalAlignment(SwingConstants.TOP); |
||||||
|
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")), hAlignmentPane}, |
||||||
|
new Component[]{fontLabel, frFontPane}, |
||||||
|
}; |
||||||
|
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) { |
||||||
|
formWidgetValuePane.populate(ob); |
||||||
|
isStyleAlignmentWrapText.setSelected(ob.isAutoLine()); |
||||||
|
isPageSetupVertically.setSelected(ob.isVerticalCenter()); |
||||||
|
hAlignmentPane.setSelectedIndex(ob.getTextalign()); |
||||||
|
frFontPane.populateBean(ob.getFont()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public Label updateBean() { |
||||||
|
Label layout = (Label) creator.toData(); |
||||||
|
formWidgetValuePane.update(layout); |
||||||
|
layout.setAutoLine(isStyleAlignmentWrapText.isSelected()); |
||||||
|
layout.setVerticalCenter(isPageSetupVertically.isSelected()); |
||||||
|
layout.setTextalign(hAlignmentPane.getSelectedIndex()); |
||||||
|
layout.setFont(frFontPane.update(layout.getFont())); |
||||||
|
return layout; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
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.ispinner.UISpinner; |
||||||
|
import com.fr.design.gui.itextfield.UINumberField; |
||||||
|
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 UISpinner 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 UISpinner(0, 20, 1, 0); |
||||||
|
|
||||||
|
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()); |
||||||
|
fontSizeField.setValue(e.getFontSize()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected MultiFileEditor updateSubFieldEditorBean() { |
||||||
|
MultiFileEditor ob = new MultiFileEditor(); |
||||||
|
ob.setAccept((String) acceptType.getSelectedItem()); |
||||||
|
ob.setSingleFile(singleFileCheckBox.isSelected()); |
||||||
|
ob.setMaxSize(fileSizeField.getValue()); |
||||||
|
ob.setFontSize((int)fontSizeField.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,312 @@ |
|||||||
|
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.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 FormWidgetValuePane formWidgetValuePane; |
||||||
|
/** |
||||||
|
* |
||||||
|
*/ |
||||||
|
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 = new FormWidgetValuePane(creator.toData(), false); |
||||||
|
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_WaterMark")), waterMarkDictPane}, |
||||||
|
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, 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())); |
||||||
|
} |
||||||
|
formWidgetValuePane.populate(e); |
||||||
|
// this.regErrorMsgTextField.setText(e.getRegErrorMessage());
|
||||||
|
this.waterMarkDictPane.populate(e); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected NumberEditor updateSubFieldEditorBean() { |
||||||
|
|
||||||
|
NumberEditor ob = new NumberEditor(); |
||||||
|
formWidgetValuePane.update(ob); |
||||||
|
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); |
||||||
|
|
||||||
|
|
||||||
|
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,122 @@ |
|||||||
|
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.general.Inter; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
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() { |
||||||
|
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(creator.toData(), false); |
||||||
|
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()); |
||||||
|
waterMarkDictPane.setText(e.getWaterMark()); |
||||||
|
formWidgetValuePane.populate(e); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected TextEditor updateSubFieldEditorBean() { |
||||||
|
TextEditor ob = newTextEditorInstance(); |
||||||
|
ob.setRegex(this.regPane.update()); |
||||||
|
ob.setWaterMark(waterMarkDictPane.getText()); |
||||||
|
formWidgetValuePane.update(ob); |
||||||
|
return ob; |
||||||
|
} |
||||||
|
|
||||||
|
protected TextEditor newTextEditorInstance() { |
||||||
|
return new TextEditor(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
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.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.form.ui.TreeEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class TreeComboBoxEditorDefinePane extends TreeEditorDefinePane { |
||||||
|
|
||||||
|
protected UITextField waterMarkDictPane; |
||||||
|
|
||||||
|
public TreeComboBoxEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
public Component[] createWaterMarkPane(){ |
||||||
|
waterMarkDictPane = new UITextField(); |
||||||
|
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return "treecombobox"; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubDictionaryEditorBean(TreeEditor ob){ |
||||||
|
super.populateSubDictionaryEditorBean(ob); |
||||||
|
formWidgetValuePane.populate(ob); |
||||||
|
waterMarkDictPane.setText(ob.getWaterMark()); |
||||||
|
} |
||||||
|
|
||||||
|
protected TreeEditor updateSubDictionaryEditorBean(){ |
||||||
|
TreeEditor editor = super.updateSubDictionaryEditorBean(); |
||||||
|
formWidgetValuePane.update(editor); |
||||||
|
editor.setWaterMark(waterMarkDictPane.getText()); |
||||||
|
return editor; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
|
return treeSettingPane; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,87 @@ |
|||||||
|
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.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
|
||||||
|
import com.fr.form.ui.TreeEditor; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
|
||||||
|
/* |
||||||
|
* richer:tree editor |
||||||
|
*/ |
||||||
|
public class TreeEditorDefinePane extends DictEditorDefinePane<TreeEditor> { |
||||||
|
protected TreeSettingPane treeSettingPane; |
||||||
|
protected TreeRootPane treeRootPane; |
||||||
|
private UICheckBox mutiSelect; |
||||||
|
private UICheckBox loadAsync; |
||||||
|
private UICheckBox returnLeaf; |
||||||
|
private UICheckBox returnPath; |
||||||
|
|
||||||
|
public TreeEditorDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
treeRootPane = new TreeRootPane(); |
||||||
|
treeSettingPane = new TreeSettingPane(true); |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel createOtherPane() { |
||||||
|
mutiSelect = new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not")); |
||||||
|
loadAsync = new UICheckBox(Inter.getLocText("Widget-Load_By_Async")); |
||||||
|
returnLeaf = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Leaf")); |
||||||
|
returnPath = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Path")); |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{mutiSelect}, |
||||||
|
new Component[]{loadAsync}, |
||||||
|
new Component[]{returnLeaf}, |
||||||
|
new Component[]{returnPath} |
||||||
|
}; |
||||||
|
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"; |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateSubDictionaryEditorBean(TreeEditor e){ |
||||||
|
formWidgetValuePane.populate(e); |
||||||
|
treeSettingPane.populate(e); |
||||||
|
treeRootPane.populate(e.getTreeAttr()); |
||||||
|
mutiSelect.setSelected(e.isMultipleSelection()); |
||||||
|
loadAsync.setSelected(e.isAjax()); |
||||||
|
returnLeaf.setSelected(e.isSelectLeafOnly()); |
||||||
|
returnPath.setSelected(e.isReturnFullPath()); |
||||||
|
} |
||||||
|
|
||||||
|
protected TreeEditor updateSubDictionaryEditorBean(){ |
||||||
|
TreeEditor editor = (TreeEditor)creator.toData(); |
||||||
|
formWidgetValuePane.update(editor); |
||||||
|
editor.setTreeAttr(treeRootPane.update()); |
||||||
|
editor.setMultipleSelection(mutiSelect.isSelected()); |
||||||
|
editor.setAjax(loadAsync.isSelected()); |
||||||
|
editor.setSelectLeafOnly(returnLeaf.isSelected()); |
||||||
|
editor.setReturnFullPath(returnPath.isSelected()); |
||||||
|
return editor; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@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(); |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue