Repository navigation
Expand file tree
/
Copy pathManagePropertiesPage.java
More file actions
275 lines (239 loc) · 11.5 KB
/
Copy pathManagePropertiesPage.java
File metadata and controls
275 lines (239 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Image;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import java.awt.Font;
/**
*
* @author thesc
*/
public class ManagePropertiesPage extends javax.swing.JPanel { //View class for Manage Properties Page, generated using NetBeans
private JPanel panelInsideScrollPane;
private ArrayList<JButton> viewDetailsButtons = new ArrayList<>();
/**
* Creates new form ManagePropertiesPage
*/
public ManagePropertiesPage() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
sideBarPanel = new javax.swing.JPanel();
sideBarPanel.setBounds(0, 0, 246, 746);
sidebarPanel = new javax.swing.JPanel();
homeButton = new javax.swing.JButton();
rentRequestsButton = new javax.swing.JButton();
managePropertiesButton = new javax.swing.JButton();
newPropertyPageButton = new javax.swing.JButton();
logOutButton = new javax.swing.JButton();
titleLabel = new javax.swing.JLabel();
titleLabel.setBounds(252, 11, 276, 33);
requestsScrollPane = new javax.swing.JScrollPane();
requestsScrollPane.setBounds(252, 62, 750, 600);
setSize(new java.awt.Dimension(1024, 700));
setPreferredSize(new java.awt.Dimension(1024, 700));
sideBarPanel.setPreferredSize(new java.awt.Dimension(255, 684));
sidebarPanel.setBackground(new Color(236, 77, 55));
sidebarPanel.setPreferredSize(new java.awt.Dimension(255, 684));
homeButton.setBackground(new Color(236, 77, 55));
homeButton.setFont(new java.awt.Font("Source Serif Pro Black", 0, 25)); // NOI18N
homeButton.setForeground(new java.awt.Color(255, 255, 255));
homeButton.setText("Home");
homeButton.setBorder(null);
rentRequestsButton.setBackground(new Color(236, 77, 55));
rentRequestsButton.setFont(new java.awt.Font("Source Serif Pro Black", 0, 25)); // NOI18N
rentRequestsButton.setForeground(new java.awt.Color(255, 255, 255));
rentRequestsButton.setText("Rent requests");
rentRequestsButton.setBorder(null);
managePropertiesButton.setBackground(new Color(236, 77, 55));
managePropertiesButton.setFont(new Font("Source Serif Pro Black", Font.PLAIN, 23)); // NOI18N
managePropertiesButton.setForeground(new java.awt.Color(255, 255, 255));
managePropertiesButton.setText("Manage Properties");
managePropertiesButton.setBorder(null);
newPropertyPageButton.setBackground(new Color(236, 77, 55));
newPropertyPageButton.setFont(new java.awt.Font("Source Serif Pro Black", 0, 25)); // NOI18N
newPropertyPageButton.setForeground(new java.awt.Color(255, 255, 255));
newPropertyPageButton.setText("New Property");
newPropertyPageButton.setBorder(null);
logOutButton.setBackground(new Color(236, 77, 55));
logOutButton.setFont(new java.awt.Font("Source Serif Pro Black", 0, 25)); // NOI18N
logOutButton.setForeground(new java.awt.Color(255, 255, 255));
logOutButton.setText("Log Out");
logOutButton.setBorder(null);
javax.swing.GroupLayout sidebarPanelLayout = new javax.swing.GroupLayout(sidebarPanel);
sidebarPanelLayout.setHorizontalGroup(
sidebarPanelLayout.createParallelGroup(Alignment.LEADING)
.addGroup(sidebarPanelLayout.createSequentialGroup()
.addGap(27)
.addGroup(sidebarPanelLayout.createParallelGroup(Alignment.LEADING)
.addComponent(managePropertiesButton)
.addComponent(logOutButton)
.addComponent(newPropertyPageButton)
.addComponent(rentRequestsButton)
.addComponent(homeButton))
.addContainerGap(30, Short.MAX_VALUE))
);
sidebarPanelLayout.setVerticalGroup(
sidebarPanelLayout.createParallelGroup(Alignment.LEADING)
.addGroup(sidebarPanelLayout.createSequentialGroup()
.addGap(38)
.addComponent(homeButton)
.addGap(18)
.addComponent(rentRequestsButton)
.addGap(38)
.addComponent(managePropertiesButton)
.addGap(34)
.addComponent(newPropertyPageButton)
.addGap(18)
.addComponent(logOutButton)
.addContainerGap(517, Short.MAX_VALUE))
);
sidebarPanel.setLayout(sidebarPanelLayout);
javax.swing.GroupLayout sideBarPanelLayout = new javax.swing.GroupLayout(sideBarPanel);
sideBarPanel.setLayout(sideBarPanelLayout);
sideBarPanelLayout.setHorizontalGroup(
sideBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sidebarPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
);
sideBarPanelLayout.setVerticalGroup(
sideBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sideBarPanelLayout.createSequentialGroup()
.addComponent(sidebarPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 838, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
titleLabel.setFont(new java.awt.Font("Source Serif Pro Black", 0, 24)); // NOI18N
titleLabel.setText("Manage Properties");
titleLabel.setPreferredSize(new java.awt.Dimension(276, 33));
titleLabel.setRequestFocusEnabled(false);
panelInsideScrollPane = new JPanel();
panelInsideScrollPane.setPreferredSize(new Dimension(400,400));
requestsScrollPane = new JScrollPane(panelInsideScrollPane,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
requestsScrollPane.getVerticalScrollBar().setUnitIncrement(16);
panelInsideScrollPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
requestsScrollPane.setLocation(247, 82);
requestsScrollPane.setSize(761, 575);
setLayout(null);
add(sideBarPanel);
add(titleLabel);
add(requestsScrollPane);
}// </editor-fold>//GEN-END:initComponents
public void setPropertiesList(ArrayList<ManagePropertyListing> managePropertyListing) {
panelInsideScrollPane.removeAll();
viewDetailsButtons.clear();
if(managePropertyListing.size() == 0) {
// noResultFoundMessage();
}
for(int i = 0; i < managePropertyListing.size(); i++){
viewDetailsButtons.add(managePropertyListing.get(i).getViewDetailsButton());
panelInsideScrollPane.setPreferredSize(new Dimension(800,300 * (i+1)));
panelInsideScrollPane.add(managePropertyListing.get(i));
}
}
private void newPropertyPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newPropertyPageButtonActionPerformed
new NewPropertyPage().setVisible(true);
setVisible(false);
}//GEN-LAST:event_newPropertyPageButtonActionPerformed
private void managePropertiesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_managePropertiesButtonActionPerformed
new ManagePropertiesPage().setVisible(true);
setVisible(false);
}//GEN-LAST:event_managePropertiesButtonActionPerformed
private void rentRequestsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rentRequestsButtonActionPerformed
new ManagePropertiesPage().setVisible(true);
setVisible(false);
}//GEN-LAST:event_rentRequestsButtonActionPerformed
/**
* @param args the command line arguments
*/
// public static void main(String args[]) { //Main method used for testing panel
// /* Set the Nimbus look and feel */
// //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
// /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
// * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
// */
// try {
// // for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
// // if ("Nimbus".equals(info.getName())) {
// // javax.swing.UIManager.setLookAndFeel(info.getClassName());
// // break;
// // }
// // }
// new ManagePropertiesPage();
// } catch (Exception ex) {
// java.util.logging.Logger.getLogger(ManagePropertiesPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// }
// //catch (InstantiationException ex) {
// // java.util.logging.Logger.getLogger(ManagePropertiesPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// // } catch (IllegalAccessException ex) {
// // java.util.logging.Logger.getLogger(ManagePropertiesPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// // } catch (javax.swing.UnsupportedLookAndFeelException ex) {
// // java.util.logging.Logger.getLogger(ManagePropertiesPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// // }
// //</editor-fold>
// /* Create and display the form */
// java.awt.EventQueue.invokeLater(new Runnable() {
// public void run() {
// new ManagePropertiesPage().setVisible(true);
// }
// });
// }
private ImageIcon loadImage(String path, int x, int y){
Image image = new ImageIcon(this.getClass().getResource(path)).getImage();
Image scaledImage = image.getScaledInstance(x, y, java.awt.Image.SCALE_SMOOTH);
return new ImageIcon(scaledImage);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton homeButton;
private javax.swing.JButton logOutButton;
private javax.swing.JButton managePropertiesButton;
private javax.swing.JButton newPropertyPageButton;
private javax.swing.JButton rentRequestsButton;
private javax.swing.JScrollPane requestsScrollPane;
private javax.swing.JPanel sideBarPanel;
private javax.swing.JPanel sidebarPanel;
private javax.swing.JLabel titleLabel;
// End of variables declaration//GEN-END:variables
//Getters and setters for components
public javax.swing.JButton getHomeButton() {
return homeButton;
}
public javax.swing.JButton getLogOutButton() {
return logOutButton;
}
public javax.swing.JButton getManagePropertiesButton() {
return managePropertiesButton;
}
// public javax.swing.JLabel getMyPropertiesLabel() {
// return myPropertiesLabel;
// }
public javax.swing.JButton getNewPropertyPageButton() {
return newPropertyPageButton;
}
public javax.swing.JButton getRentRequestsButton() {
return rentRequestsButton;
}
public javax.swing.JScrollPane getRequestsScrollPane() {
return requestsScrollPane;
}
public javax.swing.JPanel getSidebarPanel() {
return sidebarPanel;
}
public javax.swing.JPanel getSideBarPanel() {
return sideBarPanel;
}
public javax.swing.JLabel getTitleLabel() {
return titleLabel;
}
public ArrayList<JButton> getViewDetailsButtons(){
return viewDetailsButtons;
}
}