forked from fanruan/finekit
richie
5 years ago
15 changed files with 166 additions and 36 deletions
@ -0,0 +1,87 @@ |
|||||||
|
package com.fanruan.api.design.ui.component.present; |
||||||
|
|
||||||
|
|
||||||
|
import com.fanruan.api.design.DesignKit; |
||||||
|
import com.fr.data.Dictionary; |
||||||
|
import com.fr.data.impl.DynamicSQLDict; |
||||||
|
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.gui.frpane.UIComboBoxPane; |
||||||
|
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.CustomDictPane; |
||||||
|
import com.fr.design.present.dict.DatabaseDictPane; |
||||||
|
import com.fr.design.present.dict.FormulaDictPane; |
||||||
|
import com.fr.design.present.dict.TableDataDictPane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Kalven |
||||||
|
* @version 10.0 |
||||||
|
* Created by Kalven on 2019/9/4 |
||||||
|
* 数据字典容器,获取数据字典 |
||||||
|
*/ |
||||||
|
public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCreatorUI { |
||||||
|
private TableDataDictPane tableDataDictPane; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initLayout() { |
||||||
|
this.setLayout(new BorderLayout(0, 4)); |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double[] columnSize = {p, f}; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
int[][] rowCount = {{1, 1}, {1, 1}}; |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(DesignKit.i18nText("Fine-Design_Basic_Type_Set"), UILabel.LEFT), jcb}, |
||||||
|
new Component[]{null, null} |
||||||
|
}; |
||||||
|
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_MEDIUM); |
||||||
|
this.add(northPane, BorderLayout.NORTH); |
||||||
|
this.add(cardPane, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return DesignKit.i18nText("Fine-Design_Form_DS_Dictionary"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public JComponent toSwingComponent() { |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(Dictionary ob) { |
||||||
|
for (int i = 0; i < this.cards.size(); i++) { |
||||||
|
FurtherBasicBeanPane pane = cards.get(i); |
||||||
|
if (pane.accept(ob)) { |
||||||
|
pane.populateBean(ob); |
||||||
|
jcb.setSelectedIndex(i); |
||||||
|
} else { |
||||||
|
pane.reset(); |
||||||
|
} |
||||||
|
} |
||||||
|
if (ob instanceof DynamicSQLDict) { |
||||||
|
jcb.setSelectedIndex(1); |
||||||
|
tableDataDictPane.populateBean((DynamicSQLDict) ob); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected List<FurtherBasicBeanPane<? extends Dictionary>> initPaneList() { |
||||||
|
List<FurtherBasicBeanPane<? extends Dictionary>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Dictionary>>(); |
||||||
|
paneList.add(new DatabaseDictPane()); |
||||||
|
paneList.add(tableDataDictPane = new TableDataDictPane()); |
||||||
|
paneList.add(new CustomDictPane()); |
||||||
|
paneList.add(new FormulaDictPane()); |
||||||
|
return paneList; |
||||||
|
} |
||||||
|
} |
@ -1,10 +0,0 @@ |
|||||||
package com.fanruan.api.design.ui.container; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Kalven |
|
||||||
* @version 10.0 |
|
||||||
* Created by Kalven on 2019/9/4 |
|
||||||
* 数据字典容器,获取数据字典 |
|
||||||
*/ |
|
||||||
public class DictionaryPane extends com.fr.design.present.dict.DictionaryPane { |
|
||||||
} |
|
@ -1,15 +0,0 @@ |
|||||||
package com.fanruan.api.design.work; |
|
||||||
|
|
||||||
import com.fr.design.designer.properties.Encoder; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Kalven |
|
||||||
* @version 10.0 |
|
||||||
* Created by Kalven on 2019/9/4 |
|
||||||
* 根据控件属性渲染单元格 |
|
||||||
*/ |
|
||||||
public class EncoderCellRenderer extends com.fr.design.mainframe.widget.renderer.EncoderCellRenderer { |
|
||||||
public EncoderCellRenderer(Encoder encoder) { |
|
||||||
super(encoder); |
|
||||||
} |
|
||||||
} |
|
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.design.work; |
package com.fanruan.api.design.work.form; |
||||||
|
|
||||||
/** |
/** |
||||||
* @author Kalven |
* @author Kalven |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.design.ui.editor; |
package com.fanruan.api.design.work.form.basic; |
||||||
|
|
||||||
import com.fr.design.mainframe.widget.accessibles.AccessibleEditor; |
import com.fr.design.mainframe.widget.accessibles.AccessibleEditor; |
||||||
|
|
@ -0,0 +1,53 @@ |
|||||||
|
package com.fanruan.api.design.work.form.basic; |
||||||
|
|
||||||
|
import com.fr.design.designer.properties.Encoder; |
||||||
|
import com.fr.design.mainframe.widget.renderer.GenericCellRenderer; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Kalven |
||||||
|
* @version 10.0 |
||||||
|
* Created by Kalven on 2019/9/4 |
||||||
|
* 根据控件属性渲染单元格 |
||||||
|
*/ |
||||||
|
public class EncoderCellRenderer extends GenericCellRenderer { |
||||||
|
|
||||||
|
private static int LEFT = 1; |
||||||
|
protected Encoder encoder; |
||||||
|
protected Object value; |
||||||
|
|
||||||
|
public EncoderCellRenderer(Encoder encoder) { |
||||||
|
this.encoder = encoder; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void paint(Graphics g) { |
||||||
|
int width = getWidth(); |
||||||
|
int height = getHeight(); |
||||||
|
g.setColor(getBackground()); |
||||||
|
g.fillRect(0, 0, width, height); |
||||||
|
|
||||||
|
int x = LEFT; |
||||||
|
g.setColor(getForeground()); |
||||||
|
|
||||||
|
FontMetrics fm = g.getFontMetrics(); |
||||||
|
int y = ((height - fm.getHeight()) / 2) + fm.getAscent(); |
||||||
|
String txt = getValueText(); |
||||||
|
if (txt != null) { |
||||||
|
g.drawString(txt, x, y); |
||||||
|
} |
||||||
|
if (getBorder() != null) { |
||||||
|
getBorder().paintBorder(this, g, 0, 0, width, height); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void setValue(Object value) { |
||||||
|
this.value = value; |
||||||
|
} |
||||||
|
|
||||||
|
private String getValueText() { |
||||||
|
return encoder.encode(value); |
||||||
|
} |
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.design.ui.editor; |
package com.fanruan.api.design.work.form.basic; |
||||||
|
|
||||||
import com.fr.design.designer.properties.items.Item; |
import com.fr.design.designer.properties.items.Item; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.design.ui.editor; |
package com.fanruan.api.design.work.form.basic; |
||||||
|
|
||||||
import com.fr.design.designer.properties.Encoder; |
import com.fr.design.designer.properties.Encoder; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.design.ui.container; |
package com.fanruan.api.design.work.form.container; |
||||||
|
|
||||||
/** |
/** |
||||||
* 抽象数据定义,实现数据可序列化 |
* 抽象数据定义,实现数据可序列化 |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.design.ui.container; |
package com.fanruan.api.design.work.form.container; |
||||||
|
|
||||||
import com.fr.form.ui.container.WLayout; |
import com.fr.form.ui.container.WLayout; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.design.ui.editor; |
package com.fanruan.api.design.work.form.creator; |
||||||
|
|
||||||
/** |
/** |
||||||
* 允许自定义值的、允许直接编辑的、带重复的 --- 下拉框 下拉复选框 下拉树 |
* 允许自定义值的、允许直接编辑的、带重复的 --- 下拉框 下拉复选框 下拉树 |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.api.design.ui.editor; |
package com.fanruan.api.design.work.form.creator; |
||||||
|
|
||||||
import com.fr.form.ui.FieldEditor; |
import com.fr.form.ui.FieldEditor; |
||||||
|
|
@ -0,0 +1,14 @@ |
|||||||
|
package com.fanruan.api.design.work.form.editors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author richie |
||||||
|
* @version 10.0 |
||||||
|
* Created by richie on 2019-09-05 |
||||||
|
* 字符串编辑器 |
||||||
|
*/ |
||||||
|
public class StringEditor extends com.fr.design.mainframe.widget.editors.StringEditor { |
||||||
|
|
||||||
|
public StringEditor() { |
||||||
|
super(); |
||||||
|
} |
||||||
|
} |
@ -1,10 +1,10 @@ |
|||||||
package com.fanruan.api.design.ui.editor; |
package com.fanruan.api.design.work.form.editors; |
||||||
|
|
||||||
/** |
/** |
||||||
* @author Kalven |
* @author Kalven |
||||||
* @version 10.0 |
* @version 10.0 |
||||||
* Created by Kalven on 2019/9/4 |
* Created by Kalven on 2019/9/4 |
||||||
* 控件值的编辑器 |
* 控件值编辑器 |
||||||
*/ |
*/ |
||||||
public class WidgetValueEditor extends com.fr.design.mainframe.widget.editors.WidgetValueEditor { |
public class WidgetValueEditor extends com.fr.design.mainframe.widget.editors.WidgetValueEditor { |
||||||
|
|
Loading…
Reference in new issue