Example usage for com.jgoodies.forms.layout CellConstraints xy

List of usage examples for com.jgoodies.forms.layout CellConstraints xy

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints xy.

Prototype

public CellConstraints xy(int col, int row) 

Source Link

Document

Sets column and row origins; sets width and height to 1; uses the default alignments.

Examples:

 cc.xy(1, 1); cc.xy(1, 3); 

Usage

From source file:ca.phon.app.session.editor.view.ipa_validation.AutoValidateDialog.java

License:Open Source License

private void init() {
    header = new DialogHeader("Auto-validate Session", "Fill IPA tiers for the session.");

    FormLayout tierLayout = new FormLayout("fill:pref:grow", "pref, pref, pref");
    CellConstraints cc = new CellConstraints();

    JPanel tierPanel = new JPanel(tierLayout);

    validateTargetBox = new JCheckBox("Auto-validate IPA Target");
    validateTargetBox.setSelected(true);

    validateActualBox = new JCheckBox("Auto-validate IPA Actual");
    validateActualBox.setSelected(true);

    overwriteDataBox = new JCheckBox("Overwrite existing data");
    overwriteDataBox.setSelected(false);

    tierPanel.add(validateTargetBox, cc.xy(1, 1));
    tierPanel.add(validateActualBox, cc.xy(1, 2));
    tierPanel.add(overwriteDataBox, cc.xy(1, 3));
    tierPanel.setBorder(BorderFactory.createTitledBorder("Tiers"));

    FormLayout trLayout = new FormLayout("fill:pref:grow", "pref, pref, pref");
    JPanel trPanel = new JPanel(trLayout);

    trGroup = new JXRadioGroup<String>();
    trGroup.setLayoutAxis(BoxLayout.Y_AXIS);

    List<String> trNames = new ArrayList<String>();
    for (Transcriber tr : session.getTranscribers()) {
        trNames.add(getTrDisplayString(tr));
    }//from  ww w .j a va  2 s  . c  o  m

    //      ITranscriber[] trs = session.getTranscribers().toArray(new ITranscriber[0]);
    trGroup.setValues(trNames.toArray(new String[0]));
    if (trNames.size() > 0)
        trGroup.setSelectedValue(trNames.get(0));

    trPanel.add(new JLabel("If only one IPA transcript exists it is selected."), cc.xy(1, 1));
    trPanel.add(new JLabel("If more than one IPA transcript exists, choose IPA for transcriber:"), cc.xy(1, 2));
    trPanel.add(trGroup, cc.xy(1, 3));

    trPanel.setBorder(BorderFactory.createTitledBorder("IPA Selection"));

    recordFilterPanel = new RecordFilterPanel(project, session);
    recordFilterPanel.setBorder(BorderFactory.createTitledBorder("Record Selection"));
    FormLayout centerLayout = new FormLayout("fill:pref:grow", "pref, pref, pref");
    JPanel centerPanel = new JPanel(centerLayout);

    centerPanel.add(tierPanel, cc.xy(1, 1));
    centerPanel.add(trPanel, cc.xy(1, 2));
    centerPanel.add(recordFilterPanel, cc.xy(1, 3));

    // button bar
    PhonUIAction okAction = new PhonUIAction(this, "onOk");
    okAction.putValue(Action.NAME, "Ok");
    okAction.putValue(Action.SHORT_DESCRIPTION, "Perform auto-validation and close dialog");

    okButton = new JButton(okAction);

    PhonUIAction cancelAction = new PhonUIAction(this, "onCancel");
    cancelAction.putValue(Action.NAME, "Cancel");
    cancelAction.putValue(Action.SHORT_DESCRIPTION, "Cancel auto-validation and close dialog");

    cancelButton = new JButton(cancelAction);

    final JComponent buttonBar = ButtonBarBuilder.buildOkCancelBar(okButton, cancelButton);

    setLayout(new BorderLayout());
    add(header, BorderLayout.NORTH);
    add(centerPanel, BorderLayout.CENTER);
    add(buttonBar, BorderLayout.SOUTH);

    getRootPane().setDefaultButton(okButton);
}

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);/*  www. ja  v  a2  s  .c o  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.record_data.RecordDataEditorView.java

License:Open Source License

private void init() {
    setLayout(new BorderLayout());

    setBackground(Color.white);/*from   ww  w  .j  a v  a  2s  .co  m*/

    contentPane = new TierDataLayoutPanel();
    contentPane.setBackground(Color.white);

    final JScrollPane scroller = new JScrollPane(contentPane);
    scroller.setBackground(Color.white);
    add(scroller, BorderLayout.CENTER);

    final JPanel panel = getTopPanel();
    add(panel, BorderLayout.NORTH);

    final FormLayout statusLayout = new FormLayout("pref, pref, fill:pref:grow, "
            + "right:pref, right:pref, right:pref, right:pref, right:pref, right:pref", "pref");
    final CellConstraints cc = new CellConstraints();
    statusPanel = new JPanel(statusLayout);

    final Font font = Font.decode("monospace-PLAIN-10");
    final JLabel idLbl = new JLabel("Id: ");
    idLbl.setFont(font);

    recordIdLbl = new JLabel();
    recordIdLbl.setFont(font);

    statusPanel.add(idLbl, cc.xy(1, 1));
    statusPanel.add(recordIdLbl, cc.xy(2, 1));

    final JLabel tierLbl = new JLabel("Tier: ");
    tierLbl.setFont(font);

    currentTierLbl = new JLabel();
    currentTierLbl.setFont(font);

    statusPanel.add(tierLbl, cc.xy(4, 1));
    statusPanel.add(currentTierLbl, cc.xy(5, 1));

    final JLabel grpLbl = new JLabel(" Group: ");
    grpLbl.setFont(font);

    currentGroupLbl = new JLabel();
    currentGroupLbl.setFont(font);

    statusPanel.add(grpLbl, cc.xy(6, 1));
    statusPanel.add(currentGroupLbl, cc.xy(7, 1));

    final JLabel charLbl = new JLabel(" Character: ");
    charLbl.setFont(font);

    currentCharLbl = new JLabel();
    currentCharLbl.setFont(font);

    statusPanel.add(charLbl, cc.xy(8, 1));
    statusPanel.add(currentCharLbl, cc.xy(9, 1));

    add(statusPanel, BorderLayout.SOUTH);

    update();
    updateStatus();
    setupEditorActions();
    getEditor().getSelectionModel().addSelectionModelListener(selectionListener);
}

From source file:ca.phon.app.session.editor.view.record_data.RecordDataEditorView.java

License:Open Source License

private JPanel getTopPanel() {
    if (topPanel == null) {
        final TierDataLayout tdl = (TierDataLayout) contentPane.getLayout();
        final TierDataLayoutButtons layoutButtons = new TierDataLayoutButtons(contentPane, tdl);

        final SessionEditor editor = getEditor();
        final Session session = editor.getSession();

        final FormLayout layout = new FormLayout(
                "pref, pref, 3dlu, pref, fill:pref:grow(0.5), 5dlu, pref, fill:pref:grow, right:pref, 5dlu, right:pref",
                "pref");
        topPanel = new JPanel(layout);

        final JLabel recNumLbl = new JLabel("<html><u>#</u></html>");
        recNumLbl.setForeground(Color.blue);
        recNumLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        recNumLbl.setToolTipText("Click to edit record position (i.e., move record)");
        recNumLbl.addMouseListener(new MouseInputAdapter() {

            @Override//w ww . j a  v a2 s  .  co m
            public void mouseClicked(MouseEvent e) {
                recNumField.setEnabled(true);
                recNumField.requestFocus();
            }

        });

        recNumField = new RecordNumberField(1, getEditor().getSession().getRecordCount());
        recNumField.setColumns(3);
        recNumField.setText("" + (getEditor().getCurrentRecordIndex() + 1));
        final PhonUIAction moveRecordAct = new PhonUIAction(this, "moveRecord");
        moveRecordAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Edit to set this record's position in session");
        recNumField.setAction(moveRecordAct);
        recNumField.addFocusListener(new FocusListener() {

            int initialNum = 0;

            @Override
            public void focusLost(FocusEvent e) {
                if (recNumField.getText().length() == 0) {
                    recNumField.setText((getEditor().getCurrentRecordIndex() + 1) + "");
                } else {
                    final Integer newNum = Integer.parseInt(recNumField.getText()) - 1;
                    if (newNum != initialNum && newNum != getEditor().getCurrentRecordIndex())
                        moveRecord();
                }
                recNumField.setEnabled(false);
            }

            @Override
            public void focusGained(FocusEvent e) {
                initialNum = getEditor().getCurrentRecordIndex();
            }

        });
        recNumField.setEnabled(false);

        final CellConstraints cc = new CellConstraints();
        int rowIdx = 1;
        int colIdx = 1;

        topPanel.add(recNumLbl, cc.xy(colIdx++, rowIdx));
        topPanel.add(recNumField, cc.xy(colIdx++, rowIdx));
        colIdx++; // 3dlu spacer

        final DefaultComboBoxModel speakerBoxModel = new DefaultComboBoxModel();
        speakerBoxModel.addElement(null);
        for (Participant participant : session.getParticipants()) {
            speakerBoxModel.addElement(participant);
        }
        speakerBox = new JComboBox(speakerBoxModel);
        speakerBox.setRenderer(speakerRenderer);
        speakerBox.addItemListener(speakerListener);

        final PhonUIAction excludeAct = new PhonUIAction(this, "onExclude");
        excludeAct.putValue(PhonUIAction.NAME, excludeFromSearchesText);
        excludeFromSearchesBox = new JCheckBox(excludeAct);

        topPanel.add(new JLabel("Speaker: "), cc.xy(colIdx++, rowIdx));
        topPanel.add(speakerBox, cc.xy(colIdx++, rowIdx));
        colIdx++; // spacer

        topPanel.add(excludeFromSearchesBox, cc.xy(colIdx++, rowIdx));
        colIdx++; // filler

        // create group management buttons
        final JPanel btnPanel = new JPanel(new HorizontalLayout());

        final NewGroupCommand newGroupAct = new NewGroupCommand(this);
        newGroupAct.putValue(NewGroupCommand.SHORT_DESCRIPTION, newGroupAct.getValue(NewGroupCommand.NAME));
        newGroupAct.putValue(NewGroupCommand.NAME, null);
        final JButton newGroupBtn = new JButton(newGroupAct);
        newGroupBtn.setFocusable(false);
        btnPanel.add(newGroupBtn);

        final MergeGroupCommand mergeGroupAct = new MergeGroupCommand(this);
        mergeGroupAct.putValue(MergeGroupCommand.SHORT_DESCRIPTION,
                mergeGroupAct.getValue(MergeGroupCommand.NAME));
        mergeGroupAct.putValue(MergeGroupCommand.NAME, null);
        final JButton mergeGroupBtn = new JButton(mergeGroupAct);
        mergeGroupBtn.setFocusable(false);
        btnPanel.add(mergeGroupBtn);

        final SplitGroupCommand splitGroupAct = new SplitGroupCommand(this);
        splitGroupAct.putValue(SplitGroupCommand.SHORT_DESCRIPTION,
                splitGroupAct.getValue(SplitGroupCommand.NAME));
        splitGroupAct.putValue(SplitGroupCommand.NAME, null);
        final JButton splitGroupBtn = new JButton(splitGroupAct);
        splitGroupBtn.setFocusable(false);
        btnPanel.add(splitGroupBtn);

        /*
         * XXX removed in Phon 2.2
         */
        /*
        final DeleteGroupCommand delGroupAct = new DeleteGroupCommand(this);
        delGroupAct.putValue(DeleteGroupCommand.SHORT_DESCRIPTION, delGroupAct.getValue(DeleteGroupCommand.NAME));
        delGroupAct.putValue(DeleteGroupCommand.NAME, null);
        final JButton delGroupBtn = new JButton(delGroupAct);
        delGroupBtn.setFocusable(false);
        btnPanel.add(delGroupBtn);
        */

        topPanel.add(btnPanel, cc.xy(colIdx++, rowIdx));
        colIdx++; // spacer

        topPanel.add(layoutButtons, cc.xy(colIdx++, rowIdx));
    }

    return topPanel;
}

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 a  2s  . co  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.editor.view.segmentation.SegmentationEditorView.java

