Class MVFArmorView

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class MVFArmorView extends BuildView implements ActionListener, ChangeListener
Panel for assigning armor type and tonnage for most heavy units.
See Also:
  • Constructor Details

    • MVFArmorView

      public MVFArmorView(megamek.common.interfaces.ITechManager techManager)
      Create the armor panel
      Parameters:
      techManager - The supplier of tech level parameters
    • MVFArmorView

      public MVFArmorView(megamek.common.interfaces.ITechManager techManager, boolean supportVee)
      Create the armor panel
      Parameters:
      techManager - The supplier of tech level parameters
      supportVee - If true, the amount of armor will be assigned by points rather than weight.
  • Method Details

    • addListener

      public void addListener(ArmorAllocationListener l)
    • removeListener

      public void removeListener(ArmorAllocationListener l)
    • setFromEntity

      public void setFromEntity(megamek.common.units.Entity en)
      Sets the values of all fields from the current Entity.
      Parameters:
      en - The Entity currently being edited
    • setFromEntity

      public void setFromEntity(megamek.common.units.Entity en, boolean ignoreEntityPatchwork)
      Sets the values of all fields from the current Entity, with the option of ignoring whether the Entity has patchwork armor. This is because the Entity does not report patchwork armor unless it actually has multiple armor types, and we don't want to clear the patchwork checkbox unless we're loading a new unit.
      Parameters:
      en - The Entity being edited
      ignoreEntityPatchwork - Whether to ignore whether the Entity has patchwork armor.
    • refresh

      public void refresh()
    • getArmor

      public megamek.common.equipment.EquipmentType getArmor()
      Returns:
      The selected armor equipment
    • setPatchwork

      public void setPatchwork(boolean patchwork)
      Enables or disables the patchwork checkbox and refreshes
      Parameters:
      patchwork - Whether the patchwork checkbox should be enabled
    • isPatchwork

      public boolean isPatchwork()
      Returns:
      True when the patchwork checkbox is selected; this is not equivalent to the unit having patchwork armor; entity.hasPatchworkArmor() only returns true when there are actually at least two different armor types installed.
    • getArmorType

      public int getArmorType()
      Returns:
      The armor type constant for the selected armor
    • getArmorTechConstant

      public int getArmorTechConstant()
    • getTechRating

      public megamek.common.enums.TechRating getTechRating()
    • getArmorTonnage

      public double getArmorTonnage()
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Specified by:
      stateChanged in interface ChangeListener
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener