Author: tchemit Date: 2008-04-11 01:49:14 +0000 (Fri, 11 Apr 2008) New Revision: 442 Removed: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java Log: old Deleted: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java 2008-04-11 01:46:42 UTC (rev 441) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java 2008-04-11 01:49:14 UTC (rev 442) @@ -1,57 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program 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 2 - * of the License, or (at your option) any later version. This program 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 this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.AbstractTabUI; -import org.codelutin.vcs.ui.model.AbstractTabUIModel; - -import javax.swing.ListSelectionModel; -import java.beans.PropertyChangeEvent; - -/** @author chemit */ -public abstract class AbstractTabUIHandler<M extends AbstractTabUIModel, U extends AbstractTabUI> extends AbstractUIHandler<M, U> { - - protected abstract void initTab(VCSEntryLocation location); - - @Override - public void init() { - super.init(); - initTab(VCSEntryLocation.ALL); - initTab(VCSEntryLocation.LOCAL); - initTab(VCSEntryLocation.REMOTE); - } - - public ListSelectionModel getSelectionModel() { - return getUi().getTable(getLocation()).getSelectionModel(); - } - - public void propertyChange(PropertyChangeEvent evt) { - //if (log.isDebugEnabled()) { - log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); - //} - String action = evt.getPropertyName(); - - if (AbstractTabUIModel.LOCATION_PROPERTY_CHANGED.equals(action)) { - doSelectLocation((VCSEntryLocation) evt.getNewValue()); - } - } - - public void doSelectLocation(VCSEntryLocation location) { - log.info(location); - getUi().getCardLayout().show(getUi().getPreview(), "tab" + location.name().toLowerCase()); - } - -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java 2008-04-11 01:46:42 UTC (rev 441) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java 2008-04-11 01:49:14 UTC (rev 442) @@ -1,69 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program 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 2 - * of the License, or (at your option) any later version. This program 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 this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codelutin.vcs.VCSFactory; -import org.codelutin.vcs.runner.VCSActionManager; -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.AbstractUI; -import org.codelutin.vcs.ui.model.AbstractUIModel; - -import javax.swing.ListSelectionModel; -import java.beans.PropertyChangeListener; - -/** @author chemit */ -public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI> implements PropertyChangeListener { - - protected static Log log = LogFactory.getLog(AbstractUIHandler.class); - - private U ui; - - public abstract Class<? super U> getUiClass(); - - public abstract Class<? super M> getModelClass(); - - public abstract ListSelectionModel getSelectionModel(); - - @SuppressWarnings({"unchecked"}) - public M getModel() { - return (M) getUi().getModel(); - } - - public U getUi() { - return ui; - } - - public void setUi(U ui) { - this.ui = ui; - } - - - public void init() { - if (getModel() == null) { - throw new IllegalStateException("no model was defined for " + this); - } - getModel().addPropertyChangeListener(this); - } - - public VCSEntryLocation getLocation() { - return getModel().getEntriesModel().getLocation(); - } - - protected VCSActionManager getActionManager() { - return VCSFactory.getActionManager(); - } -}
participants (1)
-
tchemit@users.labs.libre-entreprise.org