Search in sources :

Example 66 with JPanel

use of javax.swing.JPanel in project ACS by ACS-Community.

the class FilterTypePanel method createComponents.

/* (non-Javadoc)
	 * @see com.cosylab.logging.settings.FilterParameterPanel#createComponents()
	 */
public void createComponents() {
    // Build the renderer for the combo boxes
    rendererMin = new LogTypeRenderer();
    rendererMax = new LogTypeRenderer();
    rendererExact = new LogTypeRenderer();
    JPanel panelTop = new JPanel(new GridBagLayout());
    add(panelTop, newConstraints(0, 4, 4, 4, 4));
    notCheck = new JCheckBox("Discard entries matching this filter");
    notCheck.setToolTipText("Keep/discard entries matching this filter");
    panelTop.add(notCheck, newConstraints(0, 4, 4, 4, 4));
    minimumCheck = new JCheckBox("Minimum value");
    minimumCheck.addItemListener(this);
    panelTop.add(minimumCheck, newConstraints(1, 4, 0, 0, 0));
    LogTypeHelper[] logTypes = LogTypeHelper.values();
    minimum = new JComboBox(logTypes);
    minimum.setSelectedIndex(0);
    minimum.setEditable(false);
    minimum.setMaximumRowCount(logTypes.length);
    minimum.setRenderer(rendererMin);
    panelTop.add(minimum, newConstraints(2, 0, 0, 4, 0));
    maximumCheck = new JCheckBox("Maximum value");
    maximumCheck.addItemListener(this);
    panelTop.add(maximumCheck, newConstraints(3, 4, 0, 0, 0));
    maximum = new JComboBox(logTypes);
    maximum.setSelectedIndex(0);
    maximum.setEditable(false);
    maximum.setMaximumRowCount(logTypes.length);
    maximum.setRenderer(rendererMax);
    panelTop.add(maximum, newConstraints(4, 0, 0, 4, 0));
    JPanel panelBottom = new JPanel(new GridBagLayout());
    add(panelBottom, newConstraints(1, 4, 4, 4, 4));
    exactCheck = new JCheckBox("Exact value");
    exactCheck.addItemListener(this);
    panelBottom.add(exactCheck, newConstraints(0, 4, 0, 0, 0));
    exact = new JComboBox(logTypes);
    exact.setSelectedIndex(0);
    exact.setEditable(false);
    exact.setMaximumRowCount(logTypes.length);
    exact.setRenderer(rendererExact);
    panelBottom.add(exact, newConstraints(1, 0, 0, 4, 0));
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper)

Example 67 with JPanel

use of javax.swing.JPanel in project ACS by ACS-Community.

the class StatsDlg method initialize.

/**
	 * Setup the GUI
	 */
