Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ArgIR GUI #9

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Arguments-enhanced IR
![version](https://img.shields.io/badge/version-0.7.0-blue)
![last-update](https://img.shields.io/badge/last_update-2/9/2022-orange)
![version](https://img.shields.io/badge/version-0.8.0-blue)
![last-update](https://img.shields.io/badge/last_update-2/10/2022-orange)
![license](https://img.shields.io/badge/license-Apache_2.0-brightgreen)

Argument-enhanced information retrieval project repository. A case study in the <a href="https://decide.madrid.es" target="_blank">Decide Madrid</a> database.
Expand Down
2 changes: 1 addition & 1 deletion code/ArgumentIR/Resources/views/proposal-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<span>- Districts</span>: $DISTRICTS$<br />
<span>- Categories</span>: $CATEGORIES$<br />
<span>- Topics</span>: $TOPICS$<br />
<p>Link: $URL$</p>
<p>Decide Madrid <a href="$URL$">link</a></p>
<p><strong>Comments:</strong></p>
<div>$COMMENTS$</div>
</div>
12 changes: 6 additions & 6 deletions code/ArgumentIR/src/es/uam/irg/ir/gui/ArgumentIRForm.form
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<Component id="lblRerankBy" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="cmbReranks" min="-2" pref="150" max="-2" attributes="0"/>
<EmptySpace pref="200" max="32767" attributes="0"/>
<EmptySpace pref="743" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="txtQuery" max="32767" attributes="0"/>
Expand Down Expand Up @@ -126,7 +126,7 @@
<Component id="cmbReranks" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Component id="scrollPane" pref="266" max="32767" attributes="0"/>
<Component id="scrollPane" pref="466" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
</Group>
</Group>
Expand Down Expand Up @@ -159,10 +159,10 @@

<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextPane" name="txtResult">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
<Component class="javax.swing.JEditorPane" name="txtResult">
<Events>
<EventHandler event="hyperlinkUpdate" listener="javax.swing.event.HyperlinkListener" parameters="javax.swing.event.HyperlinkEvent" handler="txtResultHyperlinkUpdate"/>
</Events>
</Component>
</SubComponents>
</Container>
Expand Down
37 changes: 32 additions & 5 deletions code/ArgumentIR/src/es/uam/irg/ir/gui/ArgumentIRForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
package es.uam.irg.ir.gui;

import es.uam.irg.utils.FunctionUtils;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.event.HyperlinkEvent;
import javax.swing.text.BadLocationException;

/**
Expand All @@ -40,6 +44,7 @@ public class ArgumentIRForm extends javax.swing.JFrame {
public ArgumentIRForm() {
initComponents();
this.txtResult.setContentType(HTML_CONTENT_TYPE);
this.txtResult.setEditable(false);
this.model = new ArgumentIRModel(DECIMAL_FORMAT, DATE_FORMAT);
}

Expand Down Expand Up @@ -86,7 +91,7 @@ private void initComponents() {
txtQuery = new javax.swing.JTextField();
btnSearch = new javax.swing.JButton();
scrollPane = new javax.swing.JScrollPane();
txtResult = new javax.swing.JTextPane();
txtResult = new javax.swing.JEditorPane();
lblTop = new javax.swing.JLabel();
cmbTop = new javax.swing.JComboBox<>();
lblRerankBy = new javax.swing.JLabel();
Expand Down Expand Up @@ -117,7 +122,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});

txtResult.setEditable(false);
txtResult.addHyperlinkListener(new javax.swing.event.HyperlinkListener() {
public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {
txtResultHyperlinkUpdate(evt);
}
});
scrollPane.setViewportView(txtResult);

lblTop.setText("Top:");
Expand Down Expand Up @@ -178,7 +187,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(lblRerankBy)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cmbReranks, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(200, Short.MAX_VALUE))
.addContainerGap(743, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(txtQuery)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
Expand All @@ -203,7 +212,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(lblRerankBy)
.addComponent(cmbReranks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE)
.addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
.addGap(20, 20, 20))
);

Expand Down Expand Up @@ -272,6 +281,24 @@ private void mItemExportTextActionPerformed(java.awt.event.ActionEvent evt) {//G
}
}//GEN-LAST:event_mItemExportTextActionPerformed

/**
* Event: Catch events of hyperlinks.
*
* @param evt
*/
private void txtResultHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_txtResultHyperlinkUpdate
// TODO add your handling code here:
if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(evt.getURL().toURI());
} catch (URISyntaxException | IOException ex) {
Logger.getLogger(ArgumentIRForm.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}//GEN-LAST:event_txtResultHyperlinkUpdate

/**
*
* @return
Expand Down Expand Up @@ -302,7 +329,7 @@ private String selectExportFile(String ext) {
private javax.swing.JPopupMenu.Separator menuSeparator;
private javax.swing.JScrollPane scrollPane;
private javax.swing.JTextField txtQuery;
private javax.swing.JTextPane txtResult;
private javax.swing.JEditorPane txtResult;
// End of variables declaration//GEN-END:variables

}