001/* 002 * JGrapes Event Driven Framework 003 * Copyright (C) 2017-2018 Michael N. Lipp 004 * 005 * This program is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU Affero General Public License as published by 007 * the Free Software Foundation; either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, but 011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 013 * for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License along 016 * with this program; if not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jgrapes.webconsole.base.events; 020 021import java.io.IOException; 022import java.io.Writer; 023import java.util.List; 024 025/** 026 * Sent by the server to the browser in response to {@link ConsolePrepared} 027 * (see this event's description for details). The provided information 028 * enables the web console to restore web console components to their previous 029 * positions. 030 */ 031public class LastConsoleLayout extends ConsoleCommand { 032 033 private final List<String> previewLayout; 034 private final List<String> tabsLayout; 035 private final Object xtraInfo; 036 037 /** 038 * @param previewLayout 039 * @param tabsLayout 040 */ 041 public LastConsoleLayout(List<String> previewLayout, 042 List<String> tabsLayout, Object xtraInfo) { 043 this.previewLayout = previewLayout; 044 this.tabsLayout = tabsLayout; 045 this.xtraInfo = xtraInfo; 046 } 047 048 /** 049 * @return the previewLayout 050 */ 051 public List<String> previewLayout() { 052 return previewLayout; 053 } 054 055 /** 056 * @return the tabsLayout 057 */ 058 public List<String> tabsLayout() { 059 return tabsLayout; 060 } 061 062 /** 063 * @return the extra information 064 */ 065 public Object xtraInfo() { 066 return xtraInfo; 067 } 068 069 @Override 070 public void emitJson(Writer writer) throws IOException { 071 emitJson(writer, "lastConsoleLayout", previewLayout(), tabsLayout(), 072 xtraInfo()); 073 } 074 075}