ItEr30S15RFVisualizacionMultiplesProxectosItEr29S18: Initial planner using multiple tabs with global company view
This commit is contained in:
parent
d89a6cc229
commit
80ef2015e5
3 changed files with 246 additions and 10 deletions
|
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
* This file is part of ###PROJECT_NAME###
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.navalplanner.web.planner.tabs;
|
||||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.navalplanner.business.orders.entities.Order;
|
||||
import org.navalplanner.web.planner.CompanyPlanningController;
|
||||
import org.navalplanner.web.planner.tabs.CreatedOnDemandTab.IComponentCreator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.zkoss.ganttz.adapters.TabsConfiguration;
|
||||
import org.zkoss.ganttz.extensions.ITab;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Button;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Label;
|
||||
|
||||
/**
|
||||
* Creates and handles several tabs
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class MultipleTabsPlannerController {
|
||||
|
||||
private static final String ENTERPRISE_VIEW = _("Enterprise");
|
||||
|
||||
private static final String RESOURCE_LOAD_VIEW = _("Resource Load");
|
||||
|
||||
private static final String ORDERS_VIEW = _("Orders");
|
||||
|
||||
private TabsConfiguration tabsConfiguration;
|
||||
|
||||
private Mode mode = Mode.initial();
|
||||
|
||||
@Autowired
|
||||
private CompanyPlanningController companyPlanningController;
|
||||
|
||||
public TabsConfiguration getTabs() {
|
||||
if (tabsConfiguration == null) {
|
||||
tabsConfiguration = buildTabsConfiguration();
|
||||
}
|
||||
return tabsConfiguration;
|
||||
}
|
||||
|
||||
private TabsConfiguration buildTabsConfiguration() {
|
||||
return TabsConfiguration.create().add(createEnterpriseTab()).add(
|
||||
createResourcesLoadTab()).add(createOrdersTab());
|
||||
}
|
||||
|
||||
private ITab createEnterpriseTab() {
|
||||
return TabOnModeType.forMode(mode)
|
||||
.forType(ModeType.GLOBAL,createGlobalEnterpriseTab())
|
||||
.forType(ModeType.ORDER, createOrderEnterpriseTab())
|
||||
.create();
|
||||
}
|
||||
|
||||
private org.zkoss.zk.ui.Component withUpAndDownButton(
|
||||
org.zkoss.zk.ui.Component component) {
|
||||
Div result = new Div();
|
||||
result.appendChild(component);
|
||||
Button up = new Button();
|
||||
up.setLabel("up");
|
||||
up.addEventListener(Events.ON_CLICK, new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
mode.up();
|
||||
}
|
||||
});
|
||||
Button down = new Button();
|
||||
down.setLabel("down");
|
||||
down.addEventListener(Events.ON_CLICK, new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
mode.goToOrderMode(new Order());
|
||||
}
|
||||
});
|
||||
result.appendChild(up);
|
||||
result.appendChild(down);
|
||||
return result;
|
||||
}
|
||||
|
||||
private ITab createGlobalEnterpriseTab() {
|
||||
return new CreatedOnDemandTab(ENTERPRISE_VIEW, new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
HashMap<String, Object> args = new HashMap<String, Object>();
|
||||
args.put("companyPlanningController",
|
||||
companyPlanningController);
|
||||
return Executions.createComponents("/planner/_company.zul",
|
||||
parent,
|
||||
args);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ITab createOrderEnterpriseTab() {
|
||||
return new CreatedOnDemandTab(ENTERPRISE_VIEW, new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
return withUpAndDownButton(new Label(
|
||||
"on enterprise view. mode: "
|
||||
+ mode.getType()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ITab createResourcesLoadTab() {
|
||||
return TabOnModeType.forMode(mode)
|
||||
.forType(ModeType.GLOBAL, createGlobalResourcesLoadTab())
|
||||
.forType(ModeType.ORDER, createOrderResourcesLoadTab())
|
||||
.create();
|
||||
}
|
||||
|
||||
private ITab createOrderResourcesLoadTab() {
|
||||
return new CreatedOnDemandTab(RESOURCE_LOAD_VIEW, new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
return withUpAndDownButton(new Label(
|
||||
"on resource load view. mode: "
|
||||
+ mode.getType()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ITab createGlobalResourcesLoadTab() {
|
||||
return new CreatedOnDemandTab(RESOURCE_LOAD_VIEW,
|
||||
new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
return withUpAndDownButton(new Label(
|
||||
"on resource load view. mode: "
|
||||
+ mode.getType()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ITab createOrdersTab() {
|
||||
return TabOnModeType.forMode(mode)
|
||||
.forType(ModeType.GLOBAL, createGlobalOrdersTab())
|
||||
.forType(ModeType.ORDER, createOrderOrdersTab())
|
||||
.create();
|
||||
}
|
||||
|
||||
private ITab createGlobalOrdersTab() {
|
||||
return new CreatedOnDemandTab(ORDERS_VIEW,
|
||||
new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
return withUpAndDownButton(new Label("on order view. mode: "
|
||||
+ mode.getType()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ITab createOrderOrdersTab() {
|
||||
return new CreatedOnDemandTab(ORDERS_VIEW, new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
return withUpAndDownButton(new Label("on order view. mode: "
|
||||
+ mode.getType()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,22 +18,14 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<?page title="${i18n:_('Navalpro: Company Scheduling')}"?>
|
||||
<?init class="org.zkoss.zk.ui.util.Composition" arg0="/common/layout/template.zul"?>
|
||||
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
|
||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n" ?>
|
||||
<?link rel="stylesheet" type="text/css" href="/planner/css/ganttzk.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/navalpro_v01.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/navalpro_zk.css"?>
|
||||
|
||||
<zk>
|
||||
<zscript><![CDATA[
|
||||
planningController = companyPlanningController;
|
||||
planningController = arg.get("companyPlanningController");
|
||||
]]>
|
||||
</zscript>
|
||||
|
||||
<planner id="planner" apply="${planningController}" self="@{define(content)}">
|
||||
<planner id="planner" apply="${planningController}">
|
||||
</planner>
|
||||
|
||||
<div id="idContextMenuTaskAssignment"></div>
|
||||
41
navalplanner-webapp/src/main/webapp/planner/index.zul
Normal file
41
navalplanner-webapp/src/main/webapp/planner/index.zul
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!--
|
||||
This file is part of ###PROJECT_NAME###
|
||||
|
||||
Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
Desenvolvemento Tecnolóxico de Galicia
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<?page title="${i18n:_('Navalpro: Scheduling')}"?>
|
||||
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
|
||||
<?init class="org.zkoss.zk.ui.util.Composition" arg0="/common/layout/template.zul"?>
|
||||
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/planner/css/ganttzk.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/navalpro_v01.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/navalpro_zk.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/zkau/web/js/yui/2.7.0/resize/assets/skins/sam/resize.css"?>
|
||||
|
||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
<zk>
|
||||
|
||||
<zscript><![CDATA[
|
||||
multipleTabsPlanner = multipleTabsPlannerController;
|
||||
]]>
|
||||
</zscript>
|
||||
<!-- choose lightLoad, mediumLoad or highLoad.
|
||||
-->
|
||||
<tabSwitcher self="@{define(content)}" configuration="@{multipleTabsPlanner.tabs}">
|
||||
</tabSwitcher>
|
||||
</zk>
|
||||
Loading…
Add table
Reference in a new issue