01: package org.columba.mail.gui.composer.html.action;
02:
03: import java.awt.event.ActionEvent;
04:
05: import org.columba.api.gui.frame.IFrameMediator;
06: import org.columba.core.gui.action.AbstractSelectableAction;
07: import org.columba.mail.gui.composer.ComposerController;
08: import org.columba.mail.gui.composer.ComposerModelChangedEvent;
09: import org.columba.mail.gui.composer.IComposerModelChangedListener;
10: import org.columba.mail.gui.composer.html.HtmlEditorController2;
11: import org.frapuccino.htmleditor.api.IFormatChangedListener;
12: import org.frapuccino.htmleditor.event.FormatChangedEvent;
13:
14: public abstract class AbstractComposerAction extends
15: AbstractSelectableAction implements IFormatChangedListener,
16: IComposerModelChangedListener {
17:
18: public AbstractComposerAction(IFrameMediator frameMediator,
19: String name) {
20: super (frameMediator, name);
21:
22: ComposerController ctrl = (ComposerController) getFrameMediator();
23:
24: // register for text cursor/caret and formatting changes
25: // to select/deselect action
26: HtmlEditorController2 c = (HtmlEditorController2) ctrl
27: .getHtmlEditorController();
28: c.addFormatChangedListener(this );
29:
30: // register for model changes to enable/disable when
31: // user switches between html or text plain mode
32: ctrl.getModel().addModelChangedListener(this );
33:
34: }
35:
36: public void modelChanged(ComposerModelChangedEvent event) {
37: }
38:
39: public void htmlModeChanged(ComposerModelChangedEvent event) {
40: setEnabled(event.isHtmlEnabled());
41: }
42:
43: public abstract void formatChanged(FormatChangedEvent event);
44:
45: public abstract void actionPerformed(ActionEvent e);
46: }
|