示例#1
0
  public SnapshotView(
      ClientFactory clientFactory, EventBus eventBus, SnapshotInfo snapInfo, Module parentPackage) {
    this.clientFactory = clientFactory;
    this.eventBus = eventBus;
    vert = new VerticalPanel();
    this.snapInfo = snapInfo;
    this.parentConf = parentPackage;
    PrettyFormLayout head = new PrettyFormLayout();

    head.addHeader(DroolsGuvnorImages.INSTANCE.snapshot(), header());

    vert.add(head);

    AssetViewerActivity assetViewerActivity =
        new AssetViewerActivity(parentConf.getUuid(), clientFactory);
    assetViewerActivity.start(
        new AcceptItem() {
          public void add(String tabTitle, IsWidget widget) {
            ScrollPanel pnl = new ScrollPanel();
            pnl.setWidth("100%");
            pnl.add(widget);
            vert.add(pnl);
          }
        },
        null);

    vert.setWidth("100%");
    initWidget(vert);
  }
  public WorkspaceManager() {
    PrettyFormLayout form = new PrettyFormLayout();
    form.addHeader(
        GuvnorImages.INSTANCE.WorkspaceManager(),
        new HTML("<b>" + constants.ManageWorkspaces() + "</b>"));
    form.startSection(constants.Workspaces());

    form.addAttribute("", buildDoubleList());

    HorizontalPanel hPanel = new HorizontalPanel();
    Button create = new Button(constants.AddWorkspace());
    create.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            WorkspaceEditor newCat =
                new WorkspaceEditor(
                    new Command() {
                      public void execute() {
                        refreshWorkspaceList();
                      }
                    });

            newCat.show();
          }
        });

    Button remove = new Button(constants.DeleteSelectedWorkspace());
    remove.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            if (availableWorkspacesListBox.getSelectedIndex() == -1) {
              Window.alert(constants.PleaseSelectAWorkspaceToRemove());
              return;
            }
            removeWorkspace();
          }
        });

    Button updateWorkspace = new Button(constants.UpdateSelectedWorkspace());
    updateWorkspace.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            if (availableWorkspacesListBox.getSelectedIndex() == -1) {
              Window.alert(constants.PleaseSelectAWorkspaceToUpdate());
              return;
            }

            updateWorkspace();
          }
        });
    hPanel.add(create);
    hPanel.add(remove);
    hPanel.add(updateWorkspace);

    form.addAttribute("", hPanel);

    form.endSection();
    initWidget(form);
  }
  public CategoryManager() {

    PrettyFormLayout form = new PrettyFormLayout();
    form.addHeader(images.editCategory(), new HTML(constants.EditCategories()));
    form.startSection(constants.CategoriesPurposeTip());

    explorer =
        new CategoryExplorerWidget(
            new CategorySelectHandler() {
              public void selected(String sel) {
                // don't need this here as we don't do anything on select in this spot
              }
            });
    SimplePanel editable = new SimplePanel();
    editable.add(explorer);

    form.addAttribute(constants.CurrentCategories(), editable);

    HorizontalPanel actions = new HorizontalPanel();

    form.addAttribute("", actions);

    Button newCat = new Button(constants.NewCategory());
    newCat.setTitle(constants.CreateANewCategory());
    newCat.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            CategoryEditor newCat =
                new CategoryEditor(
                    explorer.getSelectedPath(),
                    new Command() {
                      public void execute() {
                        explorer.refresh();
                      }
                    });

            newCat.show();
          }
        });

    actions.add(newCat);

    Button rename = new Button(constants.RenameSelected());
    rename.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            if (!explorer.isSelected()) {
              Window.alert(constants.PleaseSelectACategoryToRename());
              return;
            }
            renameSelected();
          }
        });

    actions.add(rename);

    Button delete = new Button(constants.DeleteSelected());
    delete.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            if (!explorer.isSelected()) {
              Window.alert(constants.PleaseSelectACategoryToDelete());
              return;
            }
            deleteSelected();
          }
        });
    delete.setTitle(constants.DeleteSelectedCat());

    actions.add(delete);

    form.endSection();

    initWidget(form);
  }