Search in sources :

Example 1 with EquipModFacade

use of pcgen.facade.core.EquipModFacade in project pcgen by PCGen.

the class EquipmentBuilderFacadeImpl method refreshAvailList.

private void refreshAvailList() {
    List<String> aFilter = equip.typeList();
    for (EquipmentHead head : equipHeads) {
        List<EquipModFacade> newEqMods = new ArrayList<>();
        for (EquipmentModifier aEqMod : Globals.getContext().getReferenceContext().getConstructedCDOMObjects(EquipmentModifier.class)) {
            if (equip.isVisible(character, aEqMod, head.isPrimary(), View.VISIBLE_DISPLAY)) {
                if (aEqMod.isType("ALL")) {
                    newEqMods.add(aEqMod);
                } else {
                    for (String aType : aFilter) {
                        if (aEqMod.isType(aType)) {
                            newEqMods.add(aEqMod);
                            break;
                        }
                    }
                }
            }
        }
        availListMap.get(head).updateContents(newEqMods);
    }
}
Also used : EquipModFacade(pcgen.facade.core.EquipModFacade) EquipmentModifier(pcgen.core.EquipmentModifier) ArrayList(java.util.ArrayList)

Example 2 with EquipModFacade

use of pcgen.facade.core.EquipModFacade in project pcgen by PCGen.

the class EquipCustomPanel method initComponents.

private void initComponents() {
    JPanel upperPanel = new JPanel(new BorderLayout());
    setTopComponent(upperPanel);
    setOrientation(VERTICAL_SPLIT);
    Box bannerBox = Box.createHorizontalBox();
    bannerBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    bannerBox.add(Box.createHorizontalGlue());
    JLabel baseItemLabel = new JLabel(LanguageBundle.getString("in_EqBuilder_BaseItem"));
    FontManipulation.large(baseItemLabel);
    bannerBox.add(baseItemLabel);
    bannerBox.add(Box.createHorizontalStrut(5));
    JLabel baseItemName = new JLabel(builder.getBaseItemName());
    FontManipulation.large(baseItemName);
    FontManipulation.title(baseItemName);
    bannerBox.add(baseItemName);
    if (validHeads.getSize() > 1) {
        bannerBox.add(Box.createHorizontalStrut(45));
        JLabel headLabel = new JLabel(LanguageBundle.getString("in_EqBuilder_Head"));
        FontManipulation.large(headLabel);
        bannerBox.add(headLabel);
        bannerBox.add(Box.createHorizontalStrut(5));
        Dimension prefDim = headCombo.getPreferredSize();
        prefDim.width += 15;
        headCombo.setMaximumSize(prefDim);
        bannerBox.add(headCombo);
    }
    bannerBox.add(Box.createHorizontalGlue());
    upperPanel.add(bannerBox, BorderLayout.NORTH);
    FlippingSplitPane topPane = new FlippingSplitPane("equipCustTop");
    upperPanel.add(topPane, BorderLayout.CENTER);
    JPanel availPanel = new JPanel(new BorderLayout());
    FilterBar<Object, EquipModFacade> bar = new FilterBar<>();
    bar.addDisplayableFilter(new SearchFilterPanel());
    availPanel.add(bar, BorderLayout.NORTH);
    availableTable.setDisplayableFilter(bar);
    availableTable.setTreeViewModel(availEqmodModelMap.get(currentHead));
    availableTable.setTreeCellRenderer(renderer);
    availPanel.add(new JScrollPane(availableTable), BorderLayout.CENTER);
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    addButton.setHorizontalTextPosition(SwingConstants.LEADING);
    addButton.setAction(addAction);
    box.add(addButton);
    box.add(Box.createHorizontalStrut(5));
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    availPanel.add(box, BorderLayout.SOUTH);
    topPane.setLeftComponent(availPanel);
    JPanel selPanel = new JPanel(new BorderLayout());
    Box equipButtonBox = Box.createHorizontalBox();
    equipButtonBox.add(Box.createHorizontalGlue());
    nameButton.setHorizontalTextPosition(SwingConstants.LEADING);
    nameButton.setAction(nameAction);
    equipButtonBox.add(nameButton);
    equipButtonBox.add(Box.createHorizontalStrut(5));
    spropButton.setHorizontalTextPosition(SwingConstants.LEADING);
    spropButton.setAction(spropAction);
    equipButtonBox.add(spropButton);
    equipButtonBox.add(Box.createHorizontalStrut(5));
    costButton.setHorizontalTextPosition(SwingConstants.LEADING);
    costButton.setAction(costAction);
    equipButtonBox.add(costButton);
    equipButtonBox.add(Box.createHorizontalStrut(5));
    weightButton.setHorizontalTextPosition(SwingConstants.LEADING);
    weightButton.setAction(weightAction);
    equipButtonBox.add(weightButton);
    if (builder.isWeapon()) {
        equipButtonBox.add(Box.createHorizontalStrut(5));
        damageButton.setHorizontalTextPosition(SwingConstants.LEADING);
        damageButton.setAction(damageAction);
        equipButtonBox.add(damageButton);
    }
    // Only show size if it can be used
    if (builder.isResizable()) {
        JPanel sizePanel = new JPanel();
        JLabel sizeLabel = new JLabel(LanguageBundle.getString("in_EqBuilder_Size"));
        sizePanel.add(sizeLabel);
        sizePanel.add(sizeCombo);
        equipButtonBox.add(Box.createHorizontalStrut(5));
        equipButtonBox.add(sizePanel);
    }
    equipButtonBox.add(Box.createHorizontalGlue());
    equipButtonBox.setBorder(new EmptyBorder(5, 0, 0, 0));
    selPanel.add(equipButtonBox, BorderLayout.NORTH);
    selectedTable.setTreeViewModel(selectedEqmodModelMap.get(currentHead));
    selectedTable.setTreeCellRenderer(renderer);
    selPanel.add(new JScrollPane(selectedTable), BorderLayout.CENTER);
    box = Box.createHorizontalBox();
    removeButton.setHorizontalTextPosition(SwingConstants.TRAILING);
    removeButton.setAction(removeAction);
    box.add(Box.createHorizontalStrut(5));
    box.add(removeButton);
    box.add(Box.createHorizontalGlue());
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    selPanel.add(box, BorderLayout.SOUTH);
    topPane.setRightComponent(selPanel);
    FlippingSplitPane bottomPane = new FlippingSplitPane("equipCustBottom");
    bottomPane.setLeftComponent(equipModInfoPane);
    bottomPane.setRightComponent(equipInfoPane);
    setBottomComponent(bottomPane);
    setResizeWeight(0.75);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JLabel(javax.swing.JLabel) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) Dimension(java.awt.Dimension) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) EquipModFacade(pcgen.facade.core.EquipModFacade) FilterBar(pcgen.gui2.filter.FilterBar) BorderLayout(java.awt.BorderLayout) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel) EmptyBorder(javax.swing.border.EmptyBorder)

Aggregations

EquipModFacade (pcgen.facade.core.EquipModFacade)2 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 ArrayList (java.util.ArrayList)1 Box (javax.swing.Box)1 JComboBox (javax.swing.JComboBox)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 EmptyBorder (javax.swing.border.EmptyBorder)1 EquipmentModifier (pcgen.core.EquipmentModifier)1 FilterBar (pcgen.gui2.filter.FilterBar)1 SearchFilterPanel (pcgen.gui2.filter.SearchFilterPanel)1 FlippingSplitPane (pcgen.gui2.tools.FlippingSplitPane)1