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

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

Introduction

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

Prototype

public CellConstraints xywh(int col, int row, int colSpan, int rowSpan) 

Source Link

Document

Sets the column, row, width, and height; uses default alignments.

Examples:

 cc.xywh(1, 3, 2, 1); cc.xywh(1, 3, 7, 3); 

Usage

From source file:hu.pagavcs.client.gui.repobrowser.RepoBrowserGui.java

License:Open Source License

public void display() throws SVNException {
    FormLayout layout = new FormLayout("right:p, 2dlu,p:g,p", "p,2dlu,p,2dlu,p:g,2dlu,p");
    JPanel pnlMain = new JPanel(layout);
    CellConstraints cc = new CellConstraints();
    lblWorkingCopy = new Label();
    sfUrl = new EditField();
    sfUrl.addFocusListener(new FocusListener() {

        public void focusLost(FocusEvent e) {
            try {
                urlChanged();/*from   w w w.j ava 2s .  c  o  m*/
            } catch (Exception ex) {
                Manager.handle(ex);
            }
        }

        public void focusGained(FocusEvent e) {
        }
    });
    sfUrl.addKeyListener(new KeyAdapter() {

        public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == '\n') {
                try {
                    urlChanged();
                } catch (Exception ex) {
                    Manager.handle(ex);
                }
            }
        }
    });

    JButton btnRefresh = new JButton(new RefreshNodeAction());

    lblStatus = new Label();
    tree = new Tree();
    tree.addTreeWillExpandListener(this);
    tree.addMouseListener(new PopupupMouseListener());

    tree.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F5"), "REFRESH_SVN_TREE");
    tree.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("control R"),
            "REFRESH_SVN_TREE");
    tree.getActionMap().put("REFRESH_SVN_TREE", new RefreshNodeAction());

    tree.setCellRenderer(new RepoTreeCellRender());
    treeWorking();

    pnlMain.add(new JLabel("URL:"), cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfUrl, cc.xywh(3, 1, 1, 1));
    pnlMain.add(btnRefresh, cc.xywh(4, 1, 1, 1));

    pnlMain.add(new JLabel("Working copy:"), cc.xywh(1, 3, 1, 1));
    pnlMain.add(lblWorkingCopy, cc.xywh(3, 3, 1, 1));

    pnlMain.add(new JScrollPane(tree), cc.xywh(1, 5, 4, 1, CellConstraints.FILL, CellConstraints.FILL));

    pnlMain.add(lblStatus, cc.xywh(4, 7, 1, 1));

    frame = GuiHelper.createAndShowFrame(pnlMain, "Repository Browser");
}

From source file:hu.pagavcs.client.gui.SwitchGui.java

License:Open Source License

public void display() throws SVNException {
    FormLayout layout = new FormLayout("right:p, 2dlu,p:g, p", "p,2dlu,p,2dlu,p,4dlu,p,2dlu,p,2dlu,p,4dlu,p");
    JPanel pnlMain = new JPanel(layout);
    CellConstraints cc = new CellConstraints();

    Label lblWorkingCopy = new Label("Path:");
    sfWorkingCopy = new EditField(switchOp.getPath());
    sfWorkingCopy.setEditable(false);//from  w w  w .  java  2s  .co  m
    Label lblRepo = new Label("Repository:");
    sfRepo = new EditField();
    sfRepo.setEditable(false);
    btnShowLog = new JButton(new ShowLogAction());

    sfSwitchToUrl = new EditField();
    sfSwitchToRevision = new EditField();
    btnSwitch = new JButton(new SwitchAction());

    lblStatus = new Label(" ");
    prgBusy = new ProgressBar(this);

    pnlMain.add(lblWorkingCopy, cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfWorkingCopy, cc.xywh(3, 1, 2, 1));
    pnlMain.add(lblRepo, cc.xywh(1, 3, 1, 1));
    pnlMain.add(sfRepo, cc.xywh(3, 3, 2, 1));
    pnlMain.add(btnShowLog, cc.xywh(4, 5, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 6, 4, 1));
    pnlMain.add(new JLabel("To url:"), cc.xywh(1, 7, 1, 1));
    pnlMain.add(sfSwitchToUrl, cc.xywh(3, 7, 2, 1));
    pnlMain.add(new JLabel("Revison:"), cc.xywh(1, 9, 1, 1));
    pnlMain.add(sfSwitchToRevision, cc.xywh(3, 9, 2, 1));
    pnlMain.add(btnSwitch, cc.xywh(4, 11, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 12, 4, 1));
    pnlMain.add(prgBusy, cc.xywh(1, 13, 3, 1));
    pnlMain.add(lblStatus, cc.xywh(4, 13, 1, 1));

    frame = GuiHelper.createAndShowFrame(pnlMain, "Switch", "switch-app-icon.png");
    frame.setTitlePrefix(switchOp.getPath());
}

