Package org.flexdock.view.actions

Source Code of org.flexdock.view.actions.DefaultPinAction$PinButtonModel

/*
* Created on Apr 26, 2005
*/
package org.flexdock.view.actions;

import java.awt.event.ActionEvent;

import javax.swing.ButtonModel;

import org.flexdock.docking.DockingManager;
import org.flexdock.docking.state.DockingState;
import org.flexdock.view.Button;
import org.flexdock.view.View;
import org.flexdock.view.model.ViewButtonModel;

/**
* @author Christopher Butler
* @author Bobby Rosenberger
*/
public class DefaultPinAction extends ViewAction {

    public DefaultPinAction() {

    }

    public void actionPerformed(View view, ActionEvent evt) {
        boolean minimize = view.isMinimized()? false: true;
        DockingManager.setMinimized(view, minimize);
    }

    public void updateState(View view, DockingState info, Button button) {
        button.getModel().setSelected(info.isMinimized());
    }

    public ButtonModel createButtonModel() {
        return new PinButtonModel();
    }

    private static class PinButtonModel extends ViewButtonModel {
        public boolean isSelected() {
            DockingState info = getDockingState();
            if(info==null)
                return super.isSelected();
            return info.isMinimized();
        }
    }

}
TOP

Related Classes of org.flexdock.view.actions.DefaultPinAction$PinButtonModel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.