private void initialize() {
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Statistics");
    this.setBounds(50, 35, 100, 100);
    JPanel mainPnl = new JPanel(new BorderLayout());
    JPanel valuesPnl = new JPanel(new GridLayout(10, 1));
    // Add the num of logs
    JPanel numOfLogsPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    numOfLogsPnl.add(new JLabel("Total logs: "));
    numOfLogsPnl.add(totNumOfLogsLbl);
    valuesPnl.add(numOfLogsPnl);
    // Visible logs
    JPanel visibleLogsPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    visibleLogsPnl.add(new JLabel("Visible logs: "));
    visibleLogsPnl.add(visibleLogsLbl);
    valuesPnl.add(visibleLogsPnl);
    // Hidden logs
    JPanel hiddenLogsPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    hiddenLogsPnl.add(new JLabel("Hidden logs: "));
    hiddenLogsPnl.add(hiddenLogsLbl);
    valuesPnl.add(hiddenLogsPnl);
    // Add the available memory
    JPanel availMemPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    availMemPnl.add(new JLabel("Memory available: "));
    availMemPnl.add(availMemLbl);
    valuesPnl.add(availMemPnl);
    // Add the used memory
    JPanel usedMemPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    usedMemPnl.add(new JLabel("Used memory: "));
    usedMemPnl.add(usedMemLbl);
    valuesPnl.add(usedMemPnl);
    // Add the number of the files of cache
    JPanel usedCacheFiles = new JPanel(new FlowLayout(FlowLayout.LEFT));
    usedCacheFiles.add(new JLabel("Number of files of cache: "));
    usedCacheFiles.add(numOfCacheFiles);
    valuesPnl.add(usedCacheFiles);
    // Add the disk space used by the files of the cache
    JPanel usedDiskSpace = new JPanel(new FlowLayout(FlowLayout.LEFT));
    usedDiskSpace.add(new JLabel("Disk space used by the cache: "));
    usedDiskSpace.add(diskSpace);
    valuesPnl.add(usedDiskSpace);
    // Add the time frame
    JPanel timeFramePnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    timeFramePnl.add(new JLabel("Time frame: "));
    timeFramePnl.add(timeFrameLbl);
    valuesPnl.add(timeFramePnl);
    // Add the rate from the NC
    JPanel inRatePnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    inRatePnl.add(new JLabel("Rate of logs from NC: "));
    inRatePnl.add(inRateLbl);
    valuesPnl.add(inRatePnl);
    // Add the rate to the listeners
    JPanel outRatePnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    outRatePnl.add(new JLabel("Rate of logs sent to table: "));
    outRatePnl.add(outRateLbl);
    valuesPnl.add(outRatePnl);
    mainPnl.add(valuesPnl, BorderLayout.CENTER);
    // Add the refresh and the close buttons
    JPanel buttonPanel = new JPanel(new FlowLayout());
    monitorBtn.addActionListener(this);
    buttonPanel.add(monitorBtn);
    refreshBtn.addActionListener(this);
    buttonPanel.add(refreshBtn);
    closeBtn.addActionListener(this);
    buttonPanel.add(closeBtn);
    mainPnl.add(buttonPanel, BorderLayout.SOUTH);
    setContentPane(mainPnl);
    addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent we) {
            enableMonitoring(false);
        }
    });
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) WindowEvent(java.awt.event.WindowEvent) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter)

Example 68 with JPanel

use of javax.swing.JPanel in project ACS by ACS-Community.

the class TestTreeExplorerWithButtons method main.

public static void main(String[] args) {
    TreeExplorer expl = createTreeExplorer();
    JPanel panel = ActionUtils.createJButtonPanel(new Class[] { PropertiesAction.class, OpenLocalExplorerAction.class });
    expl.add(panel, BorderLayout.SOUTH);
    WindowUtils.openInMode(expl, "TestTreeExplorer");
}
Also used : TreeExplorer(cern.gp.explorer.TreeExplorer) JPanel(javax.swing.JPanel)

Example 69 with JPanel

use of javax.swing.JPanel in project ACS by ACS-Community.

the class Example method example.

void example() throws IOException {
    GuiStandards.enforce();
    JPanel window = createWindow();
    JComponent widget1 = createWidget("widget 1 with default settings");
    window.add(widget1);
    window.validate();
    // save as file, then edit it, and load again
    File file = new File("colorsetting.props");
    storeCurrentSettings(file);
    editSettingsOnDisk(file);
    loadCustomSettings(file);
    JComponent widget2 = createWidget("widget 2 with customized settings");
    window.add(widget2);
    window.validate();
}
Also used : JPanel(javax.swing.JPanel) JComponent(javax.swing.JComponent) File(java.io.File)

Example 70 with JPanel

use of javax.swing.JPanel in project ACS by ACS-Community.

the class SenderPanel method initGUI.

/**
	 * Initialize the GUI
	 */