License:Open Source License

private void updateParticipantPanel() {
    participantPanel.removeAll();/*from   w ww . jav a2  s  .co m*/

    // setup layout
    String colLayout = "fill:default";
    String rowLayout = "pref, 5px";
    for (int i = 0; i <= getEditor().getSession().getParticipantCount(); i++) {
        rowLayout += ", pref, 5px";
    }
    FormLayout layout = new FormLayout(colLayout, rowLayout);
    participantPanel.setLayout(layout);
    CellConstraints cc = new CellConstraints();
    int currentRow = 1;

    String ksStr = (OSInfo.isMacOs() ? "\u2318" : "CTRL +") + "0";
    PhonUIAction noPartSegmentAct = new PhonUIAction(this, "performSegmentation", null);
    noPartSegmentAct.putValue(Action.NAME, ksStr + " speaker undefined");

    // setup labels to be used like buttons
    String segMsg = "Click name to create a new record:";
    JLabel segLbl = new JLabel(segMsg);

    participantPanel.add(segLbl, cc.xy(1, currentRow));
    currentRow += 2;

    JLabel noPartLbl = new JLabel();
    String noPartMsg = ksStr + " <no speaker>";
    noPartLbl.setText(noPartMsg);
    noPartLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    noPartLbl.addMouseListener(new SegmentLabelMouseHandler());
    noPartLbl.setOpaque(false);
    participantPanel.add(noPartLbl, cc.xy(1, currentRow));
    currentRow += 2;

    final Session session = getEditor().getSession();
    int pIdx = 1;
    for (Participant p : session.getParticipants()) {
        ksStr = (OSInfo.isMacOs() ? "\u2318" : "CTRL +") + pIdx;

        final NewSegmentAction segmentAction = new NewSegmentAction(getEditor(), this, p);
        segmentAction.putValue(Action.NAME, ksStr + " " + p.toString());

        JLabel participantLbl = new JLabel();
        String participantStr = ksStr + " " + (p.getName() != null ? p.getName() : p.getId());
        participantLbl.setText(participantStr);
        participantLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        participantLbl.addMouseListener(new SegmentLabelMouseHandler(p));
        participantLbl.setOpaque(false);
        participantPanel.add(participantLbl, cc.xy(1, currentRow));
        currentRow += 2;

        pIdx++;
    }
}

