GitCheckinOptions(@NotNull final Project project, @NotNull CheckinProjectPanel panel) { super(project, panel); myVcs = GitVcs.getInstance(project); final Insets insets = new Insets(2, 2, 2, 2); // add authors drop down GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.WEST; c.insets = insets; final JLabel authorLabel = new JLabel(GitBundle.message("commit.author")); myPanel.add(authorLabel, c); c = new GridBagConstraints(); c.anchor = GridBagConstraints.CENTER; c.insets = insets; c.gridx = 1; c.gridy = 0; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; final List<String> usersList = getUsersList(project); final Set<String> authors = usersList == null ? new HashSet<String>() : new HashSet<String>(usersList); ContainerUtil.addAll(authors, mySettings.getCommitAuthors()); List<String> list = new ArrayList<String>(authors); Collections.sort(list); list = ObjectsConvertor.convert( list, new Convertor<String, String>() { @Override public String convert(String o) { return StringUtil.shortenTextWithEllipsis(o, 30, 0); } }); myAuthor = new ComboBox(ArrayUtil.toObjectArray(list)); myAuthor.insertItemAt("", 0); myAuthor.setSelectedItem(""); myAuthor.setEditable(true); authorLabel.setLabelFor(myAuthor); myAuthor.setToolTipText(GitBundle.getString("commit.author.tooltip")); myPanel.add(myAuthor, c); }
public ChangeListChooser(List<? extends ChangeList> lists) { super(new BorderLayout(4, 2)); myChooser = new JComboBox(); //noinspection unchecked myChooser.setRenderer( new ColoredListCellRendererWrapper<LocalChangeList>() { @Override protected void doCustomize( JList list, LocalChangeList value, int index, boolean selected, boolean hasFocus) { if (value != null) { String name = value.getName().trim(); if (name.length() > MAX_LEN) { name = name.substring(0, MAX_LEN - 3) + "..."; } append( name, value.isDefault() ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES); } } }); myChooser.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { final LocalChangeList changeList = (LocalChangeList) myChooser.getSelectedItem(); setSelectedList(changeList); myChooser.setToolTipText(changeList == null ? "" : (changeList.getName())); } } }); updateLists(lists); myChooser.setEditable(false); add(myChooser, BorderLayout.CENTER); JLabel label = new JLabel(VcsBundle.message("commit.dialog.changelist.label")); label.setLabelFor(myChooser); add(label, BorderLayout.WEST); }
/** * Dem Konstruktor können Filter für den {@link PreselectionDialog Änderndialog} übergeben werden. * * @param listsFilter ein Objekt, welches die Listen des Änderndialogs filtert * @param filterTypes Typen der Objekte, die zur Auswahl angeboten werden sollen */ public DataIdentificationChoice( final PreselectionListsFilter listsFilter, final List filterTypes) { _gridBagLayout = new GridBagLayout(); setLayout(_gridBagLayout); setBorder(BorderFactory.createTitledBorder("Datenidentifikation")); // Tooltip vergeben // _simLabel.setToolTipText("Simulationsvariante"); wird nicht mehr benötigt // zuordnen der Label zu den Feldern _atgLabel.setLabelFor(_atgTextField); _aspLabel.setLabelFor(_aspTextField); _simLabel.setLabelFor(_simTextField); _objLabel.setLabelFor(_objList); // Felder sind nicht editierbar _atgTextField.setEditable(false); _atgTextField.setFocusable(false); _aspTextField.setEditable(false); _aspTextField.setFocusable(false); _simTextField.setEditable(false); _simTextField.setFocusable(false); _objList.setFocusable(false); // Ändern - Button implementieren _changeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (_preselectionDialog == null) { if (_treeNodes == null || _connection == null) { _preselectionDialog = new PreselectionDialog( "Datenidentifikationsauswahl", _changeButton, listsFilter, filterTypes); } else { _preselectionDialog = new PreselectionDialog( "Datenidentifikationsauswahl", _changeButton, listsFilter, filterTypes, _treeNodes, _connection); _preselectionDialog.setSelectedPath(_treePath); } _preselectionDialog.setMaximumSelectedAttributeGroups(1); _preselectionDialog.setMinimumSelectedAttributeGroups(1); if (_simulationVariant != -1) { _preselectionDialog.showSimulationVariant(); _preselectionDialog.setSimulationVariant(_simulationVariant); } _preselectionDialog.setMaximumSelectedAspects(_numberOfSelectedAspects); _preselectionDialog.setMinimumSelectedAspects(_numberOfSelectedAspects); _preselectionDialog.setMinimumSelectedAttributeGroups( _numberOfSelectedAttributeGroups); _preselectionDialog.setMaximumSelectedObjects(_maximumSelectedObjects); _preselectionDialog.setMinimumSelectedObjects(_minimumSelectedObjects); } _preselectionDialog.setSelectedObjectTypes(_objectTypes); _preselectionDialog.setSelectedAttributeGroups(_attributeGroups); _preselectionDialog.setSelectedAspects(_aspects); _preselectionDialog.setSelectedObjects(_objects); if (_preselectionDialog.show()) { // OK-Button wurde gedrückt // Werte übernehmen setObjectTypes(_preselectionDialog.getSelectedObjectTypes()); setAttributeGroups(_preselectionDialog.getSelectedAttributeGroups()); setAspects(_preselectionDialog.getSelectedAspects()); setObjects(_preselectionDialog.getSelectedObjects()); setSimulationVariant(_preselectionDialog.getSimulationVariant()); _treePath = _preselectionDialog.getSelectedTreePath(); } } }); createAndShowGui(); }
private void jbInit() throws Exception { titledBorder1 = new TitledBorder(""); this.setLayout(baseLayout); double[][] lower_size = { {TableLayout.PREFERRED, TableLayout.FILL, 25}, {25, 25, TableLayout.FILL} }; mLowerPanelLayout = new TableLayout(lower_size); mLowerPanel.setLayout(mLowerPanelLayout); double[][] dir_size = { {TableLayout.FILL, TableLayout.PREFERRED}, {TableLayout.PREFERRED, TableLayout.FILL} }; mDirectionsPanelLayout = new TableLayout(dir_size); mDirectionsPanel.setLayout(mDirectionsPanelLayout); // Try to get icons for the toolbar buttons try { ClassLoader loader = getClass().getClassLoader(); mAddIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/add.gif")); mRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove.gif")); mDisabledRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove_disabled.gif")); mAddNodeBtn.setIcon(mAddIcon); mRemoveNodeBtn.setIcon(mRemoveIcon); mRemoveNodeBtn.setDisabledIcon(mDisabledRemoveIcon); } catch (Exception e) { // Ack! No icons. Use text labels instead mAddNodeBtn.setText("Add"); mRemoveNodeBtn.setText("Remove"); } /* mAddNodeBtn.setMaximumSize(new Dimension(130, 33)); mAddNodeBtn.setMinimumSize(new Dimension(130, 33)); mAddNodeBtn.setPreferredSize(new Dimension(130, 33)); mAddNodeBtn.setText("Add Node"); */ mAddNodeBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mAddNodeBtn_actionPerformed(e); } }); /* mRemoveNodeBtn.setMaximumSize(new Dimension(130, 33)); mRemoveNodeBtn.setMinimumSize(new Dimension(130, 33)); mRemoveNodeBtn.setPreferredSize(new Dimension(130, 33)); mRemoveNodeBtn.setText("Remove Node"); */ mRemoveNodeBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mRemoveNode(); } }); mHostnameLabel.setHorizontalAlignment(SwingConstants.TRAILING); mHostnameLabel.setLabelFor(mHostnameField); mHostnameLabel.setText("Hostname:"); mHostnameField.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mAddNodeBtn_actionPerformed(e); } }); mDirectionsPanel.setBorder(BorderFactory.createEtchedBorder()); mTitleLabel.setFont(new java.awt.Font("Serif", 1, 20)); mTitleLabel.setHorizontalAlignment(SwingConstants.CENTER); mTitleLabel.setText("Add Cluster Nodes"); mDirectionsLabel.setText("Click on the add button to add nodes to your cluster configuration."); mDirectionsLabel.setLineWrap(true); mDirectionsLabel.setEditable(false); mDirectionsLabel.setBackground(mTitleLabel.getBackground()); baseLayout.setHgap(5); baseLayout.setVgap(5); mLowerPanel.add( mHostnameLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mHostnameField, new TableLayoutConstraints(1, 0, 1, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mListScrollPane1, new TableLayoutConstraints(0, 1, 1, 2, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mAddNodeBtn, new TableLayoutConstraints(2, 0, 2, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mRemoveNodeBtn, new TableLayoutConstraints(2, 1, 2, 1, TableLayout.FULL, TableLayout.FULL)); this.add(mLowerPanel, BorderLayout.CENTER); mListScrollPane1.getViewport().add(lstNodes, null); mDirectionsPanel.add( mTitleLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL)); mDirectionsPanel.add( mDirectionsLabel, new TableLayoutConstraints(0, 1, 0, 1, TableLayout.FULL, TableLayout.FULL)); mDirectionsPanel.add( mIconLabel, new TableLayoutConstraints(1, 0, 1, 1, TableLayout.FULL, TableLayout.FULL)); this.add(mDirectionsPanel, BorderLayout.NORTH); }
/** * Creates dialog. * * @param aFrame parent frame. * @param aTitle dialog title. * @param aPublishingAvailable <code>TRUE</code> if publishing is available. * @param aPublishingLimit the number of guides the user can have published. * @param aPublishingLimitReached <code>TRUE</code> if the limit is reached. */ public BasicGuideDialog( Frame aFrame, String aTitle, boolean aPublishingAvailable, int aPublishingLimit, boolean aPublishingLimitReached) { super(aFrame, aTitle); publishingAvailable = aPublishingAvailable; publishingLimit = aPublishingLimit; publishingLimitReached = aPublishingLimitReached; presentTitles = Collections.EMPTY_SET; model = new GuideIcons.ComboBoxModel(); renderer = new IconListCellRenderer(); readingListsModel = new ReadingListsTableModel(); tblReadingLists = new JTable(readingListsModel); tblReadingLists.setDefaultRenderer( String.class, new ReadingListsTableCellRenderer(readingListsModel)); UifUtilities.setTableColWidth(tblReadingLists, 2, 90); btnAddReadingList = new JButton(null, ResourceUtils.getIcon("add.icon")); btnAddReadingList.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onAddReadingList(); } }); btnRemoveList = new JButton(null, ResourceUtils.getIcon("delete.icon")); btnRemoveList.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onRemoveReadingList(); } }); // Publishing components chPublishingEnabled = ComponentsFactory.createCheckBox(Strings.message("guide.dialog.enable.publishing")); lbPublishingPublic = new JLabel(Strings.message("guide.dialog.public.visibility")); chPublishingPublic = new JCheckBox(); lbPublishingTitle = ComponentsFactory.createLabel(Strings.message("guide.dialog.reading.list.title")); lbPublishingTags = ComponentsFactory.createLabel(Strings.message("guide.dialog.tags")); lbPublishingURL = new JLabel(Strings.message("guide.dialog.publicationurl")); lnkPublishingURL = new LinkLabel(Strings.message("guide.dialog.not.published.yet")); lbLastPublishingDate = new JLabel(Strings.message("guide.dialog.last.update.date")); tfLastPublishingDate = new JLabel(Strings.message("guide.dialog.never.updated")); tfPublishingTitle = new JTextField(); lbPublishingTitle.setLabelFor(tfPublishingTitle); tfPublishingTags = new JTextField(); lbPublishingTags.setLabelFor(tfPublishingTags); vhPublishingRating = new ValueHolder(1); sscPublishingRating = new StarsSelectionComponent(new BoundedRangeAdapter(vhPublishingRating, 0, 1, 5)); lbPublishingRating = new JLabel(Strings.message("guide.dialog.rating")); btnCopyToClipboard = new JButton(Strings.message("guide.dialog.copy")); btnCopyToClipboard.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { CommonUtils.copyTextToClipboard(lnkPublishingURL.getText()); } }); onPublishingEnabled(); chPublishingEnabled.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { onPublishingEnabled(); } }); chAllowNotifications = ComponentsFactory.createCheckBox(Strings.message("guide.dialog.allow.notifications")); }
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Open Source Project license - unknown ResourceBundle bundle = ResourceBundle.getBundle("InformationDialog"); JPanel dialogPane = new JPanel(); JPanel contentPanel = new JPanel(); iconLabel = new JLabel(); pathLabel = new JLabel(); JLabel labelFrom = new JLabel(); fieldFrom = new JTextField(); JLabel labelSize = new JLabel(); fieldSize = new JTextField(); JLabel labelDescription = new JLabel(); JScrollPane scrollPane1 = new JScrollPane(); descriptionArea = ComponentFactory.getTextArea(); JPanel optionsPanel = new JPanel(); JLabel saveToLabel = new JLabel(); comboPath = new JComboBox(); btnSelectPath = new JButton(); progressBar = new JProgressBar(); JLabel labelRemaining = new JLabel(); remainingLabel = new JLabel(); JLabel labelEstimateTime = new JLabel(); estTimeLabel = new JLabel(); JLabel labelCurrentSpeed = new JLabel(); currentSpeedLabel = new JLabel(); JLabel labelAverageSpeed = new JLabel(); avgSpeedLabel = new JLabel(); JXButtonPanel buttonBar = new JXButtonPanel(); okButton = new JButton(); cancelButton = new JButton(); CellConstraints cc = new CellConstraints(); // ======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(Borders.DIALOG); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { // ---- iconLabel ---- iconLabel.setText(bundle.getString("iconLabel.text")); // ---- pathLabel ---- pathLabel.setText(bundle.getString("pathLabel.text")); pathLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelFrom ---- labelFrom.setText(bundle.getString("labelFrom.text")); // ---- fieldFrom ---- fieldFrom.setBorder(null); fieldFrom.setOpaque(false); fieldFrom.setText(bundle.getString("fieldFrom.text")); // ---- labelSize ---- labelSize.setText(bundle.getString("labelSize.text")); // ---- fieldSize ---- fieldSize.setBorder(null); fieldSize.setOpaque(false); // ---- labelDescription ---- labelDescription.setText(bundle.getString("labelDescription.text")); // ======== scrollPane1 ======== { scrollPane1.setViewportView(descriptionArea); } // ======== optionsPanel ======== { // ---- saveToLabel ---- saveToLabel.setText(bundle.getString("saveToLabel.text")); saveToLabel.setLabelFor(comboPath); // ---- comboPath ---- comboPath.setEditable(true); // ---- btnSelectPath ---- btnSelectPath.setText(bundle.getString("btnSelectPath.text")); PanelBuilder optionsPanelBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default")), optionsPanel); optionsPanelBuilder.add(saveToLabel, cc.xy(1, 1)); optionsPanelBuilder.add(comboPath, cc.xy(3, 1)); optionsPanelBuilder.add(btnSelectPath, cc.xy(5, 1)); } // ---- progressBar ---- progressBar.setFont(new Font("Tahoma", Font.BOLD, 16)); // ---- labelRemaining ---- labelRemaining.setText(bundle.getString("labelRemaining.text")); // ---- remainingLabel ---- remainingLabel.setText(bundle.getString("remainingLabel.text")); remainingLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelEstimateTime ---- labelEstimateTime.setText(bundle.getString("labelEstimateTime.text")); // ---- estTimeLabel ---- estTimeLabel.setText(bundle.getString("estTimeLabel.text")); estTimeLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelCurrentSpeed ---- labelCurrentSpeed.setText(bundle.getString("labelCurrentSpeed.text")); // ---- currentSpeedLabel ---- currentSpeedLabel.setText(bundle.getString("currentSpeedLabel.text")); currentSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelAverageSpeed ---- labelAverageSpeed.setText(bundle.getString("labelAverageSpeed.text")); // ---- avgSpeedLabel ---- avgSpeedLabel.setText(bundle.getString("avgSpeedLabel.text")); avgSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); PanelBuilder contentPanelBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(49)), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("max(min;70dlu)") }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, new RowSpec( RowSpec.FILL, Sizes.bounded(Sizes.PREFERRED, Sizes.dluY(40), Sizes.dluY(50)), FormSpec.DEFAULT_GROW), FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("fill:max(pref;20dlu)"), FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }), contentPanel); contentPanelBuilder.add(iconLabel, cc.xywh(1, 1, 1, 5)); contentPanelBuilder.add(pathLabel, cc.xywh(3, 1, 7, 1)); contentPanelBuilder.add(labelFrom, cc.xy(3, 3)); contentPanelBuilder.add(fieldFrom, cc.xywh(5, 3, 5, 1)); contentPanelBuilder.add(labelSize, cc.xy(3, 5)); contentPanelBuilder.add(fieldSize, cc.xywh(5, 5, 3, 1)); contentPanelBuilder.add(labelDescription, cc.xy(1, 7)); contentPanelBuilder.add(scrollPane1, cc.xywh(1, 9, 9, 1)); contentPanelBuilder.add(optionsPanel, cc.xywh(1, 11, 9, 1)); contentPanelBuilder.add(progressBar, cc.xywh(1, 13, 9, 1)); contentPanelBuilder.add(labelRemaining, cc.xy(1, 15)); contentPanelBuilder.add(remainingLabel, cc.xywh(3, 15, 3, 1)); contentPanelBuilder.add(labelEstimateTime, cc.xy(7, 15)); contentPanelBuilder.add(estTimeLabel, cc.xy(9, 15)); contentPanelBuilder.add(labelCurrentSpeed, cc.xy(1, 17)); contentPanelBuilder.add(currentSpeedLabel, cc.xywh(3, 17, 3, 1)); contentPanelBuilder.add(labelAverageSpeed, cc.xy(7, 17)); contentPanelBuilder.add(avgSpeedLabel, cc.xy(9, 17)); } dialogPane.add(contentPanel, BorderLayout.CENTER); // ======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); // ---- okButton ---- okButton.setText(bundle.getString("okButton.text")); // ---- cancelButton ---- cancelButton.setText(bundle.getString("cancelButton.text")); PanelBuilder buttonBarBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("max(pref;55dlu)"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("fill:pref")), buttonBar); ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] {{3, 5}}); buttonBarBuilder.add(okButton, cc.xy(3, 1)); buttonBarBuilder.add(cancelButton, cc.xy(5, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
public MakeReservation() { new BorderLayout(); standardRoom.setMnemonic(KeyEvent.VK_K); standardRoom.setActionCommand("Standard Room"); standardRoom.setSelected(true); familyRoom.setMnemonic(KeyEvent.VK_F); familyRoom.setActionCommand("Family Room"); suiteRoom.setMnemonic(KeyEvent.VK_S); suiteRoom.setActionCommand("Suite"); // Add Booking Button ImageIcon bookRoomIcon = createImageIcon("images/book.png"); bookRoom = new JButton("Book Room", bookRoomIcon); bookRoom.setVerticalTextPosition(AbstractButton.BOTTOM); bookRoom.setHorizontalTextPosition(AbstractButton.CENTER); bookRoom.setMnemonic(KeyEvent.VK_M); bookRoom.addActionListener(this); bookRoom.setActionCommand("book"); // Group the radio buttons. group.add(standardRoom); group.add(familyRoom); group.add(suiteRoom); // Create the labels. nameLabel = new JLabel("Name: "); amountroomsLabel = new JLabel("How many rooms? "); checkoutdateLabel = new JLabel("Check-Out Date: "); checkindateLabel = new JLabel("Check-In Date: "); // Create the text fields and set them up. nameField = new JFormattedTextField(); nameField.setColumns(10); amountroomsField = new JFormattedTextField(new Integer(1)); amountroomsField.setValue(new Integer(1)); amountroomsField.setColumns(10); // java.util.Date dt_checkin = new java.util.Date(); LocalDate today = LocalDate.now(); // java.text.SimpleDateFormat sdf_checkin = new java.text.SimpleDateFormat("MM/dd/yyyy"); currentDate_checkin = today.toString(); checkindateField = new JFormattedTextField(currentDate_checkin); checkindateField.setColumns(10); // java.util.Date dt_checkout = new java.util.Date(); LocalDate tomorrow = today.plus(1, ChronoUnit.DAYS); // java.text.SimpleDateFormat sdf_checkout = new java.text.SimpleDateFormat("MM/dd/yyyy"); currentDate_checkout = tomorrow.toString(); checkoutdateField = new JFormattedTextField(currentDate_checkout); checkoutdateField.setColumns(10); // Tell accessibility tools about label/textfield pairs. nameLabel.setLabelFor(nameField); amountroomsLabel.setLabelFor(amountroomsField); checkoutdateLabel.setLabelFor(checkoutdateField); checkindateLabel.setLabelFor(checkindateField); // Lay out the labels in a panel. JPanel labelPane1 = new JPanel(new GridLayout(0, 1)); labelPane1.add(amountroomsLabel); JPanel labelPane3 = new JPanel(new GridLayout(0, 1)); labelPane3.add(checkindateLabel); JPanel labelPane2 = new JPanel(new GridLayout(0, 1)); labelPane2.add(checkoutdateLabel); JPanel labelPane4 = new JPanel(new GridLayout(0, 1)); labelPane4.add(nameLabel); // Layout the text fields in a panel. JPanel fieldPane1 = new JPanel(new GridLayout(0, 1)); fieldPane1.add(amountroomsField); JPanel fieldPane3 = new JPanel(new GridLayout(0, 1)); fieldPane3.add(checkindateField); JPanel fieldPane2 = new JPanel(new GridLayout(0, 1)); fieldPane2.add(checkoutdateField); JPanel fieldPane4 = new JPanel(new GridLayout(0, 1)); fieldPane4.add(nameField); // Put the radio buttons in a column in a panel. JPanel radioPanel = new JPanel(new GridLayout(0, 1)); radioPanel.add(standardRoom); radioPanel.add(familyRoom); radioPanel.add(suiteRoom); // Put the panels in this panel, labels on left, // text fields on right. setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); add(labelPane1, BorderLayout.LINE_START); add(fieldPane1, BorderLayout.LINE_END); add(labelPane3, BorderLayout.LINE_START); add(fieldPane3, BorderLayout.LINE_END); add(labelPane2, BorderLayout.LINE_START); add(fieldPane2, BorderLayout.LINE_END); add(labelPane4, BorderLayout.LINE_START); add(fieldPane4, BorderLayout.LINE_END); add(radioPanel, BorderLayout.LINE_END); add(bookRoom); }
protected JComponent createCenterPanel() { Group rootGroup = ActionsTreeUtil.createMainGroup( null, null, QuickListsManager.getInstance().getAllQuickLists()); DefaultMutableTreeNode root = ActionsTreeUtil.createNode(rootGroup); DefaultTreeModel model = new DefaultTreeModel(root); myTree = new Tree(); myTree.setModel(model); myTree.setCellRenderer(new MyTreeCellRenderer()); final ActionManager actionManager = ActionManager.getInstance(); mySetIconButton = new JButton(IdeBundle.message("button.set.icon")); mySetIconButton.setEnabled(false); mySetIconButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { final TreePath selectionPath = myTree.getSelectionPath(); if (selectionPath != null) { doSetIcon( (DefaultMutableTreeNode) selectionPath.getLastPathComponent(), myTextField.getText(), getContentPane()); myTree.repaint(); } } }); myTextField = createBrowseField(); myTextField .getTextField() .getDocument() .addDocumentListener( new DocumentAdapter() { protected void textChanged(DocumentEvent e) { enableSetIconButton(actionManager); } }); JPanel northPanel = new JPanel(new BorderLayout()); northPanel.add(myTextField, BorderLayout.CENTER); final JLabel label = new JLabel(IdeBundle.message("label.icon.path")); label.setLabelFor(myTextField.getChildComponent()); northPanel.add(label, BorderLayout.WEST); northPanel.add(mySetIconButton, BorderLayout.EAST); northPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); JPanel panel = new JPanel(new BorderLayout()); panel.add(northPanel, BorderLayout.NORTH); panel.add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER); myTree .getSelectionModel() .addTreeSelectionListener( new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { enableSetIconButton(actionManager); final TreePath selectionPath = myTree.getSelectionPath(); if (selectionPath != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode) selectionPath.getLastPathComponent(); final String actionId = getActionId(node); if (actionId != null) { final String iconPath = mySelectedSchema.getIconPath(actionId); myTextField.setText(FileUtil.toSystemDependentName(iconPath)); } } } }); return panel; }
/** * The constructor * * @param project the project * @param target the target configuration * @param allChanges the all changes * @param roots the collection of roots * @param remoteBranch the remote branch * @param config the configuration * @param isModify the modify flag * @throws VcsException if there is a problem with detecting the current state */ protected SwitchBranchesDialog( Project project, final BranchConfiguration target, final List<Change> allChanges, List<VirtualFile> roots, String remoteBranch, final BranchConfigurations config, boolean isModify) throws VcsException { super(project, true); setTitle(isModify ? "Modify Branch Configuration" : "Checkout Branch Configuration"); assert (remoteBranch == null) || (target == null) : "There should be no target for remote branch"; myTarget = target; myConfig = config; myModify = isModify; myProject = project; VirtualFile baseDir = project.getBaseDir(); myBaseFile = baseDir == null ? null : new File(baseDir.getPath()); myExistingConfigNames = myConfig.getConfigurationNames(); myChangesTree = new ChangesTreeList<Change>( myProject, Collections.<Change>emptyList(), !myModify, true, null, RemoteRevisionsCache.getInstance(project).getChangesNodeDecorator()) { protected DefaultTreeModel buildTreeModel( final List<Change> changes, ChangeNodeDecorator changeNodeDecorator) { TreeModelBuilder builder = new TreeModelBuilder(myProject, false); return builder.buildModel(changes, changeNodeDecorator); } protected List<Change> getSelectedObjects(final ChangesBrowserNode<Change> node) { return node.getAllChangesUnder(); } @Nullable protected Change getLeadSelectedObject(final ChangesBrowserNode node) { final Object o = node.getUserObject(); if (o instanceof Change) { return (Change) o; } return null; } }; if (remoteBranch != null) { myBranches = prepareBranchesForRemote(remoteBranch, roots); } else { myBranches = prepareBranchDescriptors(target, roots); } Collections.sort( myBranches, new Comparator<BranchDescriptor>() { @Override public int compare(BranchDescriptor o1, BranchDescriptor o2) { return o1.getRoot().compareTo(o2.getRoot()); } }); if (target == null) { myNameTextField.setText(generateNewConfigurationName()); } else { myNameTextField.setText(target.getName()); } myChangesTree.setChangesToDisplay(allChanges); myChangesTree.setIncludedChanges(Collections.<Change>emptyList()); myChangesPanel.add(myChangesTree, BorderLayout.CENTER); myChangesLabel.setLabelFor(myChangesTree); if (myModify) { myChangesLabel.setText("Changes in the current configuration"); } RootTableModel tableModel = new RootTableModel(); myBranchesTable.setModel(tableModel); myBranchesTable.setDefaultRenderer(Pair.class, new PairTableRenderer()); final TableColumnModel columns = myBranchesTable.getColumnModel(); final PairTableRenderer renderer = new PairTableRenderer(); for (Enumeration<TableColumn> cs = columns.getColumns(); cs.hasMoreElements(); ) { cs.nextElement().setCellRenderer(renderer); } TableColumn revisionColumn = columns.getColumn(RootTableModel.REVISION_COLUMN); revisionColumn.setCellEditor(new ReferenceEditor()); TableColumn branchColumn = columns.getColumn(RootTableModel.NEW_BRANCH_COLUMN); branchColumn.setCellEditor(new BranchNameEditor()); myNameTextField .getDocument() .addDocumentListener( new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { verify(); } }); tableModel.addTableModelListener( new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { verify(); } }); verify(); init(); }
/** * Standard constructor. * * @param type Type that you are going to be creating and editor for. * @param readOnly Set to true to create a read-only customizer. */ public DynamicCustomizer(Class type, boolean readOnly) { super(new GridBagLayout()); _readOnly = readOnly; _type = type; LabelFieldGBC gbc = new LabelFieldGBC(); try { BeanInfo info = Introspector.getBeanInfo(type); // Set up pretty display stuff. setBorder(BorderFactory.createTitledBorder(info.getBeanDescriptor().getDisplayName())); setToolTipText(info.getBeanDescriptor().getShortDescription()); // Get the properties and sort them. PropertyDescriptor[] props = info.getPropertyDescriptors(); Arrays.sort(props, new PropertyComparator()); for (int i = 0; i < props.length; i++) { // Ignore the "class" property, if it is provided. if (props[i].getName().equals("class")) continue; // Create a label for the field. JLabel label = new JLabel(props[i].getDisplayName() + ":"); // Lookup the editor. PropertyEditor editor = getEditorForProperty(props[i]); // Add a listener to the editor so we know when to update // the bean's fields. editor.addPropertyChangeListener(_eListener); // XXX What we need to do right here is provide a component // that makes use of the "paintable" capability of the editor. Component comp = editor.getCustomEditor(); if (comp == null) { comp = new JLabel("<No editor available.>"); ((JLabel) comp).setBorder(BorderFactory.createEtchedBorder()); } // See if it is a read-only property. If so, then just // display it. if (_readOnly || props[i].getWriteMethod() == null) { comp.setEnabled(false); } // Setup the accellerator key. label.setLabelFor(comp); label.setDisplayedMnemonic(label.getText().charAt(0)); // Set the tool tip text, if any. String tip = props[i].getShortDescription(); if (tip != null) { label.setToolTipText(tip); if (comp instanceof JComponent) { ((JComponent) comp).setToolTipText(tip); } } // Add the label and fields. add(label, gbc.forLabel()); add(comp, gbc.forField()); // Set the mappings between editor and property, etc. for // quick lookup later. _prop2Editor.put(props[i], editor); _editor2Prop.put(editor, props[i]); } // Filler... add(new JLabel(), gbc.forLastLabel()); } catch (Exception ex) { ex.printStackTrace(); } }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout(10, 10)); fc.setAlignmentX(JComponent.CENTER_ALIGNMENT); JPanel interior = new JPanel() { public Insets getInsets() { return insets; } }; align(interior); interior.setLayout(new BoxLayout(interior, BoxLayout.PAGE_AXIS)); fc.add(interior, BorderLayout.CENTER); // PENDING(jeff) - I18N JLabel l = new JLabel(pathLabelText); l.setDisplayedMnemonic(pathLabelMnemonic); align(l); interior.add(l); File currentDirectory = fc.getCurrentDirectory(); String curDirName = null; if (currentDirectory != null) { curDirName = currentDirectory.getPath(); } pathField = new JTextField(curDirName) { public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; return d; } }; l.setLabelFor(pathField); align(pathField); // Change to folder on return pathField.addActionListener(getUpdateAction()); interior.add(pathField); interior.add(Box.createRigidArea(vstrut10)); // CENTER: left, right accessory JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.LINE_AXIS)); align(centerPanel); // left panel - Filter & folderList JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS)); align(leftPanel); // add the filter PENDING(jeff) - I18N l = new JLabel(filterLabelText); l.setDisplayedMnemonic(filterLabelMnemonic); align(l); leftPanel.add(l); filterComboBox = new JComboBox() { public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; return d; } }; l.setLabelFor(filterComboBox); filterComboBoxModel = createFilterComboBoxModel(); filterComboBox.setModel(filterComboBoxModel); filterComboBox.setRenderer(createFilterComboBoxRenderer()); fc.addPropertyChangeListener(filterComboBoxModel); align(filterComboBox); leftPanel.add(filterComboBox); // leftPanel.add(Box.createRigidArea(vstrut10)); // Add the Folder List PENDING(jeff) - I18N l = new JLabel(foldersLabelText); l.setDisplayedMnemonic(foldersLabelMnemonic); align(l); leftPanel.add(l); JScrollPane sp = createDirectoryList(); sp.getVerticalScrollBar().setFocusable(false); sp.getHorizontalScrollBar().setFocusable(false); l.setLabelFor(sp.getViewport().getView()); leftPanel.add(sp); // create files list JPanel rightPanel = new JPanel(); align(rightPanel); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.PAGE_AXIS)); l = new JLabel(filesLabelText); l.setDisplayedMnemonic(filesLabelMnemonic); align(l); rightPanel.add(l); sp = createFilesList(); l.setLabelFor(sp); rightPanel.add(sp); centerPanel.add(leftPanel); centerPanel.add(Box.createRigidArea(hstrut10)); centerPanel.add(rightPanel); JComponent accessoryPanel = getAccessoryPanel(); JComponent accessory = fc.getAccessory(); if (accessoryPanel != null) { if (accessory == null) { accessoryPanel.setPreferredSize(ZERO_ACC_SIZE); accessoryPanel.setMaximumSize(ZERO_ACC_SIZE); } else { getAccessoryPanel().add(accessory, BorderLayout.CENTER); accessoryPanel.setPreferredSize(PREF_ACC_SIZE); accessoryPanel.setMaximumSize(MAX_SIZE); } align(accessoryPanel); centerPanel.add(accessoryPanel); } interior.add(centerPanel); interior.add(Box.createRigidArea(vstrut10)); // add the filename field PENDING(jeff) - I18N l = new JLabel(enterFileNameLabelText); l.setDisplayedMnemonic(enterFileNameLabelMnemonic); align(l); interior.add(l); filenameTextField = new JTextField() { public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; return d; } }; l.setLabelFor(filenameTextField); filenameTextField.addActionListener(getApproveSelectionAction()); align(filenameTextField); filenameTextField.setAlignmentX(JComponent.LEFT_ALIGNMENT); interior.add(filenameTextField); bottomPanel = getBottomPanel(); bottomPanel.add(new JSeparator(), BorderLayout.NORTH); // Add buttons JPanel buttonPanel = new JPanel(); align(buttonPanel); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.add(Box.createGlue()); approveButton = new JButton(getApproveButtonText(fc)) { public Dimension getMaximumSize() { return new Dimension(MAX_SIZE.width, this.getPreferredSize().height); } }; approveButton.setMnemonic(getApproveButtonMnemonic(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); align(approveButton); approveButton.setMargin(buttonMargin); approveButton.addActionListener(getApproveSelectionAction()); buttonPanel.add(approveButton); buttonPanel.add(Box.createGlue()); JButton updateButton = new JButton(updateButtonText) { public Dimension getMaximumSize() { return new Dimension(MAX_SIZE.width, this.getPreferredSize().height); } }; updateButton.setMnemonic(updateButtonMnemonic); updateButton.setToolTipText(updateButtonToolTipText); align(updateButton); updateButton.setMargin(buttonMargin); updateButton.addActionListener(getUpdateAction()); buttonPanel.add(updateButton); buttonPanel.add(Box.createGlue()); JButton cancelButton = new JButton(cancelButtonText) { public Dimension getMaximumSize() { return new Dimension(MAX_SIZE.width, this.getPreferredSize().height); } }; cancelButton.setMnemonic(cancelButtonMnemonic); cancelButton.setToolTipText(cancelButtonToolTipText); align(cancelButton); cancelButton.setMargin(buttonMargin); cancelButton.addActionListener(getCancelSelectionAction()); buttonPanel.add(cancelButton); buttonPanel.add(Box.createGlue()); JButton helpButton = new JButton(helpButtonText) { public Dimension getMaximumSize() { return new Dimension(MAX_SIZE.width, this.getPreferredSize().height); } }; helpButton.setMnemonic(helpButtonMnemonic); helpButton.setToolTipText(helpButtonToolTipText); align(helpButton); helpButton.setMargin(buttonMargin); helpButton.setEnabled(false); buttonPanel.add(helpButton); buttonPanel.add(Box.createGlue()); bottomPanel.add(buttonPanel, BorderLayout.SOUTH); if (fc.getControlButtonsAreShown()) { fc.add(bottomPanel, BorderLayout.SOUTH); } }