EDU-596 Remove show hint checkbox in Add/Edit Answer Placeholder dialog

This commit is contained in:
liana.bakradze
2016-04-25 18:43:25 +02:00
parent 09f795c936
commit 35f18c1871
3 changed files with 9 additions and 40 deletions
@@ -43,7 +43,6 @@ public class CCCreateAnswerPlaceholderDialog extends DialogWrapper {
private void setHintText(AnswerPlaceholder answerPlaceholder) {
String hintText = answerPlaceholder.getHint();
myPanel.doClick();
myPanel.setHintText(hintText);
}
@@ -13,7 +13,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Placeholder text:"/>
<text value="Placeholder:"/>
</properties>
</component>
<grid id="cbc70" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -41,16 +41,6 @@
</component>
</children>
</grid>
<component id="f86b4" class="javax.swing.JCheckBox" binding="myCreateHintCheckBox" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="0" bottom="2" right="2"/>
<text value="Create hint"/>
<verticalAlignment value="0"/>
</properties>
</component>
<grid id="51a63" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
@@ -71,6 +61,14 @@
</component>
</children>
</grid>
<component id="61da7" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Hint:"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -2,41 +2,21 @@ package com.jetbrains.edu.coursecreator.ui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class CCCreateAnswerPlaceholderPanel extends JPanel {
private JPanel myPanel;
private JTextArea myHintText;
private JCheckBox myCreateHintCheckBox;
private JTextField myAnswerPlaceholderText;
public CCCreateAnswerPlaceholderPanel() {
super(new BorderLayout());
add(myPanel, BorderLayout.CENTER);
enableHint(false);
myHintText.setLineWrap(true);
myHintText.setWrapStyleWord(true);
myCreateHintCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
int state = e.getStateChange();
// 1 for checked
enableHint(state == 1);
if (state == 2) {
resetHint();
}
}
});
myAnswerPlaceholderText.grabFocus();
}
private void enableHint(boolean isEnable) {
myHintText.setEnabled(isEnable);
}
public void setAnswerPlaceholderText(String answerPlaceholderText) {
myAnswerPlaceholderText.setText(answerPlaceholderText);
}
@@ -53,14 +33,6 @@ public class CCCreateAnswerPlaceholderPanel extends JPanel {
return myHintText.getText();
}
public void doClick() {
myCreateHintCheckBox.doClick();
}
public void resetHint() {
myHintText.setText("");
}
public JComponent getPreferredFocusedComponent() {
return myAnswerPlaceholderText;
}