From source file:ca.phon.app.session.editor.view.session_information.SessionInfoEditorView.java

License:Open Source License

private void init() {
    setLayout(new BorderLayout());

    contentPanel = new TierDataLayoutPanel();

    dateField = createDateField();/*from  w w  w.j  a  v a  2  s .  c  o m*/
    dateField.getTextField().setColumns(10);
    dateField.setBackground(Color.white);

    mediaLocationField = new MediaSelectionField(getEditor().getProject());
    mediaLocationField.setEditor(getEditor());
    mediaLocationField.getTextField().setColumns(10);
    mediaLocationField.addPropertyChangeListener(FileSelectionField.FILE_PROP, mediaLocationListener);

    participantTable = new JXTable();
    participantTable.setVisibleRowCount(3);

    ComponentInputMap participantTableInputMap = new ComponentInputMap(participantTable);
    ActionMap participantTableActionMap = new ActionMap();

    ImageIcon deleteIcon = IconManager.getInstance().getIcon("actions/delete_user", IconSize.SMALL);
    final PhonUIAction deleteAction = new PhonUIAction(this, "deleteParticipant");
    deleteAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Delete selected participant");
    deleteAction.putValue(PhonUIAction.SMALL_ICON, deleteIcon);
    participantTableActionMap.put("DELETE_PARTICIPANT", deleteAction);
    participantTableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "DELETE_PARTICIPANT");
    participantTableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "DELETE_PARTICIPANT");

    removeParticipantButton = new JButton(deleteAction);

    participantTable.setInputMap(WHEN_FOCUSED, participantTableInputMap);
    participantTable.setActionMap(participantTableActionMap);

    addParticipantButton = new JButton(new NewParticipantAction(getEditor(), this));
    addParticipantButton.setFocusable(false);

    ImageIcon editIcon = IconManager.getInstance().getIcon("actions/edit_user", IconSize.SMALL);
    final PhonUIAction editParticipantAct = new PhonUIAction(this, "editParticipant");
    editParticipantAct.putValue(PhonUIAction.NAME, "Edit participant...");
    editParticipantAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Edit selected participant...");
    editParticipantAct.putValue(PhonUIAction.SMALL_ICON, editIcon);
    editParticipantButton = new JButton(editParticipantAct);
    editParticipantButton.setFocusable(false);

    final CellConstraints cc = new CellConstraints();
    FormLayout participantLayout = new FormLayout("fill:pref:grow, pref, pref, pref", "pref, pref, pref:grow");
    JPanel participantPanel = new JPanel(participantLayout);
    participantPanel.setBackground(Color.white);
    participantPanel.add(new JScrollPane(participantTable), cc.xywh(1, 2, 3, 2));
    participantPanel.add(addParticipantButton, cc.xy(2, 1));
    participantPanel.add(editParticipantButton, cc.xy(3, 1));
    participantPanel.add(removeParticipantButton, cc.xy(4, 2));
    participantTable.addMouseListener(new MouseInputAdapter() {

        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getClickCount() == 2 && arg0.getButton() == MouseEvent.BUTTON1) {
                editParticipantAct.actionPerformed(new ActionEvent(arg0.getSource(), arg0.getID(), "edit"));
            }
        }

    });

    languageField = new LanguageField();
    languageField.getDocument().addDocumentListener(languageFieldListener);

    int rowIdx = 0;
    final JLabel dateLbl = new JLabel("Session Date");
    dateLbl.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(dateLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx));
    contentPanel.add(dateField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++));

    final JLabel mediaLbl = new JLabel("Media");
    mediaLbl.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(mediaLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx));
    contentPanel.add(mediaLocationField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++));

    final JLabel partLbl = new JLabel("Participants");
    partLbl.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(partLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx));
    contentPanel.add(participantPanel, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++));

    final JLabel langLbl = new JLabel("Language");
    langLbl.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(langLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx));
    contentPanel.add(languageField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++));

    add(new JScrollPane(contentPanel), BorderLayout.CENTER);

    update();
}

From source file:ca.phon.app.session.editor.view.syllabification_and_alignment.SyllabificationAlignmentEditorView.java

License:Open Source License

private void init() {
    // tier content
    contentPane = new TierDataLayoutPanel();

    // top panel//from w  w  w  .  j a v a 2 s . c  o m
    final FormLayout topLayout = new FormLayout("pref, pref, pref, pref, pref, fill:pref:grow, right:pref",
            "pref");
    topPanel = new JPanel(topLayout);

    final SyllabificationSettingsCommand settingsAct = new SyllabificationSettingsCommand(getEditor(), this);
    settingsBtn = new JButton(settingsAct);

    final PhonUIAction toggleTargetAct = new PhonUIAction(this, "toggleCheckbox");
    toggleTargetAct.putValue(PhonUIAction.NAME, SystemTierType.TargetSyllables.getName());
    toggleTargetAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Toggle target syllables");
    toggleTargetAct.putValue(PhonUIAction.SELECTED_KEY, Boolean.TRUE);
    targetIPABox = new JCheckBox(toggleTargetAct);

    final PhonUIAction toggleActualAct = new PhonUIAction(this, "toggleCheckbox");
    toggleActualAct.putValue(PhonUIAction.NAME, SystemTierType.ActualSyllables.getName());
    toggleActualAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Toggle actual syllables");
    toggleActualAct.putValue(PhonUIAction.SELECTED_KEY, Boolean.TRUE);
    actualIPABox = new JCheckBox(toggleActualAct);

    final PhonUIAction toggleAlignmentAct = new PhonUIAction(this, "toggleCheckbox");
    toggleAlignmentAct.putValue(PhonUIAction.NAME, SystemTierType.SyllableAlignment.getName());
    toggleAlignmentAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Toggle alignment");
    toggleAlignmentAct.putValue(PhonUIAction.SELECTED_KEY, Boolean.TRUE);
    alignmentBox = new JCheckBox(toggleAlignmentAct);

    final PhonUIAction toggleAlignmentColorAct = new PhonUIAction(this, "toggleCheckbox");
    toggleAlignmentColorAct.putValue(PhonUIAction.NAME, "Color in alignment");
    toggleAlignmentColorAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Toggle color in alignment");
    toggleAlignmentColorAct.putValue(PhonUIAction.SELECTED_KEY, Boolean.FALSE);
    colorInAlignmentBox = new JCheckBox(toggleAlignmentColorAct);

    final TierDataLayoutButtons tdlb = new TierDataLayoutButtons(contentPane,
            (TierDataLayout) contentPane.getLayout());

    final CellConstraints cc = new CellConstraints();
    topPanel.add(settingsBtn, cc.xy(1, 1));
    topPanel.add(targetIPABox, cc.xy(2, 1));
    topPanel.add(actualIPABox, cc.xy(3, 1));
    topPanel.add(alignmentBox, cc.xy(4, 1));
    topPanel.add(colorInAlignmentBox, cc.xy(5, 1));
    topPanel.add(tdlb, cc.xy(7, 1));

    setLayout(new BorderLayout());
    scroller = new JScrollPane(contentPane);
    scroller.setBackground(Color.white);
    scroller.setOpaque(true);
    add(topPanel, BorderLayout.NORTH);
    add(scroller, BorderLayout.CENTER);

    update();
}

