use of java.awt.Dimension 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();
}
use of java.awt.Dimension in project ACS by ACS-Community.
the class Toolbar method initialize.
/**
* Initialize the toolbar
*
* @param <code>true</code> if the reduction rules are applied at startup
*/
private void initialize(boolean reduce) {
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
// Add the button to inhibit sounds
add(soundComponent);
// Add the label and the combobox for auto ack
Font fnt = autoAckLbl.getFont();
Font newFont = fnt.deriveFont(fnt.getSize() * 80 / 100);
autoAckLbl.setFont(newFont);
add(Box.createHorizontalStrut(2));
add(autoAckLbl);
autoAckLevelCB.setFont(newFont);
autoAckLevelCB.setEditable(false);
autoAckLevelCB.setOpaque(true);
// Set the colors of the renderers
ComboBoxValues.initSizes();
autoAckLevelCB.setRenderer(new ComboBoxRenderer());
autoAckLevelCB.setSelectedIndex(ComboBoxValues.NONE.ordinal());
autoAckLevelCB.setMaximumRowCount(ComboBoxValues.values().length);
autoAckLevelCB.setEditable(false);
autoAckLevelCB.addActionListener(this);
Dimension d = new Dimension(ComboBoxValues.getWidth(), ComboBoxValues.getHeight());
autoAckLevelCB.setMinimumSize(d);
add(Box.createHorizontalStrut(5));
add(autoAckLevelCB);
activeReductionIcon = new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_in.png"));
inactiveReductionIcon = new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_out.png"));
reductionRulesBtn = new JToggleButton("Reduce", activeReductionIcon, reduce);
reductionRulesBtn.setFont(newFont);
add(Box.createHorizontalStrut(5));
add(reductionRulesBtn);
reductionRulesBtn.addActionListener(this);
add(Box.createHorizontalStrut(5));
add(pauseBtn);
pauseBtn.addActionListener(this);
pauseBtn.setFont(newFont);
add(Box.createHorizontalStrut(5));
add(new JSeparator(JSeparator.VERTICAL));
add(Box.createHorizontalStrut(5));
JLabel searchLbl = new JLabel("Search");
add(searchLbl);
searchLbl.setFont(newFont);
add(Box.createHorizontalStrut(5));
add(searchTF);
searchTF.setEditable(true);
searchTF.getDocument().addDocumentListener(this);
searchTF.setToolTipText("Search");
add(Box.createHorizontalStrut(3));
add(prevSearchBtn);
prevSearchBtn.setToolTipText("Search prev");
prevSearchBtn.addActionListener(this);
add(Box.createHorizontalStrut(3));
add(nextSearchBtn);
nextSearchBtn.setToolTipText("Search next");
nextSearchBtn.addActionListener(this);
add(Box.createHorizontalStrut(3));
add(showBtn);
showBtn.setFont(newFont);
showBtn.setToolTipText("Filter in");
showBtn.addActionListener(this);
add(Box.createHorizontalStrut(3));
add(hideBtn);
hideBtn.setFont(newFont);
hideBtn.setToolTipText("Filter out");
hideBtn.addActionListener(this);
add(Box.createHorizontalStrut(2));
ratioSearchBtns();
}
use of java.awt.Dimension in project ACS by ACS-Community.
the class ExpertPrefsDlg method initGUI.
/**
* Builds the GUI
*
*/
private void initGUI() {
JRootPane mainPnl = this.getRootPane();
mainPnl.setLayout(new BorderLayout());
/////////////////////////////////////////////////////////////
// Add the table constraints (max num of logs and time frame)
///////////////////////////////////////////////////////////
JPanel tablePnl = new JPanel();
tablePnl.setBorder(BorderFactory.createTitledBorder("Table constraints"));
tablePnl.setLayout(new GridBagLayout());
GridBagConstraints constr = new GridBagConstraints();
// Num of logs
constr.gridx = 0;
constr.gridy = 0;
constr.fill = GridBagConstraints.HORIZONTAL;
constr.anchor = GridBagConstraints.WEST;
constr.insets = new Insets(5, 5, 5, 5);
tablePnl.add(OptionWidgets.MAX_NUM_OF_LOGS.enableCB, constr);
constr.gridx = 1;
constr.gridy = 0;
constr.anchor = GridBagConstraints.LINE_START;
constr.insets = new Insets(5, 5, 5, 5);
constr.fill = GridBagConstraints.HORIZONTAL;
tablePnl.add(maxLogsInTableCB, constr);
// Time frame
constr.gridx = 0;
constr.gridy = 1;
constr.anchor = GridBagConstraints.WEST;
constr.insets = new Insets(5, 5, 5, 5);
tablePnl.add(OptionWidgets.TIME_FRAME.enableCB, constr);
constr.gridx = 1;
constr.gridy = 1;
constr.anchor = GridBagConstraints.LINE_START;
constr.insets = new Insets(5, 5, 5, 5);
tablePnl.add(timeFrameCB, constr);
/// DISABLED
timeFrameCB.setEnabled(false);
// DISABLED
OptionWidgets.TIME_FRAME.enableCB.setEnabled(false);
///////////////////////////////////////////////////////////
// Add engine constraints
///////////////////////////////////////////////////////////
JPanel enginePnl = new JPanel();
enginePnl.setBorder(BorderFactory.createTitledBorder("Engine constraints"));
enginePnl.setLayout(new GridBagLayout());
// INPUT RATE
constr.gridx = 0;
constr.gridy = 0;
constr.anchor = GridBagConstraints.LAST_LINE_START;
constr.insets = new Insets(5, 5, 5, 5);
enginePnl.add(OptionWidgets.MAX_INPUT_RATE.enableCB, constr);
constr.gridx = 1;
constr.gridy = 0;
constr.anchor = GridBagConstraints.LAST_LINE_START;
constr.insets = new Insets(5, 5, 5, 5);
enginePnl.add(inputRateTF, constr);
// Output RATE
constr.gridx = 0;
constr.gridy = 1;
constr.anchor = GridBagConstraints.LAST_LINE_START;
constr.insets = new Insets(5, 5, 5, 5);
enginePnl.add(OptionWidgets.MAX_OUTPUT_RATE.enableCB, constr);
constr.gridx = 1;
constr.gridy = 1;
constr.anchor = GridBagConstraints.LAST_LINE_START;
constr.insets = new Insets(5, 5, 5, 5);
enginePnl.add(outputRateTF, constr);
// DYNAMIC DISCARD LEVEL
JPanel pnl = new JPanel();
pnl.setLayout(new GridLayout(3, 2));
pnl.add(new JLabel("Threshold: "), "1");
pnl.add(dynThresholdTF, "2");
pnl.add(new JLabel("Damping: "), "3");
pnl.add(dynDampingTF, "4");
pnl.add(new JLabel("Time: "), "5");
pnl.add(dynIntervalTF, "6");
constr.gridx = 0;
constr.gridy = 2;
constr.fill = GridBagConstraints.VERTICAL;
constr.anchor = GridBagConstraints.LAST_LINE_START;
constr.insets = new Insets(5, 5, 5, 5);
enginePnl.add(OptionWidgets.DYNAMIC_DISCARD_LEVEL.enableCB, constr);
constr.gridx = 1;
constr.gridy = 2;
constr.anchor = GridBagConstraints.LAST_LINE_START;
constr.insets = new Insets(5, 5, 5, 5);
enginePnl.add(pnl, constr);
// Add the table and engine panels to the main panel
mainPnl.add(tablePnl, BorderLayout.CENTER);
mainPnl.add(enginePnl, BorderLayout.NORTH);
// Add the OK, CANCEL buttons
JPanel buttonsPnl = new JPanel(new BorderLayout());
JPanel okCancelPnl = new JPanel();
okCancelPnl.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
BoxLayout boxLayout = new BoxLayout(okCancelPnl, BoxLayout.LINE_AXIS);
okCancelPnl.setLayout(boxLayout);
okCancelPnl.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
okBtn = new JButton("Ok");
okBtn.addActionListener(this);
cancelBtn = new JButton("Cancel");
cancelBtn.addActionListener(this);
okCancelPnl.add(okBtn, BorderLayout.WEST);
okCancelPnl.add(Box.createRigidArea(new Dimension(10, 0)));
okCancelPnl.add(cancelBtn, BorderLayout.EAST);
JPanel restoreBtnPnl = new JPanel(new FlowLayout());
restoreBtn = new JButton("Restore");
restoreBtn.addActionListener(this);
restoreBtnPnl.add(restoreBtn);
buttonsPnl.add(restoreBtnPnl, BorderLayout.WEST);
buttonsPnl.add(okCancelPnl, BorderLayout.EAST);
mainPnl.add(buttonsPnl, BorderLayout.SOUTH);
pack();
}
use of java.awt.Dimension in project ACS by ACS-Community.
the class ErrorBrowserDlg method initialize.
/**
* Init the GUI.
* <P>
* The dialog is composed of a set of tabs, one for each stack trace.
*/
private void initialize() {
cardsPanel.add(tabbedPane, ERROR_TRACES);
JLabel notTracesLbl = new JLabel("<HTML>No error traces.<BR>Add an error trace from the table of logs.</HTML>");
notTracesPnl.add(notTracesLbl, BorderLayout.NORTH);
cardsPanel.add(notTracesPnl, NO_ERROR_TRACES);
add(cardsPanel);
ratioContent();
tabbedPane.addContainerListener(this);
setMinimumSize(new Dimension(400, 200));
setPreferredSize(new Dimension(500, 300));
pack();
setVisible(true);
}
use of java.awt.Dimension in project ACS by ACS-Community.
the class LogLvlTree method getPreferredSize.
/**
* Return the preferred size of the JTree
* This is needed to see the scrollbars:
* "JScrollPane basis the desicision to show scroll bars off the views preferred size.
* When you explicitly set the preferred size, and using a JScrollPane, you are effectively
* forcing the size of the JTree to be the preferred size.
* If you want to limit the size of the JTree to at least a certain size,
* override getPrefferredSize to return at least a particular value"
*
* @see javax.swing.jtree
*/
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
size.width = Math.max(MIN_WIDTH, size.width);
size.height = Math.max(MIN_HEIGHT, size.height);
return size;
}
Aggregations