public void run() {
VkDesignerUtil.centerDialog(dialog);
nameTextArea.setFocus(true);
}
}.schedule(100);
final VkEventTextArea jsTextArea = new VkEventTextArea();
if(menuBar.getCommandJs().containsKey(index)) {
HorizontalPanel jsHp = new HorizontalPanel();
jsHp.setWidth("100%");
dialog.add(jsHp);
jsHp.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
jsHp.add(new Label("Command Js:"));
jsHp.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
jsHp.setCellWidth(jsHp.getWidget(0), "35%");
jsTextArea.setSize("250px","80px");
jsHp.add(jsTextArea);
jsTextArea.setText(menuBar.getCommandJs().get(index));
}
HorizontalPanel buttonsPanel = new HorizontalPanel();
dialog.add(buttonsPanel);
Button saveButton = new Button("Save");
buttonsPanel.add(saveButton);
saveButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
origDialog.hide();
MenuItem item = menuBar.getMenuItem(index);
item.setHTML(nameTextArea.getText());
if(menuBar.getCommandJs().containsKey(index))
{
menuBar.getCommandJs().put(index, jsTextArea.getText());
item.setCommand(new Command() {
@Override
public void execute() {
VkStateHelper.getInstance().getEventHelper().executeEvent(jsTextArea.getText(), (Map<String, String>)null);
}
});
}
}
});