All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nz.co.senanque.bundle2.Layout Maven / Gradle / Ivy

Go to download

This is a bundle that is used to demo the Perspectives Manager. It asks for a name and uses the blackboard to loosely interact with other bundles.

The newest version!
/*******************************************************************************
 * Copyright (c)2011 Prometheus Consulting
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package nz.co.senanque.bundle2;

import nz.co.senanque.perspectiveslibrary.Blackboard;
import nz.co.senanque.perspectiveslibrary.BlackboardListener;

import com.vaadin.annotations.AutoGenerated;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

/**
 * @author Roger Parkinson
 *
 */
public class Layout extends VerticalLayout {

	private static final long serialVersionUID = -1L;
	private Blackboard m_blackboard;
	private VerticalLayout mainLayout;
	private TextField m_name;
	/**
	 * The constructor should first build the main layout, set the
	 * composition root and then do any custom initialization.
	 *
	 * The constructor will not be automatically regenerated by the
	 * visual editor.
	 */
	public Layout() {
		buildMainLayout();
		addComponent(mainLayout);
	}
	@AutoGenerated
	private VerticalLayout buildMainLayout() {
		// common part: create layout
		mainLayout = new VerticalLayout();
		mainLayout.setImmediate(false);
		mainLayout.setWidth("100%");
		mainLayout.setHeight("100%");
		mainLayout.setMargin(false);
		
		// top-level component properties
		setWidth("100.0%");
		setHeight("100.0%");
		
		// m_name
		m_name = new TextField();
		m_name.setImmediate(false);
		m_name.setWidth("-1px");
		m_name.setHeight("-1px");
		mainLayout.addComponent(m_name);
		
		return mainLayout;
	}
	public Blackboard getBlackboard() {
		return m_blackboard;
	}
	public void setBlackboard(Blackboard blackboard) {
		m_blackboard = blackboard;
		m_blackboard.add(new BlackboardListener(){

			public void valueChanged(Object value) {
				m_name.setValue(value.toString());
			}

			public String getName() {
				return "userName";
			}});
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy