/**
* MailArchiver is an application that provides services for storing and managing e-mail messages through a Web Services SOAP interface.
* Copyright (C) 2012 Marcio Andre Scholl Levien and Fernando Alberto Reuter Wendt and Jose Ronaldo Nogueira Fonseca Junior
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
/******************************************************************************\
*
* This product was developed by
*
* SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO),
*
* a government company established under Brazilian law (5.615/70),
* at Department of Development of Porto Alegre.
*
\******************************************************************************/
package serpro.mailarchiver.view.admin;
import serpro.mailarchiver.view.BaseComponent;
import com.eventrouter.message.Message1;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.themes.BaseTheme;
class Toolbar extends BaseComponent.HorizontalLayout {
private Button config;
private Button importGears;
private Button upload;
private Button explore;
private Button search;
private Button help;
private Button terminal;
private Button logout;
private Embedded logo;
Toolbar() {
new ToolbarController(getDisplayId());
}
@Override
public final String getDisplayId() {
return "toolbar";
}
@Override
public Toolbar init() {
setStyleName("toolbar");
setMargin(true);
setSpacing(true);
setWidth("100%");
//----------------------------------------------------------------------
// config = new Button("Config");
// config.setIcon(new ThemeResource("toolbar/icons/48/config.png"));
// config.addListener(new ClickListener() {
// @Override
// public void buttonClick(ClickEvent event) {
// new Message1(event){}
// .publish("/mailarchiver/action/config_selected")
// .await();
// }
// });
// addComponent(config);
//----------------------------------------------------------------------
importGears = new Button("Gears");
importGears.setIcon(new ThemeResource("toolbar/icons/48/gears.png"));
importGears.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
new Message1(event){}
.publish("/mailarchiver/action/importGears_selected")
.await();
}
});
addComponent(importGears);
//----------------------------------------------------------------------
upload = new Button("Upload");
upload.setIcon(new ThemeResource("toolbar/icons/48/upload.png"));
upload.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
new Message1(event){}
.publish("/mailarchiver/action/upload_selected")
.await();
}
});
addComponent(upload);
//----------------------------------------------------------------------
// explore = new Button("Explore");
// explore.setIcon(new ThemeResource("toolbar/icons/48/explore.png"));
// explore.addListener(new ClickListener() {
// @Override
// public void buttonClick(ClickEvent event) {
// new Message1(event){}
// .publish("/mailarchiver/action/explore_selected")
// .await();
// }
// });
// addComponent(explore);
//----------------------------------------------------------------------
search = new Button("Search");
search.setIcon(new ThemeResource("toolbar/icons/48/search.png"));
search.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
new Message1(event){}
.publish("/mailarchiver/action/search_selected")
.await();
}
});
addComponent(search);
//----------------------------------------------------------------------
// help = new Button("Help");
// help.setIcon(new ThemeResource("toolbar/icons/48/help.png"));
// help.addListener(new ClickListener() {
// @Override
// public void buttonClick(ClickEvent event) {
// new Message1(event){}
// .publish("/mailarchiver/action/help_selected")
// .await();
// }
// });
// addComponent(help);
//----------------------------------------------------------------------
terminal = new Button("Terminal");
terminal.setIcon(new ThemeResource("toolbar/icons/48/terminal.png"));
terminal.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
new Message1(event){}
.publish("/mailarchiver/action/terminal_selected")
.await();
}
});
addComponent(terminal);
//----------------------------------------------------------------------
logout = new Button("Logout");
logout.setHeight("20px");
logout.setStyleName(BaseTheme.BUTTON_LINK);
logout.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
new Message1(event){}
.publish("/mailarchiver/action/logout_selected")
.await();
}
});
addComponent(logout);
setComponentAlignment(logout, Alignment.BOTTOM_RIGHT);
setExpandRatio(logout, 1.0f);
//----------------------------------------------------------------------
logo = new Embedded("", new ThemeResource("toolbar/img/mailarchiver_logo.png"));
addComponent(logo);
setComponentAlignment(logo, Alignment.MIDDLE_RIGHT);
//----------------------------------------------------------------------
return this;
}
}