Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-2) was last changed on 29-Dec-2020 05:25 by Ben Spink

This page was created on 29-Dec-2020 05:25 by Ben Spink

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 210 changed one line
%%
/%
----
GUI.java
----
%%prettify
{{{
package PostBack;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.lang.reflect.*;
public class GUI extends JPanel
{
private JLabel jLabel1 = new JLabel();
private JTextField url_field = new JTextField();
public GUI()
{
try
{
jbInit();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
Object parent = null;
private JPanel jPanel1 = new JPanel();
private JCheckBox enabled_cb = new JCheckBox();
private JCheckBox debug_cb = new JCheckBox();
private JCheckBox recent_cb = new JCheckBox();
private JLabel jLabel2 = new JLabel();
private JLabel jLabel3 = new JLabel();
private JLabel jLabel4 = new JLabel();
private JLabel jLabel5 = new JLabel();
private JTextField post_data_field = new JTextField();
private JLabel jLabel7 = new JLabel();
private JLabel jLabel11 = new JLabel();
private JTextField username_field = new JTextField();
private JLabel jLabel6 = new JLabel();
private JLabel jLabel8 = new JLabel();
private JPasswordField password_field = new JPasswordField();
private JCheckBox send_alerts_cb = new JCheckBox();
private JLabel jLabel9 = new JLabel();
private JTextField retry_count_field = new JTextField();
private JTextField max_full_speed = new JTextField();
private JLabel jLabel10 = new JLabel();
private JTextField delay_interval = new JTextField();
private JLabel jLabel12 = new JLabel();
public void setParent(Object parent)
{
this.parent = parent;
}
void jbInit() throws Exception
{
jLabel1.setFont(new java.awt.Font("Arial", 0, 12));
jLabel1.setText("URL:");
jLabel1.setBounds(new Rectangle(9, 44, 72, 29));
this.setLayout(null);
url_field.setBounds(new Rectangle(84, 46, 457, 22));
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setBounds(new Rectangle(3, 38, 583, 334));
jPanel1.setLayout(null);
enabled_cb.setFont(new java.awt.Font("Arial", 0, 12));
enabled_cb.setText("Enabled");
enabled_cb.setBounds(new Rectangle(6, 6, 100, 22));
debug_cb.setBounds(new Rectangle(122, 6, 100, 22));
debug_cb.setFont(new java.awt.Font("Arial", 0, 12));
debug_cb.setText("Debug");
recent_cb.setFont(new java.awt.Font("Arial", 0, 12));
recent_cb.setToolTipText("");
recent_cb.setText("Only use most recent item.");
recent_cb.setBounds(new Rectangle(86, 234, 213, 22));
jLabel2.setFont(new java.awt.Font("Arial", 0, 12));
jLabel2.setText("If this is for an event where the event happens immediately, and");
jLabel2.setBounds(new Rectangle(108, 257, 472, 16));
jLabel3.setFont(new java.awt.Font("Arial", 0, 12));
jLabel3.setText("not just on logout, this will only process the most recent item.");
jLabel3.setBounds(new Rectangle(108, 280, 472, 16));
jLabel4.setFont(new java.awt.Font("Arial", 0, 12));
jLabel4.setText("Otherwise, it will go through each item executing the command on " + "each.");
jLabel4.setBounds(new Rectangle(108, 303, 472, 16));
jLabel5.setFont(new java.awt.Font("Arial", 0, 9));
jLabel5.setHorizontalAlignment(SwingConstants.CENTER);
jLabel5.setHorizontalTextPosition(SwingConstants.CENTER);
jLabel5.setText("<html><body><center>%user_name%, %the_real_pathl%, %the_file_path%, " + "%the_file_name%, <br>%the_file_size%, %the_file_speed%, %the_file_start%, " + "%the_file_end%, %the_file_error%</center></body></html>");
jLabel5.setBounds(new Rectangle(5, 9, 573, 29));
post_data_field.setBounds(new Rectangle(84, 183, 457, 22));
jLabel7.setBounds(new Rectangle(9, 180, 72, 29));
jLabel7.setText("Post Data:");
jLabel7.setFont(new java.awt.Font("Arial", 0, 12));
jLabel11.setFont(new java.awt.Font("Arial", 0, 12));
jLabel11.setText("Enable debug mode to see how the url was called.");
jLabel11.setBounds(new Rectangle(84, 214, 494, 16));
username_field.setBounds(new Rectangle(252, 79, 95, 22));
jLabel6.setBounds(new Rectangle(9, 76, 245, 29));
jLabel6.setText("Basic Authentication Username (optional):");
jLabel6.setFont(new java.awt.Font("Arial", 0, 12));
jLabel8.setBounds(new Rectangle(352, 76, 121, 29));
jLabel8.setText("Password (optional):");
jLabel8.setFont(new java.awt.Font("Arial", 0, 12));
password_field.setBounds(new Rectangle(472, 79, 95, 22));
send_alerts_cb.setBounds(new Rectangle(9, 107, 221, 22));
send_alerts_cb.setText("Alert notifications on failures.");
send_alerts_cb.setFont(new java.awt.Font("Arial", 0, 12));
send_alerts_cb.setOpaque(false);
jLabel9.setFont(new java.awt.Font("Arial", 0, 12));
jLabel9.setText("Retry x times on failure:");
jLabel9.setBounds(new Rectangle(212, 104, 139, 29));
retry_count_field.setBounds(new Rectangle(343, 107, 47, 22));
max_full_speed.setBounds(new Rectangle(283, 143, 47, 22));
jLabel10.setBounds(new Rectangle(12, 140, 278, 29));
jLabel10.setText("Maximum files per event that post without delay:");
jLabel10.setFont(new java.awt.Font("Arial", 0, 12));
delay_interval.setBounds(new Rectangle(491, 143, 47, 22));
jLabel12.setBounds(new Rectangle(335, 140, 174, 29));
jLabel12.setText("Delay between event posts:");
jLabel12.setFont(new java.awt.Font("Arial", 0, 12));
this.add(jPanel1, null);
jPanel1.add(jLabel5, null);
this.add(enabled_cb, null);
this.add(debug_cb, null);
jPanel1.add(jLabel1, null);
jPanel1.add(url_field, null);
jPanel1.add(jLabel6, null);
jPanel1.add(username_field, null);
jPanel1.add(jLabel8, null);
jPanel1.add(password_field, null);
jPanel1.add(send_alerts_cb, null);
jPanel1.add(jLabel9, null);
jPanel1.add(retry_count_field, null);
jPanel1.add(jLabel7, null);
jPanel1.add(jLabel4, null);
jPanel1.add(jLabel3, null);
jPanel1.add(jLabel2, null);
jPanel1.add(recent_cb, null);
jPanel1.add(jLabel11, null);
jPanel1.add(post_data_field, null);
jPanel1.add(jLabel10, null);
jPanel1.add(max_full_speed, null);
jPanel1.add(jLabel12, null);
jPanel1.add(delay_interval, null);
}
public Properties getSettings()
{
Properties p = new Properties();
p.put("enabled", enabled_cb.isSelected() + "");
p.put("debug", debug_cb.isSelected() + "");
p.put("send_alerts", send_alerts_cb.isSelected() + "");
p.put("url", url_field.getText());
p.put("retry_count", retry_count_field.getText());
p.put("max_full_speed", max_full_speed.getText());
p.put("delay_interval", delay_interval.getText());
p.put("username", username_field.getText());
p.put("password", new String(password_field.getPassword()));
p.put("post_data", post_data_field.getText());
p.put("recent", recent_cb.isSelected() + "");
return p;
}
public void setSettings(Properties p)
{
enabled_cb.setSelected(p.getProperty("enabled").equalsIgnoreCase("true"));
debug_cb.setSelected(p.getProperty("debug").equalsIgnoreCase("true"));
send_alerts_cb.setSelected(p.getProperty("send_alerts", "false").equalsIgnoreCase("true"));
url_field.setText(p.getProperty("url"));
retry_count_field.setText(p.getProperty("retry_count"));
max_full_speed.setText(p.getProperty("max_full_speed"));
delay_interval.setText(p.getProperty("delay_interval"));
username_field.setText(p.getProperty("username"));
password_field.setText(p.getProperty("password"));
post_data_field.setText(p.getProperty("post_data"));
recent_cb.setSelected(p.getProperty("recent").equalsIgnoreCase("true"));
}
void test_btn_actionPerformed(ActionEvent e)
{
Properties p = getSettings();
try
{
Method setSettings = parent.getClass().getMethod("setSettings", new Class[] { new Properties().getClass() });
setSettings.invoke(parent, new Object[] { p });
Method testSettings = parent.getClass().getMethod("testSettings", null);
testSettings.invoke(parent, null);
}
catch (Exception ee)
{
}
}
}
}}}
/%
Version Date Modified Size Author Changes ... Change note
2 29-Dec-2020 05:25 15.499 kB Ben Spink to previous
1 29-Dec-2020 05:25 7.562 kB Ben Spink to last
« This page (revision-2) was last changed on 29-Dec-2020 05:25 by Ben Spink
G’day (anonymous guest)
CrushFTP10 | What's New

Referenced by
LeftMenu

JSPWiki