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

eu.future.earth.gwt.client.ui.panels.Field Maven / Gradle / Ivy

The newest version!
package eu.future.earth.gwt.client.ui.panels;

import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;

import eu.future.earth.gwt.client.ui.general.HasWidget;

public class Field extends SimplePanel implements HasWidget {

	private Image image = null;

	private Widget manager = null;

	private Widget extraWidget = null;

	private String label = null;

	private String id = null;

	private boolean shift = false;

	private boolean ident = true;

	public boolean isShift() {
		return shift;
	}

	public void setShift(boolean shift) {
		this.shift = shift;
	}

	private AbstractLabelFieldPanel labelFieldHolder = null;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Image getImage() {
		return image;
	}

	public void setImage(Image image) {
		this.image = image;
	}

	public void setLabelFieldHolder(AbstractLabelFieldPanel labelFieldHolder) {
		this.labelFieldHolder = labelFieldHolder;
	}

	private boolean alignTop = false;

	public boolean isAlignTop() {
		return alignTop;
	}

	@Override
	public void setVisible(boolean newState) {
		if (labelFieldHolder != null) {
			labelFieldHolder.setVisibleForLabel(this, newState);
		}
	}

	public void setAlignTop(boolean alignTop) {
		this.alignTop = alignTop;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
		if (labelFieldHolder != null) {
			labelFieldHolder.setLabel(this.getId(), label);
		}
	}

	public void setRequired(boolean required) {
		this.required = required;
	}

	public void changeRequired(boolean newRequired) {
		this.required = newRequired;

		if (labelFieldHolder != null) {
			labelFieldHolder.setRequiredForLabel(this);
		}
	}

	private boolean required = false;

	@UiConstructor
	public Field() {
		super();
	}

	@Override
	public void add(Widget newWidget) {
		manager = newWidget;
	}

	public boolean isRequired() {
		return required;
	}

	@Override
	public Widget containingWidget() {
		return manager;
	}

	@Override
	public Widget getWidget() {
		return manager;
	}

	public Widget getManager() {
		return manager;
	}

	public void setManager(Widget manager) {
		this.manager = manager;
	}

	public Widget getExtraWidget() {
		return extraWidget;
	}

	public void setExtraWidget(Widget extraWidget) {
		this.extraWidget = extraWidget;
	}

	public AbstractLabelFieldPanel getLabelFieldHolder() {
		return labelFieldHolder;
	}

	public boolean isIdent() {
		return ident;
	}

	public void setIdent(boolean ident) {
		this.ident = ident;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy