~ubuntu-branches/ubuntu/utopic/freemind/utopic

« back to all changes in this revision

Viewing changes to freemind/freemind/modes/mindmapmode/attributeactors/UnregistryAttributeValueActor.java

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-01-03 14:19:19 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100103141919-m5az7dkicy21hqop
Tags: 0.9.0~rc6+dfsg-1ubuntu1
* Merge from Debian unstable (LP: #182927), remaining changes:
  - debian/copyright: add license/copyright for
    freemind/freemind/main/ExampleFileFilter.java

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*FreeMind - A Program for creating and viewing Mindmaps
 
2
*Copyright (C) 2000-2006 Joerg Mueller, Daniel Polansky, Christian Foltin, Dimitri Polivaev and others.
 
3
*
 
4
*See COPYING for Details
 
5
*
 
6
*This program is free software; you can redistribute it and/or
 
7
*modify it under the terms of the GNU General Public License
 
8
*as published by the Free Software Foundation; either version 2
 
9
*of the License, or (at your option) any later version.
 
10
*
 
11
*This program is distributed in the hope that it will be useful,
 
12
*but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
*GNU General Public License for more details.
 
15
*
 
16
*You should have received a copy of the GNU General Public License
 
17
*along with this program; if not, write to the Free Software
 
18
*Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
19
*/
 
20
/*
 
21
 * Created on 29.01.2006
 
22
 * Created by Dimitri Polivaev
 
23
 */
 
24
package freemind.modes.mindmapmode.attributeactors;
 
25
 
 
26
import freemind.controller.actions.generated.instance.UnregistryAttributeValueElementaryAction;
 
27
import freemind.controller.actions.generated.instance.XmlAction;
 
28
import freemind.modes.mindmapmode.MindMapController;
 
29
import freemind.modes.mindmapmode.actions.xml.AbstractActorXml;
 
30
import freemind.modes.mindmapmode.actions.xml.ActionPair;
 
31
 
 
32
public class UnregistryAttributeValueActor extends AbstractActorXml {
 
33
 
 
34
    public UnregistryAttributeValueActor(MindMapController mindMapModeController) {
 
35
        super(mindMapModeController);
 
36
    }
 
37
 
 
38
    public XmlAction createAction(String name, String value){
 
39
        UnregistryAttributeValueElementaryAction action = new UnregistryAttributeValueElementaryAction();
 
40
        action.setName(name);
 
41
        action.setValue(value);
 
42
        return action;
 
43
    }
 
44
 
 
45
    public ActionPair createActionPair(String name, String value){
 
46
        ActionPair actionPair = new ActionPair(
 
47
                createAction(name, value),
 
48
                ((MindMapModeAttributeController)getAttributeController()).registryAttributeValueActor.createAction(name, value)
 
49
                );
 
50
        return actionPair;
 
51
    }
 
52
 
 
53
    public void act(XmlAction action) {
 
54
        if(action instanceof UnregistryAttributeValueElementaryAction){
 
55
            UnregistryAttributeValueElementaryAction unrregistryAttributeValueAction = (UnregistryAttributeValueElementaryAction)action;
 
56
            act(unrregistryAttributeValueAction.getName(),
 
57
                    unrregistryAttributeValueAction.getValue());
 
58
        }
 
59
 
 
60
    }
 
61
 
 
62
    private void act(String name, String value) {
 
63
        getAttributeRegistry().getElement(name).removeValue(value);
 
64
    }
 
65
 
 
66
    public Class getDoActionClass() {
 
67
        return UnregistryAttributeValueElementaryAction.class;
 
68
    }
 
69
 
 
70
}