You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
package com.fr.design.actions; |
|
|
|
|
|
import com.fr.design.designer.TargetComponent; |
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
public abstract class TemplateComponentAction<T extends TargetComponent> extends UndoableAction implements TemplateComponentActionInterface<T> { |
|
private T t; |
|
|
|
protected TemplateComponentAction() { |
|
} |
|
|
|
protected TemplateComponentAction(T t) { |
|
this.t = t; |
|
} |
|
|
|
protected void setEditingComponent(T t) { |
|
this.t = t; |
|
} |
|
|
|
@Override |
|
public T getEditingComponent() { |
|
return t; |
|
} |
|
|
|
@Override |
|
public void prepare4Undo() { |
|
DesignerContext.enableRefreshOnTargetModified(); |
|
this.getEditingComponent().fireTargetModified(); |
|
T component = getEditingComponent(); |
|
if (component == null) { |
|
return; |
|
} |
|
|
|
component.requestFocus(); |
|
} |
|
|
|
/** |
|
* update enable |
|
* TODO ALEX_SEP 这个方法的名字只是简单的叫update,太不明了了 |
|
*/ |
|
@Override |
|
public void update() { |
|
this.setEnabled(this.getEditingComponent() != null); |
|
} |
|
} |