/**
* Copyright 2008-2016 Qualogy Solutions B.V.
*
* 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 com.qualogy.qafe.mgwt.client;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.HasTapHandlers;
import com.googlecode.mgwt.ui.client.MGWT;
import com.googlecode.mgwt.ui.client.MGWTStyle;
import com.googlecode.mgwt.ui.client.widget.HeaderButton;
import com.googlecode.mgwt.ui.client.widget.HeaderPanel;
import com.googlecode.mgwt.ui.client.widget.LayoutPanel;
import com.googlecode.mgwt.ui.client.widget.ScrollPanel;
public abstract class DetailViewGwtImpl implements DetailView {
protected LayoutPanel main;
protected ScrollPanel scrollPanel;
protected HeaderPanel headerPanel;
protected HeaderButton headerBackButton;
protected HeaderButton headerMainButton;
protected HTML title;
public DetailViewGwtImpl() {
main = new LayoutPanel();
scrollPanel = new ScrollPanel();
headerPanel = new HeaderPanel();
title = new HTML();
headerPanel.setCenterWidget(title);
headerBackButton = new HeaderButton();
headerBackButton.setBackButton(true);
headerBackButton.setVisible(!MGWT.getOsDetection().isAndroid());
headerMainButton = new HeaderButton();
headerMainButton.setRoundButton(true);
if (!MGWT.getOsDetection().isPhone()) {
headerPanel.setLeftWidget(headerMainButton);
headerMainButton.addStyleName(MGWTStyle.getTheme().getMGWTClientBundle().getUtilCss().portraitonly());
} else {
headerPanel.setLeftWidget(headerBackButton);
}
main.add(headerPanel);
main.add(scrollPanel);
}
@Override
public Widget asWidget() {
return main;
}
@Override
public HasText getHeader() {
return title;
}
@Override
public HasText getBackbuttonText() {
return headerBackButton;
}
@Override
public HasTapHandlers getBackbutton() {
return headerBackButton;
}
@Override
public HasText getMainButtonText() {
return headerMainButton;
}
@Override
public HasTapHandlers getMainButton() {
return headerMainButton;
}
}