/* * Copyright (C) 2014 Shashank Tulsyan * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package neembuu.release1.ui.linkpanel; import javax.swing.JTextArea; import neembuu.release1.ui.ContextMenuMouseListener; import neembuu.release1.ui.actions.EditLinksActionImpl; /** * * @author Shashank Tulsyan */ public class EditLinksPanel extends javax.swing.JPanel { private EditLinksActionImpl.Actions actions; /** * Creates new form EditLinksPanel */ public EditLinksPanel() { initComponents(); textArea.addMouseListener(new ContextMenuMouseListener()); } public void initAction(EditLinksActionImpl.Actions actions){ this.actions = actions; } /** * 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() { jScrollPane1 = new javax.swing.JScrollPane(); textArea = new javax.swing.JTextArea(); saveButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); emptyCacheButton = new javax.swing.JButton(); textArea.setColumns(20); textArea.setRows(5); jScrollPane1.setViewportView(textArea); saveButton.setText(org.openide.util.NbBundle.getMessage(EditLinksPanel.class, "EditLinksPanel.saveButton.text")); // NOI18N saveButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveButtonActionPerformed(evt); } }); cancelButton.setText(org.openide.util.NbBundle.getMessage(EditLinksPanel.class, "EditLinksPanel.cancelButton.text")); // NOI18N cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); emptyCacheButton.setText(org.openide.util.NbBundle.getMessage(EditLinksPanel.class, "EditLinksPanel.emptyCacheButton.text")); // NOI18N emptyCacheButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { emptyCacheButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane1) .addGroup(layout.createSequentialGroup() .addComponent(saveButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(emptyCacheButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cancelButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(saveButton) .addComponent(cancelButton) .addComponent(emptyCacheButton)) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed actions.save(); }//GEN-LAST:event_saveButtonActionPerformed private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed actions.cancel(); }//GEN-LAST:event_cancelButtonActionPerformed private void emptyCacheButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_emptyCacheButtonActionPerformed actions.emptyCache(); }//GEN-LAST:event_emptyCacheButtonActionPerformed public EditLinksUIA ui(){ return new EditLinksUIA() { @Override public JTextArea textArea() { return textArea; } }; } public static interface EditLinksUIA { javax.swing.JTextArea textArea(); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cancelButton; private javax.swing.JButton emptyCacheButton; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JButton saveButton; private javax.swing.JTextArea textArea; // End of variables declaration//GEN-END:variables }