Angefangen, NewLending mit Hilfe von SwingX zu implementieren.
This commit is contained in:
@@ -4,6 +4,6 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.32-bin.jar"/>
|
||||
<classpathentry kind="lib" path="lib/sqlite-jdbc-3.7.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jdatepicker-1.3.4.jar"/>
|
||||
<classpathentry kind="lib" path="lib/swingx-all-1.6.4.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
234
kBorrow.ucls
234
kBorrow.ucls
@@ -37,8 +37,8 @@
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="5" language="java" name="de.katho.kBorrow.models.ArticleModel" project="kBorrow"
|
||||
file="/kBorrow/src/de/katho/kBorrow/models/ArticleModel.java" binary="false" corner="BOTTOM_RIGHT">
|
||||
<class id="5" language="java" name="de.katho.kBorrow.models.ArticleTableModel" project="kBorrow"
|
||||
file="/kBorrow/src/de/katho/kBorrow/models/ArticleTableModel.java" binary="false" corner="BOTTOM_RIGHT">
|
||||
<position height="351" width="176" x="2837" y="639"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
@@ -118,8 +118,8 @@
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="14" language="java" name="de.katho.kBorrow.models.UserModel" project="kBorrow"
|
||||
file="/kBorrow/src/de/katho/kBorrow/models/UserModel.java" binary="false" corner="BOTTOM_RIGHT">
|
||||
<class id="14" language="java" name="de.katho.kBorrow.models.UserTableModel" project="kBorrow"
|
||||
file="/kBorrow/src/de/katho/kBorrow/models/UserTableModel.java" binary="false" corner="BOTTOM_RIGHT">
|
||||
<position height="351" width="162" x="623" y="639"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
@@ -182,153 +182,141 @@
|
||||
</display>
|
||||
</class>
|
||||
<association id="21">
|
||||
<end type="SOURCE" refId="17" navigable="false">
|
||||
<attribute id="22" name="set">
|
||||
<bendpoint x="2798" y="639"/>
|
||||
<end type="SOURCE" refId="10" navigable="false">
|
||||
<attribute id="22" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="23" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="1" navigable="true"/>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="24">
|
||||
<end type="SOURCE" refId="14" navigable="false">
|
||||
<attribute id="25" name="dbCon">
|
||||
<attribute id="25" name="data">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="26" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="27">
|
||||
<end type="SOURCE" refId="18"/>
|
||||
<end type="TARGET" refId="2"/>
|
||||
</realization>
|
||||
<generalization id="28">
|
||||
<end type="SOURCE" refId="13"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<association id="29">
|
||||
<bendpoint x="1017" y="639"/>
|
||||
<end type="SOURCE" refId="4" navigable="false">
|
||||
<attribute id="30" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="31" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="32">
|
||||
<end type="SOURCE" refId="17" navigable="false">
|
||||
<attribute id="33" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="34" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="35">
|
||||
<end type="SOURCE" refId="10" navigable="false">
|
||||
<attribute id="36" name="articleModel">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="37" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="5" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="38">
|
||||
<end type="SOURCE" refId="4" navigable="false">
|
||||
<attribute id="39" name="userModel">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="40" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="14" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<generalization id="41">
|
||||
<end type="SOURCE" refId="8"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<realization id="42">
|
||||
<end type="SOURCE" refId="9"/>
|
||||
<end type="TARGET" refId="2"/>
|
||||
</realization>
|
||||
<association id="43">
|
||||
<end type="SOURCE" refId="5" navigable="false">
|
||||
<attribute id="44" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="45" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="46">
|
||||
<bendpoint x="2798" y="639"/>
|
||||
<end type="SOURCE" refId="10" navigable="false">
|
||||
<attribute id="47" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="48" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="49">
|
||||
<end type="SOURCE" refId="14" navigable="false">
|
||||
<attribute id="50" name="data">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="51" minimum="0" maximum="2147483647">
|
||||
<multiplicity id="26" minimum="0" maximum="2147483647">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="3" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="52">
|
||||
<end type="SOURCE" refId="5" navigable="false">
|
||||
<attribute id="53" name="data">
|
||||
<generalization id="27">
|
||||
<end type="SOURCE" refId="6"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<generalization id="28">
|
||||
<end type="SOURCE" refId="7"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<association id="29">
|
||||
<end type="SOURCE" refId="17" navigable="false">
|
||||
<attribute id="30" name="set">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="54" minimum="0" maximum="2147483647">
|
||||
<multiplicity id="31" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="1" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="32">
|
||||
<end type="SOURCE" refId="10" navigable="false">
|
||||
<attribute id="33" name="articleModel">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="34" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="5" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="35">
|
||||
<end type="SOURCE" refId="9"/>
|
||||
<end type="TARGET" refId="2"/>
|
||||
</realization>
|
||||
<generalization id="36">
|
||||
<end type="SOURCE" refId="16"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<realization id="37">
|
||||
<end type="SOURCE" refId="18"/>
|
||||
<end type="TARGET" refId="2"/>
|
||||
</realization>
|
||||
<association id="38">
|
||||
<end type="SOURCE" refId="14" navigable="false">
|
||||
<attribute id="39" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="40" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="41">
|
||||
<end type="SOURCE" refId="5" navigable="false">
|
||||
<attribute id="42" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="43" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="44">
|
||||
<end type="SOURCE" refId="17" navigable="false">
|
||||
<attribute id="45" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="46" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="47">
|
||||
<bendpoint x="1017" y="639"/>
|
||||
<end type="SOURCE" refId="4" navigable="false">
|
||||
<attribute id="48" name="dbCon">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="49" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="2" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="50">
|
||||
<end type="SOURCE" refId="5" navigable="false">
|
||||
<attribute id="51" name="data">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</attribute>
|
||||
<multiplicity id="52" minimum="0" maximum="2147483647">
|
||||
<position height="0" width="0" x="0" y="0"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="19" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<generalization id="55">
|
||||
<end type="SOURCE" refId="6"/>
|
||||
<generalization id="53">
|
||||
<end type="SOURCE" refId="8"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<generalization id="56">
|
||||
<end type="SOURCE" refId="7"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<generalization id="57">
|
||||
<end type="SOURCE" refId="16"/>
|
||||
<generalization id="54">
|
||||
<end type="SOURCE" refId="13"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
|
||||
BIN
lib/swingx-all-1.6.4.jar
Normal file
BIN
lib/swingx-all-1.6.4.jar
Normal file
Binary file not shown.
@@ -3,18 +3,18 @@ package de.katho.kBorrow.controller;
|
||||
import java.util.HashMap;
|
||||
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
import de.katho.kBorrow.models.ArticleModel;
|
||||
import de.katho.kBorrow.models.FreeArticleModel;
|
||||
import de.katho.kBorrow.models.ArticleTableModel;
|
||||
import de.katho.kBorrow.models.FreeArticleTableModel;
|
||||
|
||||
public class ArticleController {
|
||||
private DbConnector dbCon;
|
||||
private ArticleModel articleModel;
|
||||
private FreeArticleModel freeArticleModel;
|
||||
private ArticleTableModel articleTableModel;
|
||||
private FreeArticleTableModel freeArticleTableModel;
|
||||
|
||||
public ArticleController(DbConnector pDbCon, HashMap<String, Object> pModels){
|
||||
dbCon = pDbCon;
|
||||
articleModel = (ArticleModel)pModels.get("articlemodel");
|
||||
freeArticleModel = (FreeArticleModel)pModels.get("freearticlemodel");
|
||||
articleTableModel = (ArticleTableModel)pModels.get("articlemodel");
|
||||
freeArticleTableModel = (FreeArticleTableModel)pModels.get("freearticlemodel");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,8 +29,8 @@ public class ArticleController {
|
||||
public int createArticle(String pName, String pDesc) {
|
||||
int status = dbCon.createArticle(pName, pDesc);
|
||||
|
||||
articleModel.updateModel();
|
||||
freeArticleModel.updateModel();
|
||||
articleTableModel.updateModel();
|
||||
freeArticleTableModel.updateModel();
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -49,8 +49,8 @@ public class ArticleController {
|
||||
int status = this.dbCon.editArticle(pId, pName, pDesc);
|
||||
|
||||
if(status == 0){
|
||||
articleModel.updateModel();
|
||||
freeArticleModel.updateModel();
|
||||
articleTableModel.updateModel();
|
||||
freeArticleTableModel.updateModel();
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -64,8 +64,8 @@ public class ArticleController {
|
||||
*/
|
||||
public boolean deleteArticle(int id) {
|
||||
if(this.dbCon.deleteArticle(id)){
|
||||
articleModel.updateModel();
|
||||
freeArticleModel.updateModel();
|
||||
articleTableModel.updateModel();
|
||||
freeArticleTableModel.updateModel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,25 +3,25 @@ package de.katho.kBorrow.controller;
|
||||
import java.util.HashMap;
|
||||
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
import de.katho.kBorrow.models.UserModel;
|
||||
import de.katho.kBorrow.models.UserTableModel;
|
||||
import de.katho.kBorrow.models.UserListModel;
|
||||
|
||||
public class UserController {
|
||||
|
||||
private DbConnector dbCon;
|
||||
private UserModel userModel;
|
||||
private UserTableModel userTableModel;
|
||||
private UserListModel userListModel;
|
||||
|
||||
public UserController(DbConnector pDbCon, HashMap<String, Object> pModels) {
|
||||
dbCon = pDbCon;
|
||||
userModel = (UserModel)pModels.get("usermodel");
|
||||
userTableModel = (UserTableModel)pModels.get("usermodel");
|
||||
userListModel = (UserListModel)pModels.get("userlistmodel");
|
||||
}
|
||||
|
||||
public int createUser(String pName, String pSurname){
|
||||
int status = dbCon.createUser(pName, pSurname);
|
||||
|
||||
userModel.updateModel();
|
||||
userTableModel.updateModel();
|
||||
userListModel.updateModel();
|
||||
|
||||
return status;
|
||||
@@ -31,7 +31,7 @@ public class UserController {
|
||||
int status = dbCon.editUser(pId, pName, pSurname);
|
||||
|
||||
if(status == 0){
|
||||
userModel.updateModel();
|
||||
userTableModel.updateModel();
|
||||
userListModel.updateModel();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class UserController {
|
||||
|
||||
public boolean deleteUser(int id){
|
||||
if(dbCon.deleteUser(id)){
|
||||
userModel.updateModel();
|
||||
userTableModel.updateModel();
|
||||
userListModel.updateModel();
|
||||
|
||||
return true;
|
||||
|
||||
31
src/de/katho/kBorrow/data/KLender.java
Normal file
31
src/de/katho/kBorrow/data/KLender.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package de.katho.kBorrow.data;
|
||||
|
||||
public class KLender {
|
||||
private String name;
|
||||
private String surname;
|
||||
private int studentnumber;
|
||||
private int id;
|
||||
|
||||
public KLender(int pId, String pName, String pSurname, int pStudentnumber){
|
||||
id = pId;
|
||||
name = pName;
|
||||
surname = pSurname;
|
||||
studentnumber = pStudentnumber;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getSurname(){
|
||||
return surname;
|
||||
}
|
||||
|
||||
public int getStudentnumber(){
|
||||
return studentnumber;
|
||||
}
|
||||
|
||||
public int getId(){
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package de.katho.kBorrow.db;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.katho.kBorrow.data.KArticle;
|
||||
import de.katho.kBorrow.data.KLender;
|
||||
import de.katho.kBorrow.data.KUser;
|
||||
|
||||
public interface DbConnector {
|
||||
@@ -16,5 +17,6 @@ public interface DbConnector {
|
||||
public boolean deleteArticle(int id);
|
||||
public int editArticle(int pId, String pName, String pDesc);
|
||||
public ArrayList<KArticle> getFreeArticleList();
|
||||
public ArrayList<KLender> getLenderList();
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.katho.kBorrow.db;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.katho.kBorrow.data.KArticle;
|
||||
import de.katho.kBorrow.data.KLender;
|
||||
import de.katho.kBorrow.data.KUser;
|
||||
|
||||
public class SqlConnector implements DbConnector{
|
||||
@@ -65,5 +66,11 @@ public class SqlConnector implements DbConnector{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<KLender> getLenderList() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Hashtable;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import de.katho.kBorrow.data.KArticle;
|
||||
import de.katho.kBorrow.data.KLender;
|
||||
import de.katho.kBorrow.data.KUser;
|
||||
|
||||
/**
|
||||
@@ -242,6 +243,26 @@ public class SqliteConnector implements DbConnector {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<KLender> getLenderList() {
|
||||
ArrayList<KLender> lendArr = new ArrayList<KLender>();
|
||||
|
||||
try{
|
||||
Statement st = connection.createStatement();
|
||||
String query = "SELECT id, name, surname, studentnumber FROM lender";
|
||||
ResultSet rs = st.executeQuery(query);
|
||||
|
||||
while (rs.next()){
|
||||
lendArr.add(new KLender(rs.getInt("id"), rs.getString("name"), rs.getString("surname"), rs.getInt("studentnumber")));
|
||||
}
|
||||
|
||||
return lendArr;
|
||||
}
|
||||
catch(SQLException ex){
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return 0: Benutzer erfolgreich erzeugt
|
||||
|
||||
@@ -27,7 +27,7 @@ import de.katho.kBorrow.controller.ArticleController;
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
import de.katho.kBorrow.listener.ArticleDeleteTableButton;
|
||||
import de.katho.kBorrow.listener.ArticleEditTableButton;
|
||||
import de.katho.kBorrow.models.ArticleModel;
|
||||
import de.katho.kBorrow.models.ArticleTableModel;
|
||||
|
||||
public class ArticlePanel extends JPanel implements ActionListener, KeyListener {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ArticlePanel extends JPanel implements ActionListener, KeyListener
|
||||
private JLabel lblArticleStatus;
|
||||
private boolean articleModeEdit;
|
||||
private int articleEditId;
|
||||
private ArticleModel articleModel;
|
||||
private ArticleTableModel articleTableModel;
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
@@ -49,7 +49,7 @@ public class ArticlePanel extends JPanel implements ActionListener, KeyListener
|
||||
public ArticlePanel(final DbConnector dbCon, HashMap<String, Object> pModels) throws IOException {
|
||||
super();
|
||||
this.setLayout(null);
|
||||
articleModel = (ArticleModel)pModels.get("articlemodel");
|
||||
articleTableModel = (ArticleTableModel)pModels.get("articlemodel");
|
||||
|
||||
articleController = new ArticleController(dbCon, pModels);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ArticlePanel extends JPanel implements ActionListener, KeyListener
|
||||
* Tabelle und drumherum
|
||||
*/
|
||||
|
||||
JTable articleTable = new JTable(articleModel);
|
||||
JTable articleTable = new JTable(articleTableModel);
|
||||
articleTable.setRowHeight(30);
|
||||
ArticleDeleteTableButton articleDeleteTableButton = new ArticleDeleteTableButton("L<EFBFBD>schen", articleTable, this, articleController);
|
||||
ArticleEditTableButton articleEditTableButton = new ArticleEditTableButton("Bearbeiten", articleTable, this);
|
||||
|
||||
@@ -15,9 +15,9 @@ import de.katho.kBorrow.Settings;
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
import de.katho.kBorrow.db.SqlConnector;
|
||||
import de.katho.kBorrow.db.SqliteConnector;
|
||||
import de.katho.kBorrow.models.ArticleModel;
|
||||
import de.katho.kBorrow.models.FreeArticleModel;
|
||||
import de.katho.kBorrow.models.UserModel;
|
||||
import de.katho.kBorrow.models.ArticleTableModel;
|
||||
import de.katho.kBorrow.models.FreeArticleTableModel;
|
||||
import de.katho.kBorrow.models.UserTableModel;
|
||||
import de.katho.kBorrow.models.UserListModel;
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ public class MainWindow {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
|
||||
models = new HashMap<String, Object>();
|
||||
models.put("usermodel", new UserModel(dbCon));
|
||||
models.put("usermodel", new UserTableModel(dbCon));
|
||||
models.put("userlistmodel", new UserListModel(dbCon));
|
||||
models.put("articlemodel", new ArticleModel(dbCon));
|
||||
models.put("freearticlemodel", new FreeArticleModel(dbCon));
|
||||
models.put("articlemodel", new ArticleTableModel(dbCon));
|
||||
models.put("freearticlemodel", new FreeArticleTableModel(dbCon));
|
||||
|
||||
this.tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
||||
this.frame.getContentPane().add(this.tabbedPane, BorderLayout.CENTER);
|
||||
|
||||
@@ -1,40 +1,37 @@
|
||||
package de.katho.kBorrow.gui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import org.jdesktop.swingx.JXDatePicker;
|
||||
|
||||
import de.katho.kBorrow.Util;
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
import de.katho.kBorrow.listener.NewLendingTableButton;
|
||||
import de.katho.kBorrow.models.FreeArticleModel;
|
||||
import de.katho.kBorrow.models.FreeArticleTableModel;
|
||||
import de.katho.kBorrow.models.UserListModel;
|
||||
|
||||
import org.jdatepicker.*;
|
||||
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public class NewLendingPanel extends JPanel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7346953418572781322L;
|
||||
private FreeArticleModel freeArticleModel;
|
||||
private FreeArticleTableModel freeArticleTableModel;
|
||||
private JTextField tfName;
|
||||
private JTextField tfSurname;
|
||||
private JTextField tfStudentNumber;
|
||||
@@ -52,10 +49,10 @@ public class NewLendingPanel extends JPanel {
|
||||
setLayout(null);
|
||||
|
||||
// FreeArticleTable
|
||||
freeArticleModel = (FreeArticleModel)pModel.get("freearticlemodel");
|
||||
freeArticleTableModel = (FreeArticleTableModel)pModel.get("freearticlemodel");
|
||||
userListModel = (UserListModel)pModel.get("userlistmodel");
|
||||
|
||||
JTable freeArticleTable = new JTable(freeArticleModel);
|
||||
JTable freeArticleTable = new JTable(freeArticleTableModel);
|
||||
freeArticleTable.setRowHeight(30);
|
||||
|
||||
NewLendingTableButton newLendingTableButton = new NewLendingTableButton("Artikel ausleihen", freeArticleTable, this);
|
||||
@@ -109,13 +106,10 @@ public class NewLendingPanel extends JPanel {
|
||||
lblNewLabel.setBounds(10, 60, 90, 20);
|
||||
panelNewLending.add(lblNewLabel);
|
||||
|
||||
JDatePicker picker = new JDateComponentFactory().createJDatePicker();
|
||||
picker.setTextEditable(true);
|
||||
JPanel pickerPanel = new JPanel();
|
||||
pickerPanel.setBounds(106, 60, 205, 28);
|
||||
pickerPanel.add((JComponent)picker);
|
||||
panelNewLending.add(pickerPanel);
|
||||
|
||||
JXDatePicker xpicker = new JXDatePicker(new Date());
|
||||
xpicker.setBounds(110, 60, 200, 20);
|
||||
panelNewLending.add(xpicker);
|
||||
|
||||
|
||||
JLabel lblBenutzer = new JLabel("Benutzer:");
|
||||
lblBenutzer.setBounds(350, 20, 70, 20);
|
||||
|
||||
@@ -23,7 +23,7 @@ import de.katho.kBorrow.controller.UserController;
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
import de.katho.kBorrow.listener.UserDeleteTableButton;
|
||||
import de.katho.kBorrow.listener.UserEditTableButton;
|
||||
import de.katho.kBorrow.models.UserModel;
|
||||
import de.katho.kBorrow.models.UserTableModel;
|
||||
|
||||
public class UserPanel extends JPanel implements ActionListener, KeyListener {
|
||||
|
||||
@@ -35,17 +35,17 @@ public class UserPanel extends JPanel implements ActionListener, KeyListener {
|
||||
private JButton btnUserCancel;
|
||||
private boolean userModeEdit;
|
||||
private int userEditId;
|
||||
private UserModel userModel;
|
||||
private UserTableModel userTableModel;
|
||||
private UserController userController;
|
||||
|
||||
public UserPanel(final DbConnector dbCon, HashMap<String, Object> pModels) throws IOException{
|
||||
super();
|
||||
setLayout(null);
|
||||
userModel = (UserModel)pModels.get("usermodel");
|
||||
userTableModel = (UserTableModel)pModels.get("usermodel");
|
||||
userController = new UserController(dbCon, pModels);
|
||||
|
||||
//Tabelle und drumherum
|
||||
JTable userTable = new JTable(userModel);
|
||||
JTable userTable = new JTable(userTableModel);
|
||||
userTable.setRowHeight(30);
|
||||
UserDeleteTableButton userDeleteTableButton = new UserDeleteTableButton("L<EFBFBD>schen", userTable, this, userController);
|
||||
UserEditTableButton userEditTableButton = new UserEditTableButton("Bearbeiten", userTable, this);
|
||||
|
||||
@@ -11,7 +11,7 @@ import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.controller.ArticleController;
|
||||
import de.katho.kBorrow.gui.ArticlePanel;
|
||||
import de.katho.kBorrow.models.ArticleModel;
|
||||
import de.katho.kBorrow.models.ArticleTableModel;
|
||||
|
||||
public class ArticleDeleteTableButton extends TableButton {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ArticleDeleteTableButton extends TableButton {
|
||||
public void actionPerformed(ActionEvent e){
|
||||
fireEditingStopped();
|
||||
|
||||
ArticleModel model = (ArticleModel) pTable.getModel();
|
||||
ArticleTableModel model = (ArticleTableModel) pTable.getModel();
|
||||
|
||||
int row = pTable.getSelectedRow();
|
||||
int id = model.getArticleId(row);
|
||||
|
||||
@@ -10,7 +10,7 @@ import javax.swing.ImageIcon;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.gui.ArticlePanel;
|
||||
import de.katho.kBorrow.models.ArticleModel;
|
||||
import de.katho.kBorrow.models.ArticleTableModel;
|
||||
|
||||
public class ArticleEditTableButton extends TableButton {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ArticleEditTableButton extends TableButton {
|
||||
public void actionPerformed(ActionEvent e){
|
||||
fireEditingStopped();
|
||||
|
||||
ArticleModel model = (ArticleModel) pTable.getModel();
|
||||
ArticleTableModel model = (ArticleTableModel) pTable.getModel();
|
||||
int row = pTable.getSelectedRow();
|
||||
|
||||
articleTab.setModeEditArticle(model.getArticleId(row), model.getArticleName(row), model.getArticleDescription(row));
|
||||
|
||||
@@ -10,7 +10,7 @@ import javax.swing.ImageIcon;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.gui.NewLendingPanel;
|
||||
import de.katho.kBorrow.models.FreeArticleModel;
|
||||
import de.katho.kBorrow.models.FreeArticleTableModel;
|
||||
|
||||
public class NewLendingTableButton extends TableButton {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class NewLendingTableButton extends TableButton {
|
||||
public void actionPerformed(ActionEvent e){
|
||||
fireEditingStopped();
|
||||
|
||||
FreeArticleModel model = (FreeArticleModel) pTable.getModel();
|
||||
FreeArticleTableModel model = (FreeArticleTableModel) pTable.getModel();
|
||||
int row = pTable.getSelectedRow();
|
||||
|
||||
pPanel.setModeNewLending(model.getArticleId(row), model.getArticleName(row));
|
||||
|
||||
@@ -11,7 +11,7 @@ import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.controller.UserController;
|
||||
import de.katho.kBorrow.gui.UserPanel;
|
||||
import de.katho.kBorrow.models.UserModel;
|
||||
import de.katho.kBorrow.models.UserTableModel;
|
||||
|
||||
public class UserDeleteTableButton extends TableButton {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class UserDeleteTableButton extends TableButton {
|
||||
public void actionPerformed(ActionEvent e){
|
||||
fireEditingStopped();
|
||||
|
||||
UserModel model = (UserModel) pTable.getModel();
|
||||
UserTableModel model = (UserTableModel) pTable.getModel();
|
||||
|
||||
int row = pTable.getSelectedRow();
|
||||
int id = model.getUserId(row);
|
||||
|
||||
@@ -10,7 +10,7 @@ import javax.swing.ImageIcon;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.gui.UserPanel;
|
||||
import de.katho.kBorrow.models.UserModel;
|
||||
import de.katho.kBorrow.models.UserTableModel;
|
||||
|
||||
public class UserEditTableButton extends TableButton {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class UserEditTableButton extends TableButton {
|
||||
public void actionPerformed(ActionEvent e){
|
||||
fireEditingStopped();
|
||||
|
||||
UserModel model = (UserModel) pTable.getModel();
|
||||
UserTableModel model = (UserTableModel) pTable.getModel();
|
||||
int row = pTable.getSelectedRow();
|
||||
|
||||
pPanel.setModeEditUser(model.getUserId(row), model.getUserName(row), model.getUserSurname(row));
|
||||
|
||||
@@ -7,7 +7,7 @@ import javax.swing.table.AbstractTableModel;
|
||||
import de.katho.kBorrow.data.KArticle;
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
|
||||
public class ArticleModel extends AbstractTableModel {
|
||||
public class ArticleTableModel extends AbstractTableModel {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -17,7 +17,7 @@ public class ArticleModel extends AbstractTableModel {
|
||||
protected DbConnector dbCon;
|
||||
protected ArrayList<KArticle> data = new ArrayList<KArticle>();
|
||||
|
||||
public ArticleModel(DbConnector pDbCon){
|
||||
public ArticleTableModel(DbConnector pDbCon){
|
||||
header = new String [] {"ID", "Artikelname", "Artikelbeschreibung", "", ""};
|
||||
this.dbCon = pDbCon;
|
||||
this.updateModel();
|
||||
@@ -2,7 +2,7 @@ package de.katho.kBorrow.models;
|
||||
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
|
||||
public class FreeArticleModel extends ArticleModel {
|
||||
public class FreeArticleTableModel extends ArticleTableModel {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -10,7 +10,7 @@ public class FreeArticleModel extends ArticleModel {
|
||||
private static final long serialVersionUID = 1908669541941834593L;
|
||||
private String[] header;
|
||||
|
||||
public FreeArticleModel(DbConnector pDbCon) {
|
||||
public FreeArticleTableModel(DbConnector pDbCon) {
|
||||
super(pDbCon);
|
||||
this.header = new String[] {"ID", "Artikelname", "Artikelbeschreibung", ""};
|
||||
|
||||
20
src/de/katho/kBorrow/models/LenderModel.java
Normal file
20
src/de/katho/kBorrow/models/LenderModel.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package de.katho.kBorrow.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.katho.kBorrow.data.KLender;
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
|
||||
public class LenderModel {
|
||||
private ArrayList<KLender> data;
|
||||
private DbConnector dbCon;
|
||||
|
||||
public LenderModel(DbConnector pDbCon){
|
||||
dbCon = pDbCon;
|
||||
updateModel();
|
||||
}
|
||||
|
||||
public void updateModel(){
|
||||
data = dbCon.getLenderList();
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import javax.swing.table.AbstractTableModel;
|
||||
import de.katho.kBorrow.data.KUser;
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
|
||||
public class UserModel extends AbstractTableModel {
|
||||
public class UserTableModel extends AbstractTableModel {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -17,7 +17,7 @@ public class UserModel extends AbstractTableModel {
|
||||
private String[] header = {"ID", "Vorname", "Nachname", "", ""};
|
||||
private ArrayList<KUser> data = new ArrayList<KUser>();
|
||||
|
||||
public UserModel(DbConnector pDbCon){
|
||||
public UserTableModel(DbConnector pDbCon){
|
||||
dbCon = pDbCon;
|
||||
updateModel();
|
||||
}
|
||||
Reference in New Issue
Block a user