|
|
|
@ -6,6 +6,7 @@ import com.fr.design.event.UIObserverListener;
|
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JComponent; |
|
|
|
@ -91,7 +92,6 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private AWTEventListener awt = new AWTEventListener() { |
|
|
|
|
public void eventDispatched(AWTEvent event) { |
|
|
|
|
if (!UITable.this.isShowing()) { |
|
|
|
@ -131,6 +131,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 在table底部增加一行内容 |
|
|
|
|
* |
|
|
|
|
* @param line 该行的内容 |
|
|
|
|
*/ |
|
|
|
|
public void addLine(Object[] line) { |
|
|
|
@ -167,6 +168,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 格子是否可编辑,可置顶某一列column不可编辑 |
|
|
|
|
* |
|
|
|
|
* @param row 行号 |
|
|
|
|
* @param column 列号 |
|
|
|
|
* @return 是否可编辑 |
|
|
|
@ -232,6 +234,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 鼠标悬浮再某一行时触发的事件 |
|
|
|
|
* |
|
|
|
|
* @param index 行号 |
|
|
|
|
*/ |
|
|
|
|
public void dealWithRollOver(int index) { |
|
|
|
@ -259,6 +262,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 停止编辑事件 |
|
|
|
|
* |
|
|
|
|
* @param e 事件 |
|
|
|
|
*/ |
|
|
|
|
public void tableCellEditingStopped(ChangeEvent e) { |
|
|
|
@ -267,6 +271,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 取消编辑事件 |
|
|
|
|
* |
|
|
|
|
* @param e 事件 |
|
|
|
|
*/ |
|
|
|
|
public void tableCellEditingCanceled(ChangeEvent e) { |
|
|
|
@ -275,6 +280,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 编辑器 |
|
|
|
|
* |
|
|
|
|
* @return 编辑器 |
|
|
|
|
*/ |
|
|
|
|
public UITableEditor createTableEditor() { |
|
|
|
@ -289,21 +295,19 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
return new UITableUI(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
// public TableCellEditor getDefaultEditor(Class<?> columnClass) {
|
|
|
|
|
// return super.getDefaultEditor(UITable.class);
|
|
|
|
|
// }
|
|
|
|
|
@Override |
|
|
|
|
public TableCellRenderer getDefaultRenderer(Class<?> columnClass) { |
|
|
|
|
// 处理null的情况用于创建时未指定数据结构的情况
|
|
|
|
|
if (columnClass == null) { |
|
|
|
|
return createDefaultRenderer(); |
|
|
|
|
} |
|
|
|
|
return super.getDefaultRenderer(columnClass); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
// public TableCellRenderer getDefaultRenderer(Class<?> columnClass) {
|
|
|
|
|
// return super.getDefaultRenderer(UITable.class);
|
|
|
|
|
// }
|
|
|
|
|
private @NotNull TableCellRenderer createDefaultRenderer() { |
|
|
|
|
Object renderer = defaultRenderersByColumnClass.get(UITable.class); |
|
|
|
|
return renderer != null ? (TableCellRenderer) renderer : new UITableRender(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 给组件登记一个观察者监听事件 |
|
|
|
@ -347,6 +351,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 增加监听 |
|
|
|
|
* |
|
|
|
|
* @param l 监听 |
|
|
|
|
*/ |
|
|
|
|
public void addChangeListener(ChangeListener l) { |
|
|
|
@ -355,6 +360,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 移除监听 |
|
|
|
|
* |
|
|
|
|
* @param l 监听 |
|
|
|
|
*/ |
|
|
|
|
public void removeChangeListener(ChangeListener l) { |
|
|
|
@ -363,6 +369,7 @@ public class UITable extends JTable implements UIObserver {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 测试主函数 |
|
|
|
|
* |
|
|
|
|
* @param args 参数 |
|
|
|
|
*/ |
|
|
|
|
public static void main(String... args) { |
|
|
|
|