use of org.magic.gui.components.ManaPanel in project MtgDesktopCompanion by nicho92.
the class LightDescribeCardPanel method initDataBindings.
protected BindingGroup initDataBindings() {
BeanProperty<MagicCard, String> nameProperty = BeanProperty.create("name");
BeanProperty<JTextField, String> textProperty = BeanProperty.create("text");
AutoBinding<MagicCard, String, JTextField, String> autoBinding = Bindings.createAutoBinding(UpdateStrategy.READ, card, nameProperty, txtName, textProperty);
autoBinding.bind();
BeanProperty<MagicCard, String> costProperty = BeanProperty.create("cost");
BeanProperty<ManaPanel, String> textProperty1 = BeanProperty.create("manaCost");
AutoBinding<MagicCard, String, ManaPanel, String> autoBinding1 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, card, costProperty, manaPanel, textProperty1);
autoBinding1.bind();
BeanProperty<MagicCard, String> fullTypeProperty = BeanProperty.create("fullType");
BeanProperty<JTextField, String> textProperty2 = BeanProperty.create("text");
AutoBinding<MagicCard, String, JTextField, String> autoBinding2 = Bindings.createAutoBinding(UpdateStrategy.READ, card, fullTypeProperty, txtType, textProperty2);
autoBinding2.bind();
BeanProperty<MagicCard, Integer> loyaltyProperty = BeanProperty.create("loyalty");
BeanProperty<JTextField, String> textProperty4 = BeanProperty.create("text");
AutoBinding<MagicCard, Integer, JTextField, String> autoBinding4 = Bindings.createAutoBinding(UpdateStrategy.READ, card, loyaltyProperty, txtLoyalty, textProperty4);
autoBinding4.bind();
BeanProperty<MagicCard, String> textProperty8 = BeanProperty.create("text");
BeanProperty<MagicTextPane, String> textProperty9 = BeanProperty.create("text");
AutoBinding<MagicCard, String, MagicTextPane, String> autoBinding8 = Bindings.createAutoBinding(UpdateStrategy.READ, card, textProperty8, magicTextPane, textProperty9);
autoBinding8.bind();
BeanProperty<MagicCard, String> pProperty = BeanProperty.create("power");
BeanProperty<JTextField, String> textPropertyP = BeanProperty.create("text");
AutoBinding<MagicCard, String, JTextField, String> autoBindingP = Bindings.createAutoBinding(UpdateStrategy.READ, card, pProperty, txtPower, textPropertyP);
autoBindingP.bind();
BeanProperty<MagicCard, String> tProperty = BeanProperty.create("toughness");
BeanProperty<JTextField, String> textPropertyT = BeanProperty.create("text");
AutoBinding<MagicCard, String, JTextField, String> autoBindingT = Bindings.createAutoBinding(UpdateStrategy.READ, card, tProperty, txtT, textPropertyT);
autoBindingT.bind();
StringBuilder rules = new StringBuilder();
for (MagicRuling rul : card.getRulings()) rules.append("-").append(rul.getText()).append("\n");
rulesTextPane.setText(rules.toString());
//
BindingGroup bindingGroup = new BindingGroup();
//
bindingGroup.addBinding(autoBinding);
bindingGroup.addBinding(autoBinding1);
bindingGroup.addBinding(autoBinding2);
bindingGroup.addBinding(autoBinding4);
bindingGroup.addBinding(autoBinding8);
bindingGroup.addBinding(autoBindingT);
bindingGroup.addBinding(autoBindingP);
magicTextPane.updateTextWithIcons();
return bindingGroup;
}
use of org.magic.gui.components.ManaPanel in project MtgDesktopCompanion by nicho92.
the class CardListPanel method initGUI.
private void initGUI() {
setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 0, 137, 129, 0 };
gridBagLayout.rowHeights = new int[] { 12, 12, 12, 12, 0 };
gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
setLayout(gridBagLayout);
lblName = new JLabel();
lblName.setFont(new Font("Tahoma", Font.BOLD, 11));
GridBagConstraints gbclblName = new GridBagConstraints();
gbclblName.fill = GridBagConstraints.VERTICAL;
gbclblName.insets = new Insets(0, 0, 5, 5);
gbclblName.anchor = GridBagConstraints.WEST;
gbclblName.gridx = 1;
gbclblName.gridy = 0;
add(lblName, gbclblName);
lblType = new JLabel();
GridBagConstraints gbclblType = new GridBagConstraints();
gbclblType.fill = GridBagConstraints.VERTICAL;
gbclblType.gridwidth = 2;
gbclblType.insets = new Insets(0, 0, 5, 0);
gbclblType.anchor = GridBagConstraints.WEST;
gbclblType.gridx = 1;
gbclblType.gridy = 1;
add(lblType, gbclblType);
lblEdition = new JLabel();
GridBagConstraints gbclblEdition = new GridBagConstraints();
gbclblEdition.fill = GridBagConstraints.VERTICAL;
gbclblEdition.insets = new Insets(0, 0, 5, 0);
gbclblEdition.gridwidth = 2;
gbclblEdition.anchor = GridBagConstraints.WEST;
gbclblEdition.gridx = 1;
gbclblEdition.gridy = 2;
add(lblEdition, gbclblEdition);
manaPanel = new ManaPanel();
manaPanel.setBackground(this.getBackground());
GridBagConstraints gbcmanaPanel = new GridBagConstraints();
gbcmanaPanel.insets = new Insets(0, 0, 5, 0);
gbcmanaPanel.anchor = GridBagConstraints.EAST;
gbcmanaPanel.fill = GridBagConstraints.VERTICAL;
gbcmanaPanel.gridx = 2;
gbcmanaPanel.gridy = 0;
add(manaPanel, gbcmanaPanel);
lblRarity = new JLabel();
lblRarity.setFont(new Font("Tahoma", Font.ITALIC, 11));
GridBagConstraints gbclblRarity = new GridBagConstraints();
gbclblRarity.fill = GridBagConstraints.VERTICAL;
gbclblRarity.gridwidth = 2;
gbclblRarity.anchor = GridBagConstraints.WEST;
gbclblRarity.insets = new Insets(0, 0, 0, 5);
gbclblRarity.gridx = 1;
gbclblRarity.gridy = 3;
add(lblRarity, gbclblRarity);
}
Aggregations