Example usage for javax.swing JComponent setVisible

List of usage examples for javax.swing JComponent setVisible

Introduction

In this page you can find the example usage for javax.swing JComponent setVisible.

Prototype

@BeanProperty(hidden = true, visualUpdate = true)
public void setVisible(boolean aFlag) 

Source Link

Document

Makes the component visible or invisible.

Usage

From source file:org.eobjects.datacleaner.windows.ResultWindow.java

protected void updateButtonVisibility(boolean running) {
    _cancelButton.setVisible(running);/*from   w  w  w.j  av a2s .  co m*/

    for (JComponent pluggableButton : _pluggableButtons) {
        pluggableButton.setVisible(!running);
    }
    _saveButton.setVisible(!running);
    _publishButton.setVisible(!running);
    _exportButton.setVisible(!running);
}

From source file:org.rdv.DockingDataPanelManager.java

private DockingView generateStaticView(int viewId) {

    DockingView dv = (DockingView) viewMap_.getView(viewId);
    if (dv != null) {
        return dv;
    } else {/*  w w  w  .j  a  va2 s . c o m*/
        switch (viewId) {
        case PanelManagerView.AUDIO_PLAYER_VIEW_ID:
            JComponent audioPlayerComp = mainPanel_.getAudioPlayerComponent();
            audioPlayerComp.setVisible(true);
            dv = new DockingView(PanelManagerView.AUDIO_PLAYER_VIEW_ID, "Audio Player", null, audioPlayerComp);
            break;
        case PanelManagerView.CHANNEL_LIST_VIEW_ID:
            dv = new DockingView(PanelManagerView.CHANNEL_LIST_VIEW_ID, "Channel List", null,
                    mainPanel_.getChannelListComponent());
            break;
        case PanelManagerView.CONTROL_VIEW_ID:
            dv = new DockingView(PanelManagerView.CONTROL_VIEW_ID, "Control", null,
                    mainPanel_.getControlComponent());
            break;
        default:
            dv = new DockingView(PanelManagerView.MARKER_VIEW_ID, "Event Marker", null,
                    mainPanel_.getMarkerSubmitComponent());
            break;
        }
        viewMap_.addView(viewId, dv);
        return dv;
    }
}

From source file:org.springframework.richclient.application.support.AbstractApplicationWindow.java

protected JComponent createStatusBarControl() {
    JComponent statusBarControl = statusBar.getControl();
    statusBarControl.setVisible(getWindowConfigurer().getShowStatusBar());
    return statusBarControl;
}

From source file:org.ut.biolab.medsavant.client.project.ProjectWizard.java

private AbstractWizardPage getCreatePage() {
    //setup page/*w w  w .  j  av a  2 s.  c  o  m*/
    final DefaultWizardPage page = new DefaultWizardPage(PAGENAME_CREATE) {
        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
        }
    };
    page.addText("You are now ready to " + (modify ? "make changes to" : "create") + " this project. ");

    final JLabel progressLabel = new JLabel("");

    page.addComponent(progressLabel);

    final JButton workButton = new JButton((modify ? "Modify Project" : "Create Project"));
    final JButton publishButton = new JButton("Publish Variants");

    final JComponent j = new JLabel(
            "<html><p>You may continue. The import process will continue in the< background and you will be notified upon completion.</p></html>");

    workButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            j.setVisible(true);
            page.fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);

            workButton.setEnabled(false);

            new ProjectWorker<Void>("Modifying project", autoPublish.isSelected(),
                    LoginController.getSessionID(), projectID) {
                @Override
                protected Void runInBackground() throws Exception {
                    LOG.info("Requesting modification from server");
                    modifyProject(true, true, true, this);
                    LOG.info("Modification complete");
                    return null;
                }
            }.execute();

            toFront();
        }
    });

    page.addComponent(ViewUtil.alignRight(workButton));

    page.addComponent(j);
    j.setVisible(false);

    if (modify) {
        page.addComponent(ViewUtil.alignRight(publishButton));
        publishButton.setVisible(false);
    }

    return page;
}

From source file:org.ut.biolab.medsavant.client.variant.ImportVariantsWizard.java

