modyfikacja rekordów - sprawna
This commit is contained in:
parent
a7d40927a3
commit
71cf6237aa
BIN
biblioteka.db
BIN
biblioteka.db
Binary file not shown.
Binary file not shown.
@ -30,8 +30,9 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="Title" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="Title" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="lmusican" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="lmusican" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="idValue" alignment="0" min="-2" pref="57" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="-2" pref="56" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="49" max="-2" attributes="0"/>
|
||||||
<Component id="mainlabel" min="-2" pref="289" max="-2" attributes="0"/>
|
<Component id="mainlabel" min="-2" pref="289" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
@ -59,9 +60,17 @@
|
|||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="mainlabel" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
<Group type="102" attributes="0">
|
||||||
|
<Component id="mainlabel" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<Component id="idValue" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="Title" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="Title" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="albumTitle" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="albumTitle" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
@ -182,5 +191,10 @@
|
|||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="SaveChangesActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="SaveChangesActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="idValue">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="."/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -17,7 +17,7 @@ import javax.swing.JOptionPane;
|
|||||||
*/
|
*/
|
||||||
public class AlbumFieldPattern extends javax.swing.JFrame {
|
public class AlbumFieldPattern extends javax.swing.JFrame {
|
||||||
|
|
||||||
public boolean add = false, delete = false, edit = false, search = false;
|
public boolean add = false, delete = false, edit = false, search = false, update = false;
|
||||||
private Database d = new Database();
|
private Database d = new Database();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +28,7 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlbumFieldPattern(boolean required) {
|
public AlbumFieldPattern(boolean required, Album... a) {
|
||||||
initComponents();
|
initComponents();
|
||||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
Validation verify;
|
Validation verify;
|
||||||
@ -40,9 +40,25 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
albumTitle.setInputVerifier(verify);
|
albumTitle.setInputVerifier(verify);
|
||||||
musican.setInputVerifier(verify);
|
musican.setInputVerifier(verify);
|
||||||
year.setInputVerifier(verify);
|
year.setInputVerifier(verify);
|
||||||
|
try {
|
||||||
|
if (a[0].getId() >= 0) {
|
||||||
|
fillField(a[0]);
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
//when only one parameter is defined
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void search(Album a) {
|
public void fillField(Album a) {
|
||||||
|
idValue.setText(Integer.toString(a.getId()));
|
||||||
|
albumTitle.setText(a.getName());
|
||||||
|
musican.setText(a.getMusican());
|
||||||
|
year.setText(Integer.toString(a.getYear()));
|
||||||
|
Category.setSelectedItem(a.getCategory());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(Album a, String... mode) {
|
||||||
try {
|
try {
|
||||||
List<Album> albums = new LinkedList<>();
|
List<Album> albums = new LinkedList<>();
|
||||||
albums = d.selectAlbums(a);
|
albums = d.selectAlbums(a);
|
||||||
@ -53,8 +69,14 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
"Muzyk/Zespół",
|
"Muzyk/Zespół",
|
||||||
"Rok",
|
"Rok",
|
||||||
"Kategoria"};
|
"Kategoria"};
|
||||||
ListResult table = new ListResult(data, columnNames);
|
ListResult table = new ListResult(data, columnNames, "album");
|
||||||
table.setVisible(true);
|
table.setVisible(true);
|
||||||
|
if (mode[0].equals("edit")) {
|
||||||
|
table.setEnabledButton("edit");
|
||||||
|
}
|
||||||
|
if (mode[0].equals("delete")) {
|
||||||
|
table.setEnabledButton("delete");
|
||||||
|
}
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
|
||||||
//nothing to do here
|
//nothing to do here
|
||||||
@ -80,6 +102,7 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
Category = new javax.swing.JComboBox<>();
|
Category = new javax.swing.JComboBox<>();
|
||||||
mainlabel = new javax.swing.JLabel();
|
mainlabel = new javax.swing.JLabel();
|
||||||
SaveChanges = new javax.swing.JButton();
|
SaveChanges = new javax.swing.JButton();
|
||||||
|
idValue = new javax.swing.JLabel();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
@ -116,6 +139,8 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
idValue.setText(".");
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
@ -126,8 +151,9 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(Title)
|
.addComponent(Title)
|
||||||
.addComponent(lmusican))
|
.addComponent(lmusican)
|
||||||
.addGap(56, 56, 56)
|
.addComponent(idValue, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGap(49, 49, 49)
|
||||||
.addComponent(mainlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(mainlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(lyear, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(lyear, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
@ -148,8 +174,13 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(mainlabel)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(18, 18, 18)
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(mainlabel)
|
||||||
|
.addGap(18, 18, 18))
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addComponent(idValue)
|
||||||
|
.addGap(7, 7, 7)))
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(Title)
|
.addComponent(Title)
|
||||||
.addComponent(albumTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(albumTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
@ -188,11 +219,22 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
} else if (this.edit) {
|
} else if (this.edit) {
|
||||||
Album a = new Album(0, albumTitle.getText(), musican.getText(), year.getText(), Category.getSelectedItem().toString());
|
Album a = new Album(0, albumTitle.getText(), musican.getText(), year.getText(), Category.getSelectedItem().toString());
|
||||||
this.search(a);
|
this.search(a, "edit");
|
||||||
} else if (this.delete) {
|
} else if (this.delete) {
|
||||||
JOptionPane.showMessageDialog(null, "USUŃ");
|
Album a = new Album(0, albumTitle.getText(), musican.getText(), year.getText(), Category.getSelectedItem().toString());
|
||||||
|
this.search(a, "delete");
|
||||||
|
} else if (this.search) {
|
||||||
|
Album a = new Album(0, albumTitle.getText(), musican.getText(), year.getText(), Category.getSelectedItem().toString());
|
||||||
|
this.search(a);
|
||||||
|
} else if (this.update) {
|
||||||
|
Album a = new Album(Integer.parseInt(idValue.getText()), albumTitle.getText(), musican.getText(), year.getText(), Category.getSelectedItem().toString());
|
||||||
|
try {
|
||||||
|
d.updateQ(a);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
dispose();
|
||||||
}//GEN-LAST:event_SaveChangesActionPerformed
|
}//GEN-LAST:event_SaveChangesActionPerformed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,6 +281,7 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
|||||||
private javax.swing.JButton SaveChanges;
|
private javax.swing.JButton SaveChanges;
|
||||||
private javax.swing.JLabel Title;
|
private javax.swing.JLabel Title;
|
||||||
private javax.swing.JTextField albumTitle;
|
private javax.swing.JTextField albumTitle;
|
||||||
|
private javax.swing.JLabel idValue;
|
||||||
private javax.swing.JLabel lcategory;
|
private javax.swing.JLabel lcategory;
|
||||||
private javax.swing.JLabel lmusican;
|
private javax.swing.JLabel lmusican;
|
||||||
private javax.swing.JLabel lyear;
|
private javax.swing.JLabel lyear;
|
||||||
|
@ -26,18 +26,6 @@
|
|||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="Title" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="authorname" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="authorName" min="-2" pref="220" max="-2" attributes="0"/>
|
|
||||||
<Component id="bookTitle" min="-2" pref="363" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="0" pref="20" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||||
<Component id="lcategory" max="32767" attributes="0"/>
|
<Component id="lcategory" max="32767" attributes="0"/>
|
||||||
@ -59,20 +47,39 @@
|
|||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="Title" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="authorname" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="authorName" min="-2" pref="220" max="-2" attributes="0"/>
|
||||||
|
<Component id="bookTitle" min="-2" pref="363" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Component id="idValue" min="-2" pref="57" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="mainlabel" min="-2" pref="289" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace min="0" pref="20" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
|
||||||
<Component id="mainlabel" min="-2" pref="289" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="71" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="mainlabel" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="mainlabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="idValue" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="Title" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="Title" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
@ -290,5 +297,10 @@
|
|||||||
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="jLabel1.setVisible(false);"/>
|
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="jLabel1.setVisible(false);"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="idValue">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="."/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -20,7 +20,8 @@ import javax.swing.JOptionPane;
|
|||||||
*/
|
*/
|
||||||
public class BookFieldPattern extends javax.swing.JFrame {
|
public class BookFieldPattern extends javax.swing.JFrame {
|
||||||
|
|
||||||
public boolean add = false, delete = false, edit = false, search = false;
|
public boolean add = false, delete = false, edit = false, search = false, update = false;
|
||||||
|
public Book b;
|
||||||
private Database d = new Database();
|
private Database d = new Database();
|
||||||
|
|
||||||
public BookFieldPattern() {
|
public BookFieldPattern() {
|
||||||
@ -32,7 +33,7 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BookFieldPattern(boolean required) {
|
public BookFieldPattern(boolean required, Book... b) {
|
||||||
initComponents();
|
initComponents();
|
||||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
Validation verify;
|
Validation verify;
|
||||||
@ -47,9 +48,28 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
year.setInputVerifier(verify);
|
year.setInputVerifier(verify);
|
||||||
ISBN.setInputVerifier(verify);
|
ISBN.setInputVerifier(verify);
|
||||||
publishing.setInputVerifier(verify);
|
publishing.setInputVerifier(verify);
|
||||||
|
try {
|
||||||
|
if (b[0].getId() >= 0) {
|
||||||
|
fillField(b[0]);
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
//when only one parameter is defined
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void search(Book b) {
|
public void fillField(Book b) {
|
||||||
|
idValue.setText(Integer.toString(b.getId()));
|
||||||
|
bookTitle.setText(b.getName());
|
||||||
|
authorName.setText(b.getAuthorName());
|
||||||
|
authorSurname.setText(b.getAuthorSurname());
|
||||||
|
publishing.setText(b.getPublishing());
|
||||||
|
year.setText(Integer.toString(b.getYear()));
|
||||||
|
ISBN.setText(b.getISBN());
|
||||||
|
Category.setSelectedItem(b.getCategory());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(Book b, String... mode) {
|
||||||
try {
|
try {
|
||||||
List<Book> books = new LinkedList<>();
|
List<Book> books = new LinkedList<>();
|
||||||
books = d.selectBooks(b);
|
books = d.selectBooks(b);
|
||||||
@ -62,8 +82,14 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
"ISBN",
|
"ISBN",
|
||||||
"Wydawnictwo",
|
"Wydawnictwo",
|
||||||
"Kategoria"};
|
"Kategoria"};
|
||||||
ListResult table = new ListResult(data, columnNames);
|
ListResult table = new ListResult(data, columnNames, "book");
|
||||||
table.setVisible(true);
|
table.setVisible(true);
|
||||||
|
if (mode[0].equals("edit")) {
|
||||||
|
table.setEnabledButton("edit");
|
||||||
|
}
|
||||||
|
if (mode[0].equals("delete")) {
|
||||||
|
table.setEnabledButton("delete");
|
||||||
|
}
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,6 +120,7 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
mainlabel = new javax.swing.JLabel();
|
mainlabel = new javax.swing.JLabel();
|
||||||
SaveChanges = new javax.swing.JButton();
|
SaveChanges = new javax.swing.JButton();
|
||||||
jLabel1 = new javax.swing.JLabel();
|
jLabel1 = new javax.swing.JLabel();
|
||||||
|
idValue = new javax.swing.JLabel();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
@ -181,6 +208,8 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
jLabel1.setDoubleBuffered(true);
|
jLabel1.setDoubleBuffered(true);
|
||||||
jLabel1.setName(""); // NOI18N
|
jLabel1.setName(""); // NOI18N
|
||||||
|
|
||||||
|
idValue.setText(".");
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
@ -188,15 +217,6 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(Title)
|
|
||||||
.addComponent(authorname))
|
|
||||||
.addGap(35, 35, 35)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(authorName, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(bookTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(0, 20, Short.MAX_VALUE))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||||
.addComponent(lcategory, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(lcategory, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
@ -214,17 +234,30 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
.addComponent(SaveChanges, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(SaveChanges, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addComponent(jLabel1)
|
.addComponent(jLabel1)
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(mainlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(71, 71, 71))
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(Title)
|
||||||
|
.addComponent(authorname))
|
||||||
|
.addGap(35, 35, 35)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(authorName, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(bookTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(idValue, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(mainlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addGap(0, 20, Short.MAX_VALUE))))
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(mainlabel)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(mainlabel)
|
||||||
|
.addComponent(idValue))
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(Title)
|
.addComponent(Title)
|
||||||
@ -281,13 +314,22 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.getMessage();
|
e.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.edit) {
|
} else if (this.edit) {
|
||||||
Book b = new Book(0, bookTitle.getText(), authorName.getText(), authorSurname.getText(), year.getText(), ISBN.getText(), publishing.getText(), Category.getSelectedItem().toString());
|
Book b = new Book(0, bookTitle.getText(), authorName.getText(), authorSurname.getText(), year.getText(), ISBN.getText(), publishing.getText(), Category.getSelectedItem().toString());
|
||||||
this.search(b);
|
this.search(b, "edit");
|
||||||
} else if (this.delete) {
|
} else if (this.delete) {
|
||||||
JOptionPane.showMessageDialog(null, "USUŃ");
|
Book b = new Book(0, bookTitle.getText(), authorName.getText(), authorSurname.getText(), year.getText(), ISBN.getText(), publishing.getText(), Category.getSelectedItem().toString());
|
||||||
|
this.search(b, "delete");
|
||||||
} else if (this.search) {
|
} else if (this.search) {
|
||||||
|
Book b = new Book(0, bookTitle.getText(), authorName.getText(), authorSurname.getText(), year.getText(), ISBN.getText(), publishing.getText(), Category.getSelectedItem().toString());
|
||||||
|
this.search(b);
|
||||||
|
} else if (this.update) {
|
||||||
|
Book b = new Book(Integer.parseInt(idValue.getText()), bookTitle.getText(), authorName.getText(), authorSurname.getText(), year.getText(), ISBN.getText(), publishing.getText(), Category.getSelectedItem().toString());
|
||||||
|
try {
|
||||||
|
d.updateQ(b);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
dispose();
|
dispose();
|
||||||
@ -327,16 +369,24 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
if ("Nimbus".equals(info.getName())) {
|
if ("Nimbus".equals(info.getName())) {
|
||||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
java.util.logging.Logger.getLogger(BookFieldPattern.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
java.util.logging.Logger.getLogger(BookFieldPattern.class
|
||||||
|
.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||||
|
|
||||||
} catch (InstantiationException ex) {
|
} catch (InstantiationException ex) {
|
||||||
java.util.logging.Logger.getLogger(BookFieldPattern.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
java.util.logging.Logger.getLogger(BookFieldPattern.class
|
||||||
|
.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||||
|
|
||||||
} catch (IllegalAccessException ex) {
|
} catch (IllegalAccessException ex) {
|
||||||
java.util.logging.Logger.getLogger(BookFieldPattern.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
java.util.logging.Logger.getLogger(BookFieldPattern.class
|
||||||
|
.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||||
|
|
||||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||||
java.util.logging.Logger.getLogger(BookFieldPattern.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
java.util.logging.Logger.getLogger(BookFieldPattern.class
|
||||||
|
.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
@ -360,6 +410,7 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
|||||||
private javax.swing.JLabel authorname;
|
private javax.swing.JLabel authorname;
|
||||||
private javax.swing.JLabel authorsurname;
|
private javax.swing.JLabel authorsurname;
|
||||||
javax.swing.JTextField bookTitle;
|
javax.swing.JTextField bookTitle;
|
||||||
|
private javax.swing.JLabel idValue;
|
||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JLabel jLabel1;
|
||||||
private javax.swing.JLabel lISBN;
|
private javax.swing.JLabel lISBN;
|
||||||
private javax.swing.JLabel lcategory;
|
private javax.swing.JLabel lcategory;
|
||||||
|
@ -126,7 +126,7 @@ public class Database {
|
|||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
JOptionPane.showMessageDialog(null, "Błąd przy dodawaniu do bazy", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, "Błąd przy dodawaniu do bazy", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new SQLException("Error dodawania albumu");
|
throw new SQLException("Error dodawania filmu");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ public class Database {
|
|||||||
|
|
||||||
public List<Movie> selectMovies(Movie searchData) {
|
public List<Movie> selectMovies(Movie searchData) {
|
||||||
List<Movie> movies = new ArrayList<>();
|
List<Movie> movies = new ArrayList<>();
|
||||||
String query = "";
|
String query = new String();
|
||||||
try {
|
try {
|
||||||
List<String> wheres = new ArrayList<>();
|
List<String> wheres = new ArrayList<>();
|
||||||
if (searchData.getName().length() > 0) {
|
if (searchData.getName().length() > 0) {
|
||||||
@ -324,6 +324,7 @@ public class Database {
|
|||||||
wheres.add("category LIKE '" + searchData.getCategory() + "'");
|
wheres.add("category LIKE '" + searchData.getCategory() + "'");
|
||||||
}
|
}
|
||||||
if (!wheres.isEmpty()) {
|
if (!wheres.isEmpty()) {
|
||||||
|
System.out.println(wheres.size());
|
||||||
if (wheres.size() == 1) {
|
if (wheres.size() == 1) {
|
||||||
query = "SELECT * FROM movies WHERE " + wheres.get(0) + ";";
|
query = "SELECT * FROM movies WHERE " + wheres.get(0) + ";";
|
||||||
} else if (wheres.size() > 1) {
|
} else if (wheres.size() > 1) {
|
||||||
@ -336,18 +337,18 @@ public class Database {
|
|||||||
query += " AND " + wheres.get(i) + ";";
|
query += " AND " + wheres.get(i) + ";";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(query);
|
}
|
||||||
ResultSet result = stat.executeQuery(query);
|
System.out.println(query);
|
||||||
int id;
|
ResultSet result = stat.executeQuery(query);
|
||||||
String name, category, director, year;
|
int id;
|
||||||
while (result.next()) {
|
String name, category, director, year;
|
||||||
id = result.getInt("id");
|
while (result.next()) {
|
||||||
year = result.getString("year");
|
id = result.getInt("id");
|
||||||
name = result.getString("name");
|
year = result.getString("year");
|
||||||
director = result.getString("director");
|
name = result.getString("name");
|
||||||
category = result.getString("category");
|
director = result.getString("director");
|
||||||
movies.add(new Movie(id, name, director, year, category));
|
category = result.getString("category");
|
||||||
}
|
movies.add(new Movie(id, name, director, year, category));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,24 +376,84 @@ public class Database {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> void updateQ(T obj) throws SQLException {
|
||||||
|
if (obj instanceof Book) {
|
||||||
|
try {
|
||||||
|
Book b = (Book) obj;
|
||||||
|
PreparedStatement prepStmt = conn.prepareStatement(
|
||||||
|
"UPDATE books SET name = ?, author_name = ?, author_surname = ?, publishing = ?, year = ?, isbn = ?, category = ? WHERE id = ?;");
|
||||||
|
prepStmt.setString(1, b.getName());
|
||||||
|
prepStmt.setString(2, b.getAuthorName());
|
||||||
|
prepStmt.setString(3, b.getAuthorSurname());
|
||||||
|
prepStmt.setString(4, b.getPublishing());
|
||||||
|
prepStmt.setInt(5, b.getYear());
|
||||||
|
prepStmt.setString(6, b.getISBN());
|
||||||
|
prepStmt.setString(7, b.getCategory());
|
||||||
|
prepStmt.setInt(8, b.getId());
|
||||||
|
System.out.println(prepStmt.toString());
|
||||||
|
prepStmt.executeUpdate();
|
||||||
|
JOptionPane.showMessageDialog(null, "Zaktualizowano książkę poprawnie.", "Informacja:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Błąd przy aktualiacji bazy", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new SQLException("Error aktualizacji ksiazki");
|
||||||
|
}
|
||||||
|
} else if (obj instanceof Album) {
|
||||||
|
try {
|
||||||
|
Album a = (Album) obj;
|
||||||
|
PreparedStatement prepStmt = conn.prepareStatement(
|
||||||
|
"UPDATE albums SET name = ?, musican = ?, year = ?, category = ? WHERE id = ?;");
|
||||||
|
prepStmt.setString(1, a.getName());
|
||||||
|
prepStmt.setString(2, a.getMusican());
|
||||||
|
prepStmt.setInt(3, a.getYear());
|
||||||
|
prepStmt.setString(4, a.getCategory());
|
||||||
|
prepStmt.setInt(5, a.getId());
|
||||||
|
System.out.println(prepStmt.toString());
|
||||||
|
prepStmt.executeUpdate();
|
||||||
|
JOptionPane.showMessageDialog(null, "Zaktualizowano album poprawnie.", "Informacja:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Błąd przy aktualiacji bazy", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new SQLException("Error aktualizacji albumu");
|
||||||
|
}
|
||||||
|
} else if (obj instanceof Movie) {
|
||||||
|
try {
|
||||||
|
Movie m = (Movie) obj;
|
||||||
|
PreparedStatement prepStmt = conn.prepareStatement(
|
||||||
|
"UPDATE movies SET name = ?, director = ?, year = ?, category = ? WHERE id = ?;");
|
||||||
|
prepStmt.setString(1, m.getName());
|
||||||
|
prepStmt.setString(2, m.getDirector());
|
||||||
|
prepStmt.setInt(3, m.getYear());
|
||||||
|
prepStmt.setString(4, m.getCategory());
|
||||||
|
prepStmt.setInt(5, m.getId());
|
||||||
|
System.out.println(prepStmt.toString());
|
||||||
|
prepStmt.executeUpdate();
|
||||||
|
JOptionPane.showMessageDialog(null, "Zaktualizowano film poprawnie.", "Informacja:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Błąd przy aktualiacji bazy", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new SQLException("Error aktualizacji filmu");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Object[][] convertToTable(List<?> l) {
|
public Object[][] convertToTable(List<?> l) {
|
||||||
try {
|
try {
|
||||||
Object first = l.get(0);
|
Object first = l.get(0);
|
||||||
String type = first.getClass().getName();
|
|
||||||
int i = l.size();
|
int i = l.size();
|
||||||
if (type.equals("library.Book")) {
|
if (first instanceof Book) {
|
||||||
Object tab[][] = new Object[i][8];
|
Object tab[][] = new Object[i][8];
|
||||||
for (int y = 0; y < i; y++) { //kolejne wiersze danych
|
for (int y = 0; y < i; y++) { //kolejne wiersze danych
|
||||||
tab = Book.insertRowToTable(tab, y, (Book) l.get(y));
|
tab = Book.insertRowToTable(tab, y, (Book) l.get(y));
|
||||||
}
|
}
|
||||||
return tab;
|
return tab;
|
||||||
} else if (type.equals("library.Album")) {
|
} else if (first instanceof Album) {
|
||||||
Object tab[][] = new Object[i][5];
|
Object tab[][] = new Object[i][5];
|
||||||
for (int y = 0; y < i; y++) { //kolejne wiersze danych
|
for (int y = 0; y < i; y++) { //kolejne wiersze danych
|
||||||
tab = Album.insertRowToTable(tab, y, (Album) l.get(y));
|
tab = Album.insertRowToTable(tab, y, (Album) l.get(y));
|
||||||
}
|
}
|
||||||
return tab;
|
return tab;
|
||||||
} else if (type.equals("library.Movie")) {
|
} else if (first instanceof Movie) {
|
||||||
Object tab[][] = new Object[i][5];
|
Object tab[][] = new Object[i][5];
|
||||||
for (int y = 0; y < i; y++) { //kolejne wiersze danych
|
for (int y = 0; y < i; y++) { //kolejne wiersze danych
|
||||||
tab = Movie.insertRowToTable(tab, y, (Movie) l.get(y));
|
tab = Movie.insertRowToTable(tab, y, (Movie) l.get(y));
|
||||||
@ -401,7 +462,7 @@ public class Database {
|
|||||||
}
|
}
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
JOptionPane.showMessageDialog(null, "Brak danych.", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, "Brak danych.", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
throw new IndexOutOfBoundsException("Poza zakresem");
|
throw new IndexOutOfBoundsException("dł.tablicy = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -33,13 +33,16 @@
|
|||||||
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
|
||||||
<Component id="jScrollPane1" min="-2" pref="1180" max="-2" attributes="0"/>
|
<Component id="jScrollPane1" min="-2" pref="1180" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="496" max="-2" attributes="0"/>
|
|
||||||
<Component id="OK" min="-2" pref="215" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace pref="26" max="32767" attributes="0"/>
|
<EmptySpace pref="26" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
|
<Component id="editButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
|
<Component id="deleteButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="-2" pref="548" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
@ -49,9 +52,12 @@
|
|||||||
<Component id="mainlabel" min="-2" max="-2" attributes="0"/>
|
<Component id="mainlabel" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
|
||||||
<Component id="jScrollPane1" min="-2" pref="473" max="-2" attributes="0"/>
|
<Component id="jScrollPane1" min="-2" pref="473" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
<Component id="OK" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<EmptySpace pref="33" max="32767" attributes="0"/>
|
<Component id="editButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="deleteButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace pref="47" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -75,12 +81,10 @@
|
|||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JTable" name="table">
|
<Component class="javax.swing.JTable" name="table">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="autoCreateColumnsFromModel" type="boolean" editor="org.netbeans.modules.form.RADConnectionPropertyEditor" postCode="table.setModel(new javax.swing.table.DefaultTableModel(
 rows,
 columnsNames
));">
|
<Property name="autoCreateColumnsFromModel" type="boolean" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
<Connection code="false" type="code"/>
|
<Connection code="false" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor" postCode="table.setRowSelectionInterval(0, 0);">
|
<Property name="model" postCode="table.setRowSelectionInterval(0, 0);"/>
|
||||||
<Connection code="new javax.swing.table.DefaultTableModel(
 rows,
 columnsNames
)" type="code"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="rowHeight" type="int" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
<Property name="rowHeight" type="int" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
<Connection code="25" type="code"/>
|
<Connection code="25" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
@ -89,21 +93,29 @@
|
|||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
|
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="DefaultTableModel tableModel = new DefaultTableModel(rows, columnsNames) {

 @Override
 public boolean isCellEditable(int row, int column) {
 //all cells false
 return false;
 }
};
table.setModel(tableModel);"/>
|
||||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JTable(rows, columnsNames)"/>
|
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JTable(rows, columnsNames)"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
<Component class="javax.swing.JButton" name="OK">
|
<Component class="javax.swing.JButton" name="editButton">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Wybierz pozycję..."/>
|
<Property name="text" type="java.lang.String" value="Edytuj"/>
|
||||||
|
<Property name="enabled" type="boolean" value="false"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="OKActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editButtonActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JButton" name="deleteButton">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Usuń"/>
|
||||||
|
<Property name="enabled" type="boolean" value="false"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteButtonActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_ListenersCodePost" type="java.lang.String" value="int row = table.getSelectedRow();

if(row == -1)
{
OK.setVisible(false);
}
else
{
 
 // do whatever you need to do with the data from the row
}"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -20,15 +21,16 @@ public class ListResult extends javax.swing.JFrame {
|
|||||||
/**
|
/**
|
||||||
* Creates new form NewJFrame
|
* Creates new form NewJFrame
|
||||||
*/
|
*/
|
||||||
private Object[][] rows;
|
public String dataType;
|
||||||
private Object[] columnsNames;
|
private final Object[][] rows;
|
||||||
|
private final Object[] columnsNames;
|
||||||
|
|
||||||
public ListResult(Object[][] rowData, Object[] colNam) {
|
public ListResult(Object[][] rowData, Object[] colNam, String dataT) {
|
||||||
rows = rowData;
|
rows = rowData;
|
||||||
columnsNames = colNam;
|
columnsNames = colNam;
|
||||||
|
dataType = dataT;
|
||||||
initComponents();
|
initComponents();
|
||||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,7 +45,8 @@ public class ListResult extends javax.swing.JFrame {
|
|||||||
mainlabel = new javax.swing.JLabel();
|
mainlabel = new javax.swing.JLabel();
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
table = new javax.swing.JTable(rows, columnsNames);
|
table = new javax.swing.JTable(rows, columnsNames);
|
||||||
OK = new javax.swing.JButton();
|
editButton = new javax.swing.JButton();
|
||||||
|
deleteButton = new javax.swing.JButton();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
@ -52,36 +55,35 @@ public class ListResult extends javax.swing.JFrame {
|
|||||||
mainlabel.setText("Tabela danych");
|
mainlabel.setText("Tabela danych");
|
||||||
|
|
||||||
table.setAutoCreateColumnsFromModel(false);
|
table.setAutoCreateColumnsFromModel(false);
|
||||||
table.setModel(new javax.swing.table.DefaultTableModel(
|
|
||||||
rows,
|
|
||||||
columnsNames
|
|
||||||
));
|
|
||||||
table.setModel(new javax.swing.table.DefaultTableModel(
|
|
||||||
rows,
|
|
||||||
columnsNames
|
|
||||||
));
|
|
||||||
table.setRowSelectionInterval(0, 0);
|
table.setRowSelectionInterval(0, 0);
|
||||||
table.setRowHeight(25);
|
table.setRowHeight(25);
|
||||||
table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||||
jScrollPane1.setViewportView(table);
|
jScrollPane1.setViewportView(table);
|
||||||
|
DefaultTableModel tableModel = new DefaultTableModel(rows, columnsNames) {
|
||||||
|
|
||||||
OK.setText("Wybierz pozycję...");
|
@Override
|
||||||
OK.addActionListener(new java.awt.event.ActionListener() {
|
public boolean isCellEditable(int row, int column) {
|
||||||
|
//all cells false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
table.setModel(tableModel);
|
||||||
|
|
||||||
|
editButton.setText("Edytuj");
|
||||||
|
editButton.setEnabled(false);
|
||||||
|
editButton.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
OKActionPerformed(evt);
|
editButtonActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
int row = table.getSelectedRow();
|
|
||||||
|
|
||||||
if(row == -1)
|
deleteButton.setText("Usuń");
|
||||||
{
|
deleteButton.setEnabled(false);
|
||||||
OK.setVisible(false);
|
deleteButton.addActionListener(new java.awt.event.ActionListener() {
|
||||||
}
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
else
|
deleteButtonActionPerformed(evt);
|
||||||
{
|
}
|
||||||
|
});
|
||||||
// do whatever you need to do with the data from the row
|
|
||||||
}
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@ -94,11 +96,14 @@ public class ListResult extends javax.swing.JFrame {
|
|||||||
.addComponent(mainlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(mainlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(23, 23, 23)
|
.addGap(23, 23, 23)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1180, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1180, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGap(496, 496, 496)
|
|
||||||
.addComponent(OK, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addContainerGap(26, Short.MAX_VALUE))
|
.addContainerGap(26, Short.MAX_VALUE))
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE)
|
||||||
|
.addComponent(editButton)
|
||||||
|
.addGap(18, 18, 18)
|
||||||
|
.addComponent(deleteButton)
|
||||||
|
.addGap(548, 548, 548))
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
@ -107,17 +112,70 @@ public class ListResult extends javax.swing.JFrame {
|
|||||||
.addComponent(mainlabel)
|
.addComponent(mainlabel)
|
||||||
.addGap(13, 13, 13)
|
.addGap(13, 13, 13)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 473, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 473, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(32, 32, 32)
|
.addGap(18, 18, 18)
|
||||||
.addComponent(OK)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addContainerGap(33, Short.MAX_VALUE))
|
.addComponent(editButton)
|
||||||
|
.addComponent(deleteButton))
|
||||||
|
.addContainerGap(47, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKActionPerformed
|
public boolean isCellEditable(int row, int col) {
|
||||||
// TODO add your handling code here:
|
return false;
|
||||||
}//GEN-LAST:event_OKActionPerformed
|
}
|
||||||
|
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
|
||||||
|
int selectedRowIndex = table.getSelectedRow();
|
||||||
|
System.out.println(selectedRowIndex);
|
||||||
|
if (dataType.equals("book")) {
|
||||||
|
Book b = new Book(
|
||||||
|
(Integer) table.getValueAt(selectedRowIndex, 0),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 1),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 2),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 3),
|
||||||
|
Integer.toString((Integer) table.getValueAt(selectedRowIndex, 4)),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 5),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 6),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 7));
|
||||||
|
|
||||||
|
BookFieldPattern bookPattern = new BookFieldPattern(true, b);
|
||||||
|
bookPattern.setVisible(true);
|
||||||
|
} else if (dataType.equals("movie")) {
|
||||||
|
Movie m = new Movie(
|
||||||
|
(Integer) table.getValueAt(selectedRowIndex, 0),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 1),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 2),
|
||||||
|
Integer.toString((Integer) table.getValueAt(selectedRowIndex, 3)),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 4));
|
||||||
|
MovieFieldPattern moviePattern = new MovieFieldPattern(true, m);
|
||||||
|
moviePattern.setVisible(true);
|
||||||
|
} else if (dataType.equals("album")) {
|
||||||
|
Album a = new Album(
|
||||||
|
(Integer) table.getValueAt(selectedRowIndex, 0),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 1),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 2),
|
||||||
|
Integer.toString((Integer) table.getValueAt(selectedRowIndex, 3)),
|
||||||
|
(String) table.getValueAt(selectedRowIndex, 4));
|
||||||
|
AlbumFieldPattern albumPattern = new AlbumFieldPattern(true, a);
|
||||||
|
albumPattern.setVisible(true);
|
||||||
|
}
|
||||||
|
dispose();
|
||||||
|
}//GEN-LAST:event_editButtonActionPerformed
|
||||||
|
|
||||||
|
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
|
||||||
|
int selectedRowIndex = table.getSelectedRow();
|
||||||
|
System.out.println(selectedRowIndex);
|
||||||
|
|
||||||
|
}//GEN-LAST:event_deleteButtonActionPerformed
|
||||||
|
|
||||||
|
public void setEnabledButton(String which) {
|
||||||
|
if (which.equals("edit")) {
|
||||||
|
editButton.setEnabled(true);
|
||||||
|
} else if (which.equals("delete")) {
|
||||||
|
deleteButton.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args the command line arguments
|
* @param args the command line arguments
|
||||||
@ -165,7 +223,8 @@ public class ListResult extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton OK;
|
private javax.swing.JButton deleteButton;
|
||||||
|
private javax.swing.JButton editButton;
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
private javax.swing.JLabel mainlabel;
|
private javax.swing.JLabel mainlabel;
|
||||||
private javax.swing.JTable table;
|
private javax.swing.JTable table;
|
||||||
|
@ -31,32 +31,31 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="programTitle" max="32767" attributes="0"/>
|
<Component id="programTitle" pref="817" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace min="-2" pref="359" max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Component id="jToggleButton1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="359" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
|
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="searchButtonsPanel" min="-2" max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jToggleButton1" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
|
<Component id="searchButtonsPanel" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace min="-2" pref="141" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
@ -64,17 +63,18 @@
|
|||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
|
||||||
<Component id="programTitle" min="-2" pref="38" max="-2" attributes="0"/>
|
<Component id="programTitle" min="-2" pref="38" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="searchButtonsPanel" min="-2" pref="87" max="-2" attributes="0"/>
|
<Component id="searchButtonsPanel" min="-2" pref="87" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
</Group>
|
||||||
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
<Component id="jToggleButton1" min="-2" max="-2" attributes="0"/>
|
<Component id="jToggleButton1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="43" max="32767" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -116,12 +116,12 @@
|
|||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Component id="radioBSearch" min="-2" max="-2" attributes="0"/>
|
<Component id="radioBSearch" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="61" max="32767" attributes="0"/>
|
<EmptySpace pref="133" max="32767" attributes="0"/>
|
||||||
<Component id="radioBAdd" min="-2" max="-2" attributes="0"/>
|
<Component id="radioBAdd" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="radioBEdit" min="-2" max="-2" attributes="0"/>
|
<Component id="radioBEdit" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
<Component id="radioBDelete1" min="-2" max="-2" attributes="0"/>
|
<Component id="radioBDelete" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="78" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="78" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -135,7 +135,7 @@
|
|||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="radioBAdd" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="radioBAdd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="radioBEdit" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="radioBEdit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="radioBDelete1" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="radioBDelete" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="radioBSearch" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="radioBSearch" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
@ -196,7 +196,7 @@
|
|||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioBEditActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioBEditActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JRadioButton" name="radioBDelete1">
|
<Component class="javax.swing.JRadioButton" name="radioBDelete">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="mode"/>
|
<ComponentRef name="mode"/>
|
||||||
@ -204,7 +204,7 @@
|
|||||||
<Property name="text" type="java.lang.String" value="Usuwanie"/>
|
<Property name="text" type="java.lang.String" value="Usuwanie"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioBDelete1ActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioBDeleteActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JRadioButton" name="radioBSearch">
|
<Component class="javax.swing.JRadioButton" name="radioBSearch">
|
||||||
|
@ -41,7 +41,7 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
bBook = new javax.swing.JButton();
|
bBook = new javax.swing.JButton();
|
||||||
radioBAdd = new javax.swing.JRadioButton();
|
radioBAdd = new javax.swing.JRadioButton();
|
||||||
radioBEdit = new javax.swing.JRadioButton();
|
radioBEdit = new javax.swing.JRadioButton();
|
||||||
radioBDelete1 = new javax.swing.JRadioButton();
|
radioBDelete = new javax.swing.JRadioButton();
|
||||||
radioBSearch = new javax.swing.JRadioButton();
|
radioBSearch = new javax.swing.JRadioButton();
|
||||||
jPanel1 = new javax.swing.JPanel();
|
jPanel1 = new javax.swing.JPanel();
|
||||||
allMovieShow = new javax.swing.JButton();
|
allMovieShow = new javax.swing.JButton();
|
||||||
@ -108,11 +108,11 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mode.add(radioBDelete1);
|
mode.add(radioBDelete);
|
||||||
radioBDelete1.setText("Usuwanie");
|
radioBDelete.setText("Usuwanie");
|
||||||
radioBDelete1.addActionListener(new java.awt.event.ActionListener() {
|
radioBDelete.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
radioBDelete1ActionPerformed(evt);
|
radioBDeleteActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -141,12 +141,12 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
.addGroup(searchButtonsPanelLayout.createSequentialGroup()
|
.addGroup(searchButtonsPanelLayout.createSequentialGroup()
|
||||||
.addComponent(radioBSearch)
|
.addComponent(radioBSearch)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 61, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 133, Short.MAX_VALUE)
|
||||||
.addComponent(radioBAdd)
|
.addComponent(radioBAdd)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(radioBEdit)
|
.addComponent(radioBEdit)
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addComponent(radioBDelete1)
|
.addComponent(radioBDelete)
|
||||||
.addGap(78, 78, 78))))
|
.addGap(78, 78, 78))))
|
||||||
);
|
);
|
||||||
searchButtonsPanelLayout.setVerticalGroup(
|
searchButtonsPanelLayout.setVerticalGroup(
|
||||||
@ -156,7 +156,7 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
.addGroup(searchButtonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(searchButtonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(radioBAdd)
|
.addComponent(radioBAdd)
|
||||||
.addComponent(radioBEdit)
|
.addComponent(radioBEdit)
|
||||||
.addComponent(radioBDelete1)
|
.addComponent(radioBDelete)
|
||||||
.addComponent(radioBSearch))
|
.addComponent(radioBSearch))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addGroup(searchButtonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(searchButtonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
@ -327,40 +327,40 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(programTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.addComponent(programTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 817, Short.MAX_VALUE))
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGap(359, 359, 359)
|
||||||
|
.addComponent(jLabel1))
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGap(19, 19, 19)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(jToggleButton1)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(359, 359, 359)
|
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(jLabel1))
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||||
.addGap(26, 26, 26)
|
|
||||||
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGap(19, 19, 19)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jToggleButton1))))
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE)))
|
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE)
|
||||||
|
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addGap(141, 141, 141))
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(24, 24, 24)
|
.addGap(24, 24, 24)
|
||||||
.addComponent(programTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(programTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(13, 13, 13)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(jLabel1)
|
.addComponent(jLabel1)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addGap(18, 18, 18)
|
||||||
.addComponent(jToggleButton1)
|
.addComponent(jToggleButton1)
|
||||||
.addContainerGap(43, Short.MAX_VALUE))
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
@ -382,6 +382,11 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
b.setVisible(true);
|
b.setVisible(true);
|
||||||
b.delete = true;
|
b.delete = true;
|
||||||
}
|
}
|
||||||
|
if (radioBDelete.getModel().isSelected()) {
|
||||||
|
MovieFieldPattern b = new MovieFieldPattern();
|
||||||
|
b.setVisible(true);
|
||||||
|
b.delete = true;
|
||||||
|
}
|
||||||
}//GEN-LAST:event_bMovieActionPerformed
|
}//GEN-LAST:event_bMovieActionPerformed
|
||||||
|
|
||||||
private void bAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAlbumActionPerformed
|
private void bAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAlbumActionPerformed
|
||||||
@ -431,12 +436,17 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
b.setVisible(true);
|
b.setVisible(true);
|
||||||
b.search = true;
|
b.search = true;
|
||||||
}
|
}
|
||||||
|
if (radioBDelete.getModel().isSelected()) {
|
||||||
|
BookFieldPattern b = new BookFieldPattern();
|
||||||
|
b.setVisible(true);
|
||||||
|
b.delete = true;
|
||||||
|
}
|
||||||
|
|
||||||
}//GEN-LAST:event_bBookActionPerformed
|
}//GEN-LAST:event_bBookActionPerformed
|
||||||
|
|
||||||
private void radioBDelete1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioBDelete1ActionPerformed
|
private void radioBDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioBDeleteActionPerformed
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
}//GEN-LAST:event_radioBDelete1ActionPerformed
|
}//GEN-LAST:event_radioBDeleteActionPerformed
|
||||||
|
|
||||||
private void allBooksShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allBooksShowActionPerformed
|
private void allBooksShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allBooksShowActionPerformed
|
||||||
try {
|
try {
|
||||||
@ -451,7 +461,7 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
"ISBN",
|
"ISBN",
|
||||||
"Wydawnictwo",
|
"Wydawnictwo",
|
||||||
"Kategoria"};
|
"Kategoria"};
|
||||||
ListResult table = new ListResult(data, columnNames);
|
ListResult table = new ListResult(data, columnNames, "book");
|
||||||
table.setVisible(true);
|
table.setVisible(true);
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
//nothing to do here
|
//nothing to do here
|
||||||
@ -469,7 +479,7 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
"Reżyser",
|
"Reżyser",
|
||||||
"Rok",
|
"Rok",
|
||||||
"Kategoria"};
|
"Kategoria"};
|
||||||
ListResult table = new ListResult(data, columnNames);
|
ListResult table = new ListResult(data, columnNames, "movie");
|
||||||
table.setVisible(true);
|
table.setVisible(true);
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
//nothing to do here
|
//nothing to do here
|
||||||
@ -488,7 +498,7 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
"Muzyk/Zespół",
|
"Muzyk/Zespół",
|
||||||
"Rok",
|
"Rok",
|
||||||
"Kategoria"};
|
"Kategoria"};
|
||||||
ListResult table = new ListResult(data, columnNames);
|
ListResult table = new ListResult(data, columnNames, "album");
|
||||||
|
|
||||||
table.setVisible(true);
|
table.setVisible(true);
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
@ -568,7 +578,7 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
private javax.swing.JLabel numberOfMovies;
|
private javax.swing.JLabel numberOfMovies;
|
||||||
private javax.swing.JLabel programTitle;
|
private javax.swing.JLabel programTitle;
|
||||||
private javax.swing.JRadioButton radioBAdd;
|
private javax.swing.JRadioButton radioBAdd;
|
||||||
private javax.swing.JRadioButton radioBDelete1;
|
private javax.swing.JRadioButton radioBDelete;
|
||||||
private javax.swing.JRadioButton radioBEdit;
|
private javax.swing.JRadioButton radioBEdit;
|
||||||
private javax.swing.JRadioButton radioBSearch;
|
private javax.swing.JRadioButton radioBSearch;
|
||||||
private javax.swing.JButton refreshNumbersOfItems;
|
private javax.swing.JButton refreshNumbersOfItems;
|
||||||
|
@ -30,8 +30,9 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="Title" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="Title" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="directorrname" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="directorrname" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="idValue" alignment="0" min="-2" pref="57" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="-2" pref="56" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="52" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="director" min="-2" pref="219" max="-2" attributes="0"/>
|
<Component id="director" min="-2" pref="219" max="-2" attributes="0"/>
|
||||||
<Component id="movieTitle" min="-2" pref="362" max="-2" attributes="0"/>
|
<Component id="movieTitle" min="-2" pref="362" max="-2" attributes="0"/>
|
||||||
@ -47,11 +48,7 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="year" alignment="0" min="-2" pref="76" max="-2" attributes="0"/>
|
<Component id="year" alignment="0" min="-2" pref="76" max="-2" attributes="0"/>
|
||||||
<Component id="Category" min="-2" pref="220" max="-2" attributes="0"/>
|
<Component id="Category" min="-2" pref="220" max="-2" attributes="0"/>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Component id="SaveChanges" alignment="0" min="-2" pref="220" max="-2" attributes="0"/>
|
||||||
<Component id="SaveChanges" min="-2" pref="220" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Component id="cancel" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -63,7 +60,10 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="mainlabel" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="mainlabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="idValue" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="Title" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="Title" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
@ -85,11 +85,8 @@
|
|||||||
<Component id="Category" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="Category" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Component id="SaveChanges" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="SaveChanges" alignment="3" min="-2" max="-2" attributes="0"/>
|
<EmptySpace pref="26" max="32767" attributes="0"/>
|
||||||
<Component id="cancel" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="25" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -139,9 +136,6 @@
|
|||||||
<Font name="Tahoma" size="14" style="0"/>
|
<Font name="Tahoma" size="14" style="0"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="yearActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="lcategory">
|
<Component class="javax.swing.JLabel" name="lcategory">
|
||||||
<Properties>
|
<Properties>
|
||||||
@ -154,22 +148,55 @@
|
|||||||
<Component class="javax.swing.JComboBox" name="Category">
|
<Component class="javax.swing.JComboBox" name="Category">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||||
<StringArray count="9">
|
<StringArray count="45">
|
||||||
<StringItem index="0" value=" "/>
|
<StringItem index="0" value=" "/>
|
||||||
<StringItem index="1" value="Kryminał"/>
|
<StringItem index="1" value="Akcji"/>
|
||||||
<StringItem index="2" value="Thriller"/>
|
<StringItem index="2" value="Anime"/>
|
||||||
<StringItem index="3" value="Przygodowy"/>
|
<StringItem index="3" value="Animowany"/>
|
||||||
<StringItem index="4" value="Animowany"/>
|
<StringItem index="4" value="Baśń"/>
|
||||||
<StringItem index="5" value="Akcji"/>
|
<StringItem index="5" value="Biograficzny"/>
|
||||||
<StringItem index="6" value="Dla dzieci"/>
|
<StringItem index="6" value="Dla dzieci"/>
|
||||||
<StringItem index="7" value="Komedia"/>
|
<StringItem index="7" value="Dla młodzieży"/>
|
||||||
<StringItem index="8" value="Horror"/>
|
<StringItem index="8" value="Dokument"/>
|
||||||
|
<StringItem index="9" value="Dokumentalizowany"/>
|
||||||
|
<StringItem index="10" value="Dramat"/>
|
||||||
|
<StringItem index="11" value="Edukacyjny"/>
|
||||||
|
<StringItem index="12" value="Etiuda"/>
|
||||||
|
<StringItem index="13" value="Fabularyzowany dokument"/>
|
||||||
|
<StringItem index="14" value="Familijny"/>
|
||||||
|
<StringItem index="15" value="Fantastyka"/>
|
||||||
|
<StringItem index="16" value="Fantasy"/>
|
||||||
|
<StringItem index="17" value="Historyczny"/>
|
||||||
|
<StringItem index="18" value="Horror"/>
|
||||||
|
<StringItem index="19" value="Karate"/>
|
||||||
|
<StringItem index="20" value="Katastroficzny"/>
|
||||||
|
<StringItem index="21" value="Komedia"/>
|
||||||
|
<StringItem index="22" value="Komedia romantyczna"/>
|
||||||
|
<StringItem index="23" value="Komediodramat"/>
|
||||||
|
<StringItem index="24" value="Kostiumowy"/>
|
||||||
|
<StringItem index="25" value="Kryminał"/>
|
||||||
|
<StringItem index="26" value="Kung-fu"/>
|
||||||
|
<StringItem index="27" value="Melodramat"/>
|
||||||
|
<StringItem index="28" value="Musical"/>
|
||||||
|
<StringItem index="29" value="Obyczajowy"/>
|
||||||
|
<StringItem index="30" value="Parodia"/>
|
||||||
|
<StringItem index="31" value="Przygodowy"/>
|
||||||
|
<StringItem index="32" value="Przyrodniczy"/>
|
||||||
|
<StringItem index="33" value="Psychologiczny"/>
|
||||||
|
<StringItem index="34" value="Religijny"/>
|
||||||
|
<StringItem index="35" value="Romans"/>
|
||||||
|
<StringItem index="36" value="Satyra"/>
|
||||||
|
<StringItem index="37" value="Science fiction"/>
|
||||||
|
<StringItem index="38" value="Sensacja"/>
|
||||||
|
<StringItem index="39" value="Sportowy"/>
|
||||||
|
<StringItem index="40" value="Surrealistyczny"/>
|
||||||
|
<StringItem index="41" value="Sztuki walki"/>
|
||||||
|
<StringItem index="42" value="Thriller"/>
|
||||||
|
<StringItem index="43" value="Western"/>
|
||||||
|
<StringItem index="44" value="Wojenny"/>
|
||||||
</StringArray>
|
</StringArray>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CategoryActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
@ -194,13 +221,10 @@
|
|||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="SaveChangesActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="SaveChangesActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JButton" name="cancel">
|
<Component class="javax.swing.JLabel" name="idValue">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Anuluj"/>
|
<Property name="text" type="java.lang.String" value="."/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -17,7 +17,7 @@ import javax.swing.JOptionPane;
|
|||||||
*/
|
*/
|
||||||
public class MovieFieldPattern extends javax.swing.JFrame {
|
public class MovieFieldPattern extends javax.swing.JFrame {
|
||||||
|
|
||||||
public boolean add = false, delete = false, edit = false, search = false;
|
public boolean add = false, delete = false, edit = false, search = false, update = false;
|
||||||
private Database d = new Database();
|
private Database d = new Database();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +28,7 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MovieFieldPattern(boolean required) {
|
public MovieFieldPattern(boolean required, Movie... m) {
|
||||||
initComponents();
|
initComponents();
|
||||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
Validation verify;
|
Validation verify;
|
||||||
@ -40,6 +40,47 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
movieTitle.setInputVerifier(verify);
|
movieTitle.setInputVerifier(verify);
|
||||||
director.setInputVerifier(verify);
|
director.setInputVerifier(verify);
|
||||||
year.setInputVerifier(verify);
|
year.setInputVerifier(verify);
|
||||||
|
try {
|
||||||
|
if (m[0].getId() >= 0) {
|
||||||
|
fillField(m[0]);
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
//when only one parameter is defined
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fillField(Movie m) {
|
||||||
|
idValue.setText(Integer.toString(m.getId()));
|
||||||
|
movieTitle.setText(m.getName());
|
||||||
|
director.setText(m.getDirector());
|
||||||
|
year.setText(Integer.toString(m.getYear()));
|
||||||
|
Category.setSelectedItem(m.getCategory());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(Movie m, String... mode) {
|
||||||
|
try {
|
||||||
|
List<Movie> movies = new LinkedList<>();
|
||||||
|
movies = d.selectMovies(m);
|
||||||
|
Object[][] data = d.convertToTable(movies);
|
||||||
|
String[] columnNames = {
|
||||||
|
"ID",
|
||||||
|
"Tytuł",
|
||||||
|
"Reżyser",
|
||||||
|
"Rok",
|
||||||
|
"Kategoria"};
|
||||||
|
ListResult table = new ListResult(data, columnNames, "movie");
|
||||||
|
table.setVisible(true);
|
||||||
|
if (mode[0].equals("edit")) {
|
||||||
|
table.setEnabledButton("edit");
|
||||||
|
}
|
||||||
|
if (mode[0].equals("delete")) {
|
||||||
|
table.setEnabledButton("delete");
|
||||||
|
}
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
//nothing to do here
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,7 +102,7 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
Category = new javax.swing.JComboBox<>();
|
Category = new javax.swing.JComboBox<>();
|
||||||
mainlabel = new javax.swing.JLabel();
|
mainlabel = new javax.swing.JLabel();
|
||||||
SaveChanges = new javax.swing.JButton();
|
SaveChanges = new javax.swing.JButton();
|
||||||
cancel = new javax.swing.JButton();
|
idValue = new javax.swing.JLabel();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
@ -79,21 +120,11 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
lyear.setText("Rok:");
|
lyear.setText("Rok:");
|
||||||
|
|
||||||
year.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
year.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||||
year.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
yearActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lcategory.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
lcategory.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||||
lcategory.setText("Kategoria:");
|
lcategory.setText("Kategoria:");
|
||||||
|
|
||||||
Category.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " ", "Kryminał", "Thriller", "Przygodowy", "Animowany", "Akcji", "Dla dzieci", "Komedia", "Horror" }));
|
Category.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " ", "Akcji", "Anime", "Animowany", "Baśń", "Biograficzny", "Dla dzieci", "Dla młodzieży", "Dokument", "Dokumentalizowany", "Dramat", "Edukacyjny", "Etiuda", "Fabularyzowany dokument", "Familijny", "Fantastyka", "Fantasy", "Historyczny", "Horror", "Karate", "Katastroficzny", "Komedia", "Komedia romantyczna", "Komediodramat", "Kostiumowy", "Kryminał", "Kung-fu", "Melodramat", "Musical", "Obyczajowy", "Parodia", "Przygodowy", "Przyrodniczy", "Psychologiczny", "Religijny", "Romans", "Satyra", "Science fiction", "Sensacja", "Sportowy", "Surrealistyczny", "Sztuki walki", "Thriller", "Western", "Wojenny" }));
|
||||||
Category.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
CategoryActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mainlabel.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
|
mainlabel.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
|
||||||
mainlabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
mainlabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
@ -107,12 +138,7 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cancel.setText("Anuluj");
|
idValue.setText(".");
|
||||||
cancel.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@ -124,8 +150,9 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(Title)
|
.addComponent(Title)
|
||||||
.addComponent(directorrname))
|
.addComponent(directorrname)
|
||||||
.addGap(56, 56, 56)
|
.addComponent(idValue, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGap(52, 52, 52)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(director, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(director, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(movieTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(movieTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
@ -138,17 +165,16 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(year, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(year, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(Category, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(Category, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addComponent(SaveChanges, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||||
.addComponent(SaveChanges, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(cancel)))))
|
|
||||||
.addContainerGap(21, Short.MAX_VALUE))
|
.addContainerGap(21, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(mainlabel)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(mainlabel)
|
||||||
|
.addComponent(idValue))
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(Title)
|
.addComponent(Title)
|
||||||
@ -166,10 +192,8 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
.addComponent(lcategory)
|
.addComponent(lcategory)
|
||||||
.addComponent(Category, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(Category, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGap(33, 33, 33)
|
.addGap(33, 33, 33)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addComponent(SaveChanges)
|
||||||
.addComponent(SaveChanges)
|
.addContainerGap(26, Short.MAX_VALUE))
|
||||||
.addComponent(cancel))
|
|
||||||
.addContainerGap(25, Short.MAX_VALUE))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
@ -179,10 +203,6 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
this.SaveChanges.setText(s);
|
this.SaveChanges.setText(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CategoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CategoryActionPerformed
|
|
||||||
// TODO add your handling code here:
|
|
||||||
}//GEN-LAST:event_CategoryActionPerformed
|
|
||||||
|
|
||||||
private void SaveChangesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveChangesActionPerformed
|
private void SaveChangesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveChangesActionPerformed
|
||||||
if (this.add) {
|
if (this.add) {
|
||||||
try {
|
try {
|
||||||
@ -193,36 +213,25 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
e.getMessage();
|
e.getMessage();
|
||||||
}
|
}
|
||||||
} else if (this.edit) {
|
} else if (this.edit) {
|
||||||
try {
|
Movie m = new Movie(0, movieTitle.getText(), director.getText(), year.getText(), Category.getSelectedItem().toString());
|
||||||
List<Movie> movies = new LinkedList<>();
|
this.search(m, "edit");
|
||||||
Movie m = new Movie(0, movieTitle.getText(), director.getText(), year.getText(), Category.getSelectedItem().toString());
|
|
||||||
movies = d.selectMovies(m);
|
|
||||||
Object[][] data = d.convertToTable(movies);
|
|
||||||
String[] columnNames = {
|
|
||||||
"ID",
|
|
||||||
"Tytuł",
|
|
||||||
"Reżyser",
|
|
||||||
"Rok",
|
|
||||||
"Kategoria"};
|
|
||||||
ListResult table = new ListResult(data, columnNames);
|
|
||||||
table.setVisible(true);
|
|
||||||
} catch (IndexOutOfBoundsException e) {
|
|
||||||
//nothing to do here
|
|
||||||
}
|
|
||||||
} else if (this.delete) {
|
} else if (this.delete) {
|
||||||
JOptionPane.showMessageDialog(null, "USUŃ");
|
Movie m = new Movie(0, movieTitle.getText(), director.getText(), year.getText(), Category.getSelectedItem().toString());
|
||||||
|
this.search(m, "delete");
|
||||||
|
} else if (this.search) {
|
||||||
|
Movie m = new Movie(0, movieTitle.getText(), director.getText(), year.getText(), Category.getSelectedItem().toString());
|
||||||
|
this.search(m);
|
||||||
|
} else if (this.update) {
|
||||||
|
Movie m = new Movie(Integer.parseInt(idValue.getText()), movieTitle.getText(), director.getText(), year.getText(), Category.getSelectedItem().toString());
|
||||||
|
try {
|
||||||
|
d.updateQ(m);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
dispose();
|
||||||
}//GEN-LAST:event_SaveChangesActionPerformed
|
}//GEN-LAST:event_SaveChangesActionPerformed
|
||||||
|
|
||||||
private void yearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yearActionPerformed
|
|
||||||
// TODO add your handling code here:
|
|
||||||
}//GEN-LAST:event_yearActionPerformed
|
|
||||||
|
|
||||||
private void cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelActionPerformed
|
|
||||||
this.dispose();
|
|
||||||
}//GEN-LAST:event_cancelActionPerformed
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args the command line arguments
|
* @param args the command line arguments
|
||||||
*/
|
*/
|
||||||
@ -264,9 +273,9 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
|||||||
private javax.swing.JComboBox<String> Category;
|
private javax.swing.JComboBox<String> Category;
|
||||||
private javax.swing.JButton SaveChanges;
|
private javax.swing.JButton SaveChanges;
|
||||||
private javax.swing.JLabel Title;
|
private javax.swing.JLabel Title;
|
||||||
private javax.swing.JButton cancel;
|
|
||||||
private javax.swing.JTextField director;
|
private javax.swing.JTextField director;
|
||||||
private javax.swing.JLabel directorrname;
|
private javax.swing.JLabel directorrname;
|
||||||
|
private javax.swing.JLabel idValue;
|
||||||
private javax.swing.JLabel lcategory;
|
private javax.swing.JLabel lcategory;
|
||||||
private javax.swing.JLabel lyear;
|
private javax.swing.JLabel lyear;
|
||||||
private javax.swing.JLabel mainlabel;
|
private javax.swing.JLabel mainlabel;
|
||||||
|
Loading…
Reference in New Issue
Block a user