From source file:hu.pagavcs.client.gui.UpdateToRevisionGui.java

License:Open Source License

public void display() throws SVNException {
    FormLayout layout = new FormLayout("right:p, 2dlu,p:g, p",
            "p,2dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,2dlu,p,4dlu,p,4dlu,p");
    JPanel pnlMain = new JPanel(layout);
    CellConstraints cc = new CellConstraints();

    Label lblWorkingCopy = new Label("Path:");
    sfWorkingCopy = new EditField(other.getPath());
    sfWorkingCopy.setEditable(false);/*from   w w w.j  ava  2  s . c  o m*/
    Label lblRepo = new Label("Repository:");
    sfRepo = new EditField();
    sfRepo.setEditable(false);
    btnShowLog = new JButton(new ShowLogAction());

    sfUpdateTo = new EditField();
    btnUpdateToRevision = new JButton(new UpdateToRevisionAction());

    lblStatus = new Label(" ");
    prgBusy = new ProgressBar(this);

    pnlMain.add(lblWorkingCopy, cc.xywh(1, 1, 1, 1));
    pnlMain.add(sfWorkingCopy, cc.xywh(3, 1, 2, 1));
    pnlMain.add(lblRepo, cc.xywh(1, 3, 1, 1));
    pnlMain.add(sfRepo, cc.xywh(3, 3, 2, 1));
    pnlMain.add(btnShowLog, cc.xywh(4, 5, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 6, 4, 1));
    pnlMain.add(new JLabel("Update to revision:"), cc.xywh(1, 7, 1, 1));
    pnlMain.add(sfUpdateTo, cc.xywh(3, 7, 2, 1));
    pnlMain.add(btnUpdateToRevision, cc.xywh(4, 9, 1, 1));

    pnlMain.add(new JSeparator(), cc.xywh(1, 10, 4, 1));
    pnlMain.add(prgBusy, cc.xywh(1, 11, 3, 1));
    pnlMain.add(lblStatus, cc.xywh(4, 11, 1, 1));

    frame = GuiHelper.createAndShowFrame(pnlMain, "Update to revision", "update-app-icon.png");
    frame.setTitlePrefix(other.getPath());
}

From source file:IceGridGUI.LiveDeployment.LogFilterDialog.java

License:Open Source License

LogFilterDialog(final ShowIceLogDialog dialog) {
    super(dialog, "Ice log filter - IceGrid Admin", true);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    java.util.Set<Ice.LogMessageType> messageTypeFilterSet = null;
    if (dialog.getMessageTypeFilter() != null) {
        messageTypeFilterSet = new java.util.HashSet<>(java.util.Arrays.asList(dialog.getMessageTypeFilter()));
    }/* ww w  .  j av  a2s .  com*/

    final JCheckBox error = new JCheckBox("Error",
            messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.ErrorMessage));
    final JCheckBox warning = new JCheckBox("Warning",
            messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.WarningMessage));
    final JCheckBox print = new JCheckBox("Print",
            messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.PrintMessage));
    final JCheckBox trace = new JCheckBox("Trace",
            messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.TraceMessage));

    final JTextArea traceCategories = new JTextArea(3, 40);
    traceCategories.setLineWrap(true);

    String[] traceCategoryFilter = dialog.getTraceCategoryFilter();
    if (traceCategoryFilter != null) {
        // TODO: join with escapes!
        traceCategories.setText(
                IceUtilInternal.StringUtil.joinString(java.util.Arrays.asList(traceCategoryFilter), ", "));
    } else {
        traceCategories.setText(null);
    }

    traceCategories.setToolTipText("Trace categories separated by commas; leave blank to get all categories");

    JButton okButton = new JButton("OK");
    ActionListener okListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String[] traceCategoryFilter = null;

            String txt = traceCategories.getText();
            if (txt != null && !txt.isEmpty()) {
                traceCategoryFilter = IceUtilInternal.StringUtil.splitString(txt, ", \t\r\n");
                if (traceCategoryFilter == null) {
                    // unmatched quote
                    JOptionPane.showMessageDialog(LogFilterDialog.this,
                            "Unmatched quote in Trace categories field", "Invalid entry",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }

                if (traceCategoryFilter.length == 0) // only separators
                {
                    traceCategoryFilter = null;
                }
            }

            java.util.Set<Ice.LogMessageType> messageTypeFilterSet = new java.util.HashSet<>();
            if (error.isSelected()) {
                messageTypeFilterSet.add(Ice.LogMessageType.ErrorMessage);
            }
            if (warning.isSelected()) {
                messageTypeFilterSet.add(Ice.LogMessageType.WarningMessage);
            }
            if (print.isSelected()) {
                messageTypeFilterSet.add(Ice.LogMessageType.PrintMessage);
            }
            if (trace.isSelected()) {
                messageTypeFilterSet.add(Ice.LogMessageType.TraceMessage);
            }
            if (messageTypeFilterSet.size() == 0 || messageTypeFilterSet.size() == 4) {
                // All or nothing checked equivalent of getting everything!
                messageTypeFilterSet = null;
            }
            Ice.LogMessageType[] messageTypeFilter = null;
            if (messageTypeFilterSet != null) {
                messageTypeFilter = messageTypeFilterSet.toArray(new Ice.LogMessageType[0]);
            }

            dispose();
            dialog.setFilters(messageTypeFilter, traceCategoryFilter);
        }
    };
    okButton.addActionListener(okListener);
    getRootPane().setDefaultButton(okButton);

    JButton cancelButton = new JButton("Cancel");
    ActionListener cancelListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    };
    cancelButton.addActionListener(cancelListener);

    FormLayout layout = new FormLayout("left:pref, 3dlu, fill:pref:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.border(Borders.DIALOG);
    builder.rowGroupingEnabled(true);
    builder.lineGapSize(LayoutStyle.getCurrent().getLinePad());

    builder.appendSeparator("Retrieve only the following types of log messages (server-side filtering)");
    builder.nextLine();
    builder.append(error);
    builder.nextLine();
    builder.append(warning);
    builder.nextLine();
    builder.append(print);
    builder.nextLine();
    builder.append(trace);
    builder.nextLine();
    builder.append("Trace categories");
    builder.nextLine();
    builder.append("");
    builder.nextRow(-2);
    CellConstraints cc = new CellConstraints();
    JScrollPane scrollPane = new JScrollPane(traceCategories);
    builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 1, 3));
    builder.nextRow(2);
    builder.nextLine();

    JComponent buttonBar = new ButtonBarBuilder().addGlue().addButton(okButton, cancelButton).build();
    buttonBar.setBorder(Borders.DIALOG);

    java.awt.Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    contentPane.add(builder.getPanel());
    contentPane.add(buttonBar);

    pack();
    setResizable(false);
    setLocationRelativeTo(dialog);
    setVisible(true);
}

From source file:imageviewer.ui.dialog.LoginDialog.java

License:Open Source License

public LoginDialog(String loginDialogText, String loginContextName, LoginInterface li) {

    super();/*from w  ww  . j a va  2 s. co m*/
    FormLayout fl = new FormLayout("pref,2dlu,right:pref:grow,2dlu,pref,2dlu,pref",
            "top:pref,4px:grow,pref,2px,pref,2px:grow,pref,2px,bottom:pref");
    setLayout(fl);
    setBorder(new EmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(260, 128));

    JTextArea loginDescription = DialogUtil.createTextArea(loginDialogText);
    JLabel loginIcon = new JLabel(LOGIN_ICON);
    JLabel loginLabel = new JLabel("Username", JLabel.TRAILING);
    JLabel passwordLabel = new JLabel("Password", JLabel.TRAILING);
    JSeparator separator = new JSeparator();
    separator.setPreferredSize(new Dimension(245, 5));

    clearButton.setActionCommand("clear");
    clearButton.addActionListener(this);
    loginButton.setActionCommand("login");
    loginButton.addActionListener(this);
    cancelButton.setActionCommand("cancel");
    cancelButton.addActionListener(this);
    pwf.setActionCommand("login");
    pwf.addActionListener(this);

    CellConstraints cc = new CellConstraints();
    add(loginDescription, cc.xywh(1, 1, 7, 1));
    add(loginIcon, cc.xywh(1, 3, 1, 3));
    add(loginLabel, cc.xy(3, 3));
    add(ltf, cc.xywh(5, 3, 3, 1));
    add(passwordLabel, cc.xy(3, 5));
    add(pwf, cc.xywh(5, 5, 3, 1));
    add(separator, cc.xywh(1, 7, 7, 1));
    add(clearButton, cc.xy(1, 9));
    add(loginButton, cc.xy(5, 9));
    add(cancelButton, cc.xy(7, 9));

    try {
        this.li = li;
        lc = new LoginContext(loginContextName, new LoginCallbackHandler());
    } catch (Exception exc) {
    }
}

