2 * Copyright 2000-2009 JetBrains s.r.o.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package com
.intellij
.uiDesigner
.clientProperties
;
18 import com
.intellij
.openapi
.project
.Project
;
19 import com
.intellij
.openapi
.ui
.DialogWrapper
;
20 import com
.intellij
.ui
.IdeBorderFactory
;
21 import com
.intellij
.uiDesigner
.clientProperties
.ClientPropertiesManager
;
22 import com
.intellij
.uiDesigner
.UIDesignerBundle
;
23 import org
.jetbrains
.annotations
.Nullable
;
30 public class AddClientPropertyDialog
extends DialogWrapper
{
31 private JTextField myPropertyNameTextField
;
32 private JRadioButton myStringRadioButton
;
33 private JRadioButton myIntegerRadioButton
;
34 private JRadioButton myDoubleRadioButton
;
35 private JRadioButton myBooleanRadioButton
;
36 private JPanel myRootPanel
;
37 private JPanel myGroupPanel
;
39 public AddClientPropertyDialog(Project project
) {
40 super(project
, false);
42 setTitle(UIDesignerBundle
.message("client.property.add.title"));
43 myGroupPanel
.setBorder(IdeBorderFactory
.createTitledHeaderBorder(UIDesignerBundle
.message("client.properties.type.header")));
47 protected JComponent
createCenterPanel() {
52 public JComponent
getPreferredFocusedComponent() {
53 return myPropertyNameTextField
;
56 public ClientPropertiesManager
.ClientProperty
getEnteredProperty() {
58 if (myStringRadioButton
.isSelected()) {
59 className
= String
.class.getName();
61 else if (myIntegerRadioButton
.isSelected()) {
62 className
= Integer
.class.getName();
64 else if (myDoubleRadioButton
.isSelected()) {
65 className
= Double
.class.getName();
68 className
= Boolean
.class.getName();
70 return new ClientPropertiesManager
.ClientProperty(myPropertyNameTextField
.getText(), className
);