Example usage for javax.swing BoxLayout LINE_AXIS

List of usage examples for javax.swing BoxLayout LINE_AXIS

Introduction

In this page you can find the example usage for javax.swing BoxLayout LINE_AXIS.

Prototype

int LINE_AXIS

To view the source code for javax.swing BoxLayout LINE_AXIS.

Click Source Link

Document

Specifies that components should be laid out in the direction of a line of text as determined by the target container's ComponentOrientation property.

Usage

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.QueryComponentExpressionPanel.java

/**
 * Creates the additional constraint panel.
 *//*from   ww  w .j  av a2s.com*/
private synchronized void createAdditionalConstraintPanel() {

    constraintPanel = new ConstraintPanel(queryService);
    JButton saveButton = new JButton(new AbstractAction("Save") {
        public void actionPerformed(ActionEvent arg0) {

            if (!editingExisting) {
                // get constraint from panel and add to model
                activeAdditionalConstraint = constraintPanel.getConstraint();
                // add constraint to sub query
                componentExpression.addAdditionalConstraint(activeAdditionalConstraint);
                // update model
                constraintsTableModel.populateConstraints(
                        new ArrayList<Constraint>(componentExpression.getAdditionalConstraints()));
                // notify listeners of query change
                queryService.queryChanged(queryService.getActiveQuery(), QueryComponentExpressionPanel.this);
            } else {
                Constraint oldConstraint = activeAdditionalConstraint;
                Constraint modifiedConstraint = constraintPanel.getConstraint();
                if (modifiedConstraint instanceof DataRangeConstraint) {
                    DataRangeConstraint drc = (DataRangeConstraint) modifiedConstraint;
                    DataRangeFacetConstraint lfc = drc.getLowerBoundFacet();
                    DataRangeFacetConstraint ufc = drc.getUpperBoundFacet();
                }
                // remove old constraint from sub query
                componentExpression.removeAdditionalConstraint(oldConstraint);
                // add new constraint to sub query
                componentExpression.addAdditionalConstraint(modifiedConstraint);
                // update model
                constraintsTableModel.populateConstraints(
                        new ArrayList<Constraint>(componentExpression.getAdditionalConstraints()));
                // notify listeners of query change
                queryService.queryChanged(queryService.getActiveQuery(), QueryComponentExpressionPanel.this);
            }

            // collapse panel
            constraintCollapsiblePane.setCollapsed(true);
        }
    });

    JButton cancelButton = new JButton(new AbstractAction("Cancel") {

        public void actionPerformed(ActionEvent arg0) {
            // collapse panel
            constraintCollapsiblePane.setCollapsed(true);
        }
    });

    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS));
    buttonsPanel.add(Box.createHorizontalGlue());
    buttonsPanel.add(saveButton);
    buttonsPanel.add(cancelButton);

    constraintCollapsiblePane = new JXCollapsiblePane();
    constraintCollapsiblePane.setLayout(new BorderLayout());
    constraintCollapsiblePane.add(constraintPanel, BorderLayout.CENTER);
    constraintCollapsiblePane.add(buttonsPanel, BorderLayout.SOUTH);
    constraintCollapsiblePane.setCollapsed(true);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.SimpleCloseToUserExpressionPanel.java

/**
 * Inits the components.//from   w w w . j  a v a  2 s. c o m
 */
