Search in sources :

Example 1 with FileDrop

use of beast.app.util.FileDrop in project beast2 by CompEvol.

the class AlignmentListInputEditor method init.

@Override
@SuppressWarnings("unchecked")
public void init(Input<?> input, BEASTInterface beastObject, int itemNr, ExpandOption isExpandOption, boolean addButtons) {
    this.itemNr = itemNr;
    if (input.get() instanceof List) {
        alignments = (List<Alignment>) input.get();
    } else {
        // we just have a single Alignment
        alignments = new ArrayList<>();
        alignments.add((Alignment) input.get());
    }
    linkButtons = new ArrayList<>();
    unlinkButtons = new ArrayList<>();
    partitionCount = alignments.size();
    // override BoxLayout in superclass
    setLayout(new BorderLayout());
    add(createLinkButtons(), BorderLayout.NORTH);
    add(createListBox(), BorderLayout.CENTER);
    // Box box = Box.createVerticalBox();
    // box.add(Box.createVerticalStrut(STRUT_SIZE));
    // box.add(createLinkButtons());
    // box.add(Box.createVerticalStrut(STRUT_SIZE));
    // box.add(createListBox());
    // box.add(Box.createVerticalStrut(STRUT_SIZE));
    // box.add(Box.createVerticalGlue());
    // add(box, BorderLayout.CENTER);
    Color focusColor = UIManager.getColor("Focus.color");
    Border focusBorder = BorderFactory.createMatteBorder(2, 2, 2, 2, focusColor);
    new FileDrop(null, scrollPane, focusBorder, new FileDrop.Listener() {

        @Override
        public void filesDropped(java.io.File[] files) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    addItem(files);
                }
            });
        }
    });
    // end FileDrop.Listener
    // this should place the add/remove/split buttons at the bottom of the window.
    add(createAddRemoveSplitButtons(), BorderLayout.SOUTH);
    updateStatus();
}
Also used : Color(java.awt.Color) FileDrop(beast.app.util.FileDrop) FilteredAlignment(beast.evolution.alignment.FilteredAlignment) Alignment(beast.evolution.alignment.Alignment) BorderLayout(java.awt.BorderLayout) List(java.util.List) ArrayList(java.util.ArrayList) Border(javax.swing.border.Border) File(java.io.File)

Aggregations

FileDrop (beast.app.util.FileDrop)1 Alignment (beast.evolution.alignment.Alignment)1 FilteredAlignment (beast.evolution.alignment.FilteredAlignment)1 BorderLayout (java.awt.BorderLayout)1 Color (java.awt.Color)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Border (javax.swing.border.Border)1