yaoh.wu
8 years ago
2 changed files with 86 additions and 55 deletions
@ -1,61 +1,61 @@ |
|||||||
package com.fr.design.selection; |
package com.fr.design.selection; |
||||||
|
|
||||||
import javax.swing.JComponent; |
|
||||||
|
|
||||||
import com.fr.design.designer.TargetComponent; |
import com.fr.design.designer.TargetComponent; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* 快速编辑区域 |
* 快速编辑区域 |
||||||
* |
* |
||||||
* @author zhou |
* @author zhou |
||||||
* @since 2012-7-12下午2:48:20 |
* @since 2012-7-12下午2:48:20 |
||||||
*/ |
*/ |
||||||
@SuppressWarnings("rawtypes") |
@SuppressWarnings("rawtypes") |
||||||
public abstract class QuickEditor<T extends TargetComponent> extends JComponent { |
public abstract class QuickEditor<T extends TargetComponent> extends JComponent { |
||||||
private static final long serialVersionUID = 5434472104640676832L; |
private static final long serialVersionUID = 5434472104640676832L; |
||||||
|
|
||||||
protected T tc; |
protected T tc; |
||||||
|
|
||||||
protected boolean isEditing = false; |
protected boolean isEditing = false; |
||||||
|
|
||||||
public QuickEditor() { |
public QuickEditor() { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
public void populate(T tc) { |
public void populate(T tc) { |
||||||
isEditing = false; |
isEditing = false; |
||||||
this.tc = tc; |
this.tc = tc; |
||||||
refresh(); |
refresh(); |
||||||
isEditing = true; |
isEditing = true; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 触发保存一定要用这个 |
* 触发保存一定要用这个 |
||||||
*/ |
*/ |
||||||
protected void fireTargetModified() { |
protected void fireTargetModified() { |
||||||
if(!isEditing) { |
if (!isEditing) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
tc.fireTargetModified(); |
tc.fireTargetModified(); |
||||||
} |
} |
||||||
|
|
||||||
protected abstract void refresh(); |
protected abstract void refresh(); |
||||||
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* for 关闭时候释放 |
* for 关闭时候释放 |
||||||
*/ |
*/ |
||||||
public void release () { |
public void release() { |
||||||
tc = null; |
tc = null; |
||||||
} |
} |
||||||
|
|
||||||
public static QuickEditor DEFAULT_EDITOR = new QuickEditor() { |
public static QuickEditor DEFAULT_EDITOR = new QuickEditor() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void refresh() { |
protected void refresh() { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
}; |
}; |
||||||
|
|
||||||
} |
} |
Loading…
Reference in new issue