Search in sources :

Example 1 with Metadata

use of net.sourceforge.processdash.ev.EVSnapshot.Metadata in project processdash by dtuma.

the class TaskScheduleSnapshotManager method createGui.

private void createGui(List<Metadata> snapshots) {
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(layout);
    int activePos = -1;
    snapshotModel = new DefaultListModel();
    for (Metadata snap : snapshots) {
        if (snap.getId().equals(activeSnapshotId))
            activePos = snapshotModel.getSize();
        snapshotModel.addElement(snap);
    }
    snapshotList = new JList(snapshotModel);
    snapshotList.setCellRenderer(new CellRenderer());
    if (activePos != -1)
        snapshotList.setSelectedIndex(activePos);
    c.gridx = c.gridy = 0;
    c.gridheight = 3;
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(0, 0, 0, 10);
    add(new JScrollPane(snapshotList), c);
    c.gridx = c.gridheight = 1;
    c.weighty = c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(0, 0, 0, 0);
    add(new JButton(new EditAction()), c);
    c.weighty = c.gridy = 1;
    add(new JButton(new DeleteAction()), c);
    c.weighty = 0;
    c.gridy = 2;
    add(new JButton(new SelectAction()), c);
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) EVMetadata(net.sourceforge.processdash.ev.EVMetadata) Metadata(net.sourceforge.processdash.ev.EVSnapshot.Metadata) JButton(javax.swing.JButton) DefaultListModel(javax.swing.DefaultListModel) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) JList(javax.swing.JList)

Aggregations

GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 DefaultListCellRenderer (javax.swing.DefaultListCellRenderer)1 DefaultListModel (javax.swing.DefaultListModel)1 JButton (javax.swing.JButton)1 JList (javax.swing.JList)1 JScrollPane (javax.swing.JScrollPane)1 EVMetadata (net.sourceforge.processdash.ev.EVMetadata)1 Metadata (net.sourceforge.processdash.ev.EVSnapshot.Metadata)1