private JPanel createResetPanel() { resetInterpreter = new JCheckBox(JMeterUtils.getResString("bsh_script_reset_interpreter")); // $NON-NLS-1$ resetInterpreter.setName(BeanShellAssertion.PARAMETERS); JPanel resetInterpreterPanel = new JPanel(new BorderLayout()); resetInterpreterPanel.add(resetInterpreter, BorderLayout.WEST); return resetInterpreterPanel; }
public BiblioSearchLimitPanel( DatabankSchema schema, MarcQueryBuilder queryBuilder, int language, SearchUI utils) { super(new GridBagLayout(), queryBuilder); this.schema = schema; this.language = language; ButtonGroup g; props = PropertyUtils.loadProperties(getClass().getName(), LocaleUtils.getLocale(language)); GuiUtils.setActionName(dateRangeAction, props.getProperty("date_range.name")); GuiUtils.setActionName(yearAction, props.getProperty("year.name")); this.utils = utils; lblCodingLevel = new JLabel(props.getProperty("coding_level.name")); cmCodingLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_17); cmCodingLevel.setName("biblioCodingLevel"); lblCodingLevel.setLabelFor(cmCodingLevel); lblCataloguingForm = new JLabel(props.getProperty("cataloguing_form.name")); cmCataloguingForm = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_18); cmCataloguingForm.setName("biblioCataloguingForm"); lblCataloguingForm.setLabelFor(cmCataloguingForm); rBetween = new JRadioButton(props.getProperty("between.name")); rBetween.setName("biblioBetweenYears"); rLt = new JRadioButton(props.getProperty("lt.name")); rLt.setName("biblioLessThanYear"); rGt = new JRadioButton(props.getProperty("gt.name")); rGt.setName("biblioGreaterThanYear"); txfYear = utils.queryTextField(4); txfYear.setName("biblioYearEquals"); rYear = new JRadioButton(yearAction); rYear.setName("biblioYear"); rDateRange = new JRadioButton(dateRangeAction); rDateRange.setName("biblioDateRange"); lblDoctype = new JLabel(props.getProperty("biblio_doctype.name")); lblFrom = new JLabel(props.getProperty("from.name")); lblTo = new JLabel(props.getProperty("to.name")); lblLanguage = new JLabel(props.getProperty("language.name")); lblLocation = new JLabel(props.getProperty("location.name")); lblRetriveNo = new JLabel(props.getProperty("retriveNo.name")); lblRecType = new JLabel(props.getProperty("rectype.name")); lblRecStatus = new JLabel(props.getProperty("recstatus.name")); lblCalendar = new JLabel(props.getProperty("calendar.name")); lblBiblevel = new JLabel(props.getProperty("biblevel.name")); lblHierarchicalLevel = new JLabel(props.getProperty("hierarchical_level.name")); cmDoctype = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_DOC_TYPE); cmDoctype.setName("biblioDocType"); cmLocation = utils.constantTableLookup(SearchEngineDocumentModel.LOCATION); cmLocation.setName("biblioLocation"); cmLanguage = utils.constantTableLookup(SearchEngineDocumentModel.LANGUAGE); cmLanguage.setName("biblioLanguage"); cmBiblevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_7); cmBiblevel.setName("biblioLevel"); cmHierarchicalLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_8); cmHierarchicalLevel.setName("biblioHierarchicalLevel"); cmRecType = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_6); cmRecType.setName("biblioRecType"); cmRecStatus = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_5); cmRecStatus.setName("biblioRecStatus"); cmCalendar = utils.constantTableLookup(SearchEngineDocumentModel.CALENDAR); cmCalendar.setName("biblioCalendar"); txfFrom = utils.queryTextField(10); txfFrom.setName("biblioFromYear"); txfTo = utils.queryTextField(10); txfTo.setName("biblioToYear"); txfRetriveNo = utils.queryTextField(10); txfRetriveNo.setName("retriveNo"); lblDoctype.setLabelFor(cmDoctype); lblLocation.setLabelFor(cmLocation); lblLanguage.setLabelFor(cmLanguage); lblFrom.setLabelFor(txfFrom); lblTo.setLabelFor(txfTo); lblRetriveNo.setLabelFor(txfRetriveNo); lblTo.setVerticalTextPosition(JLabel.BOTTOM); lblCalendar.setHorizontalAlignment(JLabel.TRAILING); lblLanguage.setHorizontalAlignment(JLabel.TRAILING); lblRecType.setHorizontalAlignment(JLabel.TRAILING); lblDoctype.setHorizontalAlignment(JLabel.TRAILING); lblLocation.setHorizontalAlignment(JLabel.TRAILING); cbHasAttachment = new JCheckBox(props.getProperty("attachment.name")); cbIsOpenShelf = new JCheckBox(props.getProperty("openShelf.name")); cbIsLendable = new JCheckBox(props.getProperty("lendable.name")); rWithAttachment = new JRadioButton(props.getProperty("attachment-present.name")); rWithoutAttachment = new JRadioButton(props.getProperty("attachment-notpresent.name")); cbHasAttachment.setName("biblioAttachment"); cbIsOpenShelf.setName("holdingIsOpenShelf"); cbIsLendable.setName("holdingIsLendable"); rWithAttachment.setName("biblioAttachmentPresent"); rWithoutAttachment.setName("biblioAttachmentNotPresent"); cbHasAttachment.addChangeListener(attachmentChangedListener); rWithAttachment.setEnabled(false); rWithoutAttachment.setEnabled(false); cbHasAttachment.setSelected(false); cbIsOpenShelf.setSelected(false); cbIsLendable.setSelected(false); g = new ButtonGroup(); g.add(rWithAttachment); g.add(rWithoutAttachment); g = new ButtonGroup(); g.add(rBetween); g.add(rLt); g.add(rGt); g = new ButtonGroup(); g.add(rDateRange); g.add(rYear); rYear.setSelected(true); dateCriteriaChanged(); lblDescriptionLevel = new JLabel(props.getProperty("level-of-description.name")); cmDescriptionLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_ISAD_LEVEL_OF_DESCRIPTION); cmDescriptionLevel.setName("biblioDescriptionLevel"); lblDescriptionLevel.setLabelFor(cmDescriptionLevel); lblGMD = new JLabel(props.getProperty("general-material.name")); cmGMD = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_GMD_LIST); cmGMD.setName("biblioGMD"); lblGMD.setLabelFor(cmGMD); lblLCClass = new JLabel(props.getProperty("lcclass.name")); txfLCClass = new JTextField(20); GuiUtils.localeSupport(txfLCClass); GuiUtils.setComponentOrientation(txfLCClass, ComponentOrientation.LEFT_TO_RIGHT); lblLCClass.setLabelFor(txfLCClass); LayoutFacility lf = new LayoutFacility(this); /* lf.add(lblCodingLevel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add(cmCodingLevel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); */ int y = 0; lf.add( lblDoctype, new GridBagConstraints( 0, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmDoctype, new GridBagConstraints( 1, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblRecType, new GridBagConstraints( 2, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmRecType, new GridBagConstraints( 3, y++, GridBagConstraints.REMAINDER, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblGMD, new GridBagConstraints( 0, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmGMD, new GridBagConstraints( 1, y++, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblLocation, new GridBagConstraints( 0, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmLocation, new GridBagConstraints( 1, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblLanguage, new GridBagConstraints( 2, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmLanguage, new GridBagConstraints( 3, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblBiblevel, new GridBagConstraints( 4, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmBiblevel, new GridBagConstraints( 5, y++, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); //// lf.add( lblCataloguingForm, new GridBagConstraints( 0, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmCataloguingForm, new GridBagConstraints( 1, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblHierarchicalLevel, new GridBagConstraints( 2, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmHierarchicalLevel, new GridBagConstraints( 3, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblRecStatus, new GridBagConstraints( 4, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmRecStatus, new GridBagConstraints( 5, y++, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); //// lf.add( lblCodingLevel, new GridBagConstraints( 4, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmCodingLevel, new GridBagConstraints( 5, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); lf.add( rYear, new GridBagConstraints( 0, y, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); lf.add( txfYear, new GridBagConstraints( 1, y, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblCalendar, new GridBagConstraints( 2, y, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmCalendar, new GridBagConstraints( 3, y++, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( rDateRange, new GridBagConstraints( 0, y, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); LayoutFacility datelf = new LayoutFacility(new JPanel()); datelf.add( lblFrom, new GridBagConstraints( 1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); datelf.add( txfFrom, new GridBagConstraints( 2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( rGt, new GridBagConstraints( 3, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( rBetween, new GridBagConstraints( 4, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( rLt, new GridBagConstraints( 5, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( lblTo, new GridBagConstraints( 6, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); datelf.add( txfTo, new GridBagConstraints( 7, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( Box.createHorizontalGlue(), new GridBagConstraints( 8, 1, GridBagConstraints.REMAINDER, 1, 1.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( datelf.container, new GridBagConstraints( 1, y++, GridBagConstraints.REMAINDER, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); LayoutFacility lcClasslf = new LayoutFacility(new JPanel()); lcClasslf.add( lblLCClass, new GridBagConstraints( 1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); lcClasslf.add( txfLCClass, new GridBagConstraints( 2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lcClasslf.container, new GridBagConstraints( 0, y++, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); LayoutFacility attLf = LayoutFacility.createLayoutFacility(); int x = 0; attLf.add( cbHasAttachment, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); attLf.add( cbIsOpenShelf, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); // attLf.add(cbIsLendable, // new GridBagConstraints(x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, // GridBagConstraints.NONE, new Insets(2, 2, 2, 10), 0, 0)); attLf.add( lblRetriveNo, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 20, 2, 2), 0, 0)); attLf.add( txfRetriveNo, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 25, 0)); if (SystemUtils.isISADAvailable()) { attLf.add( lblDescriptionLevel, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 20, 2, 2), 0, 0)); attLf.add( cmDescriptionLevel, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); } /* attLf.add(rWithAttachment, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); attLf.add(rWithoutAttachment, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); */ lf.add( attLf.container, new GridBagConstraints( 0, y, GridBagConstraints.REMAINDER, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); // lf.add(Box.createHorizontalGlue(), // new GridBagConstraints(1, 4, 0, 1, 0.0, 0.0, GridBagConstraints.LINE_START, // GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); ChangeListener limitChangeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { txfFrom.setEditable(!rLt.isSelected() && rDateRange.isSelected()); txfTo.setEditable(!rGt.isSelected() && rDateRange.isSelected()); } }; rGt.addChangeListener(limitChangeListener); rLt.addChangeListener(limitChangeListener); rBetween.addChangeListener(limitChangeListener); rGt.setSelected(true); }
private void createUI() { ActionListener productNodeCheckListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateUIState(); } }; checkers = new ArrayList<JCheckBox>(10); JPanel checkersPane = GridBagUtils.createPanel(); setComponentName(checkersPane, "CheckersPane"); GridBagConstraints gbc = GridBagUtils.createConstraints("insets.left=4,anchor=WEST,fill=HORIZONTAL"); for (int i = 0; i < productNodes.length; i++) { ProductNode productNode = (ProductNode) productNodes[i]; String name = productNode.getName(); JCheckBox productNodeCheck = new JCheckBox(name); productNodeCheck.setSelected(selected); productNodeCheck.setFont(SMALL_PLAIN_FONT); productNodeCheck.addActionListener(productNodeCheckListener); if (includeAlways != null && StringUtils.containsIgnoreCase(includeAlways, name)) { productNodeCheck.setSelected(true); productNodeCheck.setEnabled(false); } else if (givenProductSubsetDef != null) { productNodeCheck.setSelected(givenProductSubsetDef.containsNodeName(name)); } checkers.add(productNodeCheck); String description = productNode.getDescription(); JLabel productNodeLabel = new JLabel(description != null ? description : " "); productNodeLabel.setFont(SMALL_ITALIC_FONT); GridBagUtils.addToPanel( checkersPane, productNodeCheck, gbc, "weightx=0,gridx=0,gridy=" + i); GridBagUtils.addToPanel( checkersPane, productNodeLabel, gbc, "weightx=1,gridx=1,gridy=" + i); } // Add a last 'filler' row GridBagUtils.addToPanel( checkersPane, new JLabel(" "), gbc, "gridwidth=2,weightx=1,weighty=1,gridx=0,gridy=" + productNodes.length); ActionListener allCheckListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == allCheck) { checkAllProductNodes(true); } else if (e.getSource() == noneCheck) { checkAllProductNodes(false); } updateUIState(); } }; allCheck = new JCheckBox("Select all"); allCheck.setName("selectAll"); allCheck.setMnemonic('a'); allCheck.addActionListener(allCheckListener); noneCheck = new JCheckBox("Select none"); noneCheck.setName("SelectNone"); noneCheck.setMnemonic('n'); noneCheck.addActionListener(allCheckListener); JScrollPane scrollPane = new JScrollPane(checkersPane); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JPanel buttonRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 4)); buttonRow.add(allCheck); buttonRow.add(noneCheck); setLayout(new BorderLayout()); add(scrollPane, BorderLayout.CENTER); add(buttonRow, BorderLayout.SOUTH); setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)); updateUIState(); }
public DiameterCutOptionsTargetPanel() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); panel.add(GUIFactory.createLabel("Lungime:", 100)); JFormattedTextField length = GUIFactory.createNumberInput(4100L, 0L, 1000000L, 80); panel.add(length); JComboBox<String> mCombo = new JComboBox<String>(GUIUtil.metric); mCombo.addItemListener(this); mCombo = new JComboBox<String>(GUIUtil.metric); mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height)); panel.add(mCombo); add(panel); panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); panel.add(GUIFactory.createLabel("Diametru 1:", 100)); JFormattedTextField smallRadius = GUIFactory.createNumberInput(200L, 0L, 1000000L, 80); panel.add(smallRadius); mCombo = new JComboBox<String>(GUIUtil.metric); mCombo.addItemListener(this); mCombo = new JComboBox<String>(GUIUtil.metric); mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height)); panel.add(mCombo); add(panel); panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); panel.add(GUIFactory.createLabel("Diametru 2:", 100)); JFormattedTextField bigRadius = GUIFactory.createNumberInput(600L, 0L, 1000000L, 80); panel.add(bigRadius); mCombo = new JComboBox<String>(GUIUtil.metric); mCombo.addItemListener(this); mCombo = new JComboBox<String>(GUIUtil.metric); mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height)); panel.add(mCombo); add(panel); panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); label2 = GUIFactory.createLabel("Produse:", 100); panel.add(label2); products = ProductDAO.getProducts(); JPanel productsPanel = new JPanel(); productsPanel.setLayout(new BoxLayout(productsPanel, BoxLayout.Y_AXIS)); for (Product product : products) { JPanel row = new JPanel(new FlowLayout(FlowLayout.LEFT)); JCheckBox chk = new JCheckBox(); row.add(chk); selection.add(chk); chk.setName("length" + (long) product.getLength()); row.add(new JLabel(product.getName())); productsPanel.add(row); } JScrollPane scrollPane = new JScrollPane(productsPanel); scrollPane.setPreferredSize(new Dimension(productsPanel.getPreferredSize().width + 20, 215)); panel.add(scrollPane); add(panel); JPanel filtru = new JPanel(new FlowLayout(FlowLayout.LEADING)); filtru.add(filtru2m); filtru.add(filtru3m); filtru.add(filtru4m); filtru2m.setActionCommand("FILTRU2"); filtru3m.setActionCommand("FILTRU3"); filtru4m.setActionCommand("FILTRU4"); filtru2m.addActionListener(this); filtru3m.addActionListener(this); filtru4m.addActionListener(this); panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); JLabel label1 = GUIFactory.createLabel("Filtru", 100); panel.add(label1); panel.add(filtru); add(panel); cancel.setActionCommand("CANCEL_DIALOG"); cancel.addActionListener(GUIUtil.main); see.addActionListener(this); }
public ConfigurationPanel(final Project project) { serverUrl.setName("serverUrl"); buildDelay.setName("buildDelay"); jobRefreshPeriod.setName("jobRefreshPeriod"); rssRefreshPeriod.setName("rssRefreshPeriod"); username.setName("_username_"); passwordField.setName("passwordFile"); crumbDataField.setName("crumbDataFile"); testConnexionButton.setName("testConnexionButton"); connectionStatusLabel.setName("connectionStatusLabel"); successOrStableCheckBox.setName("successOrStableCheckBox"); unstableOrFailCheckBox.setName("unstableOrFailCheckBox"); abortedCheckBox.setName("abortedCheckBox"); rssStatusFilterPanel.setBorder(IdeBorderFactory.createTitledBorder("Event Log Settings", true)); debugPanel.setVisible(false); initDebugTextPane(); buildDelay.setDocument(new NumberDocument()); jobRefreshPeriod.setDocument(new NumberDocument()); rssRefreshPeriod.setDocument(new NumberDocument()); uploadPatchSettingsPanel.setBorder( IdeBorderFactory.createTitledBorder("Upload a Patch Settings", true)); passwordField .getDocument() .addDocumentListener( new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { myPasswordModified = true; } @Override public void removeUpdate(DocumentEvent e) { myPasswordModified = true; } @Override public void changedUpdate(DocumentEvent e) { myPasswordModified = true; } }); testConnexionButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { try { debugPanel.setVisible(false); new NotNullValidator().validate(serverUrl); new UrlValidator().validate(serverUrl); JenkinsSettings jenkinsSettings = JenkinsSettings.getSafeInstance(project); String password = isPasswordModified() ? getPassword() : jenkinsSettings.getPassword(); RequestManager.getInstance(project) .authenticate( serverUrl.getText(), username.getText(), password, crumbDataField.getText()); setConnectionFeedbackLabel(CONNECTION_TEST_SUCCESSFUL_COLOR, "Successful"); setPassword(password); } catch (Exception ex) { setConnectionFeedbackLabel(CONNECTION_TEST_FAILED_COLOR, "[Fail] " + ex.getMessage()); if (ex instanceof AuthenticationException) { AuthenticationException authenticationException = (AuthenticationException) ex; String responseBody = authenticationException.getResponseBody(); if (StringUtils.isNotBlank(responseBody)) { debugPanel.setVisible(true); debugTextPane.setText(responseBody); } } } } }); formValidator = FormValidator.init(this) .addValidator( username, new UIValidator<JTextField>() { public void validate(JTextField component) throws ConfigurationException { if (StringUtils.isNotBlank(component.getText())) { String password = getPassword(); if (StringUtils.isBlank(password)) { throw new ConfigurationException( String.format("'%s' must be set", passwordField.getName())); } } } }); }