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.google.gwt.core.client.GWT; 019import com.smartgwt.client.types.Encoding; 020import com.smartgwt.client.types.FormMethod; 021import com.smartgwt.client.widgets.form.fields.CheckboxItem; 022import com.smartgwt.client.widgets.form.fields.HiddenItem; 023import com.smartgwt.client.widgets.form.fields.StaticTextItem; 024import com.smartgwt.client.widgets.form.fields.UploadItem; 025import com.smartgwt.client.widgets.form.fields.events.ClickEvent; 026import org.modeshape.web.shared.ModalDialog; 027 028/** 029 * Dialog asking backup directory. 030 * 031 * @author kulikov 032 */ 033public class UploadBackupDialog extends ModalDialog { 034 035 private final HiddenItem repositoryField = new HiddenItem("repository"); 036 private final UploadItem fileItem = new UploadItem("Upload content"); 037 private final CheckboxItem incBinaries = new CheckboxItem("Include binaries"); 038 private final CheckboxItem reindexOnFinish = new CheckboxItem("Reindex on finish"); 039 private final UploadRestoreControl control; 040 041 public UploadBackupDialog(UploadRestoreControl control) { 042 super("Upload", 400, 200); 043 this.control = control; 044 045 StaticTextItem description = new StaticTextItem(""); 046 description.setValue("Specify backup name"); 047 048 setControls(description,repositoryField, fileItem, incBinaries, reindexOnFinish); 049 setAction(GWT.getModuleBaseForStaticFiles() + "backup-upload/content"); 050 051 form().setEncoding(Encoding.MULTIPART); 052 form().setMethod(FormMethod.POST); 053 form().setAction(GWT.getModuleBaseForStaticFiles() + "backup-upload/content"); 054 } 055 056 @Override 057 public void onConfirm(ClickEvent event) { 058 control.showLoadIcon(); 059 this.submitForm(); 060 } 061 062 public void showModal(String repository) { 063 repositoryField.setValue(repository); 064 showModal(); 065 } 066}