Skip to content

Commit

Permalink
started to follow the law of demeter; implemented basic load/save mec…
Browse files Browse the repository at this point in the history
…hanism
  • Loading branch information
stefanbrenner committed Jan 30, 2012
1 parent 108c2dc commit e9b2654
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 0 deletions.
Binary file added Droplet/lib/commons-io-2.1.jar
Binary file not shown.
41 changes: 41 additions & 0 deletions Droplet/src/com/stefanbrenner/droplet/model/IDropletContext.java
@@ -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();

}
@@ -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);
}

}
@@ -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;
}

}

0 comments on commit e9b2654

Please sign in to comment.