- 浏览: 1027908 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (538)
- 奇文共赏 (36)
- spring (13)
- hibernate (10)
- AOP/Aspectj (9)
- spring security (7)
- lucence (5)
- compass (3)
- jbmp (2)
- jboss rule(drools) (0)
- birt (1)
- jasper (1)
- cxf (3)
- flex (98)
- webgis (6)
- 设计模式 (1)
- 代码重构 (2)
- log4j (1)
- tomcat (9)
- 神品音乐 (1)
- 工作计划 (2)
- appfuse (1)
- svn (4)
- 寻章摘句 (3)
- eclipse (10)
- arcgis api for flex (1)
- 算法 (5)
- opengis-cs (1)
- bug心得 (13)
- 图标 (1)
- software&key (14)
- java (17)
- 搞笑视频 (13)
- sqlserver (9)
- postgresql (1)
- postgis (0)
- geoserver (5)
- 日子 (50)
- 水晶报表 (1)
- 绝对电影 (3)
- Alternativa3D (1)
- 酷站大全 (10)
- c++ (5)
- oracle (17)
- oracle spatial (25)
- flashbuilder4 (3)
- TweenLite (1)
- DailyBuild (6)
- 华山论贱 (5)
- 系统性能 (5)
- 经典古文 (6)
- SOA/SCA/OSGI (6)
- jira (2)
- Hadoop生态圈(hadoop/hbase/pig/hive/zookeeper) (37)
- 风水 (1)
- linux操作基础 (17)
- 经济 (4)
- 茶 (3)
- JUnit (1)
- C# dotNet (1)
- netbeans (1)
- Java2D (1)
- QT4 (1)
- google Test/Mock/AutoTest (3)
- maven (1)
- 3d/OSG (1)
- Eclipse RCP (3)
- CUDA (1)
- Access control (0)
- http://linux.chinaunix.net/techdoc/beginner/2008/01/29/977725.shtml (1)
- redis (1)
最新评论
-
dove19900520:
朋友,你确定你的标题跟文章内容对应???
tomcat控制浏览器不缓存 -
wussrc:
我只想说牛逼,就我接触过的那点云计算的东西,仔细想想还真是这么 ...
别样解释云计算,太TM天才跨界了 -
hw_imxy:
endpoint="/Hello/messagebr ...
flex+java代码分两个工程 -
gaohejie:
rsrsdgrfdh坎坎坷坷
Flex 与 Spring 集成 -
李涤尘:
谢谢。不过说得有点太罗嗦了。
Oracle数据库数据的导入及导出(转)
PropertyEditor
- 博客分类:
- java
package propertyproj; import javax.swing.*; import javax.swing.table.*; import java.util.Hashtable; import java.awt.Component; import java.awt.*; import javax.swing.event.*; import java.awt.event.*; import java.util.*; import java.beans.*; public class PropertyEditor extends JTable { protected DefaultCellEditor dlgCellEditor; protected DefaultCellEditor booleanCellEditor; protected TableCellRenderer booleanRender; protected DefaultCellEditor longEditor; protected DefaultTableCellRenderer longRender; protected Hashtable propertyEditors = new Hashtable(10); protected Hashtable propertyRender = new Hashtable(10); protected Hashtable propertyEditable = new Hashtable(10); public PropertyEditorModel ptm = new PropertyEditorModel(); public PropertyEditor(PropertyEditorModel ptm) { super(ptm); this.ptm = ptm; } public PropertyEditor() { } public class PropertyEditorModel extends DefaultTableModel { PropertyEditorModel() { super(0, 2); } /** * Returns the name of the column at <code>columnIndex</code>. * * @param columnIndex the index of the column * @return the name of the column * @todo Implement this javax.swing.table.TableModel method */ public String getColumnName(int columnIndex) { if (columnIndex == 0) { return "属性"; } else { return "值"; } } /** * Returns true if the cell at <code>rowIndex</code> and * <code>columnIndex</code> is editable. * * @param rowIndex the row whose value to be queried * @param columnIndex the column whose value to be queried * @return true if the cell is editable * @todo Implement this javax.swing.table.TableModel method */ public boolean isCellEditable(int rowIndex, int columnIndex) { if (columnIndex == 0) { return false; } else { return true; } } } /** * Returns an appropriate editor for the cell specified by <code>row</code> and * <code>column</code>. * * @param row the row of the cell to edit, where 0 is the first row * @param column the column of the cell to edit, where 0 is the first column * @return the editor for this cell; if <code>null</code> return the default * editor for this type of cell * @todo Implement this javax.swing.JTable method */ public TableCellEditor getCellEditor(int row, int column) { TableCellEditor editor = null; if (column == 1) { editor = (TableCellEditor) propertyEditors.get(this.getValueAt(row, 0)); } if (editor == null) { editor = super.getCellEditor(row, column); } return editor; } /** * Returns an appropriate renderer for the cell specified by this row and * column. * * @param row the row of the cell to render, where 0 is the first row * @param column the column of the cell to render, where 0 is the first column * @return the assigned renderer; if <code>null</code> returns the default * renderer for this type of object * @todo Implement this javax.swing.JTable method */ public TableCellRenderer getCellRenderer(int row, int column) { TableCellRenderer render = null; if (column == 1) { render = (TableCellRenderer) propertyRender.get(this.getValueAt(row, 0)); } if (render == null) { render = super.getCellRenderer(row, column); } return render; } public void addProperty(String propertyName, Long longNumObj) { if (propertyName == null) { throw new RuntimeException("属性名称不能为空"); } Object[] row = new Object[2]; row[0] = propertyName; row[1] = longNumObj; this.appenRow(row); propertyEditors.put(propertyName, longEditor); this.propertyRender.put(propertyName, longRender); this.propertyEditable.put(propertyName, new Boolean(true)); } public void addProperty(String propertyName, Boolean booleanObj) { if (propertyName == null) { throw new RuntimeException("属性名称不能为空"); } Object[] row = new Object[2]; row[0] = propertyName; row[1] = booleanObj; this.appenRow(row); propertyEditors.put(propertyName, this.booleanCellEditor); this.propertyRender.put(propertyName, this.booleanRender); this.propertyEditable.put(propertyName, new Boolean(true)); } public Object getPropertyValue(String propertyName) { Object retValue = null; for (int i = 0; i ptm.getRowCount(); i++) { if (ptm.getValueAt(i, 0).equals(propertyName)) { retValue = ptm.getValueAt(i, 1); break; } } return retValue; } public void setPropertyValue(String propertyName, Object newValue) { for (int i = 0; i ptm.getRowCount(); i++) { if (ptm.getValueAt(i, 0).equals(propertyName)) { ptm.setValueAt(newValue, i, 1); break; } } } public void appenRow(Object[] row) { ptm.addRow(row); } public void createLongEditorRenderer() { final PanelInputText longTextField = new PanelInputText(); longEditor = new DefaultCellEditor(new JTextField()) { Component editor; private Object previsousValue = null; public Object getCellEditorValue() { if (editor instanceof PanelInputText) { if ( ( (PanelInputText) editor).getText().equals("")) { return (Long)null; } else { System.out.println("getCellEditorValue " + ( (PanelInputText) editor).getText()); return new Long( ( (PanelInputText) editor).getText()); } } else { return (Long)null; } } public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { editor = null; if (value != null) { longTextField.setText(value.toString()); } else { longTextField.setText(""); } previsousValue = value; System.out.println("getTableCellEditorCompontOldValue: " + value); editor = longTextField; System.out.println("getTableCellEditorCompont"); return editor; } public boolean stopCellEditing() { Long lv = null; if (! ( (PanelInputText) editor).getText().equals("")) { try { System.out.println("stopCellEditing"); lv = new Long( ( (PanelInputText) editor).getText()); } catch (Exception e) { this.cancelCellEditing(); return true; } } if ( (previsousValue == null) ? (previsousValue == lv) : this.previsousValue.equals(lv)) { System.out.println("stopCellEditing"); this.cancelCellEditing(); return true; } System.out.println("DefaultstopEditing"); return super.stopCellEditing(); } }; longTextField.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { System.out.println("FocusLost"); longEditor.stopCellEditing(); } } ); longEditor.setClickCountToStart(2); this.longRender = new DefaultTableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel jLabel; jLabel = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (value == null) { jLabel.setText(""); } else if ( ( (Long) value).toString().equals("11")) { jLabel.setText("测试代码名称转换"); } else { jLabel.setText( ( (Long) value).toString()); } if (! (value == null)) { System.out.println("getRender" + value.getClass().getName()); } return jLabel; } } ; longRender.setHorizontalAlignment(JLabel.LEFT); longRender.setBackground(Color.pink); } public void createBooleanEditorRender() { JCheckBox jcb = new JCheckBox(""); this.booleanCellEditor = new DefaultCellEditor(jcb); booleanCellEditor.setClickCountToStart(1); this.booleanRender = new TableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { BooleanRender booleanRender = new BooleanRender(); if (value != null) { if ( ( (Boolean) value).booleanValue()) { booleanRender.selJCheckBox(new Boolean(true)); } else { booleanRender.selJCheckBox(new Boolean(false)); } } else { booleanRender.selJCheckBox(new Boolean(false)); } return booleanRender; } }; } }
发表评论
-
Java中Object类的wait()和notify()方法怎么使用
2013-02-12 18:28 1600http://wenwen.soso.com/z/q1292 ... -
一个完整的TableViewer实例
2011-09-23 15:04 2168http://tieba.baidu.com/f?kz=168 ... -
JSON与JAVA的数据转换
2011-09-19 17:27 1041http://developer.51cto.com/art/ ... -
String,StringBuffer与StringBuilder的区别??
2010-07-13 09:51 1026http://blog.csdn.net/rmn190/a ... -
获取java线程中信息的两种方法
2010-06-13 11:08 1182http://www.cn-java.com/www1/?ac ... -
Java:模拟Eclipes的控制台
2010-06-09 10:17 1230http://www.cppblog.com/biao/arc ... -
The Final Performance Testing Example
2009-11-05 10:47 873http://www.artima.com/weblogs/v ... -
看JTS源码,感受Java优化编程
2009-09-21 14:30 2500看JTS源码,感受Java优化编程 http://www.bl ... -
发布FetionAPI 中国移动飞信免费发短信API接口
2009-04-19 10:30 2038http://www.cnbeta.com/articles/ ... -
jolt书籍下载大全
2009-03-09 14:43 1443第19届(2009)Annual Jolt Product E ... -
JDBC性能优化
2009-02-05 15:06 1163jdbc程序的性能主要由两个因素决定,一是数据库本身的性质,另 ... -
Java代码优化,策略与方法
2009-02-05 15:05 1224http://looxiaohu.iteye.com/blog ... -
『Java代码优化』 尽可能地使用stack(栈)变量(方法内部的局部变量)
2009-02-05 15:04 1057http://looxiaohu.iteye.com/blog ... -
各种数据库的JDBC驱动下载及连接字符串URL写法
2009-01-07 16:19 3973各种数据库的JDBC驱动下载及连接字符串URL写法 sun官 ... -
dos下各种常见命令索引
2008-11-19 17:19 1034http://www.huo119.com/study/dos ... -
java保留小数
2008-08-28 17:21 1587http://www.bincn.com/index.php? ...
相关推荐
NULL 博文链接:https://bijian1013.iteye.com/blog/2164121
NULL 博文链接:https://b-l-east.iteye.com/blog/1705872
properties Editor for eclipse,解压后丢到eclipse安装目录的drops下重启eclipse即可,亲测有效。
Delphi7~Delphi2010 JSON 读写组件(源码)
DELPHI JSON 解析字符串,封装
(3)对象属性编辑器(PropertyEditor):可查看每个对象的属性 值,也可修改、设置对象的属性值;(4)位置调整工具(Alignment Too1):用来调整图形窗1:1中各个图形对象的位置的工具. (5)对象浏览编辑器(Object Browser...
figurepalette pan plotbrowser plotedit plottools propertyeditor rotate3d showplottool zoom 显示或隐藏图形窗口的调色板 交互式移动图像以多方向浏览 显示或隐藏窗口的图形浏览器 交互式编辑和标注图形 显示或...
PropertyEditor依然有效 强大的ConversionService,让很多梦想成真 基于ConversionService体系,定义自定义的类型转换器 格式化:带格式字符串内部对象 相互转换 使用支持格式化的转换器 数据校验框架 JSR 303 ...
LambdaProbe 1.7b 发布了,原作者网站不... 如果没有合适的工具, 推荐下载本站开发的 Java 属性文件编辑器: PropertyEditor.jar 47KB PropertyEditor_src.zip 36KB 截屏: PropertyEditor_screenshotV2-1_1.png (位于...
PropertyEditor依然有效 强大的ConversionService,让很多梦想成真 基于ConversionService体系,定义自定义的类型转换器 格式化:带格式字符串内部对象 相互转换 使用支持格式化的转换器 数据校验框架 JSR...
Spring.NET是一个应用程序框架,其目的是协助开发人员创建企业级的.NET应用程序。...32.3.PropertyEditor和TypeConverter 32.4.ResourceBundle和ResourceManager 32.5.异常 32.6.应用程序配置 32.7.AOP框架
5.4.2. 内建的PropertyEditor实现 5.4.2.1. 注册用户自定义的PropertyEditor 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. Spring的AOP代理 6.2. @AspectJ...
实作 Validator 使用 PropertyEditor 档案上传 <br> <br>View层方案、Web框架整合 当使用JSP作为View层技术时,您可以结合JSTL以及Spring提供的标签,而除了JSP技术作为View层之外,Spring还...
Not Using Commons Logging ................................................................... 12 Using SLF4J ..............................................................................................
3.5.1 Naming of property and PropertyEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.5.2 src/App/PropertyStandard.h . . . . . . . . . . . . . . . . . . . . . ....
5.4.2. 内建的PropertyEditor实现 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. Spring的AOP代理 6.2. @AspectJ支持 6.2.1. 启用@AspectJ支持 ...
5.4.2. 内建的PropertyEditor实现 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. AOP代理 6.2. @AspectJ支持 6.2.1. 启用@AspectJ支持 6.2.2. 声明...
5.4.2. 内建的PropertyEditor实现 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. Spring的AOP代理 6.2. @AspectJ支持 6.2.1. 启用@AspectJ支持 ...
5.4.2. 内建的PropertyEditor实现 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. AOP代理 6.2. @AspectJ支持 6.2.1. 启用@AspectJ支持 6.2.2. 声明...