diff --git a/modules/BlueskyGephi/pom.xml b/modules/BlueskyGephi/pom.xml
index f3d03017a..3dc644532 100644
--- a/modules/BlueskyGephi/pom.xml
+++ b/modules/BlueskyGephi/pom.xml
@@ -9,7 +9,7 @@
fr.totetmatt
bluesky-gephi
- 0.1.0
+ 0.2.1
nbm
Bluesky Gephi
diff --git a/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephi.java b/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephi.java
index 7efadd9f4..dcffd5525 100644
--- a/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephi.java
+++ b/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephi.java
@@ -38,6 +38,7 @@ public class BlueskyGephi {
protected static final Logger logger = Logger.getLogger(BlueskyGephi.class.getName());
private final static String NBPREF_BSKY_HANDLE = "bsky.handle";
private final static String NBPREF_BSKY_PASSWORD = "bsky.password";
+ private final static String NBPREF_ATPROTO_HOST ="bsky.social";
private final static String NBPREF_QUERY = "query";
private final static String NBPREF_QUERY_ISFOLLOWERSACTIVE = "query.isFollowersActive";
private final static String NBPREF_QUERY_ISFOLLOWSACTIVE = "query.isFollowsActive";
@@ -46,16 +47,14 @@ public class BlueskyGephi {
private final static String NBPREF_QUERY_LIMITCRAWL = "query.limitCrawl";
private final Preferences nbPref = NbPreferences.forModule(BlueskyGephi.class);
- // If ATProto get released and decentralized, this will change to adapt to other instances
- final private AtClient client = new AtClient("bsky.social");
+
+ private AtClient client;
private GraphModel graphModel;
public BlueskyGephi() {
- initProjectAndWorkspace();
-
}
- private void initProjectAndWorkspace() {
+ private void ensureProject() {
ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
Project currentProject = projectController.getCurrentProject();
if (currentProject == null) {
@@ -63,14 +62,18 @@ private void initProjectAndWorkspace() {
}
}
- public boolean connect(String handle, String password) {
+ public boolean connect(String host,String handle, String password) {
nbPref.put(NBPREF_BSKY_HANDLE, handle);
nbPref.put(NBPREF_BSKY_PASSWORD, password);
+ nbPref.put(NBPREF_ATPROTO_HOST,host);
+ client = new AtClient(host);
return client.comAtprotoServerCreateSession(handle, password);
}
-
+ public String getHost(){
+ return nbPref.get(NBPREF_ATPROTO_HOST,"bsky.social");
+ }
public String getHandle() {
return nbPref.get(NBPREF_BSKY_HANDLE, "");
}
@@ -270,12 +273,14 @@ private void initGraphTable() {
}
public void fetchFollowerFollowsFromActors(List actors, boolean isFollowsActive, boolean isFollowersActive, boolean isBlocksActive) {
+ ensureProject();
graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
initGraphTable();
actors.stream().forEach(actor -> fetchFollowerFollowsFromActor(actor, null, isFollowsActive, isFollowersActive, getIsDeepSearch()));
}
public void fetchFollowerFollowsFromActors(List actors) {
+ ensureProject();
graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
initGraphTable();
actors
diff --git a/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.form b/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.form
index 42402520a..4aaa740d2 100644
--- a/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.form
+++ b/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.form
@@ -71,7 +71,7 @@
-
+
@@ -95,7 +95,7 @@
-
+
@@ -106,10 +106,15 @@
-
+
+
+
+
+
+
@@ -117,8 +122,13 @@
-
-
+
+
+
+
+
+
+
@@ -130,12 +140,28 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.java b/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.java
index 0cb5f9bfd..1d114dc24 100644
--- a/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.java
+++ b/modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.java
@@ -16,33 +16,37 @@
import org.openide.awt.ActionReference;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;
/**
*
* @author totetmatt
*/
-
@TopComponent.Description(preferredID = "BlueskyGephiMainPanel",
- iconBase = "fr/totetmatt/gephi/twitter/twitterlogo.png"
-)
-
-
-@ActionReference(path = "Menu/Window", position = 334)
-@TopComponent.OpenActionRegistration(displayName = "Bluesky Gephi",
- preferredID = "MainTwitterStreamerWindow")
+ persistenceType = TopComponent.PERSISTENCE_ALWAYS)
+@TopComponent.Registration(mode = "layoutmode", openAtStartup = true, roles = {"overview"}, position = 2)
@ActionID(category = "Window", id = "fr.totetmatt.blueskygephi.BlueskyGephiMainPanel")
-@TopComponent.Registration(mode = "layoutmode", openAtStartup = true, position=2)
+@ActionReference(path = "Menu/Window", position = 334)
+@TopComponent.OpenActionRegistration(displayName = "#CTL_BlueskyGephiMainPanel",
+ preferredID = "BlueskyGephiMainPanel")
public class BlueskyGephiMainPanel extends TopComponent {
protected static final Logger consoleLogger = Logger.getLogger(BlueskyGephiMainPanel.class.getName());
- private final BlueskyGephi blueskyGephi;
+ private static final Logger logger = Logger.getLogger(BlueskyGephiMainPanel.class.getName());
+ private BlueskyGephi blueskyGephi;
/**
* Creates new form BlueskyGephiMainPanel
*/
public BlueskyGephiMainPanel() {
initComponents();
- blueskyGephi = Lookup.getDefault().lookup(BlueskyGephi.class);
-
+ setName(NbBundle.getMessage(BlueskyGephiMainPanel.class, "CTL_BlueskyGephiMainPanel"));
+ setToolTipText(NbBundle.getMessage(BlueskyGephiMainPanel.class, "HINT_BlueskyGephiMainPanel"));
+ blueskyGephi = Lookup.getDefault().lookup(BlueskyGephi.class);
+ if (blueskyGephi == null) {
+ logger.warning("BlueskyGephi service not available");
+ return;
+ }
+ credentialsHostField.setText(blueskyGephi.getHost());
credentialsHandleField.setText(blueskyGephi.getHandle());
credentialsPasswordField.setText(blueskyGephi.getPassword());
handleSearchTextArea.setText(blueskyGephi.getQuery());
@@ -64,6 +68,8 @@ public BlueskyGephiMainPanel() {
private void initComponents() {
credentialsPanel = new javax.swing.JPanel();
+ credentialsHostLabel = new javax.swing.JLabel();
+ credentialsHostField = new javax.swing.JTextField();
credentialsHandleLabel = new javax.swing.JLabel();
credentialsHandleField = new javax.swing.JTextField();
credentialsPasswordLabel = new javax.swing.JLabel();
@@ -86,6 +92,15 @@ private void initComponents() {
credentialsPanel.setToolTipText(org.openide.util.NbBundle.getMessage(BlueskyGephiMainPanel.class, "BlueskyGephiMainPanel.Credentials.toolTipText")); // NOI18N
credentialsPanel.setName("Credentials"); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(credentialsHostLabel, org.openide.util.NbBundle.getMessage(BlueskyGephiMainPanel.class, "BlueskyGephiMainPanel.credentialsHostLabel.text")); // NOI18N
+
+ credentialsHostField.setText(org.openide.util.NbBundle.getMessage(BlueskyGephiMainPanel.class, "BlueskyGephiMainPanel.credentialsHostField.text")); // NOI18N
+ credentialsHostField.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ credentialsHostFieldActionPerformed(evt);
+ }
+ });
+
org.openide.awt.Mnemonics.setLocalizedText(credentialsHandleLabel, org.openide.util.NbBundle.getMessage(BlueskyGephiMainPanel.class, "BlueskyGephiMainPanel.credentialsHandleLabel.text")); // NOI18N
credentialsHandleField.setText(org.openide.util.NbBundle.getMessage(BlueskyGephiMainPanel.class, "BlueskyGephiMainPanel.credentialsHandleField.text")); // NOI18N
@@ -122,14 +137,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(credentialsHandleLabel))
.addGap(18, 18, 18)
.addGroup(credentialsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(credentialsHandleField)
- .addComponent(credentialsPasswordField))))
+ .addComponent(credentialsHandleField, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
+ .addComponent(credentialsPasswordField)))
+ .addGroup(credentialsPanelLayout.createSequentialGroup()
+ .addComponent(credentialsHostLabel)
+ .addGap(43, 43, 43)
+ .addComponent(credentialsHostField, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)))
.addContainerGap())
);
credentialsPanelLayout.setVerticalGroup(
credentialsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(credentialsPanelLayout.createSequentialGroup()
- .addContainerGap()
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, credentialsPanelLayout.createSequentialGroup()
+ .addGap(0, 9, Short.MAX_VALUE)
+ .addGroup(credentialsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(credentialsHostLabel)
+ .addComponent(credentialsHostField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(credentialsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(credentialsHandleLabel)
.addComponent(credentialsHandleField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
@@ -138,8 +161,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(credentialsPasswordLabel)
.addComponent(credentialsPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(credentialsConnectButton)
- .addContainerGap(15, Short.MAX_VALUE))
+ .addComponent(credentialsConnectButton))
);
handleSearchTextArea.setColumns(20);
@@ -236,7 +258,7 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) {
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(runFetchButton)
- .addContainerGap(51, Short.MAX_VALUE))
+ .addContainerGap(29, Short.MAX_VALUE))
);
limitCrawlSpinner.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BlueskyGephiMainPanel.class, "BlueskyGephiMainPanel.limitCrawlSpinner.AccessibleContext.accessibleDescription")); // NOI18N
@@ -247,7 +269,7 @@ private void isFollowersActivatedActionPerformed(java.awt.event.ActionEvent evt)
}//GEN-LAST:event_isFollowersActivatedActionPerformed
private void credentialsConnectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_credentialsConnectButtonActionPerformed
- if(blueskyGephi.connect(credentialsHandleField.getText(), String.valueOf(credentialsPasswordField.getPassword()))){
+ if(blueskyGephi.connect(credentialsHostField.getText(), credentialsHandleField.getText(), String.valueOf(credentialsPasswordField.getPassword()))){
credentialsConnectButton.setBackground(Color.GREEN);
} else {
credentialsConnectButton.setBackground(Color.RED);
@@ -290,11 +312,17 @@ private void limitCrawlSpinnerPropertyChange(java.beans.PropertyChangeEvent evt)
blueskyGephi.setLimitCrawl(Math.max(1,((int)limitCrawlSpinner.getValue())/100));
}//GEN-LAST:event_limitCrawlSpinnerPropertyChange
+ private void credentialsHostFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_credentialsHostFieldActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_credentialsHostFieldActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton credentialsConnectButton;
private javax.swing.JTextField credentialsHandleField;
private javax.swing.JLabel credentialsHandleLabel;
+ private javax.swing.JTextField credentialsHostField;
+ private javax.swing.JLabel credentialsHostLabel;
private javax.swing.JPanel credentialsPanel;
private javax.swing.JPasswordField credentialsPasswordField;
private javax.swing.JLabel credentialsPasswordLabel;
diff --git a/modules/BlueskyGephi/src/main/resources/fr/totetmatt/blueskygephi/Bundle.properties b/modules/BlueskyGephi/src/main/resources/fr/totetmatt/blueskygephi/Bundle.properties
index 30123d975..402c71289 100644
--- a/modules/BlueskyGephi/src/main/resources/fr/totetmatt/blueskygephi/Bundle.properties
+++ b/modules/BlueskyGephi/src/main/resources/fr/totetmatt/blueskygephi/Bundle.properties
@@ -1,3 +1,5 @@
+CTL_BlueskyGephiMainPanel=Bluesky Gephi
+HINT_BlueskyGephiMainPanel=Import network from Bluesky / AtProtocol
BlueskyGephiMainPanel.toolTipText=Bluesky Gephi
BlueskyGephiMainPanel.Credentials.toolTipText=Credentials
BlueskyGephiMainPanel.credentialsPanel.border.title=Credentials
@@ -14,3 +16,5 @@ BlueskyGephiMainPanel.isDeepSearch.text=Fetch also n+1
BlueskyGephiMainPanel.limitCrawlCheckbox.text=Crawl Limit
BlueskyGephiMainPanel.limitCrawlSpinner.AccessibleContext.accessibleDescription=
BlueskyGephiMainPanel.limitCrawlSpinner.toolTipText=Nb Follower / Following to fetch max on a n+1 crawl
+BlueskyGephiMainPanel.credentialsHostLabel.text=Host
+BlueskyGephiMainPanel.credentialsHostField.text=
diff --git a/pom.xml b/pom.xml
index 11572dc3e..e04bc86b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,7 +85,7 @@
-
+ modules/BlueskyGephi