⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multisteppane.java

📁 编辑视频文件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        return stepProperties.keySet();    }    /**     * Returns the index of the current step.     *     * @return the index of the current step     * @see mpi.eudico.client.tool.viewer.enhanced.multistep.MultiStepControl#getCurrentStepIndex()     */    public int getCurrentStepIndex() {        return currentStepIndex;    }    /**     * Returns the current step.     *     * @return the current step     */    public StepPane getCurrentStep() {        return currentStep;    }    /**     * Jumps to the step at the specified index.     *     * @param stepIndex the index of the step to jump to     * @see mpi.eudico.client.tool.viewer.enhanced.multistep.MultiStepControl#goToStep(int)     */    public void goToStep(int stepIndex) {        if ((stepIndex >= 0) && (stepIndex < stepMap.size())) {            String name = (String) stepMap.get(new Integer(stepIndex));            if (name != null) {                stepLayout.show(stepContainer, name);                currentStepIndex = stepIndex;            }        }    }    /**     * Jumps to the step identified by name.     *     * @param name identifier of the step     */    public void goToStep(String name) {        if (stepMap.containsValue(name)) {            Set keys = stepMap.keySet();            Iterator it = keys.iterator();            while (it.hasNext()) {                Integer nextInt = (Integer) it.next();                String val = (String) stepMap.get(nextInt);                if ((val != null) && val.equals(name)) {                    currentStepIndex = nextInt.intValue();                    break;                }            }            stepLayout.show(stepContainer, name);        }    }    /**     * Notify all steps the process has been finished.     */    private void finishNotify() {        Set keys = stepMap.keySet();        Iterator it = keys.iterator();        while (it.hasNext()) {            Integer nextInt = (Integer) it.next();            StepPane val = (StepPane) stepMap.get(nextInt);            if (val != null) {                val.finished();            }        }    }    /**     * Invokes setVisible(visible) on the button identified by buttonType.     *     * @param buttonType one of the button constants     * @param visible the visibility property     */    public void setButtonVisible(int buttonType, boolean visible) {        switch (buttonType) {        case HELP_BUTTON:            helpButton.setVisible(visible);            break;        case NEXT_BUTTON:            nextButton.setVisible(visible);            break;        case PREVIOUS_BUTTON:            prevButton.setVisible(visible);            break;        case FINISH_BUTTON:            finishButton.setVisible(visible);            break;        case CANCEL_BUTTON:            cancelButton.setVisible(visible);            break;        case ALL_BUTTONS:            helpButton.setVisible(visible);            nextButton.setVisible(visible);            prevButton.setVisible(visible);            finishButton.setVisible(visible);            cancelButton.setVisible(visible);            break;        default:}    }    /**     * Returns the visibility state of the specified button.     *     * @param buttonType one of the button constants     *     * @return the visibility property of the button     */    public boolean isButtonVisible(int buttonType) {        switch (buttonType) {        case HELP_BUTTON:            return helpButton.isVisible();        case NEXT_BUTTON:            return nextButton.isVisible();        case PREVIOUS_BUTTON:            return prevButton.isVisible();        case FINISH_BUTTON:            return finishButton.isVisible();        case CANCEL_BUTTON:            return cancelButton.isVisible();        case ALL_BUTTONS:            return helpButton.isVisible() && nextButton.isVisible() &&            prevButton.isVisible() && finishButton.isVisible() &&            cancelButton.isVisible();        default:            return false;        }    }    /**     * Enables / disables the specified button.     *     * @param buttonType one of the button constants     * @param enable true to enable, false to disable the button     */    public void setButtonEnabled(int buttonType, boolean enable) {        switch (buttonType) {        case HELP_BUTTON:            helpButton.setEnabled(enable);            break;        case NEXT_BUTTON:            nextButton.setEnabled(enable);            break;        case PREVIOUS_BUTTON:            prevButton.setEnabled(enable);            break;        case FINISH_BUTTON:            finishButton.setEnabled(enable);            break;        case CANCEL_BUTTON:            cancelButton.setEnabled(enable);            break;        case ALL_BUTTONS:            helpButton.setEnabled(enable);            nextButton.setEnabled(enable);            prevButton.setEnabled(enable);            finishButton.setEnabled(enable);            cancelButton.setEnabled(enable);            break;        default:}    }    /**     * Returns whether the specified button is enabled.     *     * @param buttonType one of the button constants     *     * @return true if the button is enabled, false otherwise     */    public boolean isButtonEnabled(int buttonType) {        switch (buttonType) {        case HELP_BUTTON:            return helpButton.isEnabled();        case NEXT_BUTTON:            return nextButton.isEnabled();        case PREVIOUS_BUTTON:            return prevButton.isEnabled();        case FINISH_BUTTON:            return finishButton.isEnabled();        case CANCEL_BUTTON:            return cancelButton.isEnabled();        case ALL_BUTTONS:            return helpButton.isEnabled() && nextButton.isEnabled() &&            prevButton.isEnabled() && finishButton.isEnabled() &&            cancelButton.isEnabled();        default:            return false;        }    }    /**     * Sets the labeltext of the specified button.     *     * @param buttonType one of the button constants     * @param text the new text for the button     */    public void setButtonText(int buttonType, String text) {        switch (buttonType) {        case HELP_BUTTON:            helpButton.setText(text);            break;        case NEXT_BUTTON:            nextButton.setText(text);            break;        case PREVIOUS_BUTTON:            prevButton.setText(text);            break;        case FINISH_BUTTON:            finishButton.setText(text);            break;        case CANCEL_BUTTON:            cancelButton.setText(text);            break;        default:}    }    /**     * Sets the Icon for the specifeid button.     *     * @param buttonType one of the button constants     * @param icon the new icon     */    public void setButtonIcon(int buttonType, Icon icon) {        switch (buttonType) {        case HELP_BUTTON:            helpButton.setIcon(icon);            break;        case NEXT_BUTTON:            nextButton.setIcon(icon);            break;        case PREVIOUS_BUTTON:            prevButton.setIcon(icon);            break;        case FINISH_BUTTON:            finishButton.setIcon(icon);            break;        case CANCEL_BUTTON:            cancelButton.setIcon(icon);            break;        default:}    }    /**     * Sets the color of the title panel background.     *     * @param background the new background color     */    public void setTitlePanelBackground(Color background) {        if (titlePanel != null) {            titlePanel.setBackground(background);        }    }    /**     * Replaces the current title or top panel by the specified panel.     *     * @param newTitlePanel the new title panel     */    public void setTitlePanel(StepTitlePanel newTitlePanel) {        GridBagConstraints c = ((GridBagLayout) getLayout()).getConstraints(titlePanel);        getLayout().removeLayoutComponent(titlePanel);        titlePanel = newTitlePanel;        if (titlePanel != null) {            add(titlePanel, c);        }    }    /**     * Returns the current title panel.     *     * @return the current title panel     */    public StepTitlePanel getTitlePanel() {        return titlePanel;    }    /**     * Sets the color for the button panel.     *     * @param background the color for the button panel background     */    public void setButtonPanelBackground(Color background) {        if (buttonPanel != null) {            buttonPanel.setBackground(background);        }    }    /**     * Creates and returns a dialog for the multistep process.     *     * @param parent the parent for the dialog     * @param title the dialog title     * @param modal whether or not the dialog should be modal     *     * @return the dialog     */    public JDialog createDialog(JDialog parent, String title, boolean modal) {        dialog = new ClosableDialog(parent, title, modal);        dialog.setContentPane(this);        dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);        dialog.pack();        dialog.setLocationRelativeTo(parent);        return dialog;    }    /**     * Creates and returns a dialog for the multistep process.     *     * @param parent the parent for the dialog     * @param title the dialog title     * @param modal whether or not the dialog should be modal     *     * @return the dialog     */    public JDialog createDialog(Frame parent, String title, boolean modal) {        dialog = new ClosableDialog(parent, title, modal);        dialog.setContentPane(this);        dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);        dialog.pack();        dialog.setLocationRelativeTo(parent);        return dialog;    }    /**     * The ActionListener implementation.     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)     */    public void actionPerformed(ActionEvent e) {        if (e.getSource() == helpButton) {        } else if (e.getSource() == nextButton) {            nextStep();        } else if (e.getSource() == prevButton) {            previousStep();        } else if (e.getSource() == finishButton) {            finish();        } else if (e.getSource() == cancelButton) {            cancel();        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -