List of usage examples for com.jgoodies.forms.layout CellConstraints xyw
public CellConstraints xyw(int col, int row, int colSpan)
Examples:
cc.xyw(1, 3, 7); cc.xyw(1, 3, 2);
From source file:ca.phon.app.session.editor.TranscriberSelectionDialog.java
License:Open Source License
/** Init display and listeners */ private void initDialog() { // setup layout // layout will be seperated into two sections, existing // and new transcripts FormLayout outerLayout = new FormLayout("3dlu, pref, right:pref:grow, 3dlu", "pref, 3dlu, top:pref:noGrow, 3dlu, pref, 3dlu, fill:pref:grow, 3dlu, pref"); this.getContentPane().setLayout(outerLayout); // create the 'new' panel first FormLayout newLayout = new FormLayout("left:pref:noGrow, 3dlu, fill:pref:grow", "bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, fill:pref:grow"); JPanel newPanel = new JPanel(newLayout); this.newTranscriptButton = new JRadioButton(); this.newTranscriptButton.setText("New Transcriber"); this.newTranscriptButton.setSelected(true); this.newTranscriptButton.addActionListener(new ActionListener() { @Override//from w w w . j a v a 2s . c o m public void actionPerformed(ActionEvent arg0) { realNameField.setEnabled(true); usernameField.setEnabled(true); passwordRequiredBox.setEnabled(true); if (passwordRequiredBox.isSelected()) { passwordField.setEnabled(true); checkField.setEnabled(true); } existingUserList.setEnabled(false); } }); this.existingTranscriptButton = new JRadioButton(); this.existingTranscriptButton.setText("Existing Transcriber"); this.existingTranscriptButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { realNameField.setEnabled(false); usernameField.setEnabled(false); passwordRequiredBox.setEnabled(false); passwordField.setEnabled(false); checkField.setEnabled(false); existingUserList.setEnabled(true); } }); ButtonGroup bg = new ButtonGroup(); bg.add(this.newTranscriptButton); bg.add(this.existingTranscriptButton); this.realNameField = new JTextField(); this.usernameField = new JTextField(); this.passwordRequiredBox = new JCheckBox(); this.passwordRequiredBox.setText("Use password"); this.passwordRequiredBox.setSelected(false); this.passwordRequiredBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { passwordField.setEnabled(passwordRequiredBox.isSelected()); checkField.setEnabled(passwordRequiredBox.isSelected()); } }); this.passwordField = new JPasswordField(); this.passwordField.setEnabled(false); this.checkField = new JPasswordField(); this.checkField.setEnabled(false); CellConstraints cc = new CellConstraints(); newPanel.add(new JLabel("Full Name:"), cc.xy(1, 1)); newPanel.add(this.realNameField, cc.xy(3, 1)); newPanel.add(new JLabel("Username:"), cc.xy(1, 3)); newPanel.add(this.usernameField, cc.xy(3, 3)); newPanel.add(this.passwordRequiredBox, cc.xyw(1, 5, 3)); newPanel.add(new JLabel("Password:"), cc.xy(1, 7)); newPanel.add(this.passwordField, cc.xy(3, 7)); newPanel.add(this.checkField, cc.xy(3, 9)); // create the 'existing' panel FormLayout existingLayout = new FormLayout( // just a list "fill:pref:grow", "fill:pref:grow"); JPanel existingPanel = new JPanel(existingLayout); List<String> existingUserData = new ArrayList<String>(); for (Transcriber t : session.getTranscribers()) existingUserData.add(t.getRealName() + " - " + t.getUsername()); this.existingUserList = new JList(existingUserData.toArray()); this.existingUserList.setEnabled(false); existingPanel.add(this.existingUserList, cc.xy(1, 1)); // create the button panel this.okButton = new JButton("OK"); this.okButton.setDefaultCapable(true); this.okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (checkDialog()) { okHandler(); } } }); getRootPane().setDefaultButton(okButton); this.cancelButton = new JButton("Cancel"); this.cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { cancelHandler(); } }); final JComponent bar = ButtonBarBuilder.buildOkCancelBar(okButton, cancelButton); this.getContentPane().add(bar, cc.xy(3, 9)); this.getContentPane().add(this.newTranscriptButton, cc.xy(2, 1)); this.getContentPane().add(newPanel, cc.xyw(2, 3, 2)); this.getContentPane().add(this.existingTranscriptButton, cc.xy(2, 5)); this.getContentPane().add(new JScrollPane(existingPanel), cc.xyw(2, 7, 2)); }
From source file:ca.phon.app.session.editor.view.media_player.PlayCustomSegmentDialog.java
License:Open Source License
private void init() { final FormLayout layout = new FormLayout("10dlu, fill:pref:grow", "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref"); final CellConstraints cc = new CellConstraints(); setLayout(layout);//from w w w.java2s .co m final SessionEditor editor = editorRef.get(); final Session session = editor.getSession(); btnGrp = new ButtonGroup(); currentSegmentBtn = new JRadioButton("Current segment"); currentSegmentBtn.addActionListener(radioListener); currentSegmentBtn.setSelected(true); btnGrp.add(currentSegmentBtn); contiguousSegmentBtn = new JRadioButton("Speaker turn"); contiguousSegmentBtn.addActionListener(radioListener); btnGrp.add(contiguousSegmentBtn); // periodBtn = new JRadioButton("Adjacency sequence"); // periodBtn.addActionListener(radioListener); // btnGrp.add(periodBtn); recordRangeBtn = new JRadioButton("Record range"); recordRangeBtn.addActionListener(radioListener); btnGrp.add(recordRangeBtn); rangeField = new JTextField(); rangeField.setText((editor.getCurrentRecordIndex() + 1) + ".." + (editor.getCurrentRecordIndex() + 1)); rangeField.setInputVerifier(new RangeVerifier()); rangeField.setEnabled(false); rangeField.getDocument().addDocumentListener(rangeListener); segmentTimeBtn = new JRadioButton("Time range"); segmentTimeBtn.addActionListener(radioListener); btnGrp.add(segmentTimeBtn); segmentField = new MediaSegmentField(); segmentField.setEnabled(false); updateSegmentTimes(); final DialogHeader header = new DialogHeader("Play Custom Segment", "Play a custom defined segment"); add(header, cc.xyw(1, 1, 2)); add(currentSegmentBtn, cc.xyw(1, 2, 2)); add(contiguousSegmentBtn, cc.xyw(1, 3, 2)); // add(periodBtn, cc.xyw(1, 4, 2)); add(recordRangeBtn, cc.xyw(1, 5, 2)); add(rangeField, cc.xy(2, 6)); add(segmentTimeBtn, cc.xyw(1, 7, 2)); add(segmentField, cc.xy(2, 8)); final ImageIcon playIcon = IconManager.getInstance().getIcon("actions/media-playback-start", IconSize.SMALL); final ImageIcon cancelIcon = IconManager.getInstance().getIcon("actions/button_cancel", IconSize.SMALL); final PhonUIAction playAct = new PhonUIAction(this, "onPlay"); playAct.putValue(PhonUIAction.NAME, "Play"); playAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Play segment"); playAct.putValue(PhonUIAction.SMALL_ICON, playIcon); playBtn = new JButton(playAct); final PhonUIAction cancelAct = new PhonUIAction(this, "onCancel"); cancelAct.putValue(PhonUIAction.NAME, "Close"); cancelAct.putValue(PhonUIAction.SMALL_ICON, cancelIcon); cancelBtn = new JButton(cancelAct); final JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); btnPanel.add(cancelBtn); btnPanel.add(playBtn); add(btnPanel, cc.xyw(1, 9, 2)); }
From source file:ca.phon.app.session.editor.view.segmentation.SegmentationEditorView.java
License:Open Source License
private void init() { segmentWindowField = new JTextField(); SegmentWindowDocument segDoc = new SegmentWindowDocument(); segmentWindowField.setDocument(segDoc); segmentWindowField.setText(DEFAULT_SEGMENT_WINDOW + ""); segDoc.addDocumentListener(new SegmentWindowListener()); segmentLabel = new SegmentLabel(); segmentLabel.setSegmentWindow(DEFAULT_SEGMENT_WINDOW); segmentLabel.setCurrentTime(0L);//from w w w . j a v a2 s. c o m segmentLabel.lockSegmentStartTime(-1L); modeBox = new JComboBox(SegmentationMode.values()); modeBox.setSelectedItem(SegmentationMode.INSERT_AFTER_CURRENT); JPanel topPanel = new JPanel(); FormLayout topLayout = new FormLayout("right:pref, 3dlu, fill:default:grow, pref", "pref, pref, pref, pref"); topPanel.setLayout(topLayout); CellConstraints cc = new CellConstraints(); topPanel.add(new JLabel("Segment Window"), cc.xy(1, 1)); topPanel.add(segmentWindowField, cc.xy(3, 1)); topPanel.add(new JLabel("ms"), cc.xy(4, 1)); JLabel infoLabel = new JLabel("Set to 0 for unlimited segment time"); infoLabel.setFont(infoLabel.getFont().deriveFont(10.0f)); topPanel.add(infoLabel, cc.xy(3, 2)); topPanel.add(new JLabel("Current Window"), cc.xy(1, 3)); topPanel.add(segmentLabel, cc.xy(3, 3)); topPanel.add(new JLabel("Mode"), cc.xy(1, 4)); topPanel.add(modeBox, cc.xyw(3, 4, 2)); setLayout(new BorderLayout()); add(topPanel, BorderLayout.NORTH); participantPanel = new JPanel(); participantPanel.setBackground(Color.white); participantPanel.setOpaque(true); JScrollPane participantScroller = new JScrollPane(participantPanel); Dimension prefSize = participantScroller.getPreferredSize(); prefSize.height = 150; participantScroller.setPreferredSize(prefSize); Dimension maxSize = participantScroller.getMaximumSize(); maxSize.height = 200; participantScroller.setMaximumSize(maxSize); Dimension minSize = participantScroller.getMinimumSize(); minSize.height = 100; participantScroller.setMinimumSize(minSize); participantScroller.setBorder(BorderFactory.createTitledBorder("Participants")); add(participantScroller, BorderLayout.CENTER); updateParticipantPanel(); setupEditorActions(); }
From source file:ca.phon.app.session.RecordFilterPanel.java
License:Open Source License
private void init() { FormLayout layout = new FormLayout("0px, fill:pref:grow", "pref, 1dlu, pref, pref, 1dlu, pref, pref, 1dlu, pref, pref"); CellConstraints cc = new CellConstraints(); setLayout(layout);//from w w w . j av a 2 s . c o m radioGrp = new ButtonGroup(); ButtonAction bAct = new ButtonAction(); allBtn = new JRadioButton("All records"); allBtn.setSelected(true); allBtn.addActionListener(bAct); radioGrp.add(allBtn); rangeBtn = new JRadioButton("Specific records"); rangeBtn.addActionListener(bAct); radioGrp.add(rangeBtn); speakerBtn = new JRadioButton("Records for participant(s)"); speakerBtn.addActionListener(bAct); radioGrp.add(speakerBtn); searchBtn = new JRadioButton("Records from search results"); searchBtn.addActionListener(bAct); radioGrp.add(searchBtn); rangeField = new JTextField(); rangeField.setText("1.." + t.getRecordCount()); rangeField.setInputVerifier(new RangeVerifier()); rangeField.setEnabled(false); speakerTbl = new JXTable(new ParticipantsTableModel()); speakerTbl.setVisibleRowCount(2); speakerTbl.setEnabled(false); searchTbl = new JXTable(new SearchTableModel()); searchTbl.setVisibleRowCount(4); searchTbl.setEnabled(false); searchTbl.getColumn(0).setCellRenderer(new QueryNameCellRenderer()); searchTbl.getColumn(1).setCellRenderer(new DateCellRenderer()); searchTbl.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); searchTbl.getSelectionModel().addListSelectionListener(new SearchListener()); if (searchTbl.getModel().getRowCount() > 0) { searchTbl.getSelectionModel().setSelectionInterval(0, 0); } searchTbl.setSortOrder(1, SortOrder.DESCENDING); // add components add(allBtn, cc.xyw(1, 1, 2)); add(rangeBtn, cc.xyw(1, 3, 2)); add(rangeField, cc.xy(2, 4)); add(speakerBtn, cc.xyw(1, 6, 2)); add(new JScrollPane(speakerTbl), cc.xy(2, 7)); add(searchBtn, cc.xyw(1, 9, 2)); add(new JScrollPane(searchTbl), cc.xy(2, 10)); }
From source file:ca.phon.csv2phon.wizard.DirectoryStep.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); header = new DialogHeader("CSV Import", "Select folder containing csv files."); add(header, BorderLayout.NORTH); JPanel centerPanel = new JPanel(); centerPanel.setBorder(BorderFactory.createTitledBorder("Folder")); FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow, pref", "pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref"); CellConstraints cc = new CellConstraints(); centerPanel.setLayout(layout);// w ww . j a va 2s .com String lblTxt = "<html><body><p>Please select the folder containing the csv files for import." + " <font color='red'>All csv files should have the same column structure and encoding</font>.</p></body></html>"; infoLbl = new JLabel(lblTxt); centerPanel.add(infoLbl, cc.xyw(1, 1, 3)); csvDirField = new FileSelectionField(); csvDirField.setMode(SelectionMode.FOLDERS); csvDirField.getTextField().setEditable(false); // setup charset chooser SortedMap<String, Charset> availableCharset = Charset.availableCharsets(); charsetBox = new JComboBox(availableCharset.keySet().toArray(new String[0])); charsetBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { charsetName = charsetBox.getSelectedItem().toString(); } } }); charsetBox.setSelectedItem("UTF-8"); textDelimField = new JTextField(); textDelimField.setDocument(new SingleCharDocument()); textDelimField.setText(textDelim + ""); fieldDelimField = new JTextField(); fieldDelimField.setDocument(new SingleCharDocument()); fieldDelimField.setText(fieldDelim + ""); centerPanel.add(new JLabel("Folder:"), cc.xy(1, 3)); centerPanel.add(csvDirField, cc.xyw(3, 3, 2)); centerPanel.add(new JLabel("File encoding:"), cc.xy(1, 5)); centerPanel.add(charsetBox, cc.xy(3, 5)); centerPanel.add(new JLabel("Field delimiter:"), cc.xy(1, 7)); centerPanel.add(fieldDelimField, cc.xy(3, 7)); centerPanel.add(new JLabel("Text delimiter:"), cc.xy(1, 9)); centerPanel.add(textDelimField, cc.xy(3, 9)); add(centerPanel, BorderLayout.CENTER); }
From source file:ca.phon.media.exportwizard.ExportSetupStep.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); header = new DialogHeader("Export media", "Export media segment using ffmpeg"); add(header, BorderLayout.NORTH); // setup top panel FormLayout topLayout = new FormLayout("left:100px, 3dlu, fill:pref:grow, pref", "pref, pref, pref, pref"); CellConstraints cc = new CellConstraints(); JPanel topPanel = new JPanel(topLayout); topPanel.add(new JLabel("Input file:"), cc.xy(1, 1)); topPanel.add(getInputFileLabel(), cc.xy(3, 1)); topPanel.add(getInputBrowseButton(), cc.xy(4, 1)); topPanel.add(new JLabel("Output file:"), cc.xy(1, 2)); topPanel.add(getOutputFileLabel(), cc.xy(3, 2)); topPanel.add(getOutputBrowseButton(), cc.xy(4, 2)); topPanel.add(getPartialExtractBox(), cc.xyw(1, 3, 3)); // topPanel.add(getExtractRecordsButton(), cc.xy(1, 4)); // topPanel.add(getRecordsField(), cc.xy(3, 4)); topPanel.add(new JLabel("Segment"), cc.xy(1, 4)); topPanel.add(getSegmentField(), cc.xy(3, 4)); // setup bottom panel FormLayout btmLayout = new FormLayout("left:100px, 3dlu, fill:pref:grow", "pref, pref, pref, pref, pref, fill:pref:grow"); JPanel btmPanel = new JPanel(btmLayout); btmPanel.setBorder(BorderFactory.createTitledBorder("Advanced options")); btmPanel.add(getEncodeVideoBox(), cc.xyw(1, 1, 3)); btmPanel.add(new JLabel("Video codec:"), cc.xy(1, 2)); btmPanel.add(getVideoCodecField(), cc.xy(3, 2)); btmPanel.add(getEncodeAudioBox(), cc.xyw(1, 3, 3)); btmPanel.add(new JLabel("Audio codec:"), cc.xy(1, 4)); btmPanel.add(getAudioCodecField(), cc.xy(3, 4)); btmPanel.add(new JLabel("Other arguments:"), cc.xy(1, 5)); btmPanel.add(getOtherArgsField(), cc.xyw(1, 6, 3)); JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BorderLayout()); centerPanel.add(topPanel, BorderLayout.NORTH); centerPanel.add(btmPanel, BorderLayout.CENTER); add(centerPanel, BorderLayout.CENTER); // setup actions ImageIcon brwseIcn = IconManager.getInstance().getIcon("actions/document-open", IconSize.SMALL); PhonUIAction browseForInputAct = new PhonUIAction(this, "onBrowseForInput"); browseForInputAct.putValue(Action.SMALL_ICON, brwseIcn); browseForInputAct.putValue(Action.SHORT_DESCRIPTION, "Browse for media..."); PhonUIAction showSaveDialogAct = new PhonUIAction(this, "onShowSaveDialog"); showSaveDialogAct.putValue(Action.SMALL_ICON, brwseIcn); showSaveDialogAct.putValue(Action.SHORT_DESCRIPTION, "Save media as..."); PhonUIAction togglePartialExtractAct = new PhonUIAction(this, "onTogglePartialExtract"); togglePartialExtractAct.putValue(Action.NAME, "Extract segment"); PhonUIAction toggleIncludeVideoAct = new PhonUIAction(this, "onToggleIncludeVideo"); toggleIncludeVideoAct.putValue(Action.NAME, "Include video"); PhonUIAction toggleIncludeAudioAct = new PhonUIAction(this, "onToggleIncludeAudio"); toggleIncludeAudioAct.putValue(Action.NAME, "Include audio"); PhonUIAction onRecordSelectionSwitch = new PhonUIAction(this, "onPartialExtractRecord"); onRecordSelectionSwitch.putValue(Action.NAME, "Record(s)"); PhonUIAction onTimeSelectionSwitch = new PhonUIAction(this, "onPartialExtractTime"); onTimeSelectionSwitch.putValue(Action.NAME, "Segment"); getInputBrowseButton().setAction(browseForInputAct); getOutputBrowseButton().setAction(showSaveDialogAct); getPartialExtractBox().setAction(togglePartialExtractAct); // getExtractRecordsButton().setAction(onRecordSelectionSwitch); // getExtractTimeButton().setAction(onTimeSelectionSwitch); getEncodeVideoBox().setAction(toggleIncludeVideoAct); getEncodeAudioBox().setAction(toggleIncludeAudioAct); // ButtonGroup btnGrp = new ButtonGroup(); // btnGrp.add(getExtractRecordsButton()); // btnGrp.add(getExtractTimeButton()); // check to see if we have a session // if(props.get(MediaExportWizardProp.SESSION) == null) { // // disable the record extraction selection // getExtractRecordsButton().setEnabled(false); // getRecordsField().setEnabled(false); ///* w w w. j a v a 2 s . c o m*/ // getExtractTimeButton().setSelected(true); // } // set values based on wizard props if (props.get(MediaExportWizardProp.INPUT_FILE) != null) { String inputFile = (String) props.get(MediaExportWizardProp.INPUT_FILE); getInputFileLabel().setFile(new File(inputFile)); } if (props.get(MediaExportWizardProp.OUTPUT_FILE) != null) { String outputFile = (String) props.get(MediaExportWizardProp.OUTPUT_FILE); getOutputFileLabel().setFile(new File(outputFile)); } boolean isAllowPartialExtract = true; if (props.get(MediaExportWizardProp.ALLOW_PARTIAL_EXTRACT) != null) { isAllowPartialExtract = (Boolean) props.get(MediaExportWizardProp.ALLOW_PARTIAL_EXTRACT); } if (!isAllowPartialExtract) { // disable segment extraction components getPartialExtractBox().setSelected(false); getPartialExtractBox().setEnabled(false); } else { boolean isPartialExtract = false; if (props.get(MediaExportWizardProp.IS_PARTICAL_EXTRACT) != null) { isPartialExtract = (Boolean) props.get(MediaExportWizardProp.IS_PARTICAL_EXTRACT); } if (isPartialExtract) { getPartialExtractBox().setSelected(true); getSegmentField().setEnabled(true); } else { getPartialExtractBox().setSelected(false); getSegmentField().setEnabled(false); } if (props.get(MediaExportWizardProp.PARTIAL_EXTRACT_SEGMENT_START) != null && props.get(MediaExportWizardProp.PARTIAL_EXTRACT_SEGMENT_DURATION) != null) { long startTime = (Long) props.get(MediaExportWizardProp.PARTIAL_EXTRACT_SEGMENT_START); long duration = (Long) props.get(MediaExportWizardProp.PARTIAL_EXTRACT_SEGMENT_DURATION); String timeStr = MsFormatter.msToDisplayString(startTime) + "-" + MsFormatter.msToDisplayString(startTime + duration); getSegmentField().setText(timeStr); } } boolean encodeVideo = true; if (props.get(MediaExportWizardProp.ENCODE_VIDEO) != null) { encodeVideo = (Boolean) props.get(MediaExportWizardProp.ENCODE_VIDEO); } getEncodeVideoBox().setSelected(encodeVideo); getVideoCodecField().setEnabled(encodeVideo); String videoCodec = "copy"; if (props.get(MediaExportWizardProp.VIDEO_CODEC) != null) { videoCodec = (String) props.get(MediaExportWizardProp.VIDEO_CODEC); } getVideoCodecField().setText(videoCodec); boolean encodeAudio = true; if (props.get(MediaExportWizardProp.ENCODE_AUDIO) != null) { encodeAudio = (Boolean) props.get(MediaExportWizardProp.ENCODE_AUDIO); } getEncodeAudioBox().setSelected(encodeAudio); getAudioCodecField().setEnabled(encodeAudio); String audioCodec = "copy"; if (props.get(MediaExportWizardProp.AUDIO_CODEC) != null) { audioCodec = (String) props.get(MediaExportWizardProp.AUDIO_CODEC); } getAudioCodecField().setText(audioCodec); if (props.get(MediaExportWizardProp.OTHER_ARGS) != null) { String otherArgs = (String) props.get(MediaExportWizardProp.OTHER_ARGS); getOtherArgsField().setText(otherArgs); } }
From source file:ca.phon.phon2csv.sessionwizard.SelectRecordsStep.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); header = new DialogHeader("CSV Export", "Select records and location for export."); add(header, BorderLayout.NORTH); JPanel centerPanel = new JPanel(new BorderLayout()); JPanel dirPanel = new JPanel(); FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow, pref", "pref, 3dlu, pref"); CellConstraints cc = new CellConstraints(); dirPanel.setLayout(layout);// ww w . j a va 2s. c om dirPanel.setBorder(BorderFactory.createTitledBorder("Location")); dirPanel.add(new JLabel("Save as:"), cc.xy(1, 1)); saveLocationField = new FileSelectionField(); saveLocationField.setMode(SelectionMode.FILES); saveLocationField.getTextField().setEditable(false); saveLocationField.setFileFilter(FileFilter.csvFilter); saveLocationField.setFile(new File(getDefaultSaveLocation())); dirPanel.add(saveLocationField, cc.xyw(3, 1, 2)); centerPanel.add(dirPanel, BorderLayout.NORTH); // filter panel uttFilterPanel = new RecordFilterPanel(project, transcript); uttFilterPanel.setBorder(BorderFactory.createTitledBorder("Records")); centerPanel.add(uttFilterPanel, BorderLayout.CENTER); add(centerPanel, BorderLayout.CENTER); }
From source file:ca.phon.phon2csv.wizard.CSVDirectoryStep.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); header = new DialogHeader("CSV Export", "Select destination folder."); add(header, BorderLayout.NORTH); JPanel centerPanel = new JPanel(new BorderLayout()); JPanel dirPanel = new JPanel(); FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow, pref", "pref, 3dlu, pref"); CellConstraints cc = new CellConstraints(); dirPanel.setLayout(layout);//from www . ja v a 2s . c o m dirPanel.setBorder(BorderFactory.createTitledBorder("Folder")); String lblTxt = "<html><body><p>" + "Select folder for exported csv files." + "</p></body></html>"; infoLbl = new JLabel(lblTxt); dirPanel.add(infoLbl, cc.xyw(1, 1, 4)); dirPanel.add(new JLabel("Destination folder:"), cc.xy(1, 3)); csvDirField = new FileSelectionField(); csvDirField.setMode(SelectionMode.FOLDERS); csvDirField.getTextField().setEditable(false); dirPanel.add(csvDirField, cc.xyw(3, 3, 2)); centerPanel.add(dirPanel, BorderLayout.NORTH); // session selection JPanel sessionPanel = new JPanel(new BorderLayout()); sessionPanel.setBorder(BorderFactory.createTitledBorder("Sessions")); sessionSelector = new SessionSelector(CommonModuleFrame.getCurrentFrame().getExtension(Project.class)); sessionPanel.add(new JScrollPane(sessionSelector), BorderLayout.CENTER); centerPanel.add(sessionPanel, BorderLayout.CENTER); add(centerPanel, BorderLayout.CENTER); }
From source file:ca.phon.script.params.ui.ParamPanelFactory.java
License:Open Source License
private JPanel createComponentPanel(JLabel label, JComponent comp) { String cols = "20px, fill:pref:grow"; String rows = "pref, pref"; FormLayout layout = new FormLayout(cols, rows); JPanel compPanel = new JPanel(layout); CellConstraints cc = new CellConstraints(); compPanel.add(label, cc.xyw(1, 1, 2)); compPanel.add(comp, cc.xy(2, 2));//from www . j ava 2 s . c om return compPanel; }
From source file:ca.sqlpower.architect.swingui.action.ProgressAction.java
License:Open Source License
/** * Setup the dialog, monitors and worker. Classes that extend this class * should use doStuff() and cleanUp()/*from ww w.j ava2 s . c o m*/ */ public void actionPerformed(ActionEvent e) { final JDialog progressDialog; final Map<String, Object> properties = new HashMap<String, Object>(); progressDialog = new JDialog(frame, Messages.getString("ProgressAction.name"), false); //$NON-NLS-1$ progressDialog.setLocationRelativeTo(frame); progressDialog.setTitle(getDialogMessage()); PanelBuilder pb = new PanelBuilder( new FormLayout("4dlu,fill:min(100dlu;default):grow, pref, fill:min(100dlu;default):grow,4dlu", //$NON-NLS-1$ "4dlu,pref,4dlu, pref, 6dlu, pref,4dlu")); //$NON-NLS-1$ JLabel label = new JLabel(getDialogMessage()); JProgressBar progressBar = new JProgressBar(); final MonitorableImpl monitor = new MonitorableImpl(); if (!setup(monitor, properties)) { // if setup indicates not to continue (returns false), then exit method return; } CellConstraints c = new CellConstraints(); pb.add(label, c.xyw(2, 2, 3)); pb.add(progressBar, c.xyw(2, 4, 3)); pb.add(new JButton(new AbstractAction(getButtonText()) { public void actionPerformed(ActionEvent e) { progressDialog.dispose(); monitor.setCancelled(true); } }), c.xy(3, 6)); progressDialog.add(pb.getPanel()); SPSwingWorker worker = new SPSwingWorker(getSession()) { @Override public void cleanup() throws Exception { if (getDoStuffException() != null) { ASUtils.showExceptionDialog(getSession(), Messages.getString("ProgressAction.unexpectedException"), getDoStuffException()); //$NON-NLS-1$ } ProgressAction.this.cleanUp(monitor); monitor.setFinished(true); progressDialog.dispose(); } @Override public void doStuff() throws Exception { ProgressAction.this.doStuff(monitor, properties); } }; ProgressWatcher.watchProgress(progressBar, monitor); progressDialog.pack(); progressDialog.setVisible(true); new Thread(worker).start(); }