Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

FeedbackDialog.java 4.5KB

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