是否可以在剑道网格功能之前添加AOP功能。

时间:2017-08-27 03:02:50

标签: javascript jquery kendo-ui kendo-grid

是否可能  添加.before(function){})。after(function(){})挂钩到kendo网格函数。

例如,在刷新网格之前,刷新网格之后:

$('#GridName').data('kendoGrid').beforeRefresh(function(){
  //todo
});

$('#GridName').data('kendoGrid').afterRefresh(function(){
  //todo
});

=>

package Bank;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.Color;

public class BankLogin {
  String usernameuser;
  String passworduser;
  ArrayList<String> Usernames = new ArrayList<String>();
  ArrayList<String> Passwords = new ArrayList<String>();
  private JFrame frame;
  private JTextField Username;
  private JTextField textField_1;

/**
 * Launch the application.
 */
  public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                BankLogin window = new BankLogin();
                window.frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
  }

/**
 * Create the application.
 */
  public BankLogin() {
    initialize();
  }

/**
 * Initialize the contents of the frame.
 */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 508, 381);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JLabel Messages = new JLabel("New label");
    Messages.setBackground(Color.RED);
    Messages.setFont(new Font("Tahoma", Font.PLAIN, 20));
    Messages.setBounds(99, 132, 383, 75);
    frame.getContentPane().add(Messages);
    Messages.setVisible(false);

    Username = new JTextField();
    Username.setBounds(231, 66, 131, 30);
    frame.getContentPane().add(Username);
    Username.setColumns(10);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setBounds(231, 132, 131, 30);
    frame.getContentPane().add(textField_1);

    JLabel lblUsername = new JLabel("Username");
    lblUsername.setFont(new Font("Tahoma", Font.PLAIN, 20));
    lblUsername.setBounds(109, 66, 112, 36);
    frame.getContentPane().add(lblUsername);

    JLabel lblPassword = new JLabel("Password");
    lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 20));
    lblPassword.setBounds(109, 125, 112, 36);
    frame.getContentPane().add(lblPassword);

    JButton btnLogin = new JButton("Login");
    btnLogin.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {

        }
    });

    btnLogin.setBounds(109, 240, 89, 23);
    frame.getContentPane().add(btnLogin);

    JButton btnRegister = new JButton("Register");
    btnRegister.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if((lblUsername.getText()).length() != 0 && (lblPassword.getText()).length() != 0){
             Usernames.add(lblUsername.getText());
             Passwords.add(lblPassword.getText());
             Messages.setVisible(true);
             Messages.setText("Thank you for creating an account.");
            // Messages.setVisible(false);
            }
            else{
                 Messages.setVisible(true);
                 Messages.setText("Error");
            }
        }
    });
    btnRegister.setBounds(273, 240, 89, 23);
    frame.getContentPane().add(btnRegister);
  }
}

0 个答案:

没有答案