Example usage for java.awt GridBagConstraints WEST

List of usage examples for java.awt GridBagConstraints WEST

Introduction

In this page you can find the example usage for java.awt GridBagConstraints WEST.

Prototype

int WEST

To view the source code for java.awt GridBagConstraints WEST.

Click Source Link

Document

Put the component on the left side of its display area, centered vertically.

Usage

From source file:com.digitalgeneralists.assurance.ui.components.ComparisonResultPanel.java

protected void initializeComponent(ComparisonResult result) {
    if (!this.initialized) {
        this.merging = false;
        this.numberOfLines = 0;

        this.setOpaque(true);

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

        this.basePanelConstraints.anchor = GridBagConstraints.WEST;
        this.basePanelConstraints.fill = GridBagConstraints.BOTH;
        this.basePanelConstraints.gridx = 0;
        this.basePanelConstraints.gridy = 0;
        this.basePanelConstraints.weightx = 1.0;
        this.basePanelConstraints.weighty = 1.0;
        this.basePanelConstraints.gridheight = 1;
        this.basePanelConstraints.gridwidth = 1;
        this.basePanelConstraints.insets = new Insets(0, 0, 0, 0);

        this.standardPanel.setOpaque(false);
        GridBagLayout basePanelGridbag = new GridBagLayout();
        this.standardPanel.setLayout(basePanelGridbag);
        this.add(this.standardPanel, this.basePanelConstraints);

        GridBagConstraints sourcePanelConstraints = new GridBagConstraints();
        sourcePanelConstraints.anchor = GridBagConstraints.WEST;
        sourcePanelConstraints.fill = GridBagConstraints.BOTH;
        sourcePanelConstraints.gridx = 0;
        sourcePanelConstraints.gridy = 0;
        sourcePanelConstraints.weightx = 0.4;
        sourcePanelConstraints.weighty = 1.0;
        sourcePanelConstraints.gridheight = 1;
        sourcePanelConstraints.gridwidth = 1;
        sourcePanelConstraints.insets = new Insets(0, 0, 0, 0);

        JPanel sourcePanel = new JPanel();
        sourcePanel.setOpaque(false);/*from ww w.j a  va2  s.  co m*/
        GridBagLayout sourcePanelGridbag = new GridBagLayout();
        sourcePanel.setLayout(sourcePanelGridbag);
        this.standardPanel.add(sourcePanel, sourcePanelConstraints);

        GridBagConstraints sourceFileLabelConstraints = new GridBagConstraints();
        sourceFileLabelConstraints.anchor = GridBagConstraints.WEST;
        sourceFileLabelConstraints.gridx = 0;
        sourceFileLabelConstraints.gridy = 0;
        sourceFileLabelConstraints.weightx = 1.0;
        sourceFileLabelConstraints.weighty = 1.0;
        sourceFileLabelConstraints.gridheight = 1;
        sourceFileLabelConstraints.gridwidth = 1;
        sourceFileLabelConstraints.insets = new Insets(5, 5, 5, 5);

        String sourcePath = "No File Specified";
        if ((result != null) && (result.getSource() != null)) {
            File sourceFile = result.getSource().getFile();
            if ((sourceFile == null) || (!sourceFile.exists())) {
                sourcePath = "File does not exist in source location.";
            } else {
                sourcePath = sourceFile.getPath();
            }
            sourceFile = null;
        }
        JLabel sourceFileLabel = new JLabel(sourcePath);
        sourcePath = null;
        sourcePanel.add(sourceFileLabel, sourceFileLabelConstraints);

        GridBagConstraints sourceAttributesPanelConstraints = new GridBagConstraints();
        sourceAttributesPanelConstraints.anchor = GridBagConstraints.WEST;
        sourceAttributesPanelConstraints.fill = GridBagConstraints.BOTH;
        sourceAttributesPanelConstraints.gridx = 0;
        sourceAttributesPanelConstraints.gridy = 1;
        sourceAttributesPanelConstraints.weightx = 1.0;
        sourceAttributesPanelConstraints.weighty = 1.0;
        sourceAttributesPanelConstraints.gridheight = 1;
        sourceAttributesPanelConstraints.gridwidth = 1;
        sourceAttributesPanelConstraints.insets = new Insets(0, 0, 0, 0);

        FileReference sourceReference = null;
        if (result != null) {
            sourceReference = result.getSource();
        }

        FileReference targetReference = null;
        if (result != null) {
            targetReference = result.getTarget();
        }

        JPanel sourceAttributesPanel = this.createFileAttributesPanel(sourceReference, targetReference,
                GridBagConstraints.WEST);
        sourcePanel.add(sourceAttributesPanel, sourceAttributesPanelConstraints);

        this.moreSourceAttributesButton.setHorizontalAlignment(SwingConstants.LEFT);
        this.moreSourceAttributesButton.setBorderPainted(false);
        this.moreSourceAttributesButton.setOpaque(false);
        this.moreSourceAttributesButton.setForeground(Color.blue);

        if (this.editable) {
            this.moreSourceAttributesButton.setText("All attributes...");
            this.moreSourceAttributesButton.addActionListener(this);
            this.moreSourceAttributesButton.setEnabled(true);
        } else {
            this.moreSourceAttributesButton.setText(" ");
            this.moreSourceAttributesButton.setEnabled(false);
        }
        this.moreSourceAttributesButton.setActionCommand(AssuranceActions.sourceAttributesAction);

        GridBagConstraints moreSourceAttributesButtonConstraints = new GridBagConstraints();
        moreSourceAttributesButtonConstraints.anchor = GridBagConstraints.WEST;
        moreSourceAttributesButtonConstraints.fill = GridBagConstraints.BOTH;
        moreSourceAttributesButtonConstraints.gridx = 0;
        moreSourceAttributesButtonConstraints.gridy = 2;
        moreSourceAttributesButtonConstraints.weightx = 1.0;
        moreSourceAttributesButtonConstraints.weighty = 1.0;
        moreSourceAttributesButtonConstraints.gridheight = 1;
        moreSourceAttributesButtonConstraints.gridwidth = 1;
        moreSourceAttributesButtonConstraints.insets = new Insets(0, 0, 0, 0);
        sourcePanel.add(this.moreSourceAttributesButton, moreSourceAttributesButtonConstraints);

        this.buildMergePanel(result);

        GridBagConstraints targetPanelConstraints = new GridBagConstraints();
        targetPanelConstraints.anchor = GridBagConstraints.EAST;
        targetPanelConstraints.fill = GridBagConstraints.BOTH;
        targetPanelConstraints.gridx = 2;
        targetPanelConstraints.gridy = 0;
        targetPanelConstraints.weightx = 0.4;
        targetPanelConstraints.weighty = 1.0;
        targetPanelConstraints.gridheight = 1;
        targetPanelConstraints.gridwidth = 1;
        targetPanelConstraints.insets = new Insets(0, 0, 0, 0);

        JPanel targetPanel = new JPanel();
        GridBagLayout targetPanelGridbag = new GridBagLayout();
        targetPanel.setOpaque(false);
        targetPanel.setLayout(targetPanelGridbag);
        this.standardPanel.add(targetPanel, targetPanelConstraints);

        GridBagConstraints targetFileLabelConstraints = new GridBagConstraints();
        targetFileLabelConstraints.anchor = GridBagConstraints.EAST;
        targetFileLabelConstraints.fill = GridBagConstraints.BOTH;
        targetFileLabelConstraints.gridx = 0;
        targetFileLabelConstraints.gridy = 0;
        targetFileLabelConstraints.weightx = 1.0;
        targetFileLabelConstraints.weighty = 1.0;
        targetFileLabelConstraints.gridheight = 1;
        targetFileLabelConstraints.gridwidth = 1;
        targetFileLabelConstraints.insets = new Insets(5, 5, 5, 5);

        // Create a label to put messages during an action event.
        String targetPath = "No File Specified";
        if ((result != null) && (result.getTarget() != null)) {
            File targetFile = result.getTarget().getFile();
            if ((targetFile == null) || (!targetFile.exists())) {
                targetPath = "File does not exist in target location.";
            } else {
                targetPath = targetFile.getPath();
            }
            targetFile = null;
        }
        JLabel targetFileLabel = new JLabel(targetPath);
        targetPath = null;
        targetPanel.add(targetFileLabel, targetFileLabelConstraints);

        GridBagConstraints targetAttributesPanelConstraints = new GridBagConstraints();
        targetAttributesPanelConstraints.anchor = GridBagConstraints.EAST;
        targetAttributesPanelConstraints.fill = GridBagConstraints.BOTH;
        targetAttributesPanelConstraints.gridx = 0;
        targetAttributesPanelConstraints.gridy = 1;
        targetAttributesPanelConstraints.weightx = 1.0;
        targetAttributesPanelConstraints.weighty = 1.0;
        targetAttributesPanelConstraints.gridheight = 1;
        targetAttributesPanelConstraints.gridwidth = 1;
        targetAttributesPanelConstraints.insets = new Insets(0, 0, 0, 0);

        JPanel targetAttributesPanel = this.createFileAttributesPanel(targetReference, sourceReference,
                GridBagConstraints.EAST);
        targetPanel.add(targetAttributesPanel, targetAttributesPanelConstraints);

        sourceReference = null;
        targetReference = null;

        this.moreTargetAttributesButton.setHorizontalAlignment(SwingConstants.RIGHT);
        this.moreTargetAttributesButton.setBorderPainted(false);
        this.moreTargetAttributesButton.setOpaque(false);
        this.moreTargetAttributesButton.setForeground(Color.blue);

        if (this.editable) {
            this.moreTargetAttributesButton.setText("All attributes...");
            this.moreTargetAttributesButton.addActionListener(this);
            this.moreTargetAttributesButton.setEnabled(true);
        } else {
            this.moreTargetAttributesButton.setText(" ");
            this.moreTargetAttributesButton.setEnabled(false);
        }
        this.moreTargetAttributesButton.setActionCommand(AssuranceActions.targetAttributesAction);

        GridBagConstraints moreTargetAttributesButtonConstraints = new GridBagConstraints();
        moreTargetAttributesButtonConstraints.anchor = GridBagConstraints.EAST;
        moreTargetAttributesButtonConstraints.fill = GridBagConstraints.BOTH;
        moreTargetAttributesButtonConstraints.gridx = 0;
        moreTargetAttributesButtonConstraints.gridy = 2;
        moreTargetAttributesButtonConstraints.weightx = 1.0;
        moreTargetAttributesButtonConstraints.weighty = 1.0;
        moreTargetAttributesButtonConstraints.gridheight = 1;
        moreTargetAttributesButtonConstraints.gridwidth = 1;
        moreTargetAttributesButtonConstraints.insets = new Insets(0, 0, 0, 0);
        targetPanel.add(this.moreTargetAttributesButton, moreTargetAttributesButtonConstraints);

        GridBagLayout mergingPanelGridbag = new GridBagLayout();
        this.mergingPanel.setLayout(mergingPanelGridbag);

        GridBagConstraints mergingLabelConstraints = new GridBagConstraints();
        mergingLabelConstraints.anchor = GridBagConstraints.NORTH;
        mergingLabelConstraints.fill = GridBagConstraints.BOTH;
        mergingLabelConstraints.gridx = 0;
        mergingLabelConstraints.gridy = 0;
        mergingLabelConstraints.weightx = 1.0;
        mergingLabelConstraints.weighty = 1.0;
        mergingLabelConstraints.gridheight = 1;
        mergingLabelConstraints.gridwidth = 1;
        mergingLabelConstraints.insets = new Insets(10, 10, 10, 10);

        this.mergingLabel.setHorizontalAlignment(JLabel.CENTER);
        mergingPanel.add(this.mergingLabel, mergingLabelConstraints);

        GridBagConstraints mergingStatusIndicatorConstraints = new GridBagConstraints();
        mergingStatusIndicatorConstraints.anchor = GridBagConstraints.SOUTH;
        mergingStatusIndicatorConstraints.fill = GridBagConstraints.BOTH;
        mergingStatusIndicatorConstraints.gridx = 0;
        mergingStatusIndicatorConstraints.gridy = 1;
        mergingStatusIndicatorConstraints.weightx = 1.0;
        mergingStatusIndicatorConstraints.weighty = 1.0;
        mergingStatusIndicatorConstraints.gridheight = 1;
        mergingStatusIndicatorConstraints.gridwidth = 1;
        mergingStatusIndicatorConstraints.insets = new Insets(10, 10, 10, 10);

        this.mergingProgressIndicator.setIndeterminate(true);

        mergingPanel.add(this.mergingProgressIndicator, mergingStatusIndicatorConstraints);

        this.addAncestorListener(new AncestorListener() {
            public void ancestorAdded(AncestorEvent event) {
                if (applicationDelegate != null) {
                    applicationDelegate.addEventObserver(ResultMergeStartedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(ResultMergeProgressEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(ResultMergeCompletedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(DeletedItemRestoreStartedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(DeletedItemRestoreProgressEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(DeletedItemRestoreCompletedEvent.class,
                            (IEventObserver) event.getSource());
                }
            }

            public void ancestorRemoved(AncestorEvent event) {
                if (applicationDelegate != null) {
                    applicationDelegate.removeEventObserver(ResultMergeStartedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(ResultMergeProgressEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(ResultMergeCompletedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(DeletedItemRestoreStartedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(DeletedItemRestoreProgressEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(DeletedItemRestoreCompletedEvent.class,
                            (IEventObserver) event.getSource());
                }
            }

            public void ancestorMoved(AncestorEvent event) {
            }
        });

        this.initialized = true;
    }
}

From source file:uk.ac.soton.mib104.t2.activities.json.ui.config.JSONPathConfigurationPanel.java

protected void initGui() {
    this.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    this.setLayout(new GridBagLayout());

    jsonPathAsTextField.setMinimumSize(new Dimension(240, jsonPathAsTextField.getMinimumSize().height));
    jsonPathAsTextField.setPreferredSize(jsonPathAsTextField.getMinimumSize());
    jsonPathAsTextField.setText("");

    jsonPathButton.addActionListener(new ActionListener() {

        @Override/*  ww w.  ja v a 2  s.  c  o m*/
        public void actionPerformed(final ActionEvent e) {
            final JSONPathInputDialog jsonPathInputDialog = new JSONPathInputDialog(
                    SwingUtilities.getWindowAncestor(JSONPathConfigurationPanel.this));

            final JSONPathInputPanel jsonPathInputPane = jsonPathInputDialog.getJSONPathInputPane();

            jsonPathInputPane.getJSONDocumentEditorPane().setText(jsonPathInputDialog_jsonPathEditorPane_text);

            jsonPathInputPane.getJsonPathEditorPane()
                    .setJSONValue(jsonPathInputDialog_jsonPathEditorPane_value);
            jsonPathInputPane.getJsonPathEditorPane()
                    .setTreeVisible(jsonPathInputDialog_jsonPathEditorPane_treeVisible);
            jsonPathInputPane.getJsonPathEditorPane().setText(jsonPathAsTextField.getText());

            jsonPathInputDialog.setVisible(true);

            switch (jsonPathInputDialog.getOption()) {
            case JOptionPane.OK_OPTION:
                break;
            default:
                return;
            }

            jsonPathInputDialog_jsonPathEditorPane_text = jsonPathInputPane.getJSONDocumentEditorPane()
                    .getText();
            jsonPathInputDialog_jsonPathEditorPane_treeVisible = jsonPathInputPane.getJsonPathEditorPane()
                    .isTreeVisible();
            jsonPathInputDialog_jsonPathEditorPane_value = jsonPathInputPane.getJsonPathEditorPane()
                    .getJSONValue();

            jsonPathAsTextField.setText(jsonPathInputPane.getJsonPathEditorPane().getText());
        }

    });
    jsonPathButton.setFont(jsonPathButton.getFont().deriveFont(11f));
    jsonPathButton.setIcon(JSONPathServiceIcon.getIcon());
    jsonPathButton.setText(jsonPathButtonText);
    jsonPathButton.setToolTipText(jsonPathButtonTip);

    final JLabel portDepthLabel = new JLabel();
    portDepthLabel.setFont(portDepthLabel.getFont().deriveFont(11f));
    portDepthLabel.setHorizontalAlignment(JLabel.LEFT);
    portDepthLabel.setIcon(Silk.getHelpIcon());
    portDepthLabel.setText(portDepthInputPaneText);
    portDepthLabel.setToolTipText(portDepthInputPaneTip);

    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 0;

    constraints.anchor = GridBagConstraints.WEST;
    this.add(JSONPathTextField.createLabelForDocument(jsonPathAsTextField.getDocument()), constraints);

    constraints.gridx++;

    constraints.anchor = GridBagConstraints.EAST;
    constraints.weightx = 1d;
    this.add(jsonPathAsTextField, constraints);
    constraints.weightx = 0;

    constraints.gridx++;

    constraints.fill = GridBagConstraints.NONE;
    this.add(jsonPathButton, constraints);

    constraints.gridx--;

    constraints.gridy++;

    constraints.anchor = GridBagConstraints.CENTER;
    this.add(JSONPathTextField.createLabelForDocumentationURI(), constraints);
    constraints.fill = GridBagConstraints.HORIZONTAL;

    constraints.gridx = 0;
    constraints.gridy++;

    constraints.gridwidth = 3;
    this.add(new JSeparator(JSeparator.HORIZONTAL), constraints);
    constraints.gridwidth = 1;

    constraints.gridx = 0;
    constraints.gridy++;

    constraints.anchor = GridBagConstraints.WEST;
    this.add(portDepthLabel, constraints);

    constraints.gridx++;

    constraints.anchor = GridBagConstraints.EAST;
    constraints.gridwidth = 2;
    this.add(portDepthInputPane, constraints);
    constraints.gridwidth = 1;
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.TextualAnnotationsUI.java

/** Builds and lays out the UI. */
private void buildGUI() {
    removeAll();/*from   w  w w.  j av a2  s . c o  m*/

    if (!model.isAnnotationLoaded())
        return;

    pane = new JScrollPane(commentArea);
    pane.setBorder(null);

    setLayout(new GridBagLayout());

    constraints = new GridBagConstraints();
    constraints.insets = new Insets(2, 0, 2, 0);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1;
    constraints.weighty = 1;
    add(pane, constraints);
    constraints.gridy++;

    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.WEST;
    add(addButton, constraints);
    constraints.gridy++;

    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.NORTHWEST;
}

From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java

/**
 * This method initializes this//  ww  w .  j a  va2s .co  m
 * 
 * @return void
 */
private void initialize() {
    GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
    gridBagConstraints12.gridx = 0;
    gridBagConstraints12.anchor = GridBagConstraints.WEST;
    gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints12.gridwidth = 2;
    gridBagConstraints12.weightx = 0.0;
    gridBagConstraints12.gridy = 1;
    GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
    gridBagConstraints23.fill = GridBagConstraints.BOTH;
    gridBagConstraints23.weighty = 1.0;
    gridBagConstraints23.gridwidth = 1;
    gridBagConstraints23.weightx = 1.0;
    jLabelComponentForOpt1 = new JLabel();
    jLabelComponentForOpt1.setText("(Option) Component :");
    jLabelComponentForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12));
    jLabelLicenseForOpt1 = new JLabel();
    jLabelLicenseForOpt1.setText("License :");
    jLabelLicenseForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12));
    jLabelRepresentativeLicenseForOpt2 = new JLabel();
    jLabelRepresentativeLicenseForOpt2.setText("Representative License :");
    jLabelRepresentativeLicenseForOpt2.setFont(new Font("Dialog", Font.PLAIN, 12));
    jLabelNoticeForOpt1 = new JLabel();
    jLabelNoticeForOpt1.setText(
            "Note) If you don't choose a component, it will be identified by \"DECLARED_STRING_MATCH_LICENSE_\" + \"License Name\".");
    jLabelNoticeForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12));
    this.setSize(570, 480);
    this.setLayout(new GridBagLayout());
    this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
            new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));

    // matched code view & license match info table
    this.add(getJSplitPaneCodeAndTable(), gridBagConstraints23);

    // option
    this.add(getJScrollPanelOptions(), gridBagConstraints12);
}

From source file:com.digitalgeneralists.assurance.ui.components.FileAttributesPanel.java

private JPanel createFileAttributesPanel(FileReference fileReference) {
    JPanel attributePanel = new JPanel();
    GridBagLayout attributePanelGridbag = new GridBagLayout();
    attributePanel.setOpaque(false);//  w  w  w . j av a2 s  .com
    attributePanel.setLayout(attributePanelGridbag);
    int anchor = GridBagConstraints.WEST;

    if (fileReference != null) {
        int index = 0;

        FileAttributes attributes = fileReference.getFileAttributes();

        this.addFileAttributeToPanel(attributePanel, anchor, index, "Content Hash: ",
                (attributes.getContentsHash() != null) ? attributes.getContentsHash().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Creation Time: ",
                (attributes.getCreationTime() != null) ? attributes.getCreationTime().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Directory: ",
                (attributes.getIsDirectory() != null) ? attributes.getIsDirectory().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Other: ",
                (attributes.getIsOther() != null) ? attributes.getIsOther().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Regular File: ",
                (attributes.getIsRegularFile() != null) ? attributes.getIsRegularFile().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Symbolic Link: ",
                (attributes.getIsSymbolicLink() != null) ? attributes.getIsSymbolicLink().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Last Access Time: ",
                (attributes.getLastAccessTime() != null) ? attributes.getLastAccessTime().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Last Modified Time: ",
                (attributes.getLastModifiedTime() != null) ? attributes.getLastModifiedTime().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "File Size: ",
                (attributes.getSize() != null) ? attributes.getSize().toString() : "");
        index++;
        // DOS Attributes
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Archive: ",
                (attributes.getIsArchive() != null) ? attributes.getIsArchive().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Hidden: ",
                (attributes.getIsHidden() != null) ? attributes.getIsHidden().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Read Only: ",
                (attributes.getIsReadOnly() != null) ? attributes.getIsReadOnly().toString() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "System File: ",
                (attributes.getIsSystem() != null) ? attributes.getIsSystem().toString() : "");
        index++;
        // POSIX Attributes
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Group Name: ",
                (attributes.getGroupName() != null) ? attributes.getGroupName() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Owner: ",
                (attributes.getOwner() != null) ? attributes.getOwner() : "");
        index++;
        this.addFileAttributeToPanel(attributePanel, anchor, index, "Permissions: ",
                (attributes.getPermissions() != null) ? attributes.getPermissions() : "");
        index++;
        // File-owner Attributes
        this.addFileAttributeToPanel(attributePanel, anchor, index, "File Owner: ",
                (attributes.getFileOwner() != null) ? attributes.getFileOwner() : "");
        index++;
        // ACL Attributes
        this.addFileAttributeToPanel(attributePanel, anchor, index, "ACLs: ",
                (attributes.getAclDescription() != null) ? attributes.getAclDescription() : "");
        index++;
        // User-defined Attributes
        this.addFileAttributeToPanel(attributePanel, anchor, index, "User-defined Attributes Hash: ",
                (attributes.getUserDefinedAttributesHash() != null) ? attributes.getUserDefinedAttributesHash()
                        : "");

        attributes = null;
    }

    return attributePanel;
}

From source file:gov.loc.repository.bagger.ui.NewBagFrame.java

private void layoutProfileSelection(JPanel contentPane, int row) {
    // content/*from  w w w .  j a va  2 s.c  om*/
    // profile selection
    JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:"));
    bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help"));

    profileList = new JComboBox(bagView.getProfileStore().getProfileNames());
    profileList.setName(bagView.getPropertyMessage("bag.label.projectlist"));
    profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject"));
    profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help"));

    GridBagConstraints glbc = new GridBagConstraints();

    JLabel spacerLabel = new JLabel();
    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    contentPane.add(bagProfileLabel, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER);
    contentPane.add(profileList, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE,
            GridBagConstraints.EAST);
    contentPane.add(spacerLabel, glbc);
}

From source file:ro.nextreports.designer.querybuilder.RuntimeParametersPanel.java

private void initUI() {
    setLayout(new GridBagLayout());

    JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    components = new ArrayList<JComponent>();
    checks = new ArrayList<JCheckBox>();

    int size = paramList.size();
    boolean shouldExpand = false;
    boolean needScroll = false;
    for (int i = 0; i < size; i++) {
        final int pos = i;
        final QueryParameter param = paramList.get(i);
        if (param.isHidden()) {
            components.add(null);/*from ww w. ja v  a2s. c  o m*/
            checks.add(null);
            initHiddenParameterValues(param);
            continue;
        }
        String source = param.getSource();
        String defaultSource = param.getDefaultSource();

        if ((defaultSource != null) && !defaultSource.trim().equals("")) {
            try {
                param.setDefaultSourceValues(Globals.getDBViewer().getDefaultSourceValues(con, param));
            } catch (NextSqlException e) {
                Show.error(e);
            }
        }

        final JComponent component;
        int anchor = GridBagConstraints.WEST;
        double y = 0.0;
        int expand = GridBagConstraints.HORIZONTAL;
        if ((source != null) && !source.equals("")) {
            List<IdName> values = new ArrayList<IdName>();
            try {
                if (param.isManualSource()) {
                    if (!param.isDependent()) {
                        values = Globals.getDBViewer().getValues(con, source, true, param.getOrderBy());
                    }
                } else {
                    int index = source.indexOf(".");
                    int index2 = source.lastIndexOf(".");
                    String tableName = source.substring(0, index);
                    String columnName;
                    String shownColumnName = null;
                    if (index == index2) {
                        columnName = source.substring(index + 1);
                    } else {
                        columnName = source.substring(index + 1, index2);
                        shownColumnName = source.substring(index2 + 1);
                    }
                    values = Globals.getDBViewer().getColumnValues(con, param.getSchema(), tableName,
                            columnName, shownColumnName, param.getOrderBy());
                }
            } catch (NextSqlException e) {
                error = true;
                Show.error(e);
            } catch (InvalidSqlException e) {
                String m = I18NSupport.getString("source.dialog.valid");
                Show.info(m + " : \"select <exp1> , <exp2> from ...\"");
            }
            if (param.getSelection().equals(ParameterEditPanel.SINGLE_SELECTION)) {
                component = new JComboBox();
                final JComboBox combo = (JComboBox) component;
                combo.setRenderer(new IdNameRenderer());
                combo.addItem("-- " + I18NSupport.getString("parameter.value.select") + " --");
                for (int j = 0, len = values.size(); j < len; j++) {
                    combo.addItem(values.get(j));
                }

                combo.addItemListener(new ItemListener() {
                    public void itemStateChanged(ItemEvent e) {
                        if (e.getStateChange() == ItemEvent.SELECTED) {
                            IdName in = null;
                            if (combo.getSelectedIndex() > 0) {
                                in = (IdName) combo.getSelectedItem();
                            }
                            parameterSelection(pos, in);
                        }
                    }
                });
                AutoCompleteDecorator.decorate(combo);
                needScroll = false;
            } else {
                anchor = GridBagConstraints.NORTHWEST;
                y = 1.0;
                expand = GridBagConstraints.BOTH;

                DefaultListModel model = new DefaultListModel();
                for (int j = 0, len = values.size(); j < len; j++) {
                    model.addElement(values.get(j));
                }
                List srcList = Arrays.asList(model.toArray());
                component = new ListSelectionPanel(srcList, new ArrayList(), "", "", true, false) {
                    protected void onAdd() {
                        selection();
                    }

                    protected void onRemove() {
                        selection();
                    }

                    // needed for saved parameters on rerun
                    protected void onSetRight() {
                        selection();
                    }

                    private void selection() {
                        if (ParameterManager.getInstance().getChildDependentParameters(param).size() > 0) {
                            Object[] values = getDestinationElements().toArray();
                            if (values.length == 0) {
                                values = new Object[] { ParameterUtil.NULL };
                            }
                            parameterSelection(pos, values);
                        }
                    }
                };
                ((ListSelectionPanel) component).setListSize(scrListDim);
                ((ListSelectionPanel) component).setRenderer(new IdNameRenderer(),
                        new IdNameComparator(param.getOrderBy()));

                shouldExpand = true;
            }

        } else {
            if (param.getSelection().equals(QueryParameter.MULTIPLE_SELECTION)) {
                anchor = GridBagConstraints.NORTHWEST;
                y = 1.0;
                expand = GridBagConstraints.BOTH;
                ;
                component = new ListAddPanel(param) {
                    protected void onAdd() {
                        selection();
                    }

                    protected void onRemove() {
                        selection();
                    }

                    private void selection() {
                        if (ParameterManager.getInstance().getChildDependentParameters(param).size() > 0) {
                            Object[] values = getElements().toArray();
                            parameterSelection(pos, values);
                        }
                    }
                };
            } else {
                needScroll = false;
                if (param.getValueClassName().equals("java.util.Date")) {
                    component = new JXDatePicker();
                    ((JXDatePicker) component).addPropertyChangeListener(new PropertyChangeListener() {
                        public void propertyChange(PropertyChangeEvent e) {
                            if ("date".equals(e.getPropertyName())) {
                                parameterSelection(pos, ((JXDatePicker) component).getDate());
                            }
                        }
                    });
                    // hack to fix bug with big popup button
                    JButton popupButton = (JButton) component.getComponent(1);
                    //popupButton.setMargin(new Insets(2, 2, 2, 2));
                    popupButton.setMinimumSize(new Dimension(20, (int) getPreferredSize().getHeight()));
                    popupButton.setPreferredSize(new Dimension(20, (int) getPreferredSize().getHeight()));
                    popupButton.setBorder(BorderFactory.createLineBorder(Color.GRAY));
                } else if (param.getValueClassName().equals("java.sql.Timestamp")
                        || param.getValueClassName().equals("java.sql.Time")) {
                    component = new JDateTimePicker() {
                        protected void onChange() {
                            parameterSelection(pos, getDate());
                        }
                    };
                    // hack to fix bug with big popup button
                    JButton popupButton = (JButton) (((JDateTimePicker) component).getDatePicker())
                            .getComponent(1);
                    //popupButton.setMargin(new Insets(2, 2, 2, 2));
                    popupButton.setMinimumSize(new Dimension(20, (int) getPreferredSize().getHeight()));
                    popupButton.setPreferredSize(new Dimension(20, (int) getPreferredSize().getHeight()));
                    popupButton.setBorder(BorderFactory.createLineBorder(Color.GRAY));
                } else if (param.getValueClassName().equals("java.lang.Boolean")) {
                    component = new JCheckBox();
                    ((JCheckBox) component).addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent actionEvent) {
                            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
                            boolean selected = abstractButton.getModel().isSelected();
                            parameterSelection(pos, selected);
                        }
                    });
                } else {
                    component = new JTextField(25);
                    ((JTextField) component).getDocument().addDocumentListener(new DocumentListener() {

                        @Override
                        public void changedUpdate(DocumentEvent e) {
                            updateFromTextField(e);
                        }

                        @Override
                        public void insertUpdate(DocumentEvent e) {
                            updateFromTextField(e);
                        }

                        @Override
                        public void removeUpdate(DocumentEvent e) {
                            updateFromTextField(e);
                        }

                        private void updateFromTextField(DocumentEvent e) {
                            java.awt.EventQueue.invokeLater(new Runnable() {

                                @Override
                                public void run() {
                                    Object value = null;
                                    try {
                                        if ("".equals(((JTextField) component).getText().trim())) {
                                            value = null;
                                        } else {
                                            value = ParameterUtil.getParameterValueFromString(
                                                    param.getValueClassName(),
                                                    ((JTextField) component).getText());
                                        }
                                        parameterSelection(pos, value);
                                    } catch (Exception e) {
                                        e.printStackTrace();
                                        LOG.error(e.getMessage(), e);
                                    }
                                }
                            });
                        }
                    });
                }
            }
        }
        components.add(component);
        final JCheckBox cb = new JCheckBox(I18NSupport.getString("run.parameter.ignore"));
        checks.add(cb);

        final JLabel label = new JLabel(getRuntimeParameterName(param));
        panel.add(label, new GridBagConstraints(0, i, 1, 1, 0.0, 0.0, anchor, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        final JComponent addComponent;
        if (needScroll) {
            JScrollPane scr = new JScrollPane(component, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            scr.setPreferredSize(listDim);
            addComponent = scr;
        } else {
            addComponent = component;
        }
        panel.add(addComponent, new GridBagConstraints(1, i, 1, 1, 1.0, y, GridBagConstraints.WEST, expand,
                new Insets(5, 0, 5, 5), 0, 0));
        int checkAnchor = GridBagConstraints.WEST;
        if ((addComponent instanceof JScrollPane) || (addComponent instanceof ListSelectionPanel)) {
            checkAnchor = GridBagConstraints.NORTHWEST;
        }

        if (Globals.getParametersIgnore()) {
            panel.add(cb, new GridBagConstraints(2, i, 1, 1, 0.0, 0.0, checkAnchor, GridBagConstraints.NONE,
                    new Insets(5, 0, 5, 5), 0, 0));
        }

        cb.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                if (cb.isSelected()) {
                    if (addComponent instanceof JScrollPane) {
                        component.setEnabled(false);
                    }
                    label.setEnabled(false);
                    addComponent.setEnabled(false);
                    param.setIgnore(true);
                } else {
                    if (addComponent instanceof JScrollPane) {
                        component.setEnabled(true);
                    }
                    label.setEnabled(true);
                    addComponent.setEnabled(true);
                    param.setIgnore(false);
                }
            }
        });
    }

    // populate hidden dependent parameters (this will be done if a parameter depends only on a single hidden parameter)
    // if a parameter depends on a hidden parameter and other parameters, it cannot be populated here
    for (int i = 0; i < size; i++) {
        final QueryParameter param = paramList.get(i);
        if (param.isHidden()) {
            populateDependentParameters(param, false);
        }
    }

    if (!shouldExpand) {
        panel.add(new JLabel(), new GridBagConstraints(0, size, 3, 1, 1.0, 1.0, GridBagConstraints.WEST,
                GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    }

    JScrollPane scrPanel = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrPanel.setPreferredSize(scrDim);
    scrPanel.setMinimumSize(scrDim);

    add(scrPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0), 0, 0));
    setParameterValues(parametersValues);
    setParameterIgnore(parametersIgnore);
}

