Browse Source

文档和注释

master
richie 5 years ago
parent
commit
438457acdf
  1. 34
      src/main/java/com/fanruan/api/design/work/form/basic/AccessiblePropertyEditor.java
  2. 7
      src/main/java/com/fanruan/api/design/work/form/basic/EncoderCellRenderer.java

34
src/main/java/com/fanruan/api/design/work/form/basic/AccessiblePropertyEditor.java

@ -1,15 +1,47 @@
package com.fanruan.api.design.work.form.basic; package com.fanruan.api.design.work.form.basic;
import com.fr.design.Exception.ValidationException;
import com.fr.design.mainframe.widget.accessibles.AccessibleEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleEditor;
/** /**
* @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 AccessiblePropertyEditor extends com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor { public class AccessiblePropertyEditor extends com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor {
public AccessiblePropertyEditor(AccessibleEditor editor) { public AccessiblePropertyEditor(AccessibleEditor editor) {
super(editor); super(editor);
} }
/**
* 给编辑器设置值
*
* @param o 待设置的值
*/
@Override
public void setValue(Object o) {
super.setValue(o);
}
/**
* 获取编辑器的值
*
* @return 编辑器的值
*/
@Override
public Object getValue() {
return super.getValue();
}
/**
* 检验编辑器输入的值是否合法
*
* @throws ValidationException 值不合法则抛出此异常
*/
@Override
public void validateValue() throws ValidationException {
super.validateValue();
}
} }

7
src/main/java/com/fanruan/api/design/work/form/basic/EncoderCellRenderer.java

@ -9,11 +9,11 @@ import java.awt.*;
* @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 EncoderCellRenderer extends GenericCellRenderer { public class EncoderCellRenderer extends GenericCellRenderer {
private static int LEFT = 1; private static final int LEFT = 1;
protected Encoder encoder; protected Encoder encoder;
protected Object value; protected Object value;
@ -28,14 +28,13 @@ public class EncoderCellRenderer extends GenericCellRenderer {
g.setColor(getBackground()); g.setColor(getBackground());
g.fillRect(0, 0, width, height); g.fillRect(0, 0, width, height);
int x = LEFT;
g.setColor(getForeground()); g.setColor(getForeground());
FontMetrics fm = g.getFontMetrics(); FontMetrics fm = g.getFontMetrics();
int y = ((height - fm.getHeight()) / 2) + fm.getAscent(); int y = ((height - fm.getHeight()) / 2) + fm.getAscent();
String txt = getValueText(); String txt = getValueText();
if (txt != null) { if (txt != null) {
g.drawString(txt, x, y); g.drawString(txt, LEFT, y);
} }
if (getBorder() != null) { if (getBorder() != null) {
getBorder().paintBorder(this, g, 0, 0, width, height); getBorder().paintBorder(this, g, 0, 0, width, height);

Loading…
Cancel
Save