Search in sources :

Example 1 with DropDownButton

use of net.sourceforge.processdash.ui.lib.DropDownButton in project processdash by dtuma.

the class TaskScheduleDialog method makeDropDownButton.

private DropDownButton makeDropDownButton(TSAction... actions) {
    DropDownButton result = new DropDownButton(actions[0]);
    for (int i = 1; i < actions.length; i++) result.getMenu().add(actions[i]);
    result.setRunFirstMenuOption(false);
    return result;
}
Also used : DropDownButton(net.sourceforge.processdash.ui.lib.DropDownButton) Point(java.awt.Point)

Example 2 with DropDownButton

use of net.sourceforge.processdash.ui.lib.DropDownButton in project processdash by dtuma.

the class TimeLogEditor method constructFilterPanel.

private JPanel constructFilterPanel() {
    JPanel retPanel = new JPanel(false);
    retPanel.setLayout(new BoxLayout(retPanel, BoxLayout.X_AXIS));
    retPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    DropDownButton button;
    JLabel label;
    retPanel.add(Box.createHorizontalGlue());
    addTimeFormatControl(retPanel);
    retPanel.add(new JLabel("          "));
    label = new JLabel(getResource("Filter.Label") + " ");
    retPanel.add(label);
    retPanel.add(Box.createHorizontalStrut(5));
    addScrollButton(retPanel, "Filter.Scroll_Backward", "scrollFilterBackward");
    fromDate = addDateField(retPanel, "Filter.From");
    toDate = addDateField(retPanel, "Filter.To");
    addScrollButton(retPanel, "Filter.Scroll_Forward", "scrollFilterForward");
    button = new DropDownButton(getResource("Filter.Apply"));
    button.setRunFirstMenuOption(false);
    button.getButton().addActionListener(createActionListener("applyFilter"));
    JMenu menu = button.getMenu();
    addFilterMenuItem(menu, "Filter.Today", "filterToday");
    addFilterMenuItem(menu, "Filter.Week", "filterThisWeek");
    menu.add(createWeekFilterStartDaySubmenu());
    addFilterMenuItem(menu, "Filter.Month", "filterThisMonth");
    menu.addSeparator();
    addFilterMenuItem(menu, "Filter.Remove", "clearFilter");
    retPanel.add(button);
    retPanel.add(Box.createHorizontalGlue());
    return retPanel;
}
Also used : JPanel(javax.swing.JPanel) DropDownButton(net.sourceforge.processdash.ui.lib.DropDownButton) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) EmptyBorder(javax.swing.border.EmptyBorder) JMenu(javax.swing.JMenu)

Example 3 with DropDownButton

use of net.sourceforge.processdash.ui.lib.DropDownButton in project processdash by dtuma.

the class DefectLogEditor method createImportButton.

private DropDownButton createImportButton() {
    List importActions = ExtensionManager.getExecutableExtensions("defect-importer", dashboard);
    if (importActions.isEmpty())
        return null;
    DropDownButton result = new DropDownButton(resources.getString("Log.Import_Button"));
    result.setMainButtonBehavior(DropDownButton.OPEN_DROP_DOWN_MENU);
    result.getMenu().getPopupMenu().addPopupMenuListener(new PopupMenuListener() {

        public void popupMenuCanceled(PopupMenuEvent e) {
        }

        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        }

        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            reupdateImportActions();
        }
    });
    for (Iterator i = importActions.iterator(); i.hasNext(); ) {
        Action a = (Action) i.next();
        if (a.getValue(IMPORT_ACTION_INVALID) != null)
            i.remove();
        else
            result.getMenu().add(a);
    }
    if (result.isEmpty())
        return null;
    else
        return result;
}
Also used : Action(javax.swing.Action) DropDownButton(net.sourceforge.processdash.ui.lib.DropDownButton) PopupMenuListener(javax.swing.event.PopupMenuListener) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) JList(javax.swing.JList) PopupMenuEvent(javax.swing.event.PopupMenuEvent)

Aggregations

DropDownButton (net.sourceforge.processdash.ui.lib.DropDownButton)3 Point (java.awt.Point)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Action (javax.swing.Action)1 BoxLayout (javax.swing.BoxLayout)1 JLabel (javax.swing.JLabel)1 JList (javax.swing.JList)1 JMenu (javax.swing.JMenu)1 JPanel (javax.swing.JPanel)1 EmptyBorder (javax.swing.border.EmptyBorder)1 PopupMenuEvent (javax.swing.event.PopupMenuEvent)1 PopupMenuListener (javax.swing.event.PopupMenuListener)1