From source file:com.vgi.mafscaling.VECalc.java

protected void createControlPanel(JPanel dataPanel) {
    JPanel cntlPanel = new JPanel();
    GridBagConstraints gbl_ctrlPanel = new GridBagConstraints();
    gbl_ctrlPanel.insets = insets3;/*from   w w  w .  j a  v a 2 s .c o  m*/
    gbl_ctrlPanel.anchor = GridBagConstraints.NORTH;
    gbl_ctrlPanel.fill = GridBagConstraints.HORIZONTAL;
    gbl_ctrlPanel.gridx = 0;
    gbl_ctrlPanel.gridy = 0;
    gbl_ctrlPanel.weightx = 1.0;
    gbl_ctrlPanel.gridwidth = 2;
    dataPanel.add(cntlPanel, gbl_ctrlPanel);

    GridBagLayout gbl_cntlPanel = new GridBagLayout();
    gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    gbl_cntlPanel.rowHeights = new int[] { 0 };
    gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            1.0 };
    gbl_cntlPanel.rowWeights = new double[] { 0 };
    cntlPanel.setLayout(gbl_cntlPanel);

    addButton(cntlPanel, 0, "Load Log", "loadlog", GridBagConstraints.WEST);
    addButton(cntlPanel, 1, "Clear SD Data", "clearorig", GridBagConstraints.WEST);
    addButton(cntlPanel, 2, "Clear Run Data", "clearlog", GridBagConstraints.WEST);
    addButton(cntlPanel, 3, "Clear All", "clearall", GridBagConstraints.WEST);
    addLabel(cntlPanel, 4, "SD");
    sdType = addComboBox(cntlPanel, 5, new String[] { "RR SD", "Cobb SD" });
    addLabel(cntlPanel, 6, "MP");
    mpType = addComboBox(cntlPanel, 7,
            new String[] { "Torr/mmHG Abs", "Torr/mmHG Rel Sea Lvl", "Psi Abs", "Psi Rel Sea Lvl" });
    addLabel(cntlPanel, 8, "Run");
    dataType = addComboBox(cntlPanel, 9, new String[] { "MAF Builder", "AFR Tuner" });
    addCheckBox(cntlPanel, 10, "Hide Log Table", "hidelogtable");
    compareTableCheckBox = addCheckBox(cntlPanel, 11, "Compare Tables", "comparetables");
    addButton(cntlPanel, 12, "GO", "go", GridBagConstraints.EAST);
}

From source file:com.hp.alm.ali.idea.content.settings.SettingsPanel.java

public SettingsPanel(final Project prj, Color bgColor) {
    this.prj = prj;
    this.projectConf = prj.getComponent(AliProjectConfiguration.class);

    previewAndConnection = new JPanel(new GridBagLayout());
    previewAndConnection.setOpaque(false);
    GridBagConstraints c2 = new GridBagConstraints();
    c2.gridx = 0;/*  w w w .j a va2s  . c  o m*/
    c2.gridy = 1;
    c2.gridwidth = 2;
    c2.weighty = 1;
    c2.fill = GridBagConstraints.VERTICAL;
    JPanel filler = new JPanel();
    filler.setOpaque(false);
    previewAndConnection.add(filler, c2);

    passwordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    passwordPanel.setBackground(bgColor);
    JLabel label = new JLabel("Password");
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    passwordPanel.add(label);
    final JPasswordField password = new JPasswordField(24);
    passwordPanel.add(password);
    JButton connect = new JButton("Login");
    passwordPanel.add(connect);
    final JLabel message = new JLabel();
    passwordPanel.add(message);
    ActionListener connectionAction = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            try {
                checkConnection(projectConf.getLocation(), projectConf.getDomain(), projectConf.getProject(),
                        projectConf.getUsername(), password.getText());
            } catch (AuthenticationFailed e) {
                message.setText(e.getMessage());
                return;
            }
            projectConf.ALM_PASSWORD = password.getText();
            projectConf.fireChanged();
        }
    };
    password.addActionListener(connectionAction);
    connect.addActionListener(connectionAction);

    restService = prj.getComponent(RestService.class);
    restService.addServerTypeListener(this);

    location = createTextPane(bgColor);
    domain = createTextPane(bgColor);
    project = createTextPane(bgColor);
    username = createTextPane(bgColor);

    final JPanel panel = new JPanel(new BorderLayout());
    panel.setBackground(bgColor);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    final JTextPane textPane = new JTextPane();
    textPane.setEditorKit(new HTMLEditorKit());
    textPane.setText(
            "<html><body>HP ALM integration can be configured on <a href=\"ide\">IDE</a> and overridden on <a href=\"project\">project</a> level.</body></html>");
    textPane.setEditable(false);
    textPane.addHyperlinkListener(this);
    textPane.setBackground(bgColor);
    textPane.setCaret(new NonAdjustingCaret());
    panel.add(textPane, BorderLayout.CENTER);

    JPanel content = new JPanel(new BorderLayout());
    content.setBackground(bgColor);
    content.add(panel, BorderLayout.NORTH);
    content.add(previewAndConnection, BorderLayout.WEST);

    preview = new JPanel(new GridBagLayout()) {
        public Dimension getPreferredSize() {
            Dimension dim = super.getPreferredSize();
            // make enough room for the connection status message
            dim.width = Math.max(dim.width, 300);
            return dim;
        }

        public Dimension getMinimumSize() {
            return getPreferredSize();
        }
    };
    connectedTo(restService.getServerTypeIfAvailable());
    preview.setBackground(bgColor);

    final GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 2;
    c.anchor = GridBagConstraints.WEST;
    preview.add(location, c);
    c.gridwidth = 1;
    c.gridy++;
    preview.add(domain, c);
    c.gridy++;
    preview.add(project, c);
    c.gridy++;
    preview.add(username, c);
    c.gridx++;
    c.gridy--;
    c.gridheight = 2;
    c.weightx = 0;
    c.anchor = GridBagConstraints.SOUTHEAST;
    final LinkLabel reload = new LinkLabel("Reload", IconLoader.getIcon("/actions/sync.png"));
    reload.setListener(new LinkListener() {
        public void linkSelected(LinkLabel linkLabel, Object o) {
            projectConf.fireChanged();
        }
    }, null);
    preview.add(reload, c);

    JPanel previewNorth = new JPanel(new BorderLayout());
    previewNorth.setBackground(bgColor);
    previewNorth.add(preview, BorderLayout.NORTH);

    addToGridBagPanel(0, 0, previewAndConnection, previewNorth);

    setBackground(bgColor);
    setLayout(new BorderLayout());
    add(content, BorderLayout.CENTER);

    onChanged();
    ApplicationManager.getApplication().getComponent(AliConfiguration.class).addListener(this);
    projectConf.addListener(this);
}

