Skip to content

Commit

Permalink
FORGE-2553: Labels now show tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Dec 11, 2015
1 parent 848b387 commit 0e71d76
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public void buildUI(Container container)
component = new ComponentWithBrowseButton<>(textField, createBrowseButtonActionListener(textField));

inputField = component.getChildComponent();
inputField.setToolTipText(input.getDescription());
component.setToolTipText(input.getDescription());
inputField.getDocument().addDocumentListener(new DocumentListener()
{
@Override
Expand All @@ -79,7 +81,8 @@ public void documentChanged(DocumentEvent event)
public void updateState()
{
component.setEnabled(input.isEnabled());

component.setToolTipText(input.getDescription());
inputField.setToolTipText(input.getDescription());
if (!getValue().equals(getInputValue()))
{
reloadValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void itemStateChanged(ItemEvent e)
}
}
});
combo.setToolTipText(input.getDescription());
addNoteLabel(container, combo).setText(input.getNote());

}
Expand All @@ -70,6 +71,7 @@ public void itemStateChanged(ItemEvent e)
public void updateState()
{
combo.setEnabled(input.isEnabled());
combo.setToolTipText(input.getDescription());

if (!getInputValueChoices().equals(getChoices()) ||
!getInputValue().equals(getValue()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public LabeledComponent(InputComponent<?, Object> input, ForgeComponent componen
public void buildUI(Container container)
{
this.label = new JBLabel(InputComponents.getLabelFor(input, true));
label.setToolTipText(input.getDescription());
container.add(label);
component.buildUI(container);
}
Expand Down Expand Up @@ -70,6 +71,7 @@ public void setValueChangeListener(ValueChangeListener valueChangeListener)
public void updateState()
{
label.setEnabled(input.isEnabled());
label.setToolTipText(input.getDescription());
component.updateState();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void documentChanged(DocumentEvent event)
public void updateState()
{
component.setEnabled(input.isEnabled());
component.setToolTipText(input.getDescription());

if (!getValue().equals(getInputValue()))
{
Expand All @@ -83,7 +84,6 @@ public void updateState()
{
component.setVariants(getCompletions());
}
component.setToolTipText(input.getDescription());
updateNote(component, input.getNote());
}

Expand Down

0 comments on commit 0e71d76

Please sign in to comment.