Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
started to follow the law of demeter; implemented basic load/save mec…
…hanism
- Loading branch information
1 parent
108c2dc
commit e9b2654
Showing
4 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
41 changes: 41 additions & 0 deletions
41
Droplet/src/com/stefanbrenner/droplet/model/IDropletContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/******************************************************************************* | ||
* Project: Droplet - Toolkit for Liquid Art Photographers | ||
* Copyright (C) 2012 Stefan Brenner | ||
* | ||
* This file is part of Droplet. | ||
* | ||
* Droplet is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Droplet is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Droplet. If not, see <http://www.gnu.org/licenses/>. | ||
*******************************************************************************/ | ||
package com.stefanbrenner.droplet.model; | ||
|
||
import gnu.io.CommPortIdentifier; | ||
|
||
/** | ||
* @author Stefan Brenner | ||
*/ | ||
public interface IDropletContext extends INotificationSupport { | ||
|
||
public static final String PROPERTY_PORT = "port"; | ||
|
||
public static final String PROPERTY_DROPLET = "droplet"; | ||
|
||
public abstract void setPort(CommPortIdentifier port); | ||
|
||
public abstract CommPortIdentifier getPort(); | ||
|
||
public abstract void setDroplet(IDroplet droplet); | ||
|
||
public abstract IDroplet getDroplet(); | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
Droplet/src/com/stefanbrenner/droplet/model/internal/DropletContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/******************************************************************************* | ||
* Project: Droplet - Toolkit for Liquid Art Photographers | ||
* Copyright (C) 2012 Stefan Brenner | ||
* | ||
* This file is part of Droplet. | ||
* | ||
* Droplet is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Droplet is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Droplet. If not, see <http://www.gnu.org/licenses/>. | ||
*******************************************************************************/ | ||
package com.stefanbrenner.droplet.model.internal; | ||
|
||
import gnu.io.CommPortIdentifier; | ||
|
||
import java.io.File; | ||
|
||
import com.stefanbrenner.droplet.model.IDroplet; | ||
import com.stefanbrenner.droplet.model.IDropletContext; | ||
|
||
/** | ||
* @author Stefan Brenner | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class DropletContext extends AbstractModelObject implements IDropletContext { | ||
|
||
private File file; | ||
|
||
private CommPortIdentifier port; | ||
|
||
private IDroplet droplet; | ||
|
||
public File getFile() { | ||
return file; | ||
} | ||
|
||
public void setFile(File file) { | ||
this.file = file; | ||
} | ||
|
||
@Override | ||
public CommPortIdentifier getPort() { | ||
return port; | ||
} | ||
|
||
@Override | ||
public void setPort(CommPortIdentifier port) { | ||
firePropertyChange(PROPERTY_PORT, this.port, this.port = port); | ||
} | ||
|
||
@Override | ||
public IDroplet getDroplet() { | ||
return droplet; | ||
} | ||
|
||
@Override | ||
public void setDroplet(IDroplet droplet) { | ||
firePropertyChange(PROPERTY_DROPLET, this.droplet, this.droplet = droplet); | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
Droplet/src/com/stefanbrenner/droplet/ui/actions/AbstractDropletAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Project: Droplet - Toolkit for Liquid Art Photographers | ||
* Copyright (C) 2012 Stefan Brenner | ||
* | ||
* This file is part of Droplet. | ||
* | ||
* Droplet is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Droplet is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Droplet. If not, see <http://www.gnu.org/licenses/>. | ||
*******************************************************************************/ | ||
package com.stefanbrenner.droplet.ui.actions; | ||
|
||
import javax.swing.AbstractAction; | ||
|
||
import com.stefanbrenner.droplet.model.IDropletContext; | ||
|
||
/** | ||
* @author Stefan Brenner | ||
* | ||
*/ | ||
public abstract class AbstractDropletAction extends AbstractAction { | ||
|
||
private final IDropletContext dropletContext; | ||
|
||
public AbstractDropletAction(IDropletContext dropletContext, String title) { | ||
super(title); | ||
this.dropletContext = dropletContext; | ||
} | ||
|
||
protected IDropletContext getDropletContext() { | ||
return dropletContext; | ||
} | ||
|
||
} |