public synchronized void initComponents() {

    renderingLabel = new ExpressionRenderingLabel(humanReadableRender);
    renderingLabel.initComponents();

    // create expressionBuilderDialog
    createExpressionBuilderDialog();

    JideButton editButton = new JideButton(new AbstractAction("Edit") {
        public void actionPerformed(ActionEvent e) {
            // set expression in expressionBuilderPanel
            if (getExpression() != null) {
                expressionBuilderPanel.setCloseToUserExpression(getExpression());
            }
            setActive(true);
            // display expression builder dialog
            expressionBuilderDialog.setVisible(true);
        }
    });

    // create  panel that displays editing options and button
    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
    p1.add(Box.createHorizontalGlue());
    p1.add(editButton);

    // set title and add panels
    setBorder(BorderFactory.createTitledBorder("Expression"));
    setLayout(new BorderLayout());
    add(renderingLabel, BorderLayout.CENTER);
    add(p1, BorderLayout.SOUTH);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.queryresultspanel.PatientPanel.java

/**
 * Inits the components.//from   w  w w .  j a v a2s . c  om
 */
public synchronized void initComponents() {

    JPanel personalDetailsPanel = new JPanel(new GridLayout(4, 2, 10, 10));
    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
    p1.add(new JLabel("<html><b>First Name : </b></html>"));
    firstNameLabel = new JLabel();
    p1.add(firstNameLabel);
    personalDetailsPanel.add(p1);

    JPanel p2 = new JPanel();
    p2.setLayout(new BoxLayout(p2, BoxLayout.LINE_AXIS));
    p2.add(new JLabel("<html><b>Gender : </b></html>"));
    genderLabel = new JLabel();
    p2.add(genderLabel);
    personalDetailsPanel.add(p2);

    JPanel p3 = new JPanel();
    p3.setLayout(new BoxLayout(p3, BoxLayout.LINE_AXIS));
    p3.add(new JLabel("<html><b>Last Name : </b></html>"));
    lastNameLabel = new JLabel();
    p3.add(lastNameLabel);
    personalDetailsPanel.add(p3);

    JPanel p4 = new JPanel();
    p4.setLayout(new BoxLayout(p4, BoxLayout.LINE_AXIS));
    p4.add(new JLabel("<html><b>Dob : </b></html>"));
    dobLabel = new JLabel();
    p4.add(dobLabel);
    personalDetailsPanel.add(p4);

    JPanel p5 = new JPanel();
    p5.setLayout(new BoxLayout(p5, BoxLayout.LINE_AXIS));
    p5.add(new JLabel("<html><b>Middle Name : </b></html>"));
    middleNameLabel = new JLabel();
    p5.add(middleNameLabel);
    personalDetailsPanel.add(p5);

    JPanel p6 = new JPanel();
    p6.setLayout(new BoxLayout(p6, BoxLayout.LINE_AXIS));
    p6.add(new JLabel("<html><b>Age in years : </b></html>"));
    ageYearsLabel = new JLabel();
    p6.add(ageYearsLabel);
    personalDetailsPanel.add(p6);

    JPanel p7 = new JPanel();
    p7.setLayout(new BoxLayout(p7, BoxLayout.LINE_AXIS));
    p7.add(new JLabel("<html><b>PatientId  : </b></html>"));
    idLabel = new JLabel();
    p7.add(idLabel);
    personalDetailsPanel.add(p7);

    ehrPanel = new EHRViewPanel();
    ehrPanel.initComponents();
    // set layout and add components
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createTitledBorder("Patient Details "));
    add(personalDetailsPanel, BorderLayout.NORTH);
    add(ehrPanel, BorderLayout.CENTER);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.queryresultspanel.QueryResultsPanel.java

/**
 * Inits the components.//ww  w .  j  a  v a  2 s.  c om
 */
public synchronized void initComponents() {

    while (activeFrame != null) {
        if (applicationService != null && applicationService.getFrameView() != null) {
            activeFrame = applicationService.getFrameView().getActiveFrame();
        }
    }

    resultCountLabel = new JXLabel(QUERY_COUNT_PREFIX + resultSetCount + QUERY_COUNT_SUFFIX);
    resultCountLabel.setHorizontalTextPosition(SwingConstants.LEFT);
    queryTimeLabel = new JXLabel(QUERY_TIME_PREFIX + 0 + QUERY_TIME_SUFFIX);
    queryTimeLabel.setHorizontalTextPosition(SwingConstants.LEFT);
    displayDistinctResultsCheckBox = new JCheckBox(
            new AbstractAction("" + "Display only unique patient count") {

                public void actionPerformed(ActionEvent e) {
                    renderQueryCountLabels();
                }
            });
    displayDistinctResultsCheckBox.setHorizontalAlignment(SwingConstants.LEFT);

    // create panels and add labels
    JPanel countPanel = new JPanel();
    countPanel.setLayout(new BoxLayout(countPanel, BoxLayout.LINE_AXIS));
    countPanel.add(resultCountLabel);
    countPanel.add(Box.createHorizontalGlue());
    JPanel timePanel = new JPanel();
    timePanel.setLayout(new BoxLayout(timePanel, BoxLayout.LINE_AXIS));
    timePanel.add(Box.createHorizontalGlue());
    timePanel.add(queryTimeLabel);
    timePanel.add(Box.createHorizontalGlue());
    timePanel.add(displayDistinctResultsCheckBox);

    JPanel labelsPanel = new JPanel();
    labelsPanel.setBorder(BorderFactory.createEmptyBorder(borderSize, borderSize, borderSize, borderSize));
    labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.PAGE_AXIS));
    labelsPanel.add(countPanel);
    labelsPanel.add(timePanel);

    resultSetTableModel = new ResultSetTableModel();
    resultsTable = new JXTable(resultSetTableModel);

    // set cell renderer for columns in table
    setCellRenderer();
    resultsTable.setColumnControlVisible(true);
    resultsTable.setHighlighters(HighlighterFactory.createAlternateStriping());
    resultsTable.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            // get row at click point
            int row = resultsTable.rowAtPoint(e.getPoint());
            if (row > -1) {
                // check if double click
                if (e.getClickCount() == 2) {
                    // get id at row
                    String patientId = resultSetTableModel.getValueAt(row, 0).toString();
                    logger.debug("Value of patientId : " + patientId);
                    // set as active constraint
                    patientPanel.setPatient(patientId);
                    patientDialog.setTitle("Patient - " + patientId);
                    patientDialog.setVisible(true);
                }
            }
        }
    });

    JPanel lowerPanel = new JPanel(new BorderLayout());
    lowerPanel.setBorder(BorderFactory.createTitledBorder("Query Results"));
    lowerPanel.add(labelsPanel, BorderLayout.NORTH);
    lowerPanel.add(new JScrollPane(resultsTable), BorderLayout.CENTER);
    // set components for view
    setLayout(new BorderLayout());
    add(lowerPanel, BorderLayout.CENTER);

    // create patient panel
    createPatientDialog();
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.resultexplanationpanel.QueryStatisticsCollectionPanel.java

/**
 * Inits the components.//from   w ww.j  a  v a  2  s .  c  om
 */
public synchronized void initComponents() {

    resultCountLabel = new JXLabel(
            "<html><b>Number of patients satisfying criteria in the query : </b></html>");
    resultCountLabel.setHorizontalTextPosition(SwingConstants.LEFT);
    queryTimeLabel = new JXLabel("<html><b>Time taken to return results for query : </b></html>");
    queryTimeLabel.setHorizontalTextPosition(SwingConstants.LEFT);

    // create panels and add labels
    JPanel countPanel = new JPanel();
    countPanel.setLayout(new BoxLayout(countPanel, BoxLayout.LINE_AXIS));
    countPanel.add(resultCountLabel);
    countPanel.add(Box.createHorizontalGlue());
    JPanel timePanel = new JPanel();
    timePanel.setLayout(new BoxLayout(timePanel, BoxLayout.LINE_AXIS));
    timePanel.add(Box.createHorizontalGlue());
    timePanel.add(queryTimeLabel);
    JPanel labelsPanel = new JPanel();
    labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.PAGE_AXIS));
    labelsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    labelsPanel.add(countPanel);
    labelsPanel.add(timePanel);
    // add empty panel for spacing
    labelsPanel.add(new JXLabel(" "));

    JPanel humanReadableLabelPanel = new JPanel(new BorderLayout());
    humanReadableLabelPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(),
            BorderFactory.createTitledBorder("Query Text")));
    humanReadableLabel = new JXLabel();
    humanReadableLabel.setLineWrap(true);
    humanReadableLabelPanel.add(humanReadableLabel, BorderLayout.CENTER);

    JPanel upperPanel = new JPanel(new BorderLayout());
    upperPanel.add(humanReadableLabelPanel, BorderLayout.CENTER);
    upperPanel.add(labelsPanel, BorderLayout.SOUTH);

    commentedStepsTextArea = new JTextArea();
    commentedStepsTextArea.setLineWrap(true);
    commentedStepsTextArea.setEditable(false);
    commentedStepsTextArea.setWrapStyleWord(true);
    // create panel for comments text area
    JPanel commentsPanel = createStatementsPanel(commentedStepsTextArea, "SQL Steps");

    sqlStatementsTextArea = new JTextArea();
    sqlStatementsTextArea.setLineWrap(true);
    sqlStatementsTextArea.setEditable(false);
    sqlStatementsTextArea.setWrapStyleWord(true);
    // create panel for sql statements
    JPanel sqlPanel = createStatementsPanel(sqlStatementsTextArea, "SQL Statements");

    // create a tabbed pane to contain the statements panels
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.addTab("Steps", null, commentsPanel, "Commented steps executed in generating the result");
    tabbedPane.addTab("SQL", null, sqlPanel, "SQL Statements used in generating the result");

    // add components to this panel
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder());
    setPreferredSize(new Dimension(550, 450));
    add(upperPanel, BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.resultexplanationpanel.QueryStatisticsCollectionPanel.java

/**
 * Creates the statements panel./*  w  w w . ja  v  a 2s .c  om*/
 * 
 * @param textArea the text area
 * @param title the title
 * 
 * @return the j panel
 */
private synchronized JPanel createStatementsPanel(final JTextArea textArea, String title) {

    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(),
            BorderFactory.createTitledBorder(title)));

    // create buttons for copy and export
    JButton copyButton = new JButton(new AbstractAction("Copy") {

        public void actionPerformed(ActionEvent event) {
            StringSelection selection = new StringSelection(textArea.getSelectedText());
            // get contents of text area and copy to system clipboard
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            clipboard.setContents(selection, QueryStatisticsCollectionPanel.this);
        }
    });

    JButton exportButton = new JButton(new AbstractAction("Export") {

        public void actionPerformed(ActionEvent event) {
            // open a file dialog and export the contents
            FileDialog fd = new FileDialog(applicationService.getFrameView().getActiveFrame(),
                    "Select file to export to", FileDialog.SAVE);
            fd.setVisible(true);

            String fileName = fd.getFile();
            String fileDirectory = fd.getDirectory();

            if (fileDirectory != null && fileName != null) {
                File file = new File(fileDirectory, fileName);
                try {
                    String contents = textArea.getText();
                    FileWriter fw = new FileWriter(file);
                    fw.flush();
                    fw.write(contents);
                    fw.close();
                    // inform user
                    //                  manager.getStatusMessageLabel().setText("Successfully saved contents to file "+fileName);
                    logger.info("Successfully saved contents to file " + fileName);

                } catch (IOException e) {
                    logger.warn(e.fillInStackTrace());
                    //                  manager.getStatusMessageLabel().setText("Errors saving contents to file "+fileName);
                }
            }
        }
    });
    // create buttons panel
    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS));
    buttonsPanel.add(Box.createHorizontalStrut(200));
    buttonsPanel.add(copyButton);
    buttonsPanel.add(exportButton);

    panel.add(buttonsPanel, BorderLayout.SOUTH);
    panel.add(new JScrollPane(textArea), BorderLayout.CENTER);

    return panel;
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.simulator.viewcomponent.DataGenerationPanel.java

/**
 * Inits the components.//from   w  w  w .j  a va 2s. c om
 */
public synchronized void initComponents() {

    while (activeFrame == null) {
        if (applicationService != null && applicationService.getFrameView() != null) {
            activeFrame = applicationService.getFrameView().getActiveFrame();
        }
    }

    JPanel runPanel = new JPanel();
    runPanel.setLayout(new BoxLayout(runPanel, BoxLayout.LINE_AXIS));
    runPanel.setBorder(BorderFactory.createEmptyBorder(paddingSize, paddingSize, paddingSize, paddingSize));
    JXLabel label = new JXLabel();
    label.setLineWrap(true);
    label.setText(
            "<html>This panel allows the creation of clinically plausible data based on a query specification. "
                    + "Please note that you <b>must</b> always specify a data generation source. "
                    + "The rest of the parameters can be left in their default state. When you've configured the parameters "
                    + "click the 'Generate data' button.</html>");
    runPanel.add(label);
    runPanel.add(new JSeparator(SwingConstants.VERTICAL));
    runPanel.add(Box.createHorizontalStrut(paddingSize));
    JideButton runButton = new JideButton(new GenerateDataAction(applicationService, queryService,
            dataGenerationEngine, propertyChangeTrackerService));
    runButton.setButtonStyle(ButtonStyle.HYPERLINK_STYLE);
    runPanel.add(runButton);
    runButton.setIcon(new ImageIcon(DataGenerationPanel.class.getResource("resources/linuxconf.png")));
    runPanel.add(Box.createHorizontalStrut(paddingSize));

    // create radio buttons for choosing source
    JRadioButton queryButton = new JRadioButton("Active Query");
    queryButton.setSelected(true);
    queryButton.addActionListener(this);
    queryButton.setActionCommand("activeQuery");
    JRadioButton fileButton = new JRadioButton("File");
    fileButton.addActionListener(this);
    fileButton.setActionCommand("file");

    JRadioButton folderButton = new JRadioButton("Folder");
    folderButton.addActionListener(this);
    folderButton.setActionCommand("folder");
    ButtonGroup bg = new ButtonGroup();
    bg.add(queryButton);
    bg.add(fileButton);
    bg.add(folderButton);
    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS));
    //      buttonsPanel.add(new JLabel("Select data generation source"));
    buttonsPanel.setBorder(BorderFactory.createTitledBorder("Select data generation source"));
    buttonsPanel.add(Box.createHorizontalStrut(paddingSize));
    buttonsPanel.add(queryButton);
    buttonsPanel.add(Box.createHorizontalStrut(paddingSize));
    buttonsPanel.add(fileButton);
    buttonsPanel.add(Box.createHorizontalStrut(paddingSize));
    buttonsPanel.add(folderButton);

    locationField = new JTextField(100);
    JButton loadQueryButton = new JButton("Browse");
    loadQueryButton.addActionListener(this);
    loadQueryButton.setActionCommand("load");
    locationPanel = new JPanel();
    locationPanel.setLayout(new BoxLayout(locationPanel, BoxLayout.LINE_AXIS));
    locationPanel.add(new JLabel("Load file from"));
    locationPanel.add(Box.createHorizontalStrut(paddingSize));
    locationPanel.add(locationField);
    locationPanel.add(Box.createHorizontalStrut(paddingSize));
    locationPanel.add(loadQueryButton);

    JPanel lhsPanel = new JPanel(new GridLayout(0, 2));
    JPanel rhsPanel = new JPanel(new GridLayout(0, 2));

    lhsPanel.add(new JLabel("Max number of patients to generate"));

    SpinnerNumberModel model = new SpinnerNumberModel(initialPatientsNumber, 1, 1000000, 1);
    ptNumberSpinner = new JSpinner(model);
    ptNumberSpinner.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent event) {
            // get value currently selected in spinner and set in engine
            dataGenerationEngine.setMaxPatientNumber(Long.parseLong(ptNumberSpinner.getValue().toString()));
            //                Object value = ptNumberSpinner.getValue();
            //                if(value instanceof Double)
            //                {
            //                    Double d = (Double) ptNumberSpinner.getValue();
            //                    dataGenerationEngine.setMaxPatientNumber(d.longValue());
            //                }
            //                else
            //                {
            //                    dataGenerationEngine.setMaxPatientNumber(Long.parseLong(ptNumberSpinner.getValue().toString()));
            //                }
            logger.debug("ptNumberSpinner.getValue().getClass() = " + ptNumberSpinner.getValue().getClass());
            logger.debug("Max pt number in engine set to : " + dataGenerationEngine.getMaxPatientNumber());
        }
    });
    lhsPanel.add(ptNumberSpinner);

    lhsPanel.add(new JLabel("Min age of patients to generate"));
    SpinnerNumberModel ageModel = new SpinnerNumberModel(initialMinimumAge, 1, 120, 1);
    minAgeSpinner = new JSpinner(ageModel);
    minAgeSpinner.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            // set min pt age to current value
            dataGenerationEngine.setMinPatientAgeInYears(Integer.parseInt(minAgeSpinner.getValue().toString()));
            logger.debug("Value of engine.getMinPatientAgeInYears() : "
                    + dataGenerationEngine.getMinPatientAgeInYears());
        }
    });
    lhsPanel.add(minAgeSpinner);

    lhsPanel.add(new JLabel("Data generation strategy"));
    generationStrategyBox = new JComboBox(DataGenerationEngine.DataGenerationStrategy.values());
    generationStrategyBox.setSelectedItem(DataGenerationEngine.DataGenerationStrategy.ADD_IF_NOT_EXISTS);
    generationStrategyBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dataGenerationEngine.setDataGenerationStrategy(
                    (DataGenerationEngine.DataGenerationStrategy) generationStrategyBox.getSelectedItem());
        }
    });
    lhsPanel.add(generationStrategyBox);

    includeExcludedTermsBox = new JCheckBox(new AbstractAction("Include Excluded terms in data") {

        public void actionPerformed(ActionEvent arg0) {
            dataGenerationEngine.setIncludeExcludedTerms(includeExcludedTermsBox.isSelected());
            logger.debug("dataGenerationEngine.isIncludeExcludedTerms() = "
                    + dataGenerationEngine.isIncludeExcludedTerms());
        }
    });
    rhsPanel.add(includeExcludedTermsBox);

    randomiseNumericalValuesBox = new JCheckBox(new AbstractAction("Randomise Numerical values in data") {

        public void actionPerformed(ActionEvent arg0) {
            dataGenerationEngine.setRandomiseNumericalValues(randomiseNumericalValuesBox.isSelected());
            logger.debug("dataGenerationEngine.isRandomiseNumericalValues() = "
                    + dataGenerationEngine.isRandomiseNumericalValues());
        }
    });
    rhsPanel.add(randomiseNumericalValuesBox);

    refineQualifiersCheckBox = new JCheckBox(new AbstractAction("Refine Qualifiers in expression") {
        public void actionPerformed(ActionEvent e) {
            dataGenerationEngine.setRefineQualifiers(refineQualifiersCheckBox.isSelected());
            logger.debug(
                    "dataGenerationEngine.isRefineQualifiers() = " + dataGenerationEngine.isRefineQualifiers());
        }
    });
    rhsPanel.add(refineQualifiersCheckBox);

    includePreCoordinatedDataCheckBox = new JCheckBox(
            new AbstractAction("Include pre-coordinated expressions") {
                public void actionPerformed(ActionEvent e) {
                    dataGenerationEngine
                            .setIncludePrecoordinatedData(includePreCoordinatedDataCheckBox.isSelected());
                    logger.debug("dataGenerationEngine.isIncludePrecoordinatedData() = "
                            + dataGenerationEngine.isIncludePrecoordinatedData());
                }
            });
    rhsPanel.add(includePreCoordinatedDataCheckBox);
    rhsPanel.add(new JLabel("  "));

    /*
    * create panel for parametrising engine
    */
    JPanel parametrisationPanel = new JPanel();
    parametrisationPanel.setLayout(new GridLayout(0, 2));
    parametrisationPanel.setBorder(BorderFactory.createTitledBorder("Engine Parameters"));

    // add panels to parametrisation panel
    parametrisationPanel.add(lhsPanel);
    parametrisationPanel.add(rhsPanel);

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.LINE_AXIS));
    topPanel.add(runPanel);
    topPanel.add(new JSeparator(SwingConstants.VERTICAL));
    topPanel.add(buttonsPanel);
    // add all panels to this component
    setLayout(new BorderLayout());
    add(topPanel, BorderLayout.NORTH);
    add(parametrisationPanel, BorderLayout.CENTER);

    // initialise values
    populateFields(dataGenerationEngine);
}

From source file:uk.nhs.cfh.dsp.yasb.expression.builder.panels.ConceptPanel.java

/**
 * Inits the components.// ww w . j  av a 2 s. c om
 */
public synchronized void initComponents() {
    conceptLabel = new JXHyperlink();
    conceptLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                logger.debug("Mouse double clicked on concept expression label");
            }
        }
    });

    // set layout to box layout
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    add(conceptLabel);
}

From source file:uk.nhs.cfh.dsp.yasb.expression.builder.panels.SnomedRelationshipPropertyExpressionPanel.java

/**
 * Inits the components.// w ww .j a  va2 s . c o  m
 */
public synchronized void initComponents() {

    // create attributeOperatorMap
    createAttributeOperatorMap();

    attributeLabel = new JLabel();
    attributeLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                logger.debug("Mouse double clicked on attribute label");
            }
        }
    });

    // create and add operator label
    operatorLabel = new JLabel();
    operatorLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                logger.debug("Mouse double clicked on operator label");
            }
        }
    });

    // create value panel
    valuePanel = new JPanel();

    // set main layout to box layout
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    add(attributeLabel);
    add(operatorLabel);
    add(valuePanel);
}

From source file:uk.nhs.cfh.dsp.yasb.expression.builder.RefinedExpressionBuilderPanel.java

/**
 * Inits the components./* www . j a va  2  s  .c om*/
 */
public synchronized void initComponents() {

    // generate and store concept corresponding to Side |182353008|
    if (terminologyConceptDAO != null) {
        lateralityParentConcept = TerminologyConceptUtils.getConceptForID(terminologyConceptDAO, "182353008");
    }

    // add a collapsible panel in NORTH position with a concept search panel
    searchPanel = new SearchPanel(terminologySearchService, selectionService, applicationService,
            terminologyConceptDAO);
    searchPanel.initComponents();
    searchPanel.setPreferredSize(new Dimension(350, 450));
    collapsiblePane = new JXCollapsiblePane(new BorderLayout());
    collapsiblePane.add(searchPanel, BorderLayout.CENTER);
    collapsiblePane.setCollapsed(true);

    // create panel for rendering label
    renderingLabel = new ExpressionRenderingLabel(humanReadableRender);
    renderingLabel.initComponents();

    focusConceptPanel = new ConceptPanel(humanReadableRender);
    focusConceptPanel.initComponents();

    // create top panel with some instructions
    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
    p1.add(focusConceptPanel);

    // add button for editing focus concept
    JideButton editFocusConceptButton = new JideButton(new AbstractAction("Edit") {
        public void actionPerformed(ActionEvent e) {
            if (collapsiblePane.isCollapsed()) {
                collapsiblePane.setCollapsed(false);
            } else {
                collapsiblePane.setCollapsed(true);
            }
        }
    });
    p1.add(Box.createHorizontalGlue());
    p1.add(editFocusConceptButton);

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.PAGE_AXIS));
    topPanel.add(renderingLabel);
    topPanel.add(p1);

    // create scrollPane that contains the properties
    propertyExpressionListModel = new PropertyExpressionListModel(normalFormGenerator);
    propertiesList = new JXList(propertyExpressionListModel);
    //        propertiesList.setCellRenderer(new PropertyExpressionListCellRenderer(selectionService,
    //                terminologyConceptDAO, applicationService, humanReadableRender));
    propertiesList.setCellRenderer(new ExpressionListCellRenderer(selectionService, terminologyConceptDAO,
            applicationService, humanReadableRender));
    propertiesScrollPane = new JScrollPane();
    propertiesScrollPane.setViewportView(propertiesList);

    //        // add mouse listeners to tree
    //        propertiesList.addMouseListener(new MouseAdapter() {
    //
    //            @Override
    //            public void mouseClicked(MouseEvent e) {
    //                int row = propertiesList.getSelectedIndex();
    //                if(row > -1 && e.getClickCount() == 2)
    //                {
    //                    // get selection
    //                    Object selection = propertiesList.getSelectedValue();
    //
    //                    // evaluate selection and set behaviour
    //                    if(selection instanceof SnomedRelationshipPropertyExpression)
    //                    {
    //                        SnomedRelationshipPropertyExpression propertyExpression =
    //                                (SnomedRelationshipPropertyExpression) selection;
    //                        // get contained relationship
    //                        SnomedRelationship relationship = propertyExpression.getRelationship();
    //                        if(relationship != null)
    //                        {
    //                            // set as selected propertyExpression
    //                            selectedPropertyExpression = propertyExpression;
    //                            // set as active relationship
    //                            activeRelationship = relationship;
    //                        }
    //                    }
    //                }
    //            }
    //        });

    // create laterality hierarchy panel
    createLateralityConceptHierarchyDialog();

    // add panel for adding laterality directly
    JPanel bottomPanel = new JPanel(new BorderLayout());
    // add label and button for laterilty value
    lateralityLabel = new JLabel();
    JButton editLateralityButton = new JButton(new AbstractAction("Edit") {
        public void actionPerformed(ActionEvent e) {
            /*
             get lateralityHierarchyPanel and set parent to
             Side |182353008|
            */

            lateralityHierarchyPanel.setConcept(lateralityParentConcept);
            // show conceptHierarchyDialog
            conceptHierarchyDialog.setLocationRelativeTo(activeFrame);
            conceptHierarchyDialog.setVisible(true);
        }
    });
    bottomPanel.add(new JLabel("<html><b>Laterality of concept </b></html>"), BorderLayout.WEST);
    bottomPanel.add(lateralityLabel, BorderLayout.CENTER);
    bottomPanel.add(editLateralityButton, BorderLayout.EAST);

    // add panels to this panel and main panel
    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(topPanel, BorderLayout.NORTH);
    mainPanel.add(propertiesScrollPane, BorderLayout.CENTER);

    // add to this panel
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(borderOffset, borderOffset, borderOffset, borderOffset));
    add(collapsiblePane, BorderLayout.NORTH);
    add(mainPanel, BorderLayout.CENTER);
    add(bottomPanel, BorderLayout.SOUTH);
}