Java tutorial
/* * 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 app; import java.awt.Color; import java.awt.Dimension; import java.awt.List; import java.awt.Toolkit; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Iterator; import javax.swing.JFrame; import org.apache.http.NameValuePair; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.etosha.datamodel.MultiLayerNetwork; import org.etosha.datamodel.NetworkLayer; import org.etosha.hdgs.hive.HiveImportConnector; import org.etosha.hdgs.impala.ImpalaDynamicImportConnector; import org.etosha.hdgs.impala.ImpalaImportConnector; import org.etosha.hdgs.mysql.MySQLImportConnector; import org.gephi.data.attributes.api.AttributeController; import org.gephi.data.attributes.api.AttributeModel; import org.gephi.graph.api.GraphController; import org.gephi.graph.api.GraphModel; import org.gephi.graph.api.UndirectedGraph; import org.gephi.io.exporter.api.ExportController; import org.gephi.io.exporter.spi.CharacterExporter; import org.gephi.io.exporter.spi.Exporter; import org.gephi.io.exporter.spi.GraphExporter; import org.gephi.io.processor.plugin.DefaultProcessor; import org.gephi.project.api.ProjectController; import org.gephi.project.api.Workspace; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.util.Exceptions; import org.openide.util.Lookup; import org.openide.util.NbBundle.Messages; public final class HadoopImporterWindowTopComponent extends JFrame { public static String HIVE_SERVER_IP = "192.168.3.106"; public static String MySQL_SERVER_IP = "192.168.3.106"; // Variables declaration - do not modify private javax.swing.JMenuItem aboutMenuItem; private javax.swing.JMenuItem contentsMenuItem; private javax.swing.JMenuItem copyMenuItem; private javax.swing.JMenuItem cutMenuItem; private javax.swing.JMenuItem deleteMenuItem; private javax.swing.JMenu editMenu; private javax.swing.JMenuItem exitMenuItem; private javax.swing.JMenu fileMenu; private javax.swing.JMenu helpMenu; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JPanel jPanel2; private javax.swing.JLabel jlEdges; private javax.swing.JLabel jlNodes; private javax.swing.JRadioButton jrbDirected; private javax.swing.JRadioButton jrbHierarchical; private javax.swing.JRadioButton jrbMixed; private javax.swing.JRadioButton jrbUndirected; private javax.swing.JMenuBar menuBar; private javax.swing.JMenuItem openMenuItem; private javax.swing.JMenuItem pasteMenuItem; private javax.swing.JMenuItem saveAsMenuItem; private javax.swing.JMenuItem saveMenuItem; private javax.swing.JLabel ws_info_f1; // End of variables declaration public HadoopImporterWindowTopComponent() { initComponents(); resetWorkspace(); } /** * 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() { jPanel1 = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel7 = new javax.swing.JPanel(); jButton4 = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jPanel8 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); edgesStatic = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); nodes = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); jtaQuery = new javax.swing.JTextArea(); jScrollPane2 = new javax.swing.JScrollPane(); jtaResponse = new javax.swing.JTextArea(); jcbDIRECTED = new javax.swing.JCheckBox(); jcbAppend = new javax.swing.JCheckBox(); jScrollPane3 = new javax.swing.JScrollPane(); jtaNTMNListe = new javax.swing.JTextArea(); jButton8 = new javax.swing.JButton(); jScrollPane4 = new javax.swing.JScrollPane(); jtaLAYERLISTE = new javax.swing.JTextArea(); jLabel7 = new javax.swing.JLabel(); jSpinnerPARTITION = new javax.swing.JSpinner(); jTextField3 = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); jScrollPane5 = new javax.swing.JScrollPane(); jtaLogPanel = new javax.swing.JTextPane(); jPanel10 = new javax.swing.JPanel(); jTextField6 = new javax.swing.JTextField(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jTextField5 = new javax.swing.JTextField(); jButton9 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jLabel11 = new javax.swing.JLabel(); jPanel6 = new javax.swing.JPanel(); jButton2 = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jButton3 = new javax.swing.JButton(); jPanel5 = new javax.swing.JPanel(); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jPanel1.border.title"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jButton4, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton4.text")); // NOI18N jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel5.text")); // NOI18N jTextField1.setForeground(new java.awt.Color(255, 153, 0)); jTextField1.setText(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jTextField1.text")); // NOI18N jTextField1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { jTextField1MouseExited(evt); } }); jTextField1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { jTextField1PropertyChange(evt); } }); jTextField2.setForeground(new java.awt.Color(255, 153, 0)); jTextField2.setText(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jTextField2.text")); // NOI18N jTextField2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { jTextField2MouseExited(evt); } }); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); jTextField2.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { jTextField2PropertyChange(evt); } }); org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel6.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jButton5, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton5.text")); // NOI18N jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); org.openide.awt.Mnemonics.setLocalizedText(jButton6, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton6.text")); // NOI18N jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jPanel8.border.title"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel4.text")); // NOI18N edgesStatic.setText(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.edgesStatic.text")); // NOI18N edgesStatic.setBorder(javax.swing.BorderFactory.createEtchedBorder()); edgesStatic.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { edgesStaticActionPerformed(evt); } }); org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel3.text")); // NOI18N nodes.setText(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.nodes.text")); // NOI18N nodes.setBorder(javax.swing.BorderFactory.createEtchedBorder()); nodes.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nodesActionPerformed(evt); } }); jtaQuery.setColumns(20); jtaQuery.setRows(5); jtaQuery.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jtaQuery.border.title"))); // NOI18N jScrollPane1.setViewportView(jtaQuery); jtaResponse.setColumns(20); jtaResponse.setRows(5); jtaResponse.setBorder(javax.swing.BorderFactory .createTitledBorder(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jtaResponse.border.title"))); // NOI18N jScrollPane2.setViewportView(jtaResponse); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout .setHorizontalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap().addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel8Layout.createSequentialGroup() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 557, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)) .addComponent(edgesStatic).addComponent(nodes)) .addContainerGap(57, Short.MAX_VALUE))); jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(nodes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)) .addGap(12, 12, 12) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(edgesStatic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); org.openide.awt.Mnemonics.setLocalizedText(jcbDIRECTED, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jcbDIRECTED.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jcbAppend, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jcbAppend.text")); // NOI18N jtaNTMNListe.setColumns(20); jtaNTMNListe.setRows(5); jScrollPane3.setViewportView(jtaNTMNListe); org.openide.awt.Mnemonics.setLocalizedText(jButton8, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton8.text")); // NOI18N jButton8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton8ActionPerformed(evt); } }); jtaLAYERLISTE.setColumns(20); jtaLAYERLISTE.setRows(5); jScrollPane4.setViewportView(jtaLAYERLISTE); jLabel7.setFont(new java.awt.Font("Palatino", 0, 18)); // NOI18N jLabel7.setForeground(new java.awt.Color(0, 153, 204)); org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel7.text")); // NOI18N jSpinnerPARTITION.setModel(new javax.swing.SpinnerNumberModel(1, 1, 12, 1)); jTextField3.setText(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jTextField3.text")); // NOI18N jTextField3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField3ActionPerformed(evt); } }); org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel8.text")); // NOI18N jPanel9.setLayout(new java.awt.BorderLayout()); jScrollPane5.setPreferredSize(new java.awt.Dimension(444, 220)); jtaLogPanel.setBorder(javax.swing.BorderFactory .createTitledBorder(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jtaLogPanel.border.title"))); // NOI18N jScrollPane5.setViewportView(jtaLogPanel); jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jPanel10.border.title"))); // NOI18N jTextField6.setText(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jTextField6.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jLabel9, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel9.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jLabel10, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel10.text")); // NOI18N jTextField4.setText(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jTextField4.text")); // NOI18N jTextField5.setText(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jTextField5.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jButton9, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton9.text")); // NOI18N jButton9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton9ActionPerformed(evt); } }); org.openide.awt.Mnemonics.setLocalizedText(jButton7, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton7.text")); // NOI18N jButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton7ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); jPanel10.setLayout(jPanel10Layout); jPanel10Layout.setHorizontalGroup(jPanel10Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap().addGroup(jPanel10Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup() .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(36, 36, 36) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(28, 28, 28) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 360, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 77, Short.MAX_VALUE)) .addGroup(jPanel10Layout.createSequentialGroup().addComponent(jButton7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap())); jPanel10Layout.setVerticalGroup(jPanel10Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap().addGroup(jPanel10Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9).addComponent(jLabel10) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE) .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton9).addComponent(jButton7)) .addContainerGap())); org.openide.awt.Mnemonics.setLocalizedText(jButton10, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton10.text")); // NOI18N jButton10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton10ActionPerformed(evt); } }); jLabel11.setFont(new java.awt.Font("Palatino", 1, 18)); // NOI18N jLabel11.setForeground(new java.awt.Color(0, 153, 204)); org.openide.awt.Mnemonics.setLocalizedText(jLabel11, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jLabel11.text")); // NOI18N javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addGap(27, 27, 27).addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(33, 33, 33).addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel6) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5)) .addGroup(jPanel7Layout.createSequentialGroup().addComponent(jLabel7) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel11) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel7Layout.createSequentialGroup().addGap(6, 6, 6) .addComponent(jcbDIRECTED).addGap(18, 18, 18) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addComponent(jcbAppend).addGap(18, 18, 18) .addComponent(jSpinnerPARTITION, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel7Layout.createSequentialGroup().addGap(12, 12, 12) .addComponent(jLabel8) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addGap(18, 18, 18) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 369, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 369, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton10))) .addGap(18, 18, 18) .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(231, 231, 231).addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel7Layout.createSequentialGroup().addGap(33, 33, 33).addGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton6).addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(346, 346, 346)) .addGroup(jPanel7Layout.createSequentialGroup().addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7).addComponent(jLabel11)) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(20, 20, 20) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel7Layout.createSequentialGroup().addGap(64, 64, 64) .addComponent(jLabel5))) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addGap(22, 22, 22) .addGroup(jPanel7Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jcbDIRECTED).addComponent(jcbAppend) .addComponent(jSpinnerPARTITION, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel7Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8).addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel7Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel7Layout.createSequentialGroup().addGap(18, 18, 18) .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent( jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jPanel7.TabConstraints.tabTitle"), jPanel7); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton2.text")); // NOI18N jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout .setHorizontalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() .addContainerGap(1142, Short.MAX_VALUE).addComponent(jButton2).addContainerGap())); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() .addGap(0, 668, Short.MAX_VALUE).addComponent(jButton2))); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jPanel6.TabConstraints.tabTitle"), jPanel6); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton1.text")); // NOI18N jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout .setHorizontalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addGap(0, 1148, Short.MAX_VALUE).addComponent(jButton1))); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addGap(0, 668, Short.MAX_VALUE).addComponent(jButton1))); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jPanel3.TabConstraints.tabTitle"), jPanel3); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jButton3, org.openide.util.NbBundle.getMessage( HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jButton3.text")); // NOI18N jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout .setHorizontalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGap(0, 1148, Short.MAX_VALUE).addComponent(jButton3))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGap(0, 668, Short.MAX_VALUE).addComponent(jButton3))); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 1234, Short.MAX_VALUE)); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 697, Short.MAX_VALUE)); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(HadoopImporterWindowTopComponent.class, "HadoopImporterWindowTopComponent.jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1255, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(24, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout .createSequentialGroup().addContainerGap().addComponent(jTabbedPane1).addContainerGap())); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); }// </editor-fold>//GEN-END:initComponents private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed System.exit(0); }//GEN-LAST:event_exitMenuItemActionPerformed private void openMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMenuItemActionPerformed // TODO add your handling code here: }//GEN-LAST:event_openMenuItemActionPerformed private void jrbDirectedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbDirectedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jrbDirectedActionPerformed private void copyMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyMenuItemActionPerformed }//GEN-LAST:event_copyMenuItemActionPerformed private void pasteMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pasteMenuItemActionPerformed }//GEN-LAST:event_pasteMenuItemActionPerformed private void deleteMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteMenuItemActionPerformed }//GEN-LAST:event_deleteMenuItemActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed setWaiting(); HiveImportConnector.main(null); setDone(); // TODO add your handling code here: }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed setWaiting(); if (appendAsNewTimeRange) { ImpalaDynamicImportConnector.currentPartitionId = (Integer) this.jSpinnerPARTITION.getValue(); ImpalaDynamicImportConnector.main(null); } else { ImpalaImportConnector.main(null); } setDone(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed setWaiting(); MySQLImportConnector.main(null); setDone(); }//GEN-LAST:event_jButton3ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: String networkName = this.jTextField1.getText(); System.out.println("TMN_name : " + networkName); String liste = loadNetworkLayersForTMN(networkName, this); this.jtaLAYERLISTE.setText(liste); }//GEN-LAST:event_jButton4ActionPerformed private void nodesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nodesActionPerformed // TODO add your handling code here: }//GEN-LAST:event_nodesActionPerformed public static boolean importDirected = true; public static boolean appendAsNewTimeRange = true; private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: this.jTextField1.setForeground(Color.orange); importDirected = this.jcbDIRECTED.isSelected(); appendAsNewTimeRange = this.jcbAppend.isSelected(); NetworkLayer nl = new NetworkLayer(); nl.edgelistQ = this.edgesStatic.getText(); nl.nodelistQ = this.nodes.getText(); nl.directed = importDirected; MultiLayerNetwork.setDefaultLayer(nl); ImpalaDynamicImportConnector.jta = this.jtaLogPanel; try { jButton2ActionPerformed(null); this.jTextField1.setForeground(Color.green); } catch (Exception ex) { ex.printStackTrace(); this.jTextField1.setForeground(Color.red); } }//GEN-LAST:event_jButton5ActionPerformed private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed this.jTextField2.setForeground(Color.orange); try { // load the data from WIKI String networkName = this.jTextField1.getText(); String layerName = this.jTextField2.getText(); System.out.println("TMN_name : " + networkName); System.out.println("TMN_layern_name : " + layerName); String[] q = loadQueriesForNetworkLayer(networkName, layerName, this); System.out.println(q[0]); System.out.println(q[1]); this.nodes.setText(q[0]); this.edgesStatic.setText(q[1]); NetworkLayer nl = new NetworkLayer(); nl.edgelistQ = this.edgesStatic.getText(); nl.nodelistQ = this.nodes.getText(); nl.partition_selector = this.jTextField3.getText(); MultiLayerNetwork.setDefaultLayer(nl); this.jTextField2.setForeground(Color.green); } catch (Exception ex) { ex.printStackTrace(); NetworkLayer nl = new NetworkLayer(); nl.edgelistQ = "EL ???"; nl.nodelistQ = "NL ???"; MultiLayerNetwork.setDefaultLayer(nl); this.jTextField2.setForeground(Color.red); } // TODO add your handling code here: }//GEN-LAST:event_jButton6ActionPerformed private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField2ActionPerformed private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed // TODO add your handling code here: resetWorkspace(); }//GEN-LAST:event_jButton7ActionPerformed private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed String liste = loadTMNListeFromMetastore(this); this.jtaNTMNListe.setText(liste); }//GEN-LAST:event_jButton8ActionPerformed private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField3ActionPerformed private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed //Init a project - and therefore a workspace ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); Workspace workspace = pc.getCurrentWorkspace(); String name = this.jTextField4.getText(); //Export full graph ExportController ec = Lookup.getDefault().lookup(ExportController.class); org.gephi.io.exporter.plugin.ExporterGEXF ex = (org.gephi.io.exporter.plugin.ExporterGEXF) ec .getExporter("gexf"); ex.setExportDynamic(true); ex.setExportAttributes(true); String path0 = this.jTextField6.getText(); String path1 = this.jLabel9.getText(); String path2 = this.jLabel10.getText(); String path3 = this.jTextField4.getText(); String path4 = this.jTextField5.getText(); File folder = new File(path0 + path1 + "/" + path2 + "/"); if (!folder.exists()) folder.mkdirs(); String filename = path3 + path4; if (jcbAppend.isSelected()) filename = path3 + "_part_" + jSpinnerPARTITION.getValue() + path4; try { ec.exportFile(new File(folder + "/" + filename)); } catch (IOException exc) { exc.printStackTrace(); return; } }//GEN-LAST:event_jButton9ActionPerformed private void jTextField1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTextField1PropertyChange // TODO add your handling code here: }//GEN-LAST:event_jTextField1PropertyChange private void jTextField2PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTextField2PropertyChange // TODO add your handling code here: }//GEN-LAST:event_jTextField2PropertyChange private void jTextField1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField1MouseExited this.jLabel9.setText(this.jTextField1.getText()); }//GEN-LAST:event_jTextField1MouseExited private void jTextField2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField2MouseExited this.jLabel10.setText(this.jTextField2.getText()); }//GEN-LAST:event_jTextField2MouseExited private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed this.jButton9ActionPerformed(null); Integer nv = (Integer) this.jSpinnerPARTITION.getValue(); this.jSpinnerPARTITION.setValue(nv + 1); jButton5ActionPerformed(null); }//GEN-LAST:event_jButton10ActionPerformed private void edgesStaticActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_edgesStaticActionPerformed // TODO add your handling code here: }//GEN-LAST:event_edgesStaticActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField edgesStatic; private javax.swing.JButton jButton1; private javax.swing.JButton jButton10; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JButton jButton8; private javax.swing.JButton jButton9; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel10; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JPanel jPanel8; private javax.swing.JPanel jPanel9; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane4; private javax.swing.JScrollPane jScrollPane5; private javax.swing.JSpinner jSpinnerPARTITION; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JCheckBox jcbAppend; private javax.swing.JCheckBox jcbDIRECTED; private javax.swing.JTextArea jtaLAYERLISTE; private javax.swing.JTextPane jtaLogPanel; private javax.swing.JTextArea jtaNTMNListe; private javax.swing.JTextArea jtaQuery; private javax.swing.JTextArea jtaResponse; private javax.swing.JTextField nodes; // End of variables declaration//GEN-END:variables public static void main(String[] args) { HadoopImporterWindowTopComponent view = new HadoopImporterWindowTopComponent(); //Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); view.setSize(1500, 900); view.setVisible(true); } void writeProperties(java.util.Properties p) { // better to version settings since initial version as advocated at // http://wiki.apidesign.org/wiki/PropertyFiles p.setProperty("version", "1.0"); // TODO store your settings } void readProperties(java.util.Properties p) { String version = p.getProperty("version"); // TODO read your settings according to their version } private void updateWorkspaceStatus() { // ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); // // Workspace workspace = pc.getCurrentWorkspace(); // // GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel(); // AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel(); // // boolean isDirected = graphModel.isDirected(); // boolean isUnDirected = graphModel.isUndirected(); // boolean isHierarchical = graphModel.isHierarchical(); // boolean isMixed = graphModel.isMixed(); // // this.jrbDirected.setSelected(isDirected); // this.jrbUndirected.setSelected(isDirected); // this.jrbHierarchical.setSelected(isHierarchical); // this.jrbMixed.setSelected(isMixed); // // UndirectedGraph graph = graphModel.getUndirectedGraph(); // System.out.println("Nodes: " + graph.getNodeCount()); // System.out.println("Edges: " + graph.getEdgeCount()); // // this.jlEdges.setText(""+graph.getEdgeCount()); // this.jlNodes.setText(""+graph.getNodeCount()); } private void resetWorkspace() { System.out.println(">>> RESET workspace now ... (no save!!!)"); ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); pc.closeCurrentProject(); pc.newProject(); } private void setWaiting() { // indicate activity via MousePointer ... } private void setDone() { } public void centerOnScreen() { setVisible(true); System.out.println(">>> open Hadoop connector GUI ... "); } public static String loadNetworkLayersForTMN(String networkName, HadoopImporterWindowTopComponent comp) { StringBuffer q = new StringBuffer(); CloseableHttpClient httpClient = null; HttpGet httpGet = null; CloseableHttpResponse response = null; try { httpClient = HttpClients.createDefault(); httpGet = new HttpGet(); String query = "[[Modification date::+]]|?Modification date|sort=Modification date|order=Ddesc"; String queryForLayerSQL = "[[Category:TMN_layer]][[belongs_to_TMN::" + networkName + "]]|?TMN_layer_name"; URI uri = new URI("http://semanpix.de/oldtimer/wiki/api.php?action=ask&format=json&query=" + encodeQuery(queryForLayerSQL)); String uri2 = "http://semanpix.de/oldtimer/wiki/api.php?action=ask&format=json&query=" + queryForLayerSQL; httpGet.setURI(uri); System.out.println("[Request:]\n" + uri2); if (comp != null) { comp.setQuery(uri2); } response = httpClient.execute(httpGet); if (response.getStatusLine().getStatusCode() != 200) { throw new RuntimeException( "Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); StringBuffer sb = new StringBuffer(); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); sb.append(output); } if (comp != null) { comp.setResponse(sb.toString()); } JSONObject obj1 = new JSONObject(sb.toString()); JSONObject obj2 = obj1.getJSONObject("query"); JSONObject obj3 = obj2.getJSONObject("results"); Iterator<String> it = obj3.keys(); while (it.hasNext()) { String key = it.next(); JSONObject obj = obj3.getJSONObject(key); JSONObject obj4 = obj.getJSONObject("printouts"); String nln = obj4.optString("TMN layer name"); System.out.println(nln); q.append(nln.substring(2, nln.length() - 2) + "\n"); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException ex) { Exceptions.printStackTrace(ex); } catch (JSONException ex) { Exceptions.printStackTrace(ex); } finally { try { if (response != null) { response.close(); } httpClient.close(); } catch (Exception ex) { ex.printStackTrace(); } } return q.toString(); } public static String[] loadQueriesForNetworkLayer(String networkName, String layerName, HadoopImporterWindowTopComponent comp) { String[] q = new String[2]; CloseableHttpClient httpClient = null; HttpGet httpGet = null; CloseableHttpResponse response = null; try { httpClient = HttpClients.createDefault(); httpGet = new HttpGet(); String query = "[[Modification date::+]]|?Modification date|sort=Modification date|order=Ddesc"; String queryForLayerSQL = "[[Category:TMN_layer]][[TMN_layer_name::" + layerName + "]][[belongs_to_TMN::" + networkName + "]]|?TMN_layer_nlq|?TMN_layer_elq"; URI uri = new URI("http://semanpix.de/oldtimer/wiki/api.php?action=ask&format=json&query=" + encodeQuery(queryForLayerSQL)); //"); String uri2 = "http://semanpix.de/oldtimer/wiki/api.php?action=ask&format=json&query=" + queryForLayerSQL; httpGet.setURI(uri); System.out.println("[Request:]\n" + uri2); if (comp != null) { comp.setQuery(uri2); } // ArrayList<NameValuePair> nvps; // nvps = new ArrayList<NameValuePair>(); // nvps.add(new BasicNameValuePair("content-type", "application/json")); // nvps.add(new BasicNameValuePair("x-kii-appid", "xxxxx")); // nvps.add(new BasicNameValuePair("x-kii-appkey", "xxxxxxxxxxxxxx")); // StringEntity input = new StringEntity("{\"username\": \"dummyuser\",\"password\": \"dummypassword\"}"); // input.setContentType("application/json"); // // httpPost.setEntity(input); // // for (NameValuePair h : nvps) // { // httpPost.addHeader(h.getName(), h.getValue()); // } response = httpClient.execute(httpGet); if (response.getStatusLine().getStatusCode() != 200) { throw new RuntimeException( "Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); StringBuffer sb = new StringBuffer(); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); sb.append(output); } if (comp != null) { comp.setResponse(sb.toString()); } JSONObject obj1 = new JSONObject(sb.toString()); JSONObject obj2 = obj1.getJSONObject("query"); JSONObject obj3 = obj2.getJSONObject("results"); JSONObject obj4 = obj3.getJSONObject(layerName); JSONObject obj5 = obj4.getJSONObject("printouts"); String nlq = obj5.optString("TMN layer nlq"); String elq = obj5.optString("TMN layer elq"); System.out.println(nlq); System.out.println(elq); q[0] = URLDecoder.decode(nlq.substring(2, nlq.length() - 2)); q[1] = URLDecoder.decode(elq.substring(2, elq.length() - 2)); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException ex) { Exceptions.printStackTrace(ex); } catch (JSONException ex) { Exceptions.printStackTrace(ex); } finally { try { if (response != null) { response.close(); } httpClient.close(); } catch (Exception ex) { ex.printStackTrace(); } } return q; } private static String encodeQuery(String qu) { return URLEncoder.encode(qu); } private void setQuery(String uri2) { this.jtaQuery.setText(uri2); } private void setResponse(String resp) { this.jtaResponse.setText(resp); } static public String loadTMNListeFromMetastore(HadoopImporterWindowTopComponent comp) { StringBuffer q = new StringBuffer(); CloseableHttpClient httpClient = null; HttpGet httpGet = null; CloseableHttpResponse response = null; try { httpClient = HttpClients.createDefault(); httpGet = new HttpGet(); String query = "[[Modification date::+]]|?Modification date|sort=Modification date|order=Ddesc"; String queryForLayerSQL = "[[Category:TMN]]|?TMN_name"; URI uri = new URI("http://semanpix.de/oldtimer/wiki/api.php?action=ask&format=json&query=" + encodeQuery(queryForLayerSQL)); String uri2 = "http://semanpix.de/oldtimer/wiki/api.php?action=ask&format=json&query=" + queryForLayerSQL; httpGet.setURI(uri); System.out.println("[Request:]\n" + uri2); if (comp != null) { comp.setQuery(uri2); } response = httpClient.execute(httpGet); if (response.getStatusLine().getStatusCode() != 200) { throw new RuntimeException( "Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); StringBuffer sb = new StringBuffer(); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); sb.append(output); } if (comp != null) { comp.setResponse(sb.toString()); } JSONObject obj1 = new JSONObject(sb.toString()); JSONObject obj2 = obj1.getJSONObject("query"); JSONObject obj3 = obj2.getJSONObject("results"); Iterator it = obj3.keys(); while (it.hasNext()) { String key = (String) it.next(); JSONObject obj = obj3.getJSONObject(key); String nlnfull = obj.optString("fulltext"); JSONObject obj4 = obj.getJSONObject("printouts"); String nln = obj4.optString("TMN name"); System.out.println(nln); q.append(nln.substring(2, nln.length() - 2) + " : " + nlnfull + "\n"); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException ex) { Exceptions.printStackTrace(ex); } catch (JSONException ex) { Exceptions.printStackTrace(ex); } finally { try { if (response != null) { response.close(); } httpClient.close(); } catch (Exception ex) { ex.printStackTrace(); } } return q.toString(); } }