private AbstractWizardPage getQueuePage() {
    final DefaultWizardPage page = new DefaultWizardPage("Transfer, Annotate, and Publish Variants") {
        private static final double UPLOAD_FILES_PERCENT = 20.0;
        private static final double UPDATE_DATABASE_PERCENT = 80.0;
        private final JLabel progressLabel = new JLabel("You are now ready to import variants.");
        //private final JProgressBar progressBar = new JProgressBar();
        private final JButton workButton = new JButton("Import");
        //private final JButton publishButton = new JButton("Publish Variants");
        //private final JCheckBox autoPublishVariants = new JCheckBox("Automatically publish variants after import");
        //private final JLabel publishProgressLabel = new JLabel("Ready to publish variants.");
        //private final JProgressBar publishProgressBar = new JProgressBar();
        private boolean inUploading = false;

        {//w  ww. j a va  2  s.  c om
            addComponent(progressLabel);
            //addComponent(progressBar);

            final JComponent j = new JLabel(
                    "<html>You may continue. The import process will continue in the<br>background and you will be notified upon completion.</html>");
            addComponent(j);
            j.setVisible(false);

            final DefaultWizardPage page = this;

            //autoPublishVariants.setOpaque(false);

            workButton.addActionListener(new ActionListener() {
                private int notificationId;
                private MedSavantWorker<Void> variantWorker;

                @Override
                public void actionPerformed(ActionEvent ae) {

                    LOG.info("Starting import worker");
                    workButton.setEnabled(false);
                    j.setVisible(true);
                    page.fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.BACK);
                    page.fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);

                    new ProjectWorker<Void>("Importing variants", autoPublish.isSelected(),
                            LoginController.getSessionID(),
                            ProjectController.getInstance().getCurrentProjectID()) {
                        private int fileIndex = 0;

                        @Override
                        protected Void backgroundTask() throws Exception {
                            String email = emailField.getText();
                            if (email.isEmpty()) {
                                email = null;
                            }

                            if (uploadRequired) {
                                setIndeterminate(false);
                                inUploading = true;
                                LOG.info("Creating input streams");
                                int[] transferIDs = new int[variantFiles.length];
                                for (File file : variantFiles) {
                                    LOG.info("Created input stream for file");
                                    notification.setStatusMessage("Uploading " + file.getName());
                                    //progressLabel.setText("Uploading " + file.getName() + " to server...");
                                    transferIDs[fileIndex] = ClientNetworkUtils.copyFileToServer(file);
                                    fileIndex++;
                                }
                                notification.setStatusMessage("Importing variants");
                                inUploading = false;
                                setIndeterminate(true);
                                manager.uploadVariants(LoginController.getInstance().getSessionID(),
                                        transferIDs, ProjectController.getInstance().getCurrentProjectID(),
                                        ReferenceController.getInstance().getCurrentReferenceID(),
                                        tagsToStringArray(variantTags), includeHomoRef, email, false);
                                LOG.info("Import complete");
                            } else {
                                LOG.info("Importing variants stored on server");
                                notification.setStatusMessage("Importing variants");
                                manager.uploadVariants(LoginController.getInstance().getSessionID(),
                                        new File(serverPathField.getText()),
                                        ProjectController.getInstance().getCurrentProjectID(),
                                        ReferenceController.getInstance().getCurrentReferenceID(),
                                        tagsToStringArray(variantTags), includeHomoRef, email, false);
                                LOG.info("Done importing");
                            }
                            return null;
                        }

                        @Override
                        protected void showProgress(double fract) {
                            double prog;
                            if (uploadRequired) {
                                if (inUploading) {
                                    // The fraction will be a percentage of the current file.  We have multiple files making up
                                    // the UPLOAD_FILES_PERCENT.
                                    prog = UPLOAD_FILES_PERCENT * (fileIndex + fract) / variantFiles.length;
                                } else {
                                    prog = UPLOAD_FILES_PERCENT + fract * UPDATE_DATABASE_PERCENT;
                                }
                            } else {
                                prog = fract * 100.0;
                            }
                            notification.setProgress(prog / 100.0);
                        }

                        @Override
                        protected ProgressStatus checkProgress() throws RemoteException {
                            ProgressStatus stat;
                            if (inUploading) {
                                stat = MedSavantClient.NetworkManager.checkProgress(
                                        LoginController.getInstance().getSessionID(), isCancelled());
                            } else {
                                try {
                                    stat = manager.checkProgress(LoginController.getInstance().getSessionID(),
                                            isCancelled());
                                } catch (SessionExpiredException ex) {
                                    MedSavantExceptionHandler.handleSessionExpiredException(ex);
                                    return null;
                                }
                            }
                            if (stat != null) {
                                notification.setStatusMessage(stat.message);
                            }
                            return stat;
                        }
                    }.execute();
                    toFront();

                }//end actionPerformed
            }); //end new ActionListener(...){

            addComponent(ViewUtil.alignRight(workButton));
        }

        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.NEXT);
            fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
        }
    };

    return page;
}

From source file:org.ut.biolab.medsavant.client.variant.RemoveVariantsWizard.java

private AbstractWizardPage getQueuePage() {
    //setup page// www  . j av a  2 s.  c  om
    return new DefaultWizardPage("Remove & Publish Variants") {
        private final JLabel progressLabel = new JLabel("You are now ready to remove variants.");
        private final JButton workButton = new JButton("Remove Files");

        {
            addComponent(progressLabel);
            addComponent(ViewUtil.alignRight(workButton));

            final JComponent j = new JLabel(
                    "<html>You may continue. The removal process will continue in the<br>background and you will be notified upon completion.</html>");
            addComponent(j);
            j.setVisible(false);

            workButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent ae) {
                    j.setVisible(true);
                    fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.NEXT);
                    fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
                    // progressBar.setIndeterminate(true);

                    workButton.setEnabled(false);
                    new ProjectWorker<Void>("Removing variants", autoPublish.isSelected(),
                            LoginController.getSessionID(), projectID) {
                        @Override
                        protected Void runInBackground() throws Exception {
                            MedSavantClient.VariantManager.removeVariants(LoginController.getSessionID(),
                                    projectID, referenceID, files, autoPublish.isSelected(),
                                    emailField.getText());
                            return null;
                        }
                    }.execute();

                    toFront();
                }
            });

        }

        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.NEXT);
            fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
        }
    };
}

From source file:org.ut.biolab.medsavant.client.view.component.KeyValuePairPanel.java

private void setMoreVisibility(boolean b) {
    showingMore = b;/*www  . j  ava2 s. co m*/
    for (String key : keysInMoreSection) {
        keyKeyComponentMap.get(key).setVisible(b && keysVisible);
        keyValueComponentMap.get(key).setVisible(b);
        for (JComponent c : keyExtraComponentsMap.get(key)) {
            c.setVisible(b);
        }
        // close opened sub components in more if closing more
        if (!b && keyDetailComponentMap.get(key).isVisible()) {
            keyDetailComponentMap.get(key).setVisible(false);
        }
    }
}