📄 permispolicypanel.java
字号:
/*
* Copyright (c) 2000-2005, University of Salford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the University of Salford nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* PermisPolicyFrame.java
*
* Created on 12 May 2004, 12:40
*/
package issrg.editor.gui2;
import issrg.editor.PermisXmlDom;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
/**
*
* @author Administrator
*/
public abstract class PermisPolicyPanel extends JPanel
{
private JButton newButton;
private JButton editButton;
private JButton deleteButton;
private JPanel buttonPanel;
private JPanel mainPanel;
private boolean showNewButton;
private boolean showEditButton;
private boolean showDeleteButton;
private PermisPolicyEditorPane parent;
protected PermisXmlDom xmlObject;
public PermisPolicyPanel(PermisPolicyEditorPane parentIn,
PermisXmlDom objIn){
this(parentIn, objIn, true, true, true);
}
public PermisPolicyPanel(PermisPolicyEditorPane parentIn,
PermisXmlDom objIn,
boolean showNew,
boolean showEdit,
boolean showDelete)
{
this.parent = parentIn;
this.xmlObject = objIn;
this.showNewButton = showNew;
this.showEditButton = showEdit;
this.showDeleteButton = showDelete;
this.initComponents();
}
protected final void disableMainFrame(){
this.parent.disableMainFrame();
}
protected final void enableMainFrame(){
this.parent.enableMainFrame();
}
protected abstract JPanel getMainPanel();
protected abstract void newButtonActionPerformed(ActionEvent evt);
protected abstract void editButtonActionPerformed(ActionEvent evt);
protected abstract void deleteButtonActionPerformed(ActionEvent evt);
private void initComponents(){
java.awt.GridBagConstraints gridBagConstraints;
buttonPanel = new javax.swing.JPanel();
mainPanel = this.getMainPanel();
mainPanel.setPreferredSize(new java.awt.Dimension(400,400));
newButton = new javax.swing.JButton();
editButton = new javax.swing.JButton();
deleteButton = new javax.swing.JButton();
setLayout(new java.awt.GridBagLayout());
if(this.showNewButton){
newButton.setText("New");
newButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
newButtonActionPerformed(evt);
}
});
buttonPanel.add(newButton);
}
if(this.showEditButton){
editButton.setText("Edit");
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editButtonActionPerformed(evt);
}
});
buttonPanel.add(editButton);
}
if(this.showDeleteButton){
deleteButton.setText("Delete");
deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
deleteButtonActionPerformed(evt);
}
});
buttonPanel.add(deleteButton);
}
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
add(buttonPanel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
add(mainPanel, gridBagConstraints);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -