diff options
author | Appu Goundan <appu@google.com> | 2014-08-22 19:05:15 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-08-22 19:05:16 +0000 |
commit | ffb17b96cb4447c36d44c36cc5968d5194125bf7 (patch) | |
tree | 4f260c36787cb2a42fca1e46ce49f0682cc115c7 | |
parent | 507028e964c7cbc448cc7273daf5017a3d2fad9f (diff) | |
parent | 4865de18299051a7dda357c203e49d27eae46805 (diff) | |
download | cloud-idea133-milestone.tar.gz |
Merge "Fix misaligned UI component in New Appengine Module Wizard" into idea133gradle_0.13.0idea133-milestone
-rw-r--r-- | src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.form | 24 | ||||
-rw-r--r-- | src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.java | 40 |
2 files changed, 32 insertions, 32 deletions
diff --git a/src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.form b/src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.form index 28aedfe..4a0e21a 100644 --- a/src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.form +++ b/src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.form @@ -67,7 +67,7 @@ <text value="Some text for designer"/> </properties> </component> - <grid id="ce31e" binding="myDocPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0"> + <grid id="ce31e" binding="myDocPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0"> <margin top="0" left="0" bottom="0" right="0"/> <constraints> <grid row="3" column="0" row-span="2" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> @@ -75,28 +75,14 @@ <properties/> <border type="none"/> <children> - <component id="1ccc8" class="com.intellij.ui.HyperlinkLabel" binding="myDocLabel"> + <component id="4e259" class="javax.swing.JEditorPane" binding="myModuleDescriptionText" default-binding="true"> <constraints> - <grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="2" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"> + <preferred-size width="150" height="50"/> + </grid> </constraints> <properties/> </component> - <component id="b0088" class="javax.swing.JLabel" binding="myDocLabel2"> - <constraints> - <grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <text value="for more information about the contents of this backend module, and for"/> - </properties> - </component> - <component id="904d1" class="javax.swing.JLabel" binding="myDocLabel3"> - <constraints> - <grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> - </constraints> - <properties> - <text value="detailed instructions about connecting your Android app to this backend."/> - </properties> - </component> </children> </grid> </children> diff --git a/src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.java b/src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.java index d902d28..1509928 100644 --- a/src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.java +++ b/src/com/google/gct/idea/appengine/wizard/BackendModuleWizardStep.java @@ -20,6 +20,7 @@ import com.android.tools.idea.wizard.AndroidStudioWizardStep; import com.android.tools.idea.wizard.NewModuleWizardState; import com.android.tools.idea.wizard.NewProjectWizardState; import com.android.tools.idea.wizard.TemplateWizardStep; +import com.intellij.ide.BrowserUtil; import com.intellij.ide.util.projectWizard.ModuleWizardStep; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; @@ -29,11 +30,15 @@ import com.intellij.openapi.ui.MessageType; import com.intellij.psi.PsiNameHelper; import com.intellij.ui.*; import com.intellij.ui.components.JBLabel; +import com.intellij.util.ui.UIUtil; import org.jetbrains.android.dom.manifest.Manifest; import org.jetbrains.android.facet.AndroidFacet; import javax.swing.*; import javax.swing.event.DocumentEvent; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -55,10 +60,8 @@ public class BackendModuleWizardStep extends ModuleWizardStep implements Android private JTextField myModuleNameField; private JComboBox myClientModuleCombo; private JBLabel myValidationStatus; - private HyperlinkLabel myDocLabel; - private JLabel myDocLabel2; private JPanel myDocPanel; - private JLabel myDocLabel3; + private JEditorPane myModuleDescriptionText; private boolean myUpdating; private boolean myPackageNameModified; @@ -92,14 +95,22 @@ public class BackendModuleWizardStep extends ModuleWizardStep implements Android myClientModuleCombo.setModel(new CollectionComboBoxModel(clientModules)); myClientModuleCombo.setRenderer(new AndroidModuleListCellRenderer()); - myValidationStatus.setIcon(MessageType.ERROR.getDefaultIcon()); + myModuleDescriptionText.setContentType(UIUtil.HTML_MIME); + myModuleDescriptionText.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); + myModuleDescriptionText.setFont(UIManager.getFont("Label.font")); + myModuleDescriptionText.setOpaque(false); + myModuleDescriptionText.setEditable(false); + myModuleDescriptionText.setMargin(new Insets(4, 0, 0, 0)); + myModuleDescriptionText.addHyperlinkListener(new HyperlinkListener() { + @Override + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + BrowserUtil.browse(e.getURL().toString()); + } + } + }); - // IntelliJ IDEA has a number of hyperlink components but none that support all 3 of: wrapping; hover cursor over a link; marking only - // part of text as link. So we have to use multiple separate labels here. :( - // Add some space above and below the doc and match HighlightableComponent.getTextOffset() (2 pixels left border on second label). - myDocLabel.setBorder(IdeBorderFactory.createEmptyBorder(8, 0, 0, 0)); - myDocLabel2.setBorder(IdeBorderFactory.createEmptyBorder(0, 2, 0, 0)); - myDocLabel3.setBorder(IdeBorderFactory.createEmptyBorder(0, 2, 8, 0)); + myValidationStatus.setIcon(MessageType.ERROR.getDefaultIcon()); } private void setupListener(JTextField field, final boolean updatePackageName) { @@ -166,13 +177,16 @@ public class BackendModuleWizardStep extends ModuleWizardStep implements Android } private void updateDocLabels() { - String docUrl = (String)myWizardState.get(ATTR_DOC_URL); + String docUrl = (String) myWizardState.get(ATTR_DOC_URL); TemplateMetadata metadata = myWizardState.getTemplateMetadata(); String title = metadata != null ? metadata.getTitle() : null; if (docUrl != null && title != null) { myDocPanel.setVisible(true); - myDocLabel.setHyperlinkText("Check the ", "\"" + title + "\" documentation", ""); - myDocLabel.setHyperlinkTarget(docUrl); + String hyperlink = String.format("<a href='%s'>\"%s\"</a>", docUrl, title); + myModuleDescriptionText.setText("<html><body>Check the " + hyperlink + " documentation for more " + + "information about the contents of this backend module, and for " + + "detailed instructions about connecting your Android app to this " + + "backend.</body></html>"); } else { myDocPanel.setVisible(false); } |