Search in sources :

Example 1 with BoxUtils

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

the class UserEditor method makeToolbar.

private Component makeToolbar(boolean editable) {
    FilterHandler filterer = EventHandler.create(FilterHandler.class, this, "updateFilter");
    BoxUtils toolbar = BoxUtils.hbox();
    searchField = new JTextField(10);
    searchField.getDocument().addDocumentListener(filterer);
    toolbar.addItems(resources.getString("Find") + ":", 3, searchField, 20);
    showInactiveCheckbox = new JCheckBox(resources.getString("Show_Inactive"));
    showInactiveCheckbox.addActionListener(filterer);
    if (isLegacyPdesMode()) {
        showInactiveCheckbox.setSelected(true);
    } else {
        toolbar.addItem(showInactiveCheckbox);
    }
    toolbar.addItems(100, BoxUtils.GLUE);
    if (editable) {
        AbstractAction add = (//
        PersonLookupDialog.isLookupServerConfigured() ? new AddPdesUserAction() : new AddPlainUserAction());
        toolbar.addItems(5, new JButton(add));
    }
    toolbar.addItems(5, new JButton(new ViewAction()));
    if (editable)
        toolbar.addItems(5, new JButton(new DeleteAction()));
    toolbar.addItem(new JOptionPaneTweaker.MakeResizable());
    toolbar.addItem(new JOptionPaneTweaker.DisableKeys());
    return toolbar;
}
Also used : JOptionPaneTweaker(net.sourceforge.processdash.ui.lib.JOptionPaneTweaker) JButton(javax.swing.JButton) BoxUtils(net.sourceforge.processdash.ui.lib.BoxUtils) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) AbstractAction(javax.swing.AbstractAction)

Example 2 with BoxUtils

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

the class TaskScheduleChart method showSaveAsDialog.

private TaskScheduleChartSettings showSaveAsDialog(TaskScheduleChartSettings currentSettings, String chartID) {
    String title = resources.getString("Configure.Save_As.Window_Title");
    String namePrompt = resources.getString("Configure.Save_As.Name_Prompt");
    JTextField chartNameField = new JTextField();
    if (currentSettings != null)
        chartNameField.setText(currentSettings.getCustomName());
    new JOptionPaneActionHandler().install(chartNameField);
    String scopePrompt = resources.getString("Configure.Save_As.Scope_Prompt");
    ButtonGroup group = new ButtonGroup();
    JRadioButton localScopeButton = new JRadioButton(resources.getString("Configure.Save_As.Scope_Local"));
    group.add(localScopeButton);
    JRadioButton globalScopeButton = new JRadioButton(resources.getString("Configure.Save_As.Scope_Global"));
    group.add(globalScopeButton);
    boolean global = (currentSettings != null && currentSettings.isGlobal());
    (global ? globalScopeButton : localScopeButton).setSelected(true);
    String errorKey = null;
    while (true) {
        BoxUtils errorBox;
        if (errorKey != null) {
            JLabel errorLabel = new JLabel(resources.getString(errorKey));
            errorLabel.setForeground(Color.RED);
            errorBox = BoxUtils.hbox(20, errorLabel);
        } else {
            errorBox = BoxUtils.hbox();
        }
        Object[] message = { namePrompt, BoxUtils.hbox(20, chartNameField), new JOptionPaneTweaker.GrabFocus(chartNameField), errorBox, scopePrompt, BoxUtils.hbox(20, localScopeButton), BoxUtils.hbox(20, globalScopeButton) };
        int userChoice = JOptionPane.showConfirmDialog(configurationDialog, message, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
        if (userChoice != JOptionPane.OK_OPTION)
            return null;
        String chartName = chartNameField.getText();
        chartName = (chartName == null ? "" : chartName.trim());
        if (chartName.length() == 0) {
            errorKey = "Configure.Save_As.Name_Missing";
            continue;
        }
        TaskScheduleChartSettings result = new TaskScheduleChartSettings();
        if (localScopeButton.isSelected())
            result.setTaskListID(taskList.getID());
        result.setChartID(chartID);
        result.setCustomName(chartName);
        if (result.hasSameNameAs(currentSettings) == false && chartNameIsTaken(chartName)) {
            errorKey = "Configure.Save_As.Duplicate_Name";
            continue;
        }
        return result;
    }
}
Also used : JOptionPaneTweaker(net.sourceforge.processdash.ui.lib.JOptionPaneTweaker) JOptionPaneActionHandler(net.sourceforge.processdash.ui.lib.JOptionPaneActionHandler) JRadioButton(javax.swing.JRadioButton) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) BoxUtils(net.sourceforge.processdash.ui.lib.BoxUtils) Point(java.awt.Point) ButtonGroup(javax.swing.ButtonGroup) EventObject(java.util.EventObject)

Example 3 with BoxUtils

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

the class AddTaskDialog method makeNewTaskComponentRow.

private Component makeNewTaskComponentRow() {
    BoxUtils result = BoxUtils.hbox();
    // create an icon to suggest the parent-child relationship
    JLabel childIcon = new JLabel(new ChildIcon());
    childIcon.setAlignmentY(0.5f);
    result.addItem(childIcon);
    // create components for selecting and displaying the task type
    result.addItem(createTaskTypeSelector());
    taskTypeIcon.setAlignmentY(0.5f);
    result.addItem(taskTypeIcon);
    result.addItem(4);
    // create a text field for entering the new task name
    taskName = new JHintTextField(resources.getString("Task_Name_Hint"));
    taskName.setDocument(new NodeNameDocument());
    taskName.setAlignmentY(0.5f);
    result.addItem(taskName);
    return result;
}
Also used : JLabel(javax.swing.JLabel) BoxUtils(net.sourceforge.processdash.ui.lib.BoxUtils) JHintTextField(net.sourceforge.processdash.ui.lib.JHintTextField)

Example 4 with BoxUtils

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

the class SvnLOCDiffPanel method hbox.

private Component hbox(Object... contents) {
    BoxUtils result = BoxUtils.hbox(contents);
    Dimension d = result.getPreferredSize();
    d.width = 3000;
    result.setMaximumSize(d);
    return result;
}
Also used : Dimension(java.awt.Dimension) BoxUtils(net.sourceforge.processdash.ui.lib.BoxUtils)

Example 5 with BoxUtils

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

the class FileSystemLOCDiffPanel method hbox.

private Component hbox(Object... contents) {
    BoxUtils result = BoxUtils.hbox(contents);
    Dimension d = result.getPreferredSize();
    d.width = 3000;
    result.setMaximumSize(d);
    return result;
}
Also used : Dimension(java.awt.Dimension) BoxUtils(net.sourceforge.processdash.ui.lib.BoxUtils)

Aggregations

BoxUtils (net.sourceforge.processdash.ui.lib.BoxUtils)5 Dimension (java.awt.Dimension)2 JLabel (javax.swing.JLabel)2 JTextField (javax.swing.JTextField)2 JOptionPaneTweaker (net.sourceforge.processdash.ui.lib.JOptionPaneTweaker)2 Point (java.awt.Point)1 EventObject (java.util.EventObject)1 AbstractAction (javax.swing.AbstractAction)1 ButtonGroup (javax.swing.ButtonGroup)1 JButton (javax.swing.JButton)1 JCheckBox (javax.swing.JCheckBox)1 JRadioButton (javax.swing.JRadioButton)1 JHintTextField (net.sourceforge.processdash.ui.lib.JHintTextField)1 JOptionPaneActionHandler (net.sourceforge.processdash.ui.lib.JOptionPaneActionHandler)1