private void initGUI() {
    super.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosed(WindowEvent e) {
            super.windowClosed(e);
            close();
        }
    });
    /////////////////////////////////////////////////////////
    // The panel to send alarms by triplet or file
    //
    // This panel contains:
    //  * one panel to send alarms by triplet
    //  * one to send alarms by file
    //  * one to send alarms by CDB
    // The user can select only one sending type by means
    // of a radio button.
    /////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////
    // The panel to send alarm by writing the triplet
    //
    // The panel has a radio button to select the sending by 
    // triplet and a panel that contains all the widgets 
    // needed by this sending mode.
    /////////////////////////////////////////////////////////
    JPanel tripletPnl = new JPanel(new BorderLayout());
    tripletPnl.add(sendFromTripletRB, BorderLayout.WEST);
    sendTripletBtn.setEnabled(false);
    // The panel with all the widgets to send alarms by triplets
    // It has 3 lines: triplet, descriptor and properties
    tripletWdgtsPnl.setBorder(BorderFactory.createTitledBorder("Triplet sender"));
    BoxLayout tripetWdgtsLayoout = new BoxLayout(tripletWdgtsPnl, BoxLayout.Y_AXIS);
    tripletWdgtsPnl.setLayout(tripetWdgtsLayoout);
    // Line 1: triplet text field and send button
    JPanel sendTripletPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    sendTripletPnl.add(tripletTF);
    tripletTF.setColumns(40);
    tripletTF.getDocument().addDocumentListener(this);
    tripletTF.setToolTipText("Insert triplet: FaultFamily,FaultMember,1");
    sendTripletBtn.setEnabled(false);
    sendTripletBtn.addActionListener(this);
    sendTripletPnl.add(sendTripletBtn);
    // Line 2: the descriptor
    JPanel descriptorWdgtPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    descriptorWdgtPnl.add(new JLabel("Descriptor: "));
    activeRB.setName(FaultState.ACTIVE);
    terminateRB.setName(FaultState.TERMINATE);
    changeRB.setName(FaultState.CHANGE);
    instantRB.setName(FaultState.INSTANT);
    descriptorWdgtPnl.add(activeRB);
    descriptorWdgtPnl.add(terminateRB);
    descriptorWdgtPnl.add(changeRB);
    descriptorWdgtPnl.add(instantRB);
    activeRB.setSelected(true);
    // Line 3: the properties
    JPanel propsWdgtsPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    propsWdgtsPnl.add(new JLabel("Properties"));
    propsWdgtsPnl.add(propsTF);
    propsTF.setColumns(40);
    propsTF.setToolTipText("User properties key=val, key2=val2,....");
    // Add the three lines of widgets
    tripletWdgtsPnl.add(sendTripletPnl);
    tripletWdgtsPnl.add(descriptorWdgtPnl);
    tripletWdgtsPnl.add(propsWdgtsPnl);
    tripletPnl.add(tripletWdgtsPnl, BorderLayout.CENTER);
    /////////////////////////////////////////////////////////
    // The panel to send alarm by selecting a file
    //
    // The panel has a radio button to select the sending by 
    // file and a panel that contains all the widgets 
    // needed by this sending mode.
    /////////////////////////////////////////////////////////
    JPanel filePnl = new JPanel(new BorderLayout());
    filePnl.add(sendFromFileRB, BorderLayout.WEST);
    sendFromFileRB.setPreferredSize(sendFromTripletRB.getPreferredSize());
    sendFromFileRB.setMinimumSize(sendFromTripletRB.getMinimumSize());
    // The panel with all the widgets to send alarms by file
    // It has 2 lines: one to select the file and another one with the control buttons
    fileWdgtsPnl.setBorder(BorderFactory.createTitledBorder("File sender"));
    BoxLayout fileWdgtsLayoout = new BoxLayout(fileWdgtsPnl, BoxLayout.Y_AXIS);
    fileWdgtsPnl.setLayout(fileWdgtsLayoout);
    // Line 1: widgets to select the file
    JPanel selectFilePnl = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    fileNameTF.setColumns(40);
    fileNameTF.setEditable(false);
    fileNameTF.setText("");
    selectFilePnl.add(fileNameTF);
    selectFilePnl.add(chooseFiletBtn);
    // Line 2: widgets to control the sending mode
    JPanel ctrlsFilePnl = new JPanel(new BorderLayout());
    JPanel ctrlsButtonsPnl = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    ctrlsFilePnl.add(fileTasksPB, BorderLayout.CENTER);
    fileTasksPB.setValue(0);
    fileTasksPB.setIndeterminate(false);
    ctrlsButtonsPnl.add(activateFromFileBtn);
    ctrlsButtonsPnl.add(terminateFromFileBtn);
    ctrlsButtonsPnl.add(cycleFromFileBtn);
    ctrlsFilePnl.add(ctrlsButtonsPnl, BorderLayout.EAST);
    // Add the two lines of widgets
    fileWdgtsPnl.add(selectFilePnl);
    fileWdgtsPnl.add(ctrlsFilePnl);
    filePnl.add(fileWdgtsPnl, BorderLayout.CENTER);
    /////////////////////////////////////////////////////////
    // The panel to send alarm read from TM/CDB
    //
    // The panel has a radio button to select the sending by 
    // file and a panel that contains all the widgets 
    // needed by this sending mode.
    /////////////////////////////////////////////////////////
    JPanel cdbPnl = new JPanel(new BorderLayout());
    cdbPnl.add(sendFromCdbRB, BorderLayout.WEST);
    sendFromCdbRB.setPreferredSize(sendFromTripletRB.getPreferredSize());
    sendFromCdbRB.setMinimumSize(sendFromTripletRB.getMinimumSize());
    // The panel with all the widgets to send alarms by file
    // It has 2 lines: one to select the file and another one with the control buttons
    cdbWdgtsPnl.setBorder(BorderFactory.createTitledBorder("TM/CDB sender"));
    BoxLayout cdbWdgtsLayoout = new BoxLayout(cdbWdgtsPnl, BoxLayout.Y_AXIS);
    cdbWdgtsPnl.setLayout(cdbWdgtsLayoout);
    // Line 1: widgets to show the number of alarms read from TM/CDB
    JPanel showCdbPnl = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    cdbAlarmsTF.setColumns(40);
    cdbAlarmsTF.setEditable(false);
    cdbAlarmsTF.setText("");
    showCdbPnl.add(cdbAlarmsTF);
    // Line 2: widgets to control the sending mode
    JPanel ctrlsCDBPnl = new JPanel(new BorderLayout());
    JPanel ctrlsCDBButtonsPnl = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    ctrlsCDBPnl.add(cdbTasksPB, BorderLayout.CENTER);
    cdbTasksPB.setValue(0);
    cdbTasksPB.setIndeterminate(false);
    ctrlsCDBButtonsPnl.add(activateFromCdbBtn);
    ctrlsCDBButtonsPnl.add(terminateFromCdbBtn);
    ctrlsCDBButtonsPnl.add(cycleFromCdbBtn);
    ctrlsCDBPnl.add(ctrlsCDBButtonsPnl, BorderLayout.EAST);
    // Add the two lines of widgets
    cdbWdgtsPnl.add(showCdbPnl);
    cdbWdgtsPnl.add(ctrlsCDBPnl);
    cdbPnl.add(cdbWdgtsPnl, BorderLayout.CENTER);
    // Finally add the triplet, the file and the CDB panels to the alarm sender panel
    JPanel alrmSenderPnl = new JPanel(new BorderLayout());
    alrmSenderPnl.add(tripletPnl, BorderLayout.NORTH);
    JPanel fileAndCDBSenderPnl = new JPanel(new BorderLayout());
    fileAndCDBSenderPnl.add(filePnl, BorderLayout.NORTH);
    fileAndCDBSenderPnl.add(cdbPnl, BorderLayout.SOUTH);
    alrmSenderPnl.add(fileAndCDBSenderPnl, BorderLayout.SOUTH);
    alrmSenderPnl.setBorder(BorderFactory.createTitledBorder("Send alarm"));
    add(alrmSenderPnl, BorderLayout.NORTH);
    /////////////////////////////////////////////////////////
    // The panel to clear alarms
    /////////////////////////////////////////////////////////
    JPanel alarmClearingPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    alarmClearingPnl.setBorder(BorderFactory.createTitledBorder("Alarm clearing"));
    JScrollPane scrollPane = new JScrollPane(alarmsSent);
    alarmsSent.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    alarmsSent.getModel().addTableModelListener(this);
    alarmClearingPnl.add(scrollPane);
    JPanel clearingBtnsPnl = new JPanel();
    BoxLayout layout = new BoxLayout(clearingBtnsPnl, BoxLayout.Y_AXIS);
    clearingBtnsPnl.setLayout(layout);
    clearingBtnsPnl.add(clearAllBtn);
    Dimension minSize = new Dimension(5, 10);
    Dimension prefSize = new Dimension(5, 10);
    Dimension maxSize = new Dimension(Short.MAX_VALUE, 10);
    clearingBtnsPnl.add(new Box.Filler(minSize, prefSize, maxSize));
    clearingBtnsPnl.add(clearSelectedAlarmsBtn);
    clearAllBtn.setEnabled(false);
    clearAllBtn.addActionListener(this);
    clearSelectedAlarmsBtn.setEnabled(true);
    clearSelectedAlarmsBtn.addActionListener(this);
    alarmClearingPnl.add(clearingBtnsPnl);
    add(alarmClearingPnl, BorderLayout.CENTER);
    JPanel donePnl = new JPanel(new FlowLayout(FlowLayout.CENTER));
    donePnl.add(closeBtn);
    closeBtn.addActionListener(this);
    add(donePnl, BorderLayout.SOUTH);
    // Add the listeners
    sendFromTripletRB.setSelected(true);
    sendFromFileRB.addActionListener(this);
    sendFromTripletRB.addActionListener(this);
    sendFromCdbRB.addActionListener(this);
    chooseFiletBtn.addActionListener(this);
    activateFromFileBtn.addActionListener(this);
    terminateFromFileBtn.addActionListener(this);
    cycleFromFileBtn.addActionListener(this);
    activateFromCdbBtn.addActionListener(this);
    terminateFromCdbBtn.addActionListener(this);
    cycleFromCdbBtn.addActionListener(this);
    // Set the button groups
    sendingBG.add(sendFromTripletRB);
    sendingBG.add(sendFromFileRB);
    sendingBG.add(sendFromCdbRB);
    activationBG.add(activeRB);
    activationBG.add(changeRB);
    activationBG.add(terminateRB);
    activationBG.add(instantRB);
    pack();
    setVisible(true);
    ratioSenderModeButtons();
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) WindowEvent(java.awt.event.WindowEvent) BoxLayout(javax.swing.BoxLayout) WindowAdapter(java.awt.event.WindowAdapter) JLabel(javax.swing.JLabel) Box(javax.swing.Box) Dimension(java.awt.Dimension)

Aggregations

JPanel (javax.swing.JPanel)4487 JLabel (javax.swing.JLabel)1843 BorderLayout (java.awt.BorderLayout)1461 JButton (javax.swing.JButton)1180 Dimension (java.awt.Dimension)1107 GridBagLayout (java.awt.GridBagLayout)1071 ActionEvent (java.awt.event.ActionEvent)1019 GridBagConstraints (java.awt.GridBagConstraints)954 JScrollPane (javax.swing.JScrollPane)901 ActionListener (java.awt.event.ActionListener)871 BoxLayout (javax.swing.BoxLayout)801 Insets (java.awt.Insets)724 FlowLayout (java.awt.FlowLayout)667 JTextField (javax.swing.JTextField)532 JCheckBox (javax.swing.JCheckBox)458 GridLayout (java.awt.GridLayout)375 JComboBox (javax.swing.JComboBox)267 EmptyBorder (javax.swing.border.EmptyBorder)252 JTable (javax.swing.JTable)224 Color (java.awt.Color)210