/*
* The contents of this file are subject to the terms of the Common Development
* and Distribution License (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at http://www.netbeans.org/cddl.html
* or http://www.netbeans.org/cddl.txt.
*
* When distributing Covered Code, include this CDDL Header Notice in each file
* and include the License file at http://www.netbeans.org/cddl.txt.
* If applicable, add the following below the CDDL Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* The Original Software is NetBeans. The Initial Developer of the Original
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.gwt4nb.services.refactoring.ui;
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.JPanel;
import javax.swing.event.ChangeListener;
import org.netbeans.modules.gwt4nb.services.ServiceClassSet;
import org.netbeans.modules.gwt4nb.services.refactoring.ServiceRenameRefactoring;
import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
import org.openide.util.NbBundle;
/** UI panel for displaying refactoring information.
*
* @author Prem
*/
public class ServiceRenamePanel extends JPanel implements CustomRefactoringPanel {
private static final long serialVersionUID = 1;
// refactoring this panel provides parameters for
private final ServiceRenameRefactoring refactoring;
// table model for the table of members
private ServiceClassSet serviceClassSet;
/** Creates new form ServiceRenamePanel
* @param refactoring The refactoring this panel provides parameters for.
* @param serviceClassSet Members that should be pre-selected in the panel
*/
public ServiceRenamePanel(ServiceRenameRefactoring refactoring, ServiceClassSet serviceClassSet, final ChangeListener parent) {
this.refactoring = refactoring;
this.serviceClassSet = serviceClassSet;
initComponents();
setPreferredSize(new Dimension(420, 380));
}
/** Initialization of the panel (called by the parent window).
*/
public void initialize() {
if(serviceClassSet.getService()!=null){
serviceName.setText(serviceClassSet.getService().getQualifiedName().toString()+
".java"); // NOI18N
newServiceName.setText(serviceClassSet.getService().getSimpleName().toString());
}else {
serviceName.setText(NbBundle.getMessage(
ServiceRenamePanel.class, "ClassUnav")); // NOI18N
}
if(serviceClassSet.getServiceAsync()!=null){
serviceAsyncName.setText(serviceClassSet.getServiceAsync().getQualifiedName().toString()+
".java"); // NOI18N
}else {
serviceAsyncName.setText(NbBundle.getMessage(ServiceRenamePanel.class,
"ClassUnav")); // NOI18N
}
if(serviceClassSet.getServiceImpl()!=null){
serviceImplName.setText(serviceClassSet.getServiceImpl().
getQualifiedName().toString()+".java"); // NOI18N
}else {
serviceImplName.setText(NbBundle.getMessage(
ServiceRenamePanel.class, "ClassUnav")); // NOI18N
}
}
// --- GENERATED CODE ------------------------------------------------------
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
classesChangedMessage = new javax.swing.JLabel();
serviceLbl = new javax.swing.JLabel();
serviceAsyncLbl = new javax.swing.JLabel();
serviceImplLbl = new javax.swing.JLabel();
serviceName = new javax.swing.JLabel();
serviceImplName = new javax.swing.JLabel();
serviceAsyncName = new javax.swing.JLabel();
miscChangesMessage = new javax.swing.JLabel();
newServiceNameLbl = new javax.swing.JLabel();
newServiceName = new javax.swing.JTextField();
setBorder(javax.swing.BorderFactory.createEmptyBorder(12, 12, 11, 11));
org.openide.awt.Mnemonics.setLocalizedText(classesChangedMessage, NbBundle.getMessage(ServiceRenamePanel.class, "FollowClasses")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(serviceLbl, NbBundle.getMessage(ServiceRenamePanel.class, "Svc")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(serviceAsyncLbl, NbBundle.getMessage(ServiceRenamePanel.class, "Async")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(serviceImplLbl, NbBundle.getMessage(ServiceRenamePanel.class, "SvcImpl")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(serviceAsyncName, " = = "); // NOI18N
miscChangesMessage.setFont(new java.awt.Font("Tahoma", 2, 11));
org.openide.awt.Mnemonics.setLocalizedText(miscChangesMessage, NbBundle.getMessage(ServiceRenamePanel.class, "Ex")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(newServiceNameLbl, NbBundle.getMessage(ServiceRenamePanel.class, "NewSvc")); // NOI18N
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(classesChangedMessage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 377, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(newServiceNameLbl)
.add(serviceAsyncLbl)
.add(serviceLbl))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(serviceName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 229, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(serviceAsyncName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 294, Short.MAX_VALUE)
.add(newServiceName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 218, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.add(miscChangesMessage)
.add(layout.createSequentialGroup()
.add(serviceImplLbl)
.add(37, 37, 37)
.add(serviceImplName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(newServiceNameLbl)
.add(newServiceName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(18, 18, 18)
.add(classesChangedMessage)
.add(18, 18, 18)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(serviceLbl)
.add(serviceName))
.add(3, 3, 3)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(21, 21, 21)
.add(serviceAsyncLbl))
.add(layout.createSequentialGroup()
.add(20, 20, 20)
.add(serviceAsyncName)))
.add(33, 33, 33)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(serviceImplLbl)
.add(serviceImplName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 15, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 43, Short.MAX_VALUE)
.add(miscChangesMessage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel classesChangedMessage;
private javax.swing.JLabel miscChangesMessage;
private javax.swing.JTextField newServiceName;
private javax.swing.JLabel newServiceNameLbl;
private javax.swing.JLabel serviceAsyncLbl;
private javax.swing.JLabel serviceAsyncName;
private javax.swing.JLabel serviceImplLbl;
private javax.swing.JLabel serviceImplName;
private javax.swing.JLabel serviceLbl;
private javax.swing.JLabel serviceName;
// End of variables declaration//GEN-END:variables
public Component getComponent() {
return this;
}
public String getNewServiceName(){
return newServiceName.getText();
}
}