001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2006-2010 Sun Microsystems, Inc. 025 * Portions Copyright 2015 ForgeRock AS. 026 */ 027package org.opends.quicksetup.ui; 028 029import javax.swing.*; 030import java.awt.*; 031 032/** 033 * Abstract class for rendering a review panel with fields and value 034 * that the user can use to confirm an application's operation. 035 */ 036public abstract class ReviewPanel extends QuickSetupStepPanel { 037 038 private static final long serialVersionUID = 509534079919269557L; 039 040 /** 041 * Creates an instance. 042 * @param application GuiApplication this panel represents 043 */ 044 public ReviewPanel(GuiApplication application) { 045 super(application); 046 } 047 048 /** 049 * Creates the panel containing field names and values. 050 * @return JPanel containing fields and values 051 */ 052 protected abstract JPanel createFieldsPanel(); 053 054 /** {@inheritDoc} */ 055 protected Component createInputPanel() 056 { 057 JPanel panel = UIFactory.makeJPanel(); 058 panel.setLayout(new GridBagLayout()); 059 060 GridBagConstraints gbc = new GridBagConstraints(); 061 062 gbc.insets = UIFactory.getEmptyInsets(); 063 gbc.gridwidth = GridBagConstraints.REMAINDER; 064 gbc.weightx = 1.0; 065 gbc.fill = GridBagConstraints.HORIZONTAL; 066 panel.add(createFieldsPanel(), gbc); 067 068 addVerticalGlue(panel); 069 070 JComponent chk = getBottomComponent(); 071 if (chk != null) { 072 gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD; 073 gbc.weighty = 0.0; 074 gbc.fill = GridBagConstraints.HORIZONTAL; 075 panel.add(chk, gbc); 076 } 077 078 return panel; 079 } 080 081 /** 082 * Returns the component that will placed at the bottom of the panel. 083 * In the case of the installer and the uninstaller this is basically the 084 * start server check box. 085 * If it does not exist creates the component. 086 * @return the component that will placed at the bottom of the panel. 087 */ 088 protected abstract JComponent getBottomComponent(); 089}