Make answer placeholder txt field multiline
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Mon, 25 Jul 2016 14:33:14 +0000 (17:33 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Mon, 25 Jul 2016 16:25:34 +0000 (19:25 +0300)
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateAnswerPlaceholderPanel.form
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateAnswerPlaceholderPanel.java

index 1238ac49d4bbb3c16740276c7d7b5ceff0fe54b4..84b572cb44eab7551f2beed5e8f66ab33f6b8563 100644 (file)
@@ -1,63 +1,69 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.edu.coursecreator.ui.CCCreateAnswerPlaceholderPanel">
-  <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+  <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
-      <xy x="20" y="20" width="652" height="302"/>
+      <xy x="20" y="20" width="1379" height="302"/>
     </constraints>
     <properties/>
     <border type="none"/>
     <children>
-      <grid id="ff283" 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="2" right="0"/>
+      <component id="2c397" class="com.intellij.ui.components.JBLabel" binding="myHintLabel">
         <constraints>
-          <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+          <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties>
+          <labelFor value="d0efc"/>
+          <text value="&amp;Hint:"/>
+        </properties>
+      </component>
+      <grid id="98fe" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="1" left="0" bottom="0" right="0"/>
+        <constraints>
+          <grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties/>
         <border type="none"/>
         <children>
-          <component id="2e28f" class="javax.swing.JTextField" binding="myAnswerPlaceholderText">
+          <component id="aaa28" class="javax.swing.JLabel">
             <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
-                <minimum-size width="300" height="30"/>
-                <preferred-size width="-1" height="30"/>
-              </grid>
+              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
             </constraints>
             <properties>
-              <margin top="0" left="0" bottom="0" right="0"/>
-              <text value=""/>
+              <labelFor value="11499"/>
+              <text value="&amp;Placeholder:"/>
             </properties>
           </component>
+          <vspacer id="a9687">
+            <constraints>
+              <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+            </constraints>
+          </vspacer>
         </children>
       </grid>
-      <component id="aaa28" class="javax.swing.JLabel">
-        <constraints>
-          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-        </constraints>
-        <properties>
-          <labelFor value="2e28f"/>
-          <text value="Placeholder:"/>
-        </properties>
-      </component>
       <grid id="996a1" binding="myHintsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="2" left="0" bottom="0" right="0"/>
+        <margin top="0" left="0" bottom="0" right="0"/>
         <constraints>
-          <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+          <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties/>
         <border type="none"/>
         <children>
           <component id="d0efc" class="javax.swing.JTextArea" binding="myHintTextField">
             <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
+              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
                 <minimum-size width="300" height="150"/>
-                <preferred-size width="-1" height="150"/>
+                <preferred-size width="300" height="150"/>
               </grid>
             </constraints>
             <properties>
               <alignmentX value="0.5"/>
+              <dragEnabled value="false"/>
+              <lineWrap value="true"/>
+              <margin top="0" left="0" bottom="0" right="0"/>
               <text value=""/>
-              <toolTipText value="To add the first hint type its text here"/>
+              <toolTipText value=""/>
+              <wrapStyleWord value="true"/>
             </properties>
           </component>
           <grid id="4a2a2" binding="actionsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
           </grid>
         </children>
       </grid>
-      <component id="2c397" class="com.intellij.ui.components.JBLabel" binding="myHintLabel">
+      <grid id="f94e9" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="1" left="0" bottom="6" right="0"/>
         <constraints>
-          <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="1" fill="0" indent="0" use-parent-layout="false"/>
+          <grid row="0" column="1" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
-        <properties>
-          <text value="Hint:"/>
-        </properties>
-      </component>
+        <properties/>
+        <border type="none"/>
+        <children>
+          <component id="11499" class="javax.swing.JTextArea" binding="myPlaceholderTextArea" default-binding="true">
+            <constraints>
+              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
+                <preferred-size width="150" height="50"/>
+              </grid>
+            </constraints>
+            <properties>
+              <lineWrap value="true"/>
+              <margin top="0" left="0" bottom="0" right="0"/>
+              <wrapStyleWord value="true"/>
+            </properties>
+          </component>
+        </children>
+      </grid>
     </children>
   </grid>
 </form>
index 3f4f902e6ac9831375d53dac17d0a147c431cb8b..7d661c67e0aff1fac85bc01bf2ab126b7f125565 100644 (file)
@@ -22,10 +22,10 @@ public class CCCreateAnswerPlaceholderPanel extends JPanel {
   
   private JPanel myPanel;
   private JTextArea myHintTextField;
-  private JTextField myAnswerPlaceholderText;
   private JBLabel myHintLabel;
   private JPanel actionsPanel;
   private JPanel myHintsPanel;
+  private JTextArea myPlaceholderTextArea;
   private int myShownHintNumber = 0;
 
   private List<String> myHints = new ArrayList<String>() {{
@@ -39,7 +39,7 @@ public class CCCreateAnswerPlaceholderPanel extends JPanel {
     myHintTextField.setLineWrap(true);
     myHintTextField.setWrapStyleWord(true);
     myHintTextField.setBorder(BorderFactory.createLineBorder(JBColor.border()));
-    myHintTextField.setFont(myAnswerPlaceholderText.getFont());
+    myHintTextField.setFont(myPlaceholderTextArea.getFont());
     if (myHints.get(myShownHintNumber).equals(ourFirstHintText)) {
       myHintTextField.setForeground(UIUtil.getInactiveTextColor());
     }
@@ -54,7 +54,7 @@ public class CCCreateAnswerPlaceholderPanel extends JPanel {
       }
     });
 
-    myAnswerPlaceholderText.grabFocus();
+    myPlaceholderTextArea.grabFocus();
     updateHintNumberLabel();
 
     ((GridLayoutManager)myHintsPanel.getLayout()).setHGap(1);
@@ -75,7 +75,7 @@ public class CCCreateAnswerPlaceholderPanel extends JPanel {
   }
 
   public void setAnswerPlaceholderText(String answerPlaceholderText) {
-    myAnswerPlaceholderText.setText(answerPlaceholderText);
+    myPlaceholderTextArea.setText(answerPlaceholderText);
   }
 
   public void setHintText(String hintTextField) {
@@ -84,7 +84,7 @@ public class CCCreateAnswerPlaceholderPanel extends JPanel {
   }
 
   public String getAnswerPlaceholderText() {
-    return myAnswerPlaceholderText.getText();
+    return myPlaceholderTextArea.getText();
   }
 
   public List<String> getHints() {
@@ -100,7 +100,7 @@ public class CCCreateAnswerPlaceholderPanel extends JPanel {
   }
 
   public JComponent getPreferredFocusedComponent() {
-    return myAnswerPlaceholderText;
+    return myPlaceholderTextArea;
   }
 
   public void setHints(List<String> hints) {