/* * Copyright 2017 Red Hat, Inc. and/or its affiliates. * * 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 org.kie.workbench.common.stunner.standalone.client.screens; import javax.annotation.PostConstruct; import javax.enterprise.context.Dependent; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.IsWidget; import org.gwtbootstrap3.client.ui.Heading; import org.gwtbootstrap3.client.ui.constants.HeadingSize; import org.kie.workbench.common.stunner.core.client.util.StunnerClientLogger; import org.uberfire.client.annotations.WorkbenchContextId; import org.uberfire.client.annotations.WorkbenchMenu; import org.uberfire.client.annotations.WorkbenchPartTitle; import org.uberfire.client.annotations.WorkbenchPartView; import org.uberfire.client.annotations.WorkbenchScreen; import org.uberfire.lifecycle.OnClose; import org.uberfire.lifecycle.OnOpen; import org.uberfire.lifecycle.OnStartup; import org.uberfire.mvp.PlaceRequest; import org.uberfire.workbench.model.menu.MenuFactory; import org.uberfire.workbench.model.menu.Menus; @Dependent @WorkbenchScreen(identifier = WelcomeScreen.SCREEN_ID) public class WelcomeScreen { public static final String SCREEN_ID = "WelcomeScreen"; private class View extends FlowPanel { public View(final String tag) { super(tag); init(); } public View() { init(); } private void init() { add(new Heading(HeadingSize.H1, "Welcome to Stunner!")); } } private Menus menu = null; private View view = new View(); @PostConstruct public void init() { } @OnStartup public void onStartup(final PlaceRequest placeRequest) { this.menu = makeMenuBar(); } private Menus makeMenuBar() { return MenuFactory .newTopLevelMenu("Switch log level") .respondsWith(StunnerClientLogger::switchLogLevel) .endMenu() .build(); } @OnOpen public void onOpen() { } @OnClose public void onClose() { } @WorkbenchMenu public Menus getMenu() { return menu; } @WorkbenchPartTitle public String getTitle() { return "Welcome"; } @WorkbenchPartView public IsWidget getWidget() { return view; } @WorkbenchContextId public String getMyContextRef() { return "welcomeScreenContext"; } }