From source file:imageviewer.ui.dialog.OpenDialogPanel.java

License:Open Source License

private JPanel createDirectoryPanel() {

    dirTreeTable = new JXTreeTable(new FileSystemModel());
    dirTreeTable.setHorizontalScrollEnabled(true);
    dirTreeTable.setRootVisible(false);//from ww  w  .  j a  va2  s  .co  m
    dirTreeTable.setShowsRootHandles(true);
    dirTreeTable.setShowHorizontalLines(true);
    dirTreeTable.setShowVerticalLines(true);
    dirTreeTable.setColumnMargin(1);
    dirTreeTable.setColumnControlVisible(false);
    dirTreeTable.setRolloverEnabled(true);
    dirTreeTable.setScrollsOnExpand(true);
    dirTreeTable.setTreeCellRenderer(new TreeTableCellRenderer());
    dirTreeTable.setAutoCreateColumnsFromModel(false);
    // dirTreeTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);

    ListSelectionModel lsm = dirTreeTable.getSelectionModel();
    lsm.addListSelectionListener(this);

    CompoundHighlighter cp = new CompoundHighlighter();
    cp.addHighlighter(new AlternateRowHighlighter(new Color(20, 30, 45), new Color(0, 10, 25), Color.white));
    cp.addHighlighter(new HierarchicalColumnHighlighter(new Color(40, 50, 65), Color.white));

    dirTreeTable.setHighlighters(cp);
    for (int i = 0; i < DIRECTORY_COLUMN_WIDTH.length; i++) {
        TableColumn column = dirTreeTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(DIRECTORY_COLUMN_WIDTH[i]);
        column.setHeaderRenderer(new TableHeaderRenderer(Color.black));
    }

    JScrollPane treeTableScrollPane = new JScrollPane(dirTreeTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    treeTableScrollPane.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    treeTableScrollPane.setPreferredSize(new Dimension(807, 450));
    JLabel directoryLabel = new JLabel("File explorer");
    JSeparator separator1 = new JSeparator();
    separator1.setPreferredSize(new Dimension(785, 5));

    FormLayout fl = new FormLayout(
            "pref,2dlu,pref,10px,pref,2dlu,pref,5px,pref,2dlu,pref,5px,pref,2dlu,pref,pref:grow",
            "pref,5px,pref,2dlu,pref,2px,pref");
    CellConstraints cc = new CellConstraints();

    JPanel dirOptionPanel = new JPanel(fl);
    JLabel dirOptionsLabel = new JLabel("File explorer options");
    JSeparator separator2 = new JSeparator();
    separator2.setPreferredSize(new Dimension(300, 5));
    JLabel openAsLabel = new JLabel("Open as", JLabel.TRAILING);

    JLabel rawFileLabel = new JLabel("Raw file parameters");
    JSeparator separator3 = new JSeparator();
    separator3.setPreferredSize(new Dimension(380, 5));

    imageWidthLabel.setEnabled(false);
    imageHeightLabel.setEnabled(false);
    bitsAllocatedLabel.setEnabled(false);
    bitsStoredLabel.setEnabled(false);
    fileOffsetLabel.setEnabled(false);
    numImagesLabel.setEnabled(false);

    imageWidthTextField.setEnabled(false);
    imageHeightTextField.setEnabled(false);
    bitsAllocatedTextField.setEnabled(false);
    bitsStoredTextField.setEnabled(false);
    fileOffsetTextField.setEnabled(false);
    numImagesTextField.setEnabled(false);
    openAsComboBox.addActionListener(this);

    dirOptionPanel.add(dirOptionsLabel, cc.xywh(1, 1, 3, 1));
    dirOptionPanel.add(separator2, cc.xywh(1, 3, 3, 1));
    dirOptionPanel.add(openAsLabel, cc.xy(1, 5));
    dirOptionPanel.add(openAsComboBox, cc.xy(3, 5));
    dirOptionPanel.add(recurseCheckBox, cc.xy(3, 7));

    dirOptionPanel.add(rawFileLabel, cc.xywh(5, 1, 11, 1));
    dirOptionPanel.add(separator3, cc.xywh(5, 3, 12, 1));
    dirOptionPanel.add(imageWidthLabel, cc.xy(5, 5));
    dirOptionPanel.add(imageWidthTextField, cc.xy(7, 5));
    dirOptionPanel.add(imageHeightLabel, cc.xy(5, 7));
    dirOptionPanel.add(imageHeightTextField, cc.xy(7, 7));
    dirOptionPanel.add(bitsAllocatedLabel, cc.xy(9, 5));
    dirOptionPanel.add(bitsAllocatedTextField, cc.xy(11, 5));
    dirOptionPanel.add(bitsStoredLabel, cc.xy(9, 7));
    dirOptionPanel.add(bitsStoredTextField, cc.xy(11, 7));
    dirOptionPanel.add(fileOffsetLabel, cc.xy(13, 5));
    dirOptionPanel.add(fileOffsetTextField, cc.xy(15, 5));
    dirOptionPanel.add(numImagesLabel, cc.xy(13, 7));
    dirOptionPanel.add(numImagesTextField, cc.xy(15, 7));

    openDirButton.setEnabled(false);
    closeDirButton.setSelected(true);
    SpringLayout buttonLayout = new SpringLayout();
    JPanel buttonPanel = new JPanel(buttonLayout);
    buttonPanel.setOpaque(false);
    buttonPanel.add(openDirButton);
    buttonPanel.add(closeDirButton);
    buttonLayout.putConstraint(SpringLayout.NORTH, openDirButton, 0, SpringLayout.NORTH, buttonPanel);
    buttonLayout.putConstraint(SpringLayout.WEST, openDirButton, 0, SpringLayout.WEST, buttonPanel);
    buttonLayout.putConstraint(SpringLayout.NORTH, closeDirButton, 0, SpringLayout.NORTH, buttonPanel);
    buttonLayout.putConstraint(SpringLayout.WEST, closeDirButton, 5, SpringLayout.EAST, openDirButton);
    buttonLayout.putConstraint(SpringLayout.EAST, buttonPanel, 0, SpringLayout.EAST, closeDirButton);
    buttonLayout.putConstraint(SpringLayout.SOUTH, buttonPanel, 0, SpringLayout.SOUTH, closeDirButton);

    SpringLayout layout = new SpringLayout();
    JPanel dirPanel = new JPanel(layout);
    dirPanel.add(dirOptionPanel);
    dirPanel.add(directoryLabel);
    dirPanel.add(separator1);
    dirPanel.add(treeTableScrollPane);
    dirPanel.add(buttonPanel);

    layout.putConstraint(SpringLayout.NORTH, dirOptionPanel, 0, SpringLayout.NORTH, dirPanel);
    layout.putConstraint(SpringLayout.WEST, dirOptionPanel, 0, SpringLayout.WEST, dirPanel);
    layout.putConstraint(SpringLayout.NORTH, directoryLabel, 0, SpringLayout.SOUTH, dirOptionPanel);
    layout.putConstraint(SpringLayout.WEST, directoryLabel, 0, SpringLayout.WEST, dirPanel);
    layout.putConstraint(SpringLayout.NORTH, separator1, 5, SpringLayout.SOUTH, directoryLabel);
    layout.putConstraint(SpringLayout.WEST, separator1, 0, SpringLayout.WEST, dirPanel);
    layout.putConstraint(SpringLayout.NORTH, treeTableScrollPane, 5, SpringLayout.SOUTH, separator1);
    layout.putConstraint(SpringLayout.WEST, treeTableScrollPane, 0, SpringLayout.WEST, dirPanel);
    layout.putConstraint(SpringLayout.NORTH, buttonPanel, 5, SpringLayout.SOUTH, treeTableScrollPane);
    layout.putConstraint(SpringLayout.EAST, buttonPanel, 0, SpringLayout.EAST, dirPanel);
    layout.putConstraint(SpringLayout.EAST, dirPanel, 5, SpringLayout.EAST, separator1);
    layout.putConstraint(SpringLayout.SOUTH, dirPanel, 0, SpringLayout.SOUTH, buttonPanel);
    return dirPanel;
}

From source file:imageviewer.ui.dialog.OpenDialogPanel.java

License:Open Source License

private JPanel createArchiveSearchFieldSubPanel() {

    FormLayout fl = new FormLayout(
            "pref,2dlu,pref:grow,5dlu,pref,2dlu,pref,5dlu,pref,2dlu,pref,5dlu,pref,2dlu,120px,5dlu,pref",
            "pref,2dlu,pref");
    JPanel searchPanel = new JPanel(fl);

    startDatePicker.getMonthView().setAntialiased(true);
    startDatePicker.getMonthView().setBoxPaddingX(1);
    startDatePicker.getMonthView().setBoxPaddingY(1);
    startDatePicker.getMonthView().setSelectionMode(JXMonthView.SelectionMode.SINGLE_SELECTION);
    startDatePicker.getEditor().setValue(null);
    startDatePicker.setLinkPanel(null);/*from  w  ww.ja  v a 2 s .  com*/
    endDatePicker.getMonthView().setAntialiased(true);
    endDatePicker.getMonthView().setBoxPaddingX(1);
    endDatePicker.getMonthView().setBoxPaddingY(1);
    endDatePicker.getMonthView().setSelectionMode(JXMonthView.SelectionMode.SINGLE_SELECTION);
    endDatePicker.getEditor().setValue(null);
    endDatePicker.setLinkPanel(null);

    searchButton.setActionCommand("search");
    searchButton.addActionListener(this);
    clearFieldButton.setActionCommand("clear");
    clearFieldButton.addActionListener(this);

    CellConstraints cc = new CellConstraints();
    searchPanel.add(patientNameLabel, cc.xy(1, 1));
    searchPanel.add(patientNameField, cc.xy(3, 1));
    searchPanel.add(descriptionLabel, cc.xy(5, 1));
    searchPanel.add(descriptionField, cc.xywh(7, 1, 5, 1));
    searchPanel.add(startDateLabel, cc.xy(13, 1));
    searchPanel.add(startDatePicker, cc.xy(15, 1));
    searchPanel.add(clearFieldButton, cc.xy(17, 1));
    searchPanel.add(patientIDLabel, cc.xy(1, 3));
    searchPanel.add(patientIDField, cc.xy(3, 3));
    searchPanel.add(modalityLabel, cc.xy(5, 3));
    searchPanel.add(modalityField, cc.xy(7, 3));
    searchPanel.add(anatomyLabel, cc.xy(9, 3));
    searchPanel.add(anatomyField, cc.xy(11, 3));
    searchPanel.add(endDateLabel, cc.xy(13, 3));
    searchPanel.add(endDatePicker, cc.xy(15, 3));
    searchPanel.add(searchButton, cc.xy(17, 3));

    patientIDField.setActionCommand("search");
    patientIDField.addActionListener(this);
    patientNameField.setActionCommand("search");
    patientNameField.addActionListener(this);
    descriptionField.setActionCommand("search");
    descriptionField.addActionListener(this);
    modalityField.setActionCommand("search");
    modalityField.addActionListener(this);
    anatomyField.setActionCommand("search");
    anatomyField.addActionListener(this);

    return searchPanel;
}

From source file:imageviewer.ui.dialog.OpenOptionsPanel.java

License:Open Source License

private JPanel createRightPanel() {

    JPanel containerPanel = new JPanel(new BorderLayout(10, 0));

    JLabel localArchiveLabel = new JLabel("Local archive properties", JLabel.LEFT);
    JLabel purgeNowLabel = new JLabel("Verify archive", JLabel.LEFT);
    JLabel updateLabel = new JLabel("Update archive", JLabel.LEFT);
    JLabel archiveDirectoryLabel = new JLabel("Local archive directory", JLabel.LEFT);

    JTextArea purgeDescription = DialogUtil.createTextArea(
            "Verifying the archive allows the system to check that the contents of the archive are valid.  File paths and images "
                    + "are checked against the local hard drive.  Images that cannot be found are removed.  Completing the verify process "
                    + "may take several minutes dependent on the size of your archive, and will occur in the background.");
    JTextArea updateDescription = DialogUtil
            .createTextArea("Specify a directory for immediate updating into the local archive.");
    JTextArea startupDirectoryDescription = DialogUtil.createTextArea(
            "Specify the directory that will be used to update the local archive when imageViewer starts.");

    JSeparator separator1 = new JSeparator();
    separator1.setPreferredSize(new Dimension(225, 5));
    JSeparator separator2 = new JSeparator();
    separator2.setPreferredSize(new Dimension(225, 5));
    JSeparator separator3 = new JSeparator();
    separator3.setPreferredSize(new Dimension(225, 5));
    JSeparator separator4 = new JSeparator();
    separator4.setPreferredSize(new Dimension(225, 5));

    FormLayout fl = new FormLayout("pref,2dlu,22px,2dlu,pref",
            "pref,5px,pref,5px,pref,2px,pref,2px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref");
    CellConstraints cc = new CellConstraints();

    JPanel archivePropertyPanel = new JPanel(fl);
    archivePropertyPanel.add(localArchiveLabel, cc.xywh(1, 1, 5, 1));
    archivePropertyPanel.add(separator1, cc.xywh(1, 3, 5, 1));
    archivePropertyPanel.add(updateArchiveOnStartCheckBox, cc.xywh(1, 5, 5, 1));
    archivePropertyPanel.add(purgeArchiveOnStartCheckBox, cc.xywh(1, 7, 5, 1));
    archivePropertyPanel.add(allowFindCheckBox, cc.xywh(1, 9, 5, 1));
    archivePropertyPanel.add(purgeNowLabel, cc.xywh(1, 11, 5, 1));
    archivePropertyPanel.add(separator2, cc.xywh(1, 13, 5, 1));
    archivePropertyPanel.add(purgeDescription, cc.xywh(1, 15, 5, 1));
    archivePropertyPanel.add(purgeButton, cc.xywh(1, 17, 5, 1, CellConstraints.RIGHT, CellConstraints.BOTTOM));
    archivePropertyPanel.add(archiveDirectoryLabel, cc.xywh(1, 19, 5, 1));
    archivePropertyPanel.add(separator4, cc.xywh(1, 21, 5, 1));
    archivePropertyPanel.add(startupDirectoryDescription, cc.xywh(1, 23, 5, 1));
    archivePropertyPanel.add(startupDirectory, cc.xy(1, 25));
    archivePropertyPanel.add(selectStartDirButton, cc.xy(3, 25));
    archivePropertyPanel.add(updateLabel, cc.xywh(1, 27, 5, 1));
    archivePropertyPanel.add(separator3, cc.xywh(1, 29, 5, 1));
    archivePropertyPanel.add(updateDescription, cc.xywh(1, 31, 5, 1));
    archivePropertyPanel.add(updateDir, cc.xy(1, 33));
    archivePropertyPanel.add(updateDirButton, cc.xy(3, 33));
    archivePropertyPanel.add(runUpdateButton, cc.xy(5, 33));

    updateDir.setActionCommand("runUpdate");
    updateDir.addActionListener(this);

    containerPanel.add(archivePropertyPanel, BorderLayout.WEST);
    return containerPanel;
}

From source file:imageviewer.ui.dialog.OpenTrackingPanel.java

License:Open Source License

public OpenTrackingPanel() {

    super();//from  w  w w  . j ava  2 s.  c o m

    JTextArea trackerDescription = DialogUtil.createTextArea(
            "The image tracker provides detailed information on the status of requested studies/series.  "
                    + "Approximate statistics on the data transfer rate are shown below and are dependent on your network speed.  "
                    + "Transfers over slower networks may benefit from optional stream compression (see Advanced options tab).");

    FormLayout fl = new FormLayout("670px,5px,pref:grow,2dlu,pref,2dlu,right:pref",
            "pref,5px,pref,5px,pref,5px,pref,5px,pref:grow,5px,pref");
    setLayout(fl);
    setBorder(new EmptyBorder(5, 5, 5, 5));

    trackingTable = new JXTable(model) {
        final TableCellRenderer tcr = new BarCellRenderer();

        public TableCellRenderer getCellRenderer(int row, int column) {
            if (column == 4)
                return tcr;
            else
                return super.getCellRenderer(row, column);
        }
    };

    trackingTable.setHorizontalScrollEnabled(true);
    trackingTable.setShowHorizontalLines(true);
    trackingTable.setShowVerticalLines(true);
    trackingTable.setColumnMargin(1);
    trackingTable.setColumnControlVisible(false);
    trackingTable.setRolloverEnabled(true);
    trackingTable.setRowSelectionAllowed(false);

    CompoundHighlighter cp = new CompoundHighlighter();
    cp.addHighlighter(new AlternateRowHighlighter(ROW_COLOR1, ROW_COLOR2, Color.white));
    trackingTable.setHighlighters(cp);
    for (int i = 0; i < COLUMN_WIDTH.length; i++) {
        TableColumn column = trackingTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(COLUMN_WIDTH[i]);
        column.setHeaderRenderer(new TableHeaderRenderer(Color.black));
    }

    JScrollPane sp = new JScrollPane(trackingTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    sp.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    sp.setPreferredSize(new Dimension(785, 450));

    closeButton.setActionCommand("close");
    closeButton.addActionListener(this);
    clearCompletedButton.setActionCommand("clearCompleted");
    clearCompletedButton.addActionListener(this);
    clearErrorButton.setActionCommand("clearFailed");
    clearErrorButton.addActionListener(this);
    clearCompletedTrackCheckBox.setSelected(true);

    CellConstraints cc = new CellConstraints();
    add(sp, cc.xywh(1, 1, 1, 9));
    add(trackerDescription, cc.xywh(3, 1, 5, 1));
    add(clearCompletedTrackCheckBox, cc.xywh(3, 3, 5, 1));
    add(clearCompletedButton, cc.xy(5, 5));
    add(clearErrorButton, cc.xy(7, 5));
    add(new JSeparator(), cc.xywh(3, 9, 5, 1));
    add(closeButton, cc.xy(7, 11));
}

From source file:imageviewer.ui.dialog.PreferencesGeneralPanel.java

License:Open Source License

public PreferencesGeneralPanel(PreferencesDialog pd) {

    super();/*www . ja  va2  s .  c o m*/
    initializeCheckBoxes();
    setPreferredSize(new Dimension(385, 360));

    JTextArea initialPrefsDescription = DialogUtil.createTextArea(
            "Preferences shown below are used on starting the imageViewer application. These preferences are stored "
                    + "in the corresponding XML configuration file.  Specific information on each preference is given in the tooltip.");
    JTextArea warningDescription = DialogUtil.createTextArea(
            "You can selectively toggle the state of application warnings that are given on various actions.");
    JTextArea undoDescription = DialogUtil.createTextArea(
            "The number of undo levels stored by the application determines the number of actions that are stored in an undo/redo stack.  "
                    + "Increasing the number of levels will permit more changes, but also requires more memory.");

    FormLayout fl = new FormLayout("10px,pref,10px,pref:grow,10px",
            "10px,pref,5px,pref,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,10px,pref");
    setLayout(fl);

    CellConstraints cc = new CellConstraints();
    add(initialPrefsDescription, cc.xywh(2, 2, 3, 1));
    add(optionBoxes[Options.DISPLAY_IMAGE_INFORMATION.ordinal()], cc.xy(2, 4));
    add(optionBoxes[Options.DISPLAY_GRID.ordinal()], cc.xy(4, 4));
    add(optionBoxes[Options.DISPLAY_PARTIAL_PANELS.ordinal()], cc.xy(2, 5));
    add(new JSeparator(), cc.xywh(2, 7, 3, 1));
    add(warningDescription, cc.xywh(2, 9, 3, 1));
    add(optionBoxes[Options.ASK_CHANGE_LAYOUT.ordinal()], cc.xy(2, 11));
    add(optionBoxes[Options.ASK_CLOSE_TAB.ordinal()], cc.xy(4, 11));
    add(new JSeparator(), cc.xywh(2, 13, 3, 1));
    add(undoDescription, cc.xywh(2, 15, 3, 1));

    Integer ul = (Integer) ApplicationContext.getContext().getProperty(ApplicationContext.UNDO_LEVEL);
    if (ul != null)
        undoLevelsSpinner.setValue(ul);
    else
        undoLevelsSpinner.setEnabled(false);
    undoLevelsSpinner.addChangeListener(this);

    JLabel undoLevelsLabel = new JLabel("Number of undo levels");
    JPanel undoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0));
    undoPanel.add(undoLevelsLabel);
    undoPanel.add(undoLevelsSpinner);
    add(undoPanel, cc.xywh(2, 17, 3, 1, CellConstraints.CENTER, CellConstraints.CENTER));
    this.pd = pd;
}