From source file:ca.phon.app.session.editor.view.syllabification_and_alignment.SyllabificationSettingsPanel.java

License:Open Source License

private void init() {
    final FormLayout layout = new FormLayout("right:pref, fill:pref:grow", "5dlu, pref, 3dlu, pref, 5dlu");
    setLayout(layout);/*w w w .  j  a v  a  2s. com*/
    final CellConstraints cc = new CellConstraints();

    final SyllabifierLibrary library = SyllabifierLibrary.getInstance();
    final Iterator<Syllabifier> syllabifiers = library.availableSyllabifiers();
    final List<Syllabifier> syllabifierList = new ArrayList<Syllabifier>();
    while (syllabifiers.hasNext())
        syllabifierList.add(syllabifiers.next());
    Collections.sort(syllabifierList, new SyllabifierComparator());

    this.targetSyllabifierBox = new JComboBox(syllabifierList.toArray(new Syllabifier[0]));
    final Syllabifier selectedSyllabifier = library.getSyllabifierForLanguage(
            syllabifierInfo.getSyllabifierLanguageForTier(SystemTierType.IPATarget.getName()));
    this.targetSyllabifierBox.setSelectedItem(selectedSyllabifier);
    this.targetSyllabifierBox.setRenderer(new SyllabifierCellRenderer());

    this.actualSyllabifierBox = new JComboBox(syllabifierList.toArray(new Syllabifier[0]));
    this.actualSyllabifierBox.setSelectedItem(library.getSyllabifierForLanguage(
            syllabifierInfo.getSyllabifierLanguageForTier(SystemTierType.IPAActual.getName())));
    this.actualSyllabifierBox.setRenderer(new SyllabifierCellRenderer());

    add(new JLabel("Target syllabifier:"), cc.xy(1, 2));
    add(targetSyllabifierBox, cc.xy(2, 2));

    add(new JLabel("Actual syllabifier:"), cc.xy(1, 4));
    add(actualSyllabifierBox, cc.xy(2, 4));
}

From source file:ca.phon.app.session.editor.view.tier_management.TierInfoEditor.java

License:Open Source License

private void init() {
    FormLayout layout = new FormLayout("5dlu, pref, 3dlu, fill:pref:grow, 5dlu",
            "pref, 3dlu, pref, 3dlu, pref, pref");
    CellConstraints cc = new CellConstraints();

    setLayout(layout);/*from w  w  w . j av  a  2 s.  c  o  m*/

    add(new JLabel("Tier Name"), cc.xy(2, 1));
    nameField = new JTextField();
    add(nameField, cc.xy(4, 1));

    groupBox = new JCheckBox("Grouped (word-aligned)");
    groupBox.setEnabled(!editMode);
    add(groupBox, cc.xy(4, 3));

    final PhonUIAction defaultFontAction = new PhonUIAction(this, "useDefaultFont");
    defaultFontAction.putValue(PhonUIAction.NAME, "Use default font");
    defaultFontAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Use default tier font set in Preferences");
    useDefaultFontButton = new JButton(defaultFontAction);

    fontPanel = new JFontPanel();
    fontPanel.setSelectedFont(FontPreferences.getTierFont());

    add(new JLabel("Font"), cc.xy(2, 5));
    add(useDefaultFontButton, cc.xy(4, 5));
    add(fontPanel, cc.xy(4, 6));
}