View | Details | Raw Unified | Return to bug 12306
Collapse All | Expand All

(-)a/KoLmafia/src/net/sourceforge/kolmafia/ItemManageFrame.java (+117 lines)
Lines 113-118 public class ItemManageFrame extends KoLFrame Link Here
113
		this.addSeparator();
113
		this.addSeparator();
114
114
115
		this.addPanel( "Inventory", new InventoryManagePanel( inventory, true ) );
115
		this.addPanel( "Inventory", new InventoryManagePanel( inventory, true ) );
116
		this.addPanel( " - Equipment", new EquipmentManagePanel( inventory, true ) );
116
		this.addPanel( " - Recent", new InventoryManagePanel( tally, true ) );
117
		this.addPanel( " - Recent", new InventoryManagePanel( tally, true ) );
117
		this.addPanel( " - Closet", new InventoryManagePanel( closet, true ) );
118
		this.addPanel( " - Closet", new InventoryManagePanel( closet, true ) );
118
119
Lines 948-953 public class ItemManageFrame extends KoLFrame Link Here
948
		}
949
		}
949
	}
950
	}
950
951
952
	private class EquipmentManagePanel extends ItemManagePanel
953
	{
954
		private JRadioButton [] equipmentFilters;
955
956
		public EquipmentManagePanel( LockableListModel elementModel )
957
		{	this( elementModel, true );
958
		}
959
960
		public EquipmentManagePanel( LockableListModel elementModel, boolean addFilters )
961
		{
962
			super( elementModel );
963
964
			boolean isCloset = (elementModel == closet);
965
966
			this.setButtons( addFilters, new ActionListener [] {
967
968
				new ConsumeListener(),
969
				new PutInClosetListener( isCloset ),
970
				new AutoSellListener( isCloset, AutoSellRequest.AUTOSELL ),
971
				new AutoSellListener( isCloset, AutoSellRequest.AUTOMALL ),
972
				new PulverizeListener( isCloset ),
973
				new PutOnDisplayListener( isCloset ),
974
				new GiveToClanListener( isCloset )
975
976
			} );
977
978
			this.movers[ KoLCharacter.canInteract() ? 0 : 2 ].setSelected( true );
979
		}
980
981
		public void addFilters( boolean isCompact )
982
		{
983
			ButtonGroup filterGroup = new ButtonGroup();
984
			JPanel filterPanel = new JPanel();
985
			this.equipmentFilters = new JRadioButton[7];
986
			this.equipmentFilters[0] = new JRadioButton( "weapons", true );
987
			this.equipmentFilters[1] = new JRadioButton( "offhand" );
988
			this.equipmentFilters[2] = new JRadioButton( "hats" );
989
			this.equipmentFilters[3] = new JRadioButton( "shirts" );
990
			this.equipmentFilters[4] = new JRadioButton( "pants" );
991
			this.equipmentFilters[5] = new JRadioButton( "accessories" );
992
			this.equipmentFilters[6] = new JRadioButton( "familiar" );
993
994
			for ( int i = 0; i < 7; ++i )
995
			{
996
				filterGroup.add( this.equipmentFilters[i] );
997
				filterPanel.add( this.equipmentFilters[i] );
998
				this.listenToRadioButton( this.equipmentFilters[i] );
999
			}
1000
1001
			this.northPanel.add( filterPanel, BorderLayout.CENTER );
1002
			this.filterItems();
1003
		}
1004
1005
		public FilterItemField getWordFilter()
1006
		{	return new EquipmentFilterField();
1007
		}
1008
1009
		private class EquipmentFilterField extends FilterItemField
1010
		{
1011
			public EquipmentFilterField()
1012
			{	this.filter = new EquipmentFilter();
1013
			}
1014
1015
			private class EquipmentFilter extends SimpleListFilter
1016
			{
1017
				public EquipmentFilter()
1018
				{	super( EquipmentFilterField.this );
1019
				}
1020
1021
				public boolean isVisible( Object element )
1022
				{
1023
					boolean isVisibleWithFilter = true;
1024
1025
					switch ( TradeableItemDatabase.getConsumptionType( ((AdventureResult)element).getItemId() ) )
1026
					{
1027
					case EQUIP_WEAPON:
1028
						isVisibleWithFilter = EquipmentManagePanel.this.equipmentFilters[0].isSelected();
1029
						break;
1030
1031
					case EQUIP_OFFHAND:
1032
						isVisibleWithFilter = EquipmentManagePanel.this.equipmentFilters[1].isSelected();
1033
						break;
1034
1035
					case EQUIP_HAT:
1036
						isVisibleWithFilter = EquipmentManagePanel.this.equipmentFilters[2].isSelected();
1037
						break;
1038
1039
					case EQUIP_SHIRT:
1040
						isVisibleWithFilter = EquipmentManagePanel.this.equipmentFilters[3].isSelected();
1041
						break;
1042
1043
					case EQUIP_PANTS:
1044
						isVisibleWithFilter = EquipmentManagePanel.this.equipmentFilters[4].isSelected();
1045
						break;
1046
1047
					case EQUIP_ACCESSORY:
1048
						isVisibleWithFilter = EquipmentManagePanel.this.equipmentFilters[5].isSelected();
1049
						break;
1050
1051
					case EQUIP_FAMILIAR:
1052
						isVisibleWithFilter = EquipmentManagePanel.this.equipmentFilters[6].isSelected();
1053
						break;
1054
1055
					default:
1056
						return false;
1057
					}
1058
1059
					if ( !isVisibleWithFilter )
1060
						return false;
1061
1062
					return super.isVisible( element );
1063
				}
1064
			}
1065
		}
1066
	}
1067
951
	private class HagnkEquipmentPanel extends HagnkStoragePanel
1068
	private class HagnkEquipmentPanel extends HagnkStoragePanel
952
	{
1069
	{
953
		private FilterRadioButton [] equipmentFilters;
1070
		private FilterRadioButton [] equipmentFilters;

Return to bug 12306