Exemplo n.º 1
0
 public FxComboView(MigPane parent, String name) {
   this.parent = parent;
   MigPane comboBody = new MigPane(LayoutUtils.fillWithoutInsets());
   comboBody.add(charms, new CC().wrap());
   comboBody.add(description, new CC().wrap());
   comboBody.add(buttonPanel, new CC().wrap());
   charms.getStyleClass().add("comboCharms");
   description.getStyleClass().add("comboDescription");
   titledCombo.setContent(comboBody);
   displayComboName(name);
 }
Exemplo n.º 2
0
public class FxComboView implements ComboView {
  private final TitledPane titledCombo = new TitledPane();
  private final MigPane parent;
  private final Label charms = new Label();
  private final Label description = new Label();
  private final MigPane buttonPanel = new MigPane(LayoutUtils.fillWithoutInsets());

  public FxComboView(MigPane parent, String name) {
    this.parent = parent;
    MigPane comboBody = new MigPane(LayoutUtils.fillWithoutInsets());
    comboBody.add(charms, new CC().wrap());
    comboBody.add(description, new CC().wrap());
    comboBody.add(buttonPanel, new CC().wrap());
    charms.getStyleClass().add("comboCharms");
    description.getStyleClass().add("comboDescription");
    titledCombo.setContent(comboBody);
    displayComboName(name);
  }

  public Node getNode() {
    return titledCombo;
  }

  @Override
  public Tool addTool() {
    FxButtonTool tool = FxButtonTool.ForToolbar();
    buttonPanel.add(tool.getNode());
    return tool;
  }

  @Override
  public void remove() {
    parent.getChildren().remove(titledCombo);
  }

  @Override
  public void displayComboName(String name) {
    titledCombo.setText(name);
  }

  @Override
  public void displayCharmNames(String commaSeparatedCharms) {
    charms.setText(commaSeparatedCharms);
  }

  @Override
  public void displayDescription(String text) {
    description.setText(text);
  }
}
Exemplo n.º 3
0
@RegisteredPreferenceView
public class SheetPreferenceView implements PreferenceView, NodeHolder {
  private final MigPane pane = new MigPane(LayoutUtils.fillWithoutInsets());

  public ObjectSelectionView<PageSize> addObjectSelectionView(
      String title, AgnosticUIConfiguration<PageSize> uiConfiguration) {
    ComboBoxSelectionView<PageSize> view = new ComboBoxSelectionView<>(title, uiConfiguration);
    pane.add(view.getNode());
    return view;
  }

  @Override
  public Node getNode() {
    return pane;
  }
}
Exemplo n.º 4
0
public class FxTooltipBuilder {
  private final MigPane body = new MigPane(LayoutUtils.withoutInsets().wrapAfter(2));
  public static final int DEFAULT_TOOLTIP_WIDTH = 80;

  public FxTooltipBuilder() {
    new Stylesheet("skin/platform/tooltip.css").applyToParent(body);
  }

  public void appendLine(String text) {
    addAsLine(new Label(text));
  }

  public void appendTitleLine(String title) {
    Label label = new Label(title);
    label.getStyleClass().add("boldText");
    addAsLine(label);
  }

  public void appendLine(String labelText, String valueText) {
    Label label = new Label(labelText + ": ");
    Label value = new Label(valueText);
    body.add(label);
    body.add(value);
  }

  public void appendDescriptiveLine(String description) {
    String descriptionWithLineBreaks =
        insertLineBreakEveryXCharacters(description, "\n", DEFAULT_TOOLTIP_WIDTH);
    Label label = new Label(descriptionWithLineBreaks);
    label.getStyleClass().add("italicText");
    addAsLine(label);
  }

  private void addAsLine(Node node) {
    body.add(node, new CC().span());
  }

  public void reset() {
    body.getChildren().clear();
  }

  public Node getNode() {
    return body;
  }
}
Exemplo n.º 5
0
 @SuppressWarnings("serial")
 public void addComponents(JPanel panel) {
   this.traitPanel = panel;
   panel.add(abilityLabel);
   panel.add(separatorLabel);
   panel.add(specialtyLabel, new CC().pushX().growX());
   panel.add(getValueDisplay().getComponent());
   deleteButton =
       new JButton(
           new AbstractAction(null, deleteIcon) {
             @Override
             public void actionPerformed(ActionEvent e) {
               fireDeletionPerformed();
             }
           });
   deleteButton.setPreferredSize(
       new Dimension(deleteIcon.getIconWidth() + 4, deleteIcon.getIconHeight() + 4));
   panel.add(deleteButton, LayoutUtils.constraintsForImageButton(deleteButton));
 }
Exemplo n.º 6
0
public class WeaponTagsView implements IWeaponTagsView {

  private final JPanel content =
      new JPanel(new MigLayout(LayoutUtils.fillWithoutInsets().wrapAfter(3)));

  @Override
  public JComponent getContent() {
    return content;
  }

  @Override
  public void requestFocus() {
    // nothing to do
  }

  @Override
  public JCheckBox addCheckBox(String string) {
    JCheckBox box = new JCheckBox(string);
    content.add(box);
    return box;
  }
}