menuClientMaster = new javax.swing.JMenuItem();
menuLawyerNotices = new javax.swing.JMenu();
menuCreateNotice = new javax.swing.JMenuItem();
+ menuManageNotices = new javax.swing.JMenuItem();
menuSettings = new javax.swing.JMenu();
menuDatabaseSettings = new javax.swing.JMenuItem();
});
menuLawyerNotices.add(menuCreateNotice);
+ menuManageNotices.setMnemonic('M');
+ menuManageNotices.setText("Manage Notices...");
+ menuManageNotices.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ menuManageNoticesActionPerformed(evt);
+ }
+ });
+ menuLawyerNotices.add(menuManageNotices);
+
jMenuBar1.add(menuLawyerNotices);
menuSettings.setMnemonic('S');
frm.setVisible(true);
}//GEN-LAST:event_menuCreateNoticeActionPerformed
+ private void menuManageNoticesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuManageNoticesActionPerformed
+ // TODO add your handling code here:
+ ManageNoticesDialog frm = new ManageNoticesDialog(this, true);
+ frm.setVisible(true);
+ }//GEN-LAST:event_menuManageNoticesActionPerformed
+
/**
* @param args the command line arguments
*/
private javax.swing.JMenuItem menuCreateNotice;
private javax.swing.JMenuItem menuDatabaseSettings;
private javax.swing.JMenu menuLawyerNotices;
+ private javax.swing.JMenuItem menuManageNotices;
private javax.swing.JMenu menuMaster;
private javax.swing.JMenu menuSettings;
// End of variables declaration//GEN-END:variables
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.6" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
+ <NonVisualComponents>
+ <Container class="javax.swing.JPopupMenu" name="popMenu">
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
+ <Property name="useNullLayout" type="boolean" value="true"/>
+ </Layout>
+ <SubComponents>
+ <MenuItem class="javax.swing.JMenuItem" name="menuDraftStatus">
+ <Properties>
+ <Property name="mnemonic" type="int" value="68"/>
+ <Property name="text" type="java.lang.String" value="Draft Status..."/>
+ <Property name="toolTipText" type="java.lang.String" value=""/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuDraftStatusActionPerformed"/>
+ </Events>
+ </MenuItem>
+ </SubComponents>
+ </Container>
+ </NonVisualComponents>
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ <Property name="title" type="java.lang.String" value="Manage Notices"/>
+ <Property name="locationByPlatform" type="boolean" value="true"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="0" pref="537" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="0" pref="317" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTable" name="tableNotices">
+ <Properties>
+ <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
+ <Table columnCount="3" rowCount="0">
+ <Column editable="false" title="id" type="java.lang.Integer"/>
+ <Column editable="false" title="Reference Number" type="java.lang.String"/>
+ <Column editable="false" title="Description" type="java.lang.String"/>
+ </Table>
+ </Property>
+ <Property name="selectionMode" type="int" value="0"/>
+ <Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor">
+ <JTableSelectionModel selectionMode="0"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
--- /dev/null
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package habeas;
+
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.ArrayList;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.table.DefaultTableModel;
+
+/**
+ *
+ * @author hari
+ */
+public class ManageNoticesDialog extends javax.swing.JDialog {
+
+ /**
+ * Creates new form ManageNoticesDialog
+ */
+ public ManageNoticesDialog(java.awt.Frame parent, boolean modal) {
+ super(parent, modal);
+ initComponents();
+ populateNotices ();
+ tableNotices.add(popMenu);
+ tableNotices.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mousePressed(MouseEvent arg0) {
+ if (arg0.isPopupTrigger()) {
+ popMenu.show(arg0.getComponent(), arg0.getX(), arg0.getY());
+ }
+ }
+
+ });
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ popMenu = new javax.swing.JPopupMenu();
+ menuDraftStatus = new javax.swing.JMenuItem();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ tableNotices = new javax.swing.JTable();
+
+ menuDraftStatus.setMnemonic('D');
+ menuDraftStatus.setText("Draft Status...");
+ menuDraftStatus.setToolTipText("");
+ menuDraftStatus.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ menuDraftStatusActionPerformed(evt);
+ }
+ });
+ popMenu.add(menuDraftStatus);
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Manage Notices");
+ setLocationByPlatform(true);
+
+ tableNotices.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+
+ },
+ new String [] {
+ "id", "Reference Number", "Description"
+ }
+ ) {
+ Class[] types = new Class [] {
+ java.lang.Integer.class, java.lang.String.class, java.lang.String.class
+ };
+ boolean[] canEdit = new boolean [] {
+ false, false, false
+ };
+
+ public Class getColumnClass(int columnIndex) {
+ return types [columnIndex];
+ }
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
+ });
+ tableNotices.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
+ tableNotices.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
+ jScrollPane1.setViewportView(tableNotices);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 537, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)
+ );
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void menuDraftStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDraftStatusActionPerformed
+ // TODO add your handling code here:
+ int selid = getSelectedNotice ();
+ if (selid == -1) return;
+
+ System.out.println (selid);
+
+ }//GEN-LAST:event_menuDraftStatusActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* 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;
+ }
+ }
+ } catch (ClassNotFoundException ex) {
+ java.util.logging.Logger.getLogger(ManageNoticesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(ManageNoticesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(ManageNoticesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(ManageNoticesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //</editor-fold>
+
+ /* Create and display the dialog */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ ManageNoticesDialog dialog = new ManageNoticesDialog(new javax.swing.JFrame(), true);
+ dialog.addWindowListener(new java.awt.event.WindowAdapter() {
+ @Override
+ public void windowClosing(java.awt.event.WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ dialog.setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JMenuItem menuDraftStatus;
+ private javax.swing.JPopupMenu popMenu;
+ private javax.swing.JTable tableNotices;
+ // End of variables declaration//GEN-END:variables
+
+ private void populateNotices() {
+ DefaultTableModel mdl = (DefaultTableModel) tableNotices.getModel ();
+ mdl.setRowCount(0);
+ ArrayList<Object> notices = Utility.getNotices ();
+ if (notices == null) return;
+ for (int i = 0; i < notices.size(); i += 3) {
+ mdl.addRow (new Object[] { notices.get(i), notices.get(i+1),
+ notices.get(i+2)});
+ }
+ }
+
+ private int getSelectedNotice() {
+ int selid = tableNotices.getSelectedRow();
+ if (selid == -1)
+ return -1;
+ DefaultTableModel mdl = (DefaultTableModel) tableNotices.getModel();
+ int rkey = (int) mdl.getValueAt(selid, 0);
+ return rkey;
+ }
+}