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.contents; 017 018import com.smartgwt.client.widgets.form.fields.StaticTextItem; 019import com.smartgwt.client.widgets.form.fields.TextItem; 020import org.modeshape.web.shared.JcrNode; 021import org.modeshape.web.shared.ModalDialog; 022 023/** 024 * Dialog asking node's name and primary type and creating new node. 025 * 026 * @author kulikov 027 */ 028public class RenameNodeDialog extends ModalDialog { 029 030 private TextItem name = new TextItem(); 031 private Contents contents; 032 private JcrNode node; 033 034 public RenameNodeDialog(Contents contents) { 035 super("Create new node", 450, 150); 036 this.contents = contents; 037 038 name.setName("name"); 039 name.setTitle("Node name"); 040 name.setDefaultValue(""); 041 name.setWidth(250); 042 name.setRequired(true); 043 name.setVisible(true); 044 name.setStartRow(true); 045 name.setEndRow(true); 046 047 StaticTextItem description = new StaticTextItem(); 048 description.setValue("Please specify the new name of node"); 049 description.setTitle(""); 050 description.setStartRow(true); 051 description.setEndRow(true); 052 053 setControls(description, name); 054 } 055 056 public void showModal(JcrNode node) { 057 this.node = node; 058 showModal(); 059 } 060 061 @Override 062 public void onConfirm(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { 063 contents.renameNode(node, name.getValueAsString()); 064 } 065}