View Javadoc

1   /**
2    * Copyright (C) 2008 Atlassian
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.atlassian.theplugin.idea.jira;
18  
19  import com.intellij.openapi.ui.DialogWrapper;
20  
21  import javax.swing.*;
22  import java.awt.*;
23  
24  public class ChangesetCreate extends DialogWrapper {
25  	private JPanel contentPane;
26  	private JTextField changesetName;
27  	private JTextArea changesetComment;
28  	private JCheckBox isActive;
29  
30  	public ChangesetCreate(String issueKey) {
31  		super(false);
32  		init();
33  		setTitle("Create Changelist for " + issueKey);
34  		changesetName.setDragEnabled(false);
35  		getOKAction().putValue(Action.NAME, "Create");
36  	}
37  
38  	public void setChangesetName(String txt) {
39  		changesetName.setText(txt);
40  		changesetName.setCaretPosition(0);
41  	}
42  
43  	public void setChangestComment(String txt) {
44  		changesetComment.setText(txt);
45  	}
46  
47  	public void setActive(boolean active) {
48  		isActive.setSelected(active);
49  	}
50  
51  	public String getChangesetName() {
52  		return changesetName.getText();
53  	}
54  
55  	public String getChangesetComment() {
56  		return changesetComment.getText();
57  	}
58  
59  	public boolean isActive() {
60  		return isActive.isSelected();
61  	}
62  
63  	protected JComponent createCenterPanel() {
64  		return contentPane;
65  	}
66  
67  	public JComponent getPreferredFocusedComponent() {
68  		return changesetComment;
69  	}
70  
71  	private void createUIComponents() {
72  		// TODO: place custom component creation code here
73  	}
74  
75  	{
76  // GUI initializer generated by IntelliJ IDEA GUI Designer
77  // >>> IMPORTANT!! <<<
78  // DO NOT EDIT OR ADD ANY CODE HERE!
79  		$$$setupUI$$$();
80  	}
81  
82  	/**
83  	 * Method generated by IntelliJ IDEA GUI Designer
84  	 * >>> IMPORTANT!! <<<
85  	 * DO NOT edit this method OR call it in your code!
86  	 *
87  	 * @noinspection ALL
88  	 */
89  	private void $$$setupUI$$$() {
90  		contentPane = new JPanel();
91  		contentPane.setLayout(new GridBagLayout());
92  		contentPane.setMaximumSize(new Dimension(-1, -1));
93  		contentPane.setMinimumSize(new Dimension(-1, -1));
94  		contentPane.setOpaque(false);
95  		contentPane.setPreferredSize(new Dimension(500, 200));
96  		contentPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12), null));
97  		changesetName = new JTextField();
98  		GridBagConstraints gbc;
99  		gbc = new GridBagConstraints();
100 		gbc.gridx = 1;
101 		gbc.gridy = 0;
102 		gbc.weightx = 1.0;
103 		gbc.anchor = GridBagConstraints.WEST;
104 		gbc.fill = GridBagConstraints.HORIZONTAL;
105 		contentPane.add(changesetName, gbc);
106 		final JScrollPane scrollPane1 = new JScrollPane();
107 		gbc = new GridBagConstraints();
108 		gbc.gridx = 1;
109 		gbc.gridy = 1;
110 		gbc.weightx = 1.0;
111 		gbc.weighty = 1.0;
112 		gbc.fill = GridBagConstraints.BOTH;
113 		gbc.insets = new Insets(12, 0, 12, 0);
114 		contentPane.add(scrollPane1, gbc);
115 		changesetComment = new JTextArea();
116 		scrollPane1.setViewportView(changesetComment);
117 		final JLabel label1 = new JLabel();
118 		label1.setText("Name:");
119 		gbc = new GridBagConstraints();
120 		gbc.gridx = 0;
121 		gbc.gridy = 0;
122 		gbc.anchor = GridBagConstraints.WEST;
123 		contentPane.add(label1, gbc);
124 		final JLabel label2 = new JLabel();
125 		label2.setText("Comment:");
126 		gbc = new GridBagConstraints();
127 		gbc.gridx = 0;
128 		gbc.gridy = 1;
129 		gbc.anchor = GridBagConstraints.NORTHWEST;
130 		gbc.insets = new Insets(12, 0, 0, 12);
131 		contentPane.add(label2, gbc);
132 		isActive = new JCheckBox();
133 		isActive.setSelected(false);
134 		isActive.setText("Make this changelist active");
135 		gbc = new GridBagConstraints();
136 		gbc.gridx = 0;
137 		gbc.gridy = 2;
138 		gbc.gridwidth = 2;
139 		gbc.anchor = GridBagConstraints.WEST;
140 		contentPane.add(isActive, gbc);
141 	}
142 
143 	/**
144 	 * @noinspection ALL
145 	 */
146 	public JComponent $$$getRootComponent$$$() {
147 		return contentPane;
148 	}
149 }