/* * Copyright 2013-2014 Urs Wolfer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.urswolfer.intellij.plugin.gerrit.ui; import com.intellij.openapi.project.Project; import com.intellij.ui.EditorTextField; import javax.swing.*; import java.awt.*; /** * @author Urs Wolfer */ public class ReviewPanel extends JPanel { private final EditorTextField messageField; private final JCheckBox notifyCheckBox; private final JCheckBox submitCheckBox; public ReviewPanel(Project project) { super(new BorderLayout()); SafeHtmlTextEditor editor = new SafeHtmlTextEditor(project); messageField = editor.getMessageField(); add(editor, BorderLayout.CENTER); JPanel southPanel = new JPanel(); BoxLayout southLayout = new BoxLayout(southPanel, BoxLayout.Y_AXIS); southPanel.setLayout(southLayout); add(southPanel, BorderLayout.SOUTH); notifyCheckBox = new JCheckBox("Send Notification Mails", true); southPanel.add(notifyCheckBox); submitCheckBox = new JCheckBox("Submit Change"); southPanel.add(submitCheckBox); setBorder(BorderFactory.createEmptyBorder()); } public void setMessage(final String message) { messageField.setText(message); } public String getMessage() { return messageField.getText().trim(); } public boolean getSubmitChange() { return submitCheckBox.isSelected(); } public boolean getDoNotify() { return notifyCheckBox.isSelected(); } public JComponent getPreferrableFocusComponent() { return messageField; } }