Viewing Issue Advanced Details

ID 0003911 Category [DMDirc] *Unsorted Severity minor
Reproducibility always Date Submitted 2010-03-10 20:20 Last Update 2010-04-12 21:26
Reporter MD87 Assigned To Greboid View Status public
Priority normal Status resolved Resolution fixed
Platform Fixed in Version Target Version 0.6.4
Product Version Product Build
Summary 0003911: Expose advanced action features (stoppable, concurrency group) in AED
Description
Expose advanced action features (stoppable, concurrency group) in AED
Needs unit test no
Upstream Bug URL

Relationships

Notes

A patchset (1) related to this change has been added to gerrit by Greboid

Adds some advanced options to the AED.

Fixes issue 3911

Change-Id: I6c137739de587f77139cc12265bf627c10284af9
authorGreboid <greg@dmdirc.com>2010-04-12 13:31:15 (GMT)
committer Chris Smith <chris@dmdirc.com>2010-04-12 20:25:10 (GMT)
commit7f2045cc208896bea4a734b7d7cd3f31eee9671c (patch) (side-by-side diff)
Adds some advanced options to the AED.
Fixes issue 3911 Change-Id: I6c137739de587f77139cc12265bf627c10284af9 Reviewed-on: http://gerrit.dmdirc.com/1248 Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com> Reviewed-by: Chris Smith <chris@dmdirc.com>
-rw-r--r--src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionAdvancedPanel.java111
-rw-r--r--src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionEditorDialog.java32
2 files changed, 138 insertions, 5 deletions
Click to Expand/Collapse
diff src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionAdvancedPanel.java
new file mode 100644
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package com.dmdirc.addons.ui_swing.dialogs.actioneditor;
+
+import javax.swing.BorderFactory;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.UIManager;
+
+import net.miginfocom.swing.MigLayout;
+
+/**
+ * Advanced options panel, show concurrency groups and enabled states.
+ */
+public class ActionAdvancedPanel extends JPanel {
+
+ /**
+ * A version number for this class. It should be changed whenever the class
+ * structure is changed (or anything else that would prevent serialized
+ * objects being unserialized with the new class).
+ */
+ private static final long serialVersionUID = 1;
+ private JLabel enabledLabel;
+ private JCheckBox enabled;
+ private JLabel groupLabel;
+ private JTextField group;
+
+ /**
+ * Creates a new panel to configure advanced options for actions.
+ */
+ public ActionAdvancedPanel() {
+ initComponents();
+ layoutComponents();
+ }
+
+ /** Initialises the components. */
+ private void initComponents() {
+ setBorder(BorderFactory.createTitledBorder(UIManager.getBorder(
+ "TitledBorder.border"), "Advanced"));
+ enabled = new JCheckBox("", true);
+ group = new JTextField();
+ enabledLabel = new JLabel("Enabled: ");
+ groupLabel = new JLabel("Concurrency group: ");
+ }
+
+ private void layoutComponents() {
+ setLayout(new MigLayout("fill, pack"));
+ add(enabledLabel, "");
+ add(enabled, "growx");
+ add(groupLabel, "");
+ add(group, "growx, pushx");
+ }
+
+ /**
+ * Gets the concurrency group for this action.
+ *
+ * @return Current concurrency group
+ */
+ public String getConcurrencyGroup() {
+ return group.getText();
+ }
+
+ /**
+ * Is the action currently enabled?
+ *
+ * @return true iif enabled
+ */
+ public boolean isActionEnabled() {
+ return enabled.isSelected();
+ }
+
+ /**
+ * Sets whether this action should be enabled.
+ *
+ * @param actionEnabled true to enable, false to disable
+ */
+ public void setActionEnabled(final boolean actionEnabled) {
+ enabled.setSelected(actionEnabled);
+ }
+
+ /**
+ * Sets this actions concurrency group.
+ *
+ * @param actionGroup New concurrency group
+ */
+ public void setConcurrencyGroup(final String actionGroup) {
+ group.setText(actionGroup);
+ }
+}
Click to Expand/Collapse
diff src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionEditorDialog.java
@@ -61,8 +61,12 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
private ActionConditionsPanel conditions;
/** Substitutions panel. */
private ActionSubstitutionsPanel substitutions;
+ /** Advanced panel. */
+ private ActionAdvancedPanel advanced;
/** Show substitutions button. */
private JButton showSubstitutions;
+ /** Show advanced button. */
+ private JButton showAdvanced;
/** Is the name valid? */
private boolean nameValid = false;
/** Are the triggers valid? */
@@ -183,6 +187,7 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
response.setEnabled(action != null);
conditions.setEnabled(action != null);
substitutions.setVisible(false);
+ advanced.setVisible(false);
triggersValid = action != null;
conditionsValid = true;
@@ -197,6 +202,8 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
conditions.setActionTrigger(action.getTriggers()[0]);
conditions.setConditions(action.getConditions());
conditions.setConditionTree(action.getRealConditionTree());
+ advanced.setActionEnabled(action.isEnabled());
+ advanced.setConcurrencyGroup(action.getConcurrencyGroup());
}
}
@@ -208,12 +215,15 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
response = new ActionResponsePanel();
conditions = new ActionConditionsPanel();
substitutions = new ActionSubstitutionsPanel();
+ advanced = new ActionAdvancedPanel();
showSubstitutions = new JButton("Show Substitutions");
+ showAdvanced = new JButton("Show Advanced Options");
}
/** Adds the listeners. */
private void addListeners() {
showSubstitutions.addActionListener(this);
+ showAdvanced.addActionListener(this);
getOkButton().addActionListener(this);
getCancelButton().addActionListener(this);
@@ -232,8 +242,10 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
add(triggers, "grow, w 50%");
add(response, "grow, pushy, w 50%");
add(substitutions, "spanx, grow, push");
- add(showSubstitutions, "left, sgx button, split 3, spanx 2");
- add(getLeftButton(), "right, sgx button, gapleft push");
+ add(advanced, "spanx, grow, push");
+ add(showSubstitutions, "left, sgx button, split 2");
+ add(showAdvanced, "left, sgx button");
+ add(getLeftButton(), "right, sgx button, gapleft push, split");
add(getRightButton(), "right, sgx button");
}
@@ -249,6 +261,10 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
showSubstitutions.setText(substitutions.isVisible() ? "Hide Substitutions"
: "Show Substitutions");
pack();
+ } else if (e.getSource().equals(showAdvanced)) {
+ advanced.setVisible(!advanced.isVisible());
+ showAdvanced.setText(advanced.isVisible() ? "Hide Advanced Options"
+ : "Show Advanced Options");
} else if (e.getSource().equals(getOkButton())) {
save();
dispose();
@@ -281,9 +297,12 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
conditions.getConditions();
conditions.getConditionTree();
if (action == null) {
- new Action(group, name.getActionName(), triggers.getTriggers(),
- response.getResponse(), conditions.getConditions(),
- conditions.getConditionTree(), response.getFormatter());
+ final Action newAction = new Action(group, name.getActionName(),
+ triggers.getTriggers(), response.getResponse(),
+ conditions.getConditions(), conditions.getConditionTree(),
+ response.getFormatter());
+ newAction.setConcurrencyGroup(advanced.getConcurrencyGroup());
+ newAction.setEnabled(advanced.isActionEnabled());
} else {
action.setName(name.getActionName());
action.setConditionTree(conditions.getConditionTree());
@@ -291,6 +310,8 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
action.setNewFormat(response.getFormatter());
action.setResponse(response.getResponse());
action.setTriggers(triggers.getTriggers());
+ action.setConcurrencyGroup(advanced.getConcurrencyGroup());
+ action.setEnabled(advanced.isActionEnabled());
action.save();
}
}
@@ -309,6 +330,7 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
response.setEnabled((Boolean) evt.getNewValue());
conditions.setEnabled((Boolean) evt.getNewValue());
substitutions.setEnabled((Boolean) evt.getNewValue());
+ advanced.setEnabled((Boolean) evt.getNewValue());
substitutions.setType(triggers.getPrimaryTrigger());
conditions.setActionTrigger(triggers.getPrimaryTrigger());

Issue History

Date Modified Username Field Change
2010-03-10 20:20 MD87 New Issue
2010-03-10 20:20 MD87 Status new => assigned
2010-03-10 20:20 MD87 Assigned To => Greboid
2010-04-12 14:31 Greboid Checkin
2010-04-12 14:31 Greboid Note Added: 0011005
2010-04-12 14:31 Greboid Status assigned => fix pending
2010-04-12 21:26 Greboid Checkin
2010-04-12 21:26 Greboid Note Added: 0011006
2010-04-12 21:26 Greboid Status fix pending => resolved
2010-04-12 21:26 Greboid Resolution open => fixed