You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FeedbackDialog.java 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (c) 2006-2015 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.addons.ui_swing.dialogs.feedback;
  23. import com.dmdirc.addons.ui_swing.components.NoBorderJCheckBox;
  24. import com.dmdirc.addons.ui_swing.components.text.TextLabel;
  25. import com.dmdirc.addons.ui_swing.components.validating.ValidationFactory;
  26. import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
  27. import com.dmdirc.addons.ui_swing.injection.MainWindow;
  28. import com.dmdirc.interfaces.ui.FeedbackDialogModel;
  29. import com.dmdirc.addons.ui_swing.components.IconManager;
  30. import java.awt.Window;
  31. import javax.inject.Inject;
  32. import javax.swing.JCheckBox;
  33. import javax.swing.JLabel;
  34. import javax.swing.JScrollPane;
  35. import javax.swing.JTextArea;
  36. import javax.swing.JTextField;
  37. import net.miginfocom.swing.MigLayout;
  38. /**
  39. * Dialog to send feedback to the developers.
  40. */
  41. public class FeedbackDialog extends StandardDialog {
  42. private static final long serialVersionUID = 1;
  43. @Inject
  44. public FeedbackDialog(@MainWindow final Window mainFrame,
  45. final FeedbackDialogModel model,
  46. final IconManager iconManager) {
  47. super(mainFrame, ModalityType.DOCUMENT_MODAL);
  48. final FeedbackModelLinker linker = new FeedbackModelLinker(this, model);
  49. linker.init();
  50. setTitle("Feedback");
  51. final TextLabel info = new TextLabel("Thank you for using DMDirc. If you have any "
  52. + "feedback about the client, such as bug reports or feature "
  53. + "requests, please send it to us using the form below. "
  54. + "The name and e-mail address fields are optional if you "
  55. + "don't want us to contact you about your feedback.\n\n"
  56. + "Please note that this is for feedback such as bug reports "
  57. + "and suggestions, not for technical support. For "
  58. + "technical support, please join #DMDirc using the button "
  59. + "in the help menu.");
  60. final JTextField name = new JTextField();
  61. final JTextField email = new JTextField();
  62. final JTextArea feedback = new JTextArea();
  63. final JCheckBox serverInfo = new NoBorderJCheckBox("Include information about connected "
  64. + "servers.");
  65. final JCheckBox dmdircInfo = new NoBorderJCheckBox("Include information about DMDirc.");
  66. linker.bindName(name);
  67. linker.bindEmail(email);
  68. linker.bindFeedback(feedback);
  69. linker.bindServerInfo(serverInfo);
  70. linker.bindDMDircInfo(dmdircInfo);
  71. linker.bindOKButton(getOkButton());
  72. linker.bindCancelButton(getCancelButton());
  73. setLayout(new MigLayout("fill, wmin 600, wmax 600, hmin 400, hmax 400"));
  74. add(info, "span, growx, wrap 2*unrel");
  75. add(new JLabel("Name: "), "align label");
  76. add(ValidationFactory.getValidatorPanel(name, model.getNameValidator(), iconManager),
  77. "growx, pushx, wrap");
  78. add(new JLabel("Email: "), "alignx label");
  79. add(ValidationFactory.getValidatorPanel(email, model.getEmailValidator(), iconManager),
  80. "growx, pushx, wrap");
  81. add(new JLabel("Feedback: "), "alignx label");
  82. add(ValidationFactory.getValidatorPanel(new JScrollPane(feedback), feedback,
  83. model.getFeedbackValidator(), iconManager), "grow, push, wrap");
  84. add(serverInfo, "skip 1, growx, wrap");
  85. add(dmdircInfo, "skip 1, growx, wrap 2*unrel");
  86. add(getLeftButton(), "span, split 2, right, sg button");
  87. add(getRightButton(), "right, sg button");
  88. }
  89. }