class LayoutTopComponent extends TopComponent {

    private final LayoutPanel layoutPanel;
    private LayoutModel model;

    public LayoutTopComponent() {
        initComponents();
        setName(NbBundle.getMessage(LayoutTopComponent.class, "CTL_LayoutTopComponent"));

        putClientProperty(TopComponent.PROP_MAXIMIZATION_DISABLED, Boolean.TRUE);

        layoutPanel = new LayoutPanel();
        if (UIUtils.isAquaLookAndFeel()) {
            layoutPanel.setBackground(UIManager.getColor("NbExplorerView.background"));
        }
        add(layoutPanel, BorderLayout.CENTER);

        Lookup.getDefault().lookup(ProjectController.class).addWorkspaceListener(new WorkspaceListener() {
            @Override
            public void initialize(Workspace workspace) {
            }

            @Override
            public void select(Workspace workspace) {
                model = workspace.getLookup().lookup(LayoutModel.class);
                refreshModel();
            }

            @Override
            public void unselect(Workspace workspace) {
                if (model != null) {
                    model.removePropertyChangeListener(layoutPanel);
                }
            }

            @Override
            public void close(Workspace workspace) {
            }

            @Override
            public void disable() {
                model = null;
                refreshModel();
            }
        });

        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
        if (projectController.getCurrentWorkspace() != null) {
            model = projectController.getCurrentWorkspace().getLookup().lookup(LayoutModel.class);
        }
        refreshModel();
    }

    private void refreshModel() {
        layoutPanel.refreshModel(model);
    }

    /**
     * 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() {

        setLayout(new java.awt.BorderLayout());
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
    void writeProperties(java.util.Properties p) {<FILL_FUNCTION_BODY>}

    void readProperties(java.util.Properties p) {
        String version = p.getProperty("version");
        // TODO read your settings according to their version
    }
}

        // better to version settings since initial version as advocated at
        // http://wiki.apidesign.org/wiki/PropertyFiles
        p.setProperty("version", "1.0");
        // TODO store your settings
    
<no_super_class>