From source file:com.digitalgeneralists.assurance.ui.components.ScanDefinitionPanel.java

@Override
protected void initializeComponent() {
    if (!this.initialized) {
        if (this.definition == null) {
            mode = AssuranceDialogMode.ADD;
            this.dialogTitle = "Add New Scan Definition";
            this.definition = new ScanDefinition();
        } else {//from ww  w.j av  a  2s.  c o m
            mode = AssuranceDialogMode.EDIT;
            this.dialogTitle = "Edit Scan Definition";
        }

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

        final JPanel optionsPanel = new JPanel();
        optionsPanel.setLayout(new GridBagLayout());

        Border optionsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        optionsBorder = BorderFactory.createTitledBorder(optionsBorder, "Merge Options", TitledBorder.CENTER,
                TitledBorder.TOP);

        GridBagConstraints nameTextFieldConstraints = new GridBagConstraints();
        nameTextFieldConstraints.anchor = GridBagConstraints.NORTH;
        nameTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        nameTextFieldConstraints.gridx = 0;
        nameTextFieldConstraints.gridy = 0;
        nameTextFieldConstraints.weightx = 1.0;
        nameTextFieldConstraints.weighty = 1.0;
        nameTextFieldConstraints.gridheight = 1;
        nameTextFieldConstraints.gridwidth = 2;
        nameTextFieldConstraints.insets = new Insets(10, 5, 0, 5);

        this.nameTextField.setText(this.definition.getName());
        this.nameTextField.getDocument().addDocumentListener(this.textPropertyValidationListener);
        this.add(this.nameTextField, nameTextFieldConstraints);

        Border existingScanMappingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        existingScanMappingsPanelBorder = BorderFactory.createTitledBorder(existingScanMappingsPanelBorder,
                "Paths", TitledBorder.CENTER, TitledBorder.TOP);

        GridBagConstraints existingScanMappingsPanelConstraints = new GridBagConstraints();
        existingScanMappingsPanelConstraints.anchor = GridBagConstraints.WEST;
        existingScanMappingsPanelConstraints.fill = GridBagConstraints.BOTH;
        existingScanMappingsPanelConstraints.gridx = 0;
        existingScanMappingsPanelConstraints.gridy = 1;
        existingScanMappingsPanelConstraints.weightx = 1.0;
        existingScanMappingsPanelConstraints.weighty = 1.0;
        existingScanMappingsPanelConstraints.gridheight = 1;
        existingScanMappingsPanelConstraints.gridwidth = 2;
        existingScanMappingsPanelConstraints.insets = new Insets(5, 5, 0, 5);

        JPanel existingScanMappingsPanel = new JPanel();
        GridBagLayout panelGridbag = new GridBagLayout();
        existingScanMappingsPanel.setLayout(panelGridbag);
        existingScanMappingsPanel.setBorder(existingScanMappingsPanelBorder);
        this.add(existingScanMappingsPanel, existingScanMappingsPanelConstraints);

        GridBagConstraints existingScanMappingsListConstraints = new GridBagConstraints();
        existingScanMappingsListConstraints.anchor = GridBagConstraints.WEST;
        existingScanMappingsListConstraints.fill = GridBagConstraints.BOTH;
        existingScanMappingsListConstraints.gridx = 0;
        existingScanMappingsListConstraints.gridy = 0;
        existingScanMappingsListConstraints.weightx = 1.0;
        existingScanMappingsListConstraints.weighty = 0.9;
        existingScanMappingsListConstraints.gridheight = 1;
        existingScanMappingsListConstraints.gridwidth = 2;
        existingScanMappingsListConstraints.insets = new Insets(5, 5, 5, 5);

        this.definition = (ScanDefinition) ModelUtils.initializeEntity(this.definition,
                ScanDefinition.SCAN_MAPPING_PROPERTY);
        this.scanMappingsList = new ListInputPanel<ScanMappingDefinition>(this.definition, this);
        existingScanMappingsPanel.add(this.scanMappingsList, existingScanMappingsListConstraints);

        GridBagConstraints optionsPanelConstraints = new GridBagConstraints();
        optionsPanelConstraints.anchor = GridBagConstraints.SOUTH;
        optionsPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
        optionsPanelConstraints.gridx = 0;
        optionsPanelConstraints.gridy = 3;
        optionsPanelConstraints.weightx = 1.0;
        optionsPanelConstraints.weighty = 1.0;
        optionsPanelConstraints.gridheight = 1;
        optionsPanelConstraints.gridwidth = 2;
        optionsPanelConstraints.insets = new Insets(5, 5, 5, 5);

        optionsPanel.setBorder(optionsBorder);
        this.add(optionsPanel, optionsPanelConstraints);

        GridBagConstraints strategyLabelConstraints = new GridBagConstraints();
        strategyLabelConstraints.anchor = GridBagConstraints.WEST;
        strategyLabelConstraints.fill = GridBagConstraints.BOTH;
        strategyLabelConstraints.gridx = 0;
        strategyLabelConstraints.gridy = 0;
        strategyLabelConstraints.weightx = 1.0;
        strategyLabelConstraints.weighty = 1.0;
        strategyLabelConstraints.gridheight = 1;
        strategyLabelConstraints.gridwidth = 1;
        strategyLabelConstraints.insets = new Insets(5, 5, 0, 5);

        final JLabel strategyLabel = new JLabel("Strategy", SwingConstants.RIGHT);
        optionsPanel.add(strategyLabel, strategyLabelConstraints);

        GridBagConstraints strategyComboBoxConstraints = new GridBagConstraints();
        strategyComboBoxConstraints.anchor = GridBagConstraints.WEST;
        strategyComboBoxConstraints.fill = GridBagConstraints.VERTICAL;
        strategyComboBoxConstraints.gridx = 1;
        strategyComboBoxConstraints.gridy = 0;
        strategyComboBoxConstraints.weightx = 1.0;
        strategyComboBoxConstraints.weighty = 1.0;
        strategyComboBoxConstraints.gridheight = 1;
        strategyComboBoxConstraints.gridwidth = 1;
        strategyComboBoxConstraints.insets = new Insets(5, 5, 0, 5);

        String[] strategyLabels = { "Source", "Target", "Both" };
        this.strategyComboBox = new JComboBox<String>(strategyLabels);
        // NOTE: We should have better validation of the data state for these controls.
        // We could run into problems as the application versions over time.
        this.strategyComboBox.setSelectedIndex(this.definition.getMergeStrategy().ordinal());
        this.strategyComboBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.strategyComboBox, strategyComboBoxConstraints);

        GridBagConstraints autoMergeCheckBoxConstraints = new GridBagConstraints();
        autoMergeCheckBoxConstraints.gridx = 0;
        autoMergeCheckBoxConstraints.gridy = 1;
        autoMergeCheckBoxConstraints.weightx = 1.0;
        autoMergeCheckBoxConstraints.weighty = 1.0;
        autoMergeCheckBoxConstraints.gridheight = 1;
        autoMergeCheckBoxConstraints.gridwidth = 2;
        autoMergeCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.autoMergeCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.autoMergeCheckBox.setSelected(this.definition.getAutoResolveConflicts());
        this.autoMergeCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.autoMergeCheckBox, autoMergeCheckBoxConstraints);

        GridBagConstraints includeNonCreationTimestampsCheckBoxConstraints = new GridBagConstraints();
        includeNonCreationTimestampsCheckBoxConstraints.gridx = 0;
        includeNonCreationTimestampsCheckBoxConstraints.gridy = 2;
        includeNonCreationTimestampsCheckBoxConstraints.weightx = 1.0;
        includeNonCreationTimestampsCheckBoxConstraints.weighty = 1.0;
        includeNonCreationTimestampsCheckBoxConstraints.gridheight = 1;
        includeNonCreationTimestampsCheckBoxConstraints.gridwidth = 2;
        includeNonCreationTimestampsCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.includeNonCreationTimestampCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.includeNonCreationTimestampCheckBox.setSelected(this.definition.getIncludeNonCreationTimestamps());
        this.includeNonCreationTimestampCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.includeNonCreationTimestampCheckBox,
                includeNonCreationTimestampsCheckBoxConstraints);

        GridBagConstraints advancedAttributesCheckBoxConstraints = new GridBagConstraints();
        advancedAttributesCheckBoxConstraints.gridx = 0;
        advancedAttributesCheckBoxConstraints.gridy = 3;
        advancedAttributesCheckBoxConstraints.weightx = 1.0;
        advancedAttributesCheckBoxConstraints.weighty = 1.0;
        advancedAttributesCheckBoxConstraints.gridheight = 1;
        advancedAttributesCheckBoxConstraints.gridwidth = 2;
        advancedAttributesCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.includeAdvancedAttributesCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.includeAdvancedAttributesCheckBox.setSelected(this.definition.getAutoResolveConflicts());
        this.includeAdvancedAttributesCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.includeAdvancedAttributesCheckBox, advancedAttributesCheckBoxConstraints);

        this.scanMappingsList.loadData();

        if (this.getMode() == AssuranceDialogMode.EDIT) {
            this.validateFormState();
        }

        this.initialized = true;
    }
}