From: Roland Haeder Date: Tue, 29 Sep 2015 10:36:23 +0000 (+0200) Subject: renamed jswingcore -> jcoreswing X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2b073951c2a0b0d0b36e1821901efc355c20968c;p=jcore-swing.git renamed jswingcore -> jcoreswing Signed-off-by:Roland Häder --- diff --git a/build.xml b/build.xml index 03688bd..0d46f28 100644 --- a/build.xml +++ b/build.xml @@ -7,8 +7,8 @@ - - Builds, tests, and runs the project jswingcore. + + Builds, tests, and runs the project jcore-swing. - + @@ -468,7 +468,7 @@ is divided into following sections: - + @@ -619,7 +619,7 @@ is divided into following sections: - + @@ -911,7 +911,7 @@ is divided into following sections: - + @@ -1396,7 +1396,7 @@ is divided into following sections: - + diff --git a/src/org/mxchange/jcoreswing/client/gui/ClientFrame.java b/src/org/mxchange/jcoreswing/client/gui/ClientFrame.java new file mode 100644 index 0000000..715118a --- /dev/null +++ b/src/org/mxchange/jcoreswing/client/gui/ClientFrame.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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 3 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, see . + */ +package org.mxchange.jcoreswing.client.gui; + +import java.io.IOException; +import org.mxchange.jcore.FrameworkInterface; +import org.mxchange.jcore.client.Client; +import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException; +import org.mxchange.jcore.model.contact.Contact; + +/** + * An interface for applications with a Swing frame + *

+ * @author Roland Haeder + */ +public interface ClientFrame extends FrameworkInterface { + + /** + * Shows the user the "add contact" form with some special text + *

+ * @return Contact instance + */ + public Contact doEnterOwnData (); + + /** + * Shutdown this frame + */ + public void doShutdown (); + + /** + * Enables main window (frame) + */ + public void enableMainWindow (); + + /** + * Setups the frame (and starts it). You have to call init() before you can + * call this method. + *

+ * @param client Client instance + * @throws java.io.IOException If an IO error was found + */ + public void setupFrame (final Client client) throws IOException; + + /** + * Initializes frame + *

+ * @throws org.mxchange.jcore.exceptions.FrameAlreadyInitializedException If + * this method has been called twice + */ + public void init () throws FrameAlreadyInitializedException; + + /** + * Returns field isInitialized. This flag indicates whether this frame has + * been initialized or not. + *

+ * @return Field isInitialized + */ + public boolean isInitialized (); + + /** + * Shuts down application + */ + public void shutdownApplication (); +} diff --git a/src/org/mxchange/jcoreswing/model/BaseModel.java b/src/org/mxchange/jcoreswing/model/BaseModel.java new file mode 100644 index 0000000..14e3d51 --- /dev/null +++ b/src/org/mxchange/jcoreswing/model/BaseModel.java @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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 3 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, see . + */ +package org.mxchange.jcoreswing.model; + +import java.text.MessageFormat; +import javax.swing.event.EventListenerList; +import javax.swing.event.ListDataListener; +import javax.swing.event.TableModelListener; +import org.mxchange.jcore.BaseFrameworkSystem; + +/** + * A general model class + *

+ * @author Roland Haeder + */ +public abstract class BaseModel extends BaseFrameworkSystem implements Model { + + /** + * List of event listeners + */ + private final EventListenerList eventListenerList; + + /** + * Protected constructor + */ + protected BaseModel () { + // Trace message + this.getLogger().trace("CALLED!"); //NOI18N + + // Init listener list + this.eventListenerList = new EventListenerList(); + } + + @Override + public void addListDataListener (final ListDataListener listener) { + // Trace message + this.getLogger().trace(MessageFormat.format("listener={0}", listener)); //NOI18N + + // Listener must not be null + if (null == listener) { + // Abort here + throw new NullPointerException("listener is null"); //NOI18N + } + + // Debug message + this.getLogger().debug(MessageFormat.format("Adding listener {0} ...", listener.getClass())); //NOI18N + + // Remove listener + this.eventListenerList.add(ListDataListener.class, listener); + + // Trace message + this.getLogger().trace("EXIT!"); //NOI18N + } + + @Override + public void addTableModelListener (final TableModelListener listener) { + // Trace message + this.getLogger().trace(MessageFormat.format("listener={0}", listener)); //NOI18N + + // Listener must not be null + if (null == listener) { + // Abort here + throw new NullPointerException("listener is null"); //NOI18N + } + + // Debug message + this.getLogger().debug(MessageFormat.format("Adding listener {0} ...", listener.getClass())); //NOI18N + + // Add listener + this.eventListenerList.add(TableModelListener.class, listener); + + // Trace message + this.getLogger().trace("EXIT!"); //NOI18N + } + + @Override + public void removeListDataListener (final ListDataListener listener) { + // Trace message + this.getLogger().trace(MessageFormat.format("listener={0}", listener)); //NOI18N + + // Listener must not be null + if (null == listener) { + // Abort here + throw new NullPointerException("listener is null"); //NOI18N + } + + // Debug message + this.getLogger().debug(MessageFormat.format("Removing listener {0} ...", listener.getClass())); //NOI18N + + // Remove listener + this.eventListenerList.remove(ListDataListener.class, listener); + + // Trace message + this.getLogger().trace("EXIT!"); //NOI18N + } + + @Override + public void removeTableModelListener (final TableModelListener listener) { + // Trace message + this.getLogger().trace(MessageFormat.format("listener={0}", listener)); //NOI18N + + // Listener must not be null + if (null == listener) { + // Abort here + throw new NullPointerException("listener is null"); //NOI18N + } + + // Debug message + this.getLogger().debug(MessageFormat.format("Removing listener {0} ...", listener.getClass())); //NOI18N + + // Remove listener + this.eventListenerList.remove(TableModelListener.class, listener); + + // Trace message + this.getLogger().trace("EXIT!"); //NOI18N + } +} diff --git a/src/org/mxchange/jcoreswing/model/Model.java b/src/org/mxchange/jcoreswing/model/Model.java new file mode 100644 index 0000000..38c3a2a --- /dev/null +++ b/src/org/mxchange/jcoreswing/model/Model.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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 3 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, see . + */ +package org.mxchange.jcoreswing.model; + +import javax.swing.event.ListDataListener; +import javax.swing.event.TableModelListener; +import org.mxchange.jcore.FrameworkInterface; + +/** + * A general interface for models + *

+ * @author Roland Haeder + */ +public interface Model extends FrameworkInterface { + + /** + * Adds a lister of this type to the list + *

+ * @param listener Listener instance + */ + public void addListDataListener (final ListDataListener listener); + + /** + * Adds a TableModel listener instance to the event list. + *

+ * @param listener Lister instance + */ + public void addTableModelListener (final TableModelListener listener); + + /** + * Removes given listener + *

+ * @param listener Listener instance + */ + public void removeListDataListener (final ListDataListener listener); + + /** + * Removes a TableModel listener instance from the event list. + *

+ * @param listener Listener instance + */ + public void removeTableModelListener (final TableModelListener listener); +} diff --git a/src/org/mxchange/jcoreswing/model/swing/contact/ContactTableModel.java b/src/org/mxchange/jcoreswing/model/swing/contact/ContactTableModel.java new file mode 100644 index 0000000..303ef28 --- /dev/null +++ b/src/org/mxchange/jcoreswing/model/swing/contact/ContactTableModel.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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 3 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, see . + */ +package org.mxchange.jcoreswing.model.swing.contact; + +import java.text.MessageFormat; +import javax.swing.table.TableModel; +import org.mxchange.jcore.manager.Manageable; +import org.mxchange.jcore.model.contact.Contact; +import org.mxchange.jcoreswing.model.BaseModel; +import org.mxchange.jcoreswing.model.Model; + +/** + * A table model for contacts + *

+ * @author Roland Haeder + */ +public class ContactTableModel extends BaseModel implements Model, TableModel { + + /** + * Constructor with manager instance which holds the contact manager + *

+ * @param manager Manageable instance + */ + public ContactTableModel (final Manageable manager) { + // Trace message + this.getLogger().trace(MessageFormat.format("manager={1} - CALLED!", manager)); //NOI18N + + // Manager must not be null + if (null == manager) { + // Abort here + throw new NullPointerException("manager is null"); //NOI18N + } + + // Set manager + this.setManager(manager); + } + + @Override + public Class getColumnClass (final int columnIndex) { + // All is the same + return Contact.class; + } + + @Override + public int getColumnCount () { + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + public String getColumnName (final int columnIndex) { + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + public int getRowCount () { + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + public Object getValueAt (final int rowIndex, final int columnIndex) { + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + public boolean isCellEditable (final int rowIndex, final int columnIndex) { + throw new UnsupportedOperationException("Not supported yet. rowIndex=" + rowIndex + ",columnIndex=" + columnIndex); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public void setValueAt (final Object value, final int rowIndex, final int columnIndex) { + throw new UnsupportedOperationException("Not supported yet. value=" + value + ",rowIndex=" + rowIndex + ",columnIndex=" + columnIndex); //To change body of generated methods, choose Tools | Templates. + } +} diff --git a/src/org/mxchange/jswingcore/client/gui/ClientFrame.java b/src/org/mxchange/jswingcore/client/gui/ClientFrame.java deleted file mode 100644 index c77c4a2..0000000 --- a/src/org/mxchange/jswingcore/client/gui/ClientFrame.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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 3 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, see . - */ -package org.mxchange.jswingcore.client.gui; - -import java.io.IOException; -import org.mxchange.jcore.FrameworkInterface; -import org.mxchange.jcore.client.Client; -import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException; -import org.mxchange.jcore.model.contact.Contact; - -/** - * An interface for applications with a Swing frame - *

- * @author Roland Haeder - */ -public interface ClientFrame extends FrameworkInterface { - - /** - * Shows the user the "add contact" form with some special text - *

- * @return Contact instance - */ - public Contact doEnterOwnData (); - - /** - * Shutdown this frame - */ - public void doShutdown (); - - /** - * Enables main window (frame) - */ - public void enableMainWindow (); - - /** - * Setups the frame (and starts it). You have to call init() before you can - * call this method. - *

- * @param client Client instance - * @throws java.io.IOException If an IO error was found - */ - public void setupFrame (final Client client) throws IOException; - - /** - * Initializes frame - *

- * @throws org.mxchange.jcore.exceptions.FrameAlreadyInitializedException If - * this method has been called twice - */ - public void init () throws FrameAlreadyInitializedException; - - /** - * Returns field isInitialized. This flag indicates whether this frame has - * been initialized or not. - *

- * @return Field isInitialized - */ - public boolean isInitialized (); - - /** - * Shuts down application - */ - public void shutdownApplication (); -} diff --git a/src/org/mxchange/jswingcore/model/BaseModel.java b/src/org/mxchange/jswingcore/model/BaseModel.java deleted file mode 100644 index 3733337..0000000 --- a/src/org/mxchange/jswingcore/model/BaseModel.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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 3 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, see . - */ -package org.mxchange.jswingcore.model; - -import java.text.MessageFormat; -import javax.swing.event.EventListenerList; -import javax.swing.event.ListDataListener; -import javax.swing.event.TableModelListener; -import org.mxchange.jcore.BaseFrameworkSystem; - -/** - * A general model class - *

- * @author Roland Haeder - */ -public abstract class BaseModel extends BaseFrameworkSystem implements Model { - - /** - * List of event listeners - */ - private final EventListenerList eventListenerList; - - /** - * Protected constructor - */ - protected BaseModel () { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Init listener list - this.eventListenerList = new EventListenerList(); - } - - @Override - public void addListDataListener (final ListDataListener listener) { - // Trace message - this.getLogger().trace(MessageFormat.format("listener={0}", listener)); //NOI18N - - // Listener must not be null - if (null == listener) { - // Abort here - throw new NullPointerException("listener is null"); //NOI18N - } - - // Debug message - this.getLogger().debug(MessageFormat.format("Adding listener {0} ...", listener.getClass())); //NOI18N - - // Remove listener - this.eventListenerList.add(ListDataListener.class, listener); - - // Trace message - this.getLogger().trace("EXIT!"); //NOI18N - } - - @Override - public void addTableModelListener (final TableModelListener listener) { - // Trace message - this.getLogger().trace(MessageFormat.format("listener={0}", listener)); //NOI18N - - // Listener must not be null - if (null == listener) { - // Abort here - throw new NullPointerException("listener is null"); //NOI18N - } - - // Debug message - this.getLogger().debug(MessageFormat.format("Adding listener {0} ...", listener.getClass())); //NOI18N - - // Add listener - this.eventListenerList.add(TableModelListener.class, listener); - - // Trace message - this.getLogger().trace("EXIT!"); //NOI18N - } - - @Override - public void removeListDataListener (final ListDataListener listener) { - // Trace message - this.getLogger().trace(MessageFormat.format("listener={0}", listener)); //NOI18N - - // Listener must not be null - if (null == listener) { - // Abort here - throw new NullPointerException("listener is null"); //NOI18N - } - - // Debug message - this.getLogger().debug(MessageFormat.format("Removing listener {0} ...", listener.getClass())); //NOI18N - - // Remove listener - this.eventListenerList.remove(ListDataListener.class, listener); - - // Trace message - this.getLogger().trace("EXIT!"); //NOI18N - } - - @Override - public void removeTableModelListener (final TableModelListener listener) { - // Trace message - this.getLogger().trace(MessageFormat.format("listener={0}", listener)); //NOI18N - - // Listener must not be null - if (null == listener) { - // Abort here - throw new NullPointerException("listener is null"); //NOI18N - } - - // Debug message - this.getLogger().debug(MessageFormat.format("Removing listener {0} ...", listener.getClass())); //NOI18N - - // Remove listener - this.eventListenerList.remove(TableModelListener.class, listener); - - // Trace message - this.getLogger().trace("EXIT!"); //NOI18N - } -} diff --git a/src/org/mxchange/jswingcore/model/Model.java b/src/org/mxchange/jswingcore/model/Model.java deleted file mode 100644 index eaafd67..0000000 --- a/src/org/mxchange/jswingcore/model/Model.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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 3 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, see . - */ -package org.mxchange.jswingcore.model; - -import javax.swing.event.ListDataListener; -import javax.swing.event.TableModelListener; -import org.mxchange.jcore.FrameworkInterface; - -/** - * A general interface for models - *

- * @author Roland Haeder - */ -public interface Model extends FrameworkInterface { - - /** - * Adds a lister of this type to the list - *

- * @param listener Listener instance - */ - public void addListDataListener (final ListDataListener listener); - - /** - * Adds a TableModel listener instance to the event list. - *

- * @param listener Lister instance - */ - public void addTableModelListener (final TableModelListener listener); - - /** - * Removes given listener - *

- * @param listener Listener instance - */ - public void removeListDataListener (final ListDataListener listener); - - /** - * Removes a TableModel listener instance from the event list. - *

- * @param listener Listener instance - */ - public void removeTableModelListener (final TableModelListener listener); -} diff --git a/src/org/mxchange/jswingcore/model/swing/contact/ContactTableModel.java b/src/org/mxchange/jswingcore/model/swing/contact/ContactTableModel.java deleted file mode 100644 index 55bb0b9..0000000 --- a/src/org/mxchange/jswingcore/model/swing/contact/ContactTableModel.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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 3 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, see . - */ -package org.mxchange.jswingcore.model.swing.contact; - -import java.text.MessageFormat; -import javax.swing.table.TableModel; -import org.mxchange.jcore.manager.Manageable; -import org.mxchange.jcore.model.contact.Contact; -import org.mxchange.jswingcore.model.BaseModel; -import org.mxchange.jswingcore.model.Model; - -/** - * A table model for contacts - *

- * @author Roland Haeder - */ -public class ContactTableModel extends BaseModel implements Model, TableModel { - - /** - * Constructor with manager instance which holds the contact manager - *

- * @param manager Manageable instance - */ - public ContactTableModel (final Manageable manager) { - // Trace message - this.getLogger().trace(MessageFormat.format("manager={1} - CALLED!", manager)); //NOI18N - - // Manager must not be null - if (null == manager) { - // Abort here - throw new NullPointerException("manager is null"); //NOI18N - } - - // Set manager - this.setManager(manager); - } - - @Override - public Class getColumnClass (final int columnIndex) { - // All is the same - return Contact.class; - } - - @Override - public int getColumnCount () { - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - public String getColumnName (final int columnIndex) { - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - public int getRowCount () { - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - public Object getValueAt (final int rowIndex, final int columnIndex) { - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - public boolean isCellEditable (final int rowIndex, final int columnIndex) { - throw new UnsupportedOperationException("Not supported yet. rowIndex=" + rowIndex + ",columnIndex=" + columnIndex); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public void setValueAt (final Object value, final int rowIndex, final int columnIndex) { - throw new UnsupportedOperationException("Not supported yet. value=" + value + ",rowIndex=" + rowIndex + ",columnIndex=" + columnIndex); //To change body of generated methods, choose Tools | Templates. - } -}