001/* 002 * ModeShape (http://www.modeshape.org) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.modeshape.web.client.admin; 017 018import com.smartgwt.client.widgets.Canvas; 019import com.smartgwt.client.widgets.Label; 020import com.smartgwt.client.widgets.events.ClickEvent; 021import com.smartgwt.client.widgets.events.ClickHandler; 022import com.smartgwt.client.widgets.layout.VLayout; 023 024/** 025 * 026 * @author kulikov 027 */ 028public class UploadRestoreControl extends VLayout { 029 030 private final UploadBackupDialog uploadBackupDialog = new UploadBackupDialog(this); 031 private final AdminView adminView; 032 033 public UploadRestoreControl(final AdminView adminView) { 034 super(); 035 this.adminView = adminView; 036 037 setStyleName("admin-control"); 038 039 Label label = new Label("Upload & Restore"); 040 label.setIcon("icons/documents.png"); 041 label.setStyleName("button-label"); 042 label.setHeight(25); 043 label.addClickHandler(new ClickHandler() { 044 @Override 045 public void onClick(ClickEvent event) { 046 uploadBackupDialog.showModal(adminView.repository()); 047 } 048 }); 049 050 Canvas text = new Canvas(); 051 text.setAutoHeight(); 052 text.setContents("Once you have a complete backup on disk, you can " 053 + "then restore a repository back to the state captured " 054 + "within the backup. To do that, simply start a repository " 055 + "(or perhaps a new instance of a repository with a " 056 + "different configuration) and, before it’s used by " 057 + "any applications, load into the new repository all of " + "the content in the backup. "); 058 059 addMember(label); 060 addMember(text); 061 } 062 063 protected void showLoadIcon() { 064 adminView.console().showLoadingIcon(); 065 } 066}