| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- package org.leumasjaffe.charsheet.view;
- import javax.swing.JPanel;
- import org.leumasjaffe.charsheet.model.DDCharacter;
- import org.leumasjaffe.charsheet.view.summary.AbilityPanel;
- import org.leumasjaffe.charsheet.view.summary.ArmorLine;
- import org.leumasjaffe.charsheet.view.summary.AttackLine;
- import org.leumasjaffe.charsheet.view.summary.DamageReductionLine;
- import org.leumasjaffe.charsheet.view.summary.DescriptionPanel;
- import org.leumasjaffe.charsheet.view.summary.HealthLine;
- import org.leumasjaffe.charsheet.view.summary.InitiativeLine;
- import org.leumasjaffe.charsheet.view.summary.ResistancePanel;
- import org.leumasjaffe.charsheet.view.summary.SpellResistanceLine;
- import lombok.AccessLevel;
- import lombok.experimental.FieldDefaults;
- import java.awt.GridBagLayout;
- import java.awt.GridBagConstraints;
- import java.awt.Insets;
- import java.awt.Color;
- import java.awt.Dimension;
- import java.awt.Component;
- import javax.swing.Box;
- @FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
- public class SummaryTab extends JPanel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- HealthLine healthLine;
- ArmorLine armorLine;
- ResistancePanel resistancePanel;
- AbilityPanel abilityPanel;
- DescriptionPanel descriptionPanel;
- InitiativeLine initiativeLine;
- SpellResistanceLine spellResistLine;
- DamageReductionLine damageReductionLine;
- AttackLine attackLine;
-
-
- public SummaryTab() {
- setBackground(Color.WHITE);
- GridBagLayout gridBagLayout = new GridBagLayout();
- gridBagLayout.columnWidths = new int[]{0, 0, 0};
- gridBagLayout.rowHeights = new int[]{0, 0, 0, 0};
- gridBagLayout.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
- gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
- setLayout(gridBagLayout);
-
- descriptionPanel = new DescriptionPanel();
- GridBagConstraints gbc_descriptionPanel = new GridBagConstraints();
- gbc_descriptionPanel.gridwidth = 2;
- gbc_descriptionPanel.insets = new Insets(0, 0, 5, 0);
- gbc_descriptionPanel.fill = GridBagConstraints.BOTH;
- gbc_descriptionPanel.gridx = 0;
- gbc_descriptionPanel.gridy = 0;
- add(descriptionPanel, gbc_descriptionPanel);
-
- abilityPanel = new AbilityPanel();
- GridBagConstraints gbc_abilityPanel = new GridBagConstraints();
- gbc_abilityPanel.insets = new Insets(0, 0, 5, 5);
- gbc_abilityPanel.fill = GridBagConstraints.BOTH;
- gbc_abilityPanel.gridx = 0;
- gbc_abilityPanel.gridy = 1;
- add(abilityPanel, gbc_abilityPanel);
-
- JPanel panel = new JPanel();
- panel.setOpaque(false);
- GridBagConstraints gbc_panel = new GridBagConstraints();
- gbc_panel.insets = new Insets(0, 0, 5, 0);
- gbc_panel.fill = GridBagConstraints.BOTH;
- gbc_panel.gridx = 1;
- gbc_panel.gridy = 1;
- add(panel, gbc_panel);
- GridBagLayout gbl_panel = new GridBagLayout();
- gbl_panel.columnWidths = new int[]{0, 0};
- gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
- gbl_panel.columnWeights = new double[]{1.0, Double.MIN_VALUE};
- gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
- panel.setLayout(gbl_panel);
-
- healthLine = new HealthLine();
- GridBagConstraints gbc_healthLine = new GridBagConstraints();
- gbc_healthLine.insets = new Insets(0, 0, 5, 0);
- gbc_healthLine.fill = GridBagConstraints.BOTH;
- gbc_healthLine.gridx = 0;
- gbc_healthLine.gridy = 0;
- panel.add(healthLine, gbc_healthLine);
-
- armorLine = new ArmorLine();
- GridBagConstraints gbc_armorLine = new GridBagConstraints();
- gbc_armorLine.insets = new Insets(0, 0, 5, 0);
- gbc_armorLine.fill = GridBagConstraints.BOTH;
- gbc_armorLine.gridx = 0;
- gbc_armorLine.gridy = 1;
- panel.add(armorLine, gbc_armorLine);
-
- resistancePanel = new ResistancePanel();
- GridBagConstraints gbc_resistancePanel = new GridBagConstraints();
- gbc_resistancePanel.fill = GridBagConstraints.BOTH;
- gbc_resistancePanel.gridx = 0;
- gbc_resistancePanel.gridy = 2;
- panel.add(resistancePanel, gbc_resistancePanel);
-
- JPanel panel_1 = new JPanel();
- panel_1.setOpaque(false);
- GridBagConstraints gbc_panel_1 = new GridBagConstraints();
- gbc_panel_1.gridwidth = 2;
- gbc_panel_1.insets = new Insets(0, 0, 0, 5);
- gbc_panel_1.fill = GridBagConstraints.BOTH;
- gbc_panel_1.gridx = 0;
- gbc_panel_1.gridy = 2;
- add(panel_1, gbc_panel_1);
- GridBagLayout gbl_panel_1 = new GridBagLayout();
- gbl_panel_1.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
- gbl_panel_1.rowHeights = new int[]{0, 0, 0};
- gbl_panel_1.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- gbl_panel_1.rowWeights = new double[]{1.0, 0.0, Double.MIN_VALUE};
- panel_1.setLayout(gbl_panel_1);
-
- initiativeLine = new InitiativeLine();
- GridBagConstraints gbc_initiativeLine = new GridBagConstraints();
- gbc_initiativeLine.insets = new Insets(0, 0, 5, 5);
- gbc_initiativeLine.fill = GridBagConstraints.BOTH;
- gbc_initiativeLine.gridx = 0;
- gbc_initiativeLine.gridy = 0;
- panel_1.add(initiativeLine, gbc_initiativeLine);
-
- Component horizontalStrut = Box.createHorizontalStrut(20);
- horizontalStrut.setPreferredSize(new Dimension(40, 0));
- GridBagConstraints gbc_horizontalStrut = new GridBagConstraints();
- gbc_horizontalStrut.insets = new Insets(0, 0, 5, 5);
- gbc_horizontalStrut.gridx = 1;
- gbc_horizontalStrut.gridy = 0;
- panel_1.add(horizontalStrut, gbc_horizontalStrut);
-
- spellResistLine = new SpellResistanceLine();
- GridBagConstraints gbc_spellResistLine = new GridBagConstraints();
- gbc_spellResistLine.insets = new Insets(0, 0, 5, 5);
- gbc_spellResistLine.fill = GridBagConstraints.BOTH;
- gbc_spellResistLine.gridx = 2;
- gbc_spellResistLine.gridy = 0;
- panel_1.add(spellResistLine, gbc_spellResistLine);
-
- Component horizontalStrut_1 = Box.createHorizontalStrut(20);
- horizontalStrut_1.setPreferredSize(new Dimension(40, 0));
- GridBagConstraints gbc_horizontalStrut_1 = new GridBagConstraints();
- gbc_horizontalStrut_1.insets = new Insets(0, 0, 5, 5);
- gbc_horizontalStrut_1.gridx = 3;
- gbc_horizontalStrut_1.gridy = 0;
- panel_1.add(horizontalStrut_1, gbc_horizontalStrut_1);
-
- damageReductionLine = new DamageReductionLine();
- GridBagConstraints gbc_damageReductionLine = new GridBagConstraints();
- gbc_damageReductionLine.insets = new Insets(0, 0, 5, 0);
- gbc_damageReductionLine.fill = GridBagConstraints.BOTH;
- gbc_damageReductionLine.gridx = 4;
- gbc_damageReductionLine.gridy = 0;
- panel_1.add(damageReductionLine, gbc_damageReductionLine);
-
- attackLine = new AttackLine();
- GridBagConstraints gbc_attackLine = new GridBagConstraints();
- gbc_attackLine.gridwidth = 5;
- gbc_attackLine.fill = GridBagConstraints.BOTH;
- gbc_attackLine.gridx = 0;
- gbc_attackLine.gridy = 1;
- panel_1.add(attackLine, gbc_attackLine);
- }
- public void setModel(DDCharacter model) {
- this.descriptionPanel.setModel(model);
- this.abilityPanel.setModel(model.getAbilities());
- this.initiativeLine.setModel(model);
- this.attackLine.setModel(model);
- this.armorLine.setModel(model);
- this.resistancePanel.setModel(model);
- this.healthLine.setModel(model.getHealth());
- }
- }
|