Exemplo n.º 1
0
  private VLayout createSearchPanel() {

    VLayout searchLayout = new VLayout();
    searchLayout.setWidth100();
    searchLayout.setHeight100();
    searchLayout.setLayoutMargin(10);
    searchLayout.setLayoutMargin(6);
    searchLayout.setMembersMargin(15);

    searchLayout.addMember(createSearchLayout());
    searchLayout.addMember(i_searchListGrid);

    i_searchListGrid
        .getField(SearchValueSetsListGrid.ID_ADD)
        .addCellSavedHandler(
            new CellSavedHandler() {
              @Override
              public void onCellSaved(CellSavedEvent event) {

                boolean hasRecordsToAdd = i_searchListGrid.hasAddRecords();
                i_addButton.setDisabled(!hasRecordsToAdd);
              }
            });

    return searchLayout;
  }
  public StyledLayerDescriptorLayoutView() {

    generalContentPanel = new VLayout();
    generalContentPanel.setWidth100();
    // minimal initial height
    generalContentPanel.setHeight(10);

    rulesContentPanel = new VLayout();
    rulesContentPanel.setWidth100();
    // take all the remaining space
    rulesContentPanel.setHeight("*");
    rulesContentPanel.setResizeBarTarget("next");
    rulesContentPanel.setShowResizeBar(true);

    ruleContentPanel = new VLayout();
    ruleContentPanel.setWidth100();
    // minimal initial height
    ruleContentPanel.setHeight(300);

    actionContentPanel = new VLayout();
    actionContentPanel.setWidth100();
    actionContentPanel.setHeight(10);

    widget = new VLayout();
    widget.setWidth100();
    widget.setHeight100();
    widget.setMembersMargin(5);
    widget.setMargin(5);
    widget.addMember(generalContentPanel);
    widget.addMember(rulesContentPanel);
    widget.addMember(ruleContentPanel);
    widget.addMember(actionContentPanel);
  }
Exemplo n.º 3
0
  public Canvas getViewPanel() {

    final TabSet topTabSet = new TabSet();
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setTabBarAlign(Side.LEFT);
    topTabSet.setWidth(400);
    topTabSet.setHeight(200);

    Tab tTab1 = new Tab("Blue", "pieces/16/pawn_blue.png");

    tTab1.setCanClose(true);
    Img tImg1 = new Img("pieces/48/pawn_blue.png", 48, 48);
    tTab1.setPane(tImg1);

    Tab tTab2 = new Tab("Green", "pieces/16/pawn_green.png");
    Img tImg2 = new Img("pieces/48/pawn_green.png", 48, 48);
    tTab2.setPane(tImg2);

    topTabSet.addTab(tTab1);
    topTabSet.addTab(tTab2);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);

    IButton addButton = new IButton("Add Tab");
    addButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            String title = topTabSet.getTabs().length % 2 == 0 ? "Yellow" : "Green";
            String iconType = topTabSet.getTabs().length % 2 == 0 ? "pawn" : "cube";
            Tab tTab = new Tab(title, "pieces/16/" + iconType + "_" + title.toLowerCase() + ".png");
            tTab.setCanClose(true);
            Img tImg =
                new Img("pieces/48/" + iconType + "_" + title.toLowerCase() + ".png", 48, 48);
            tTab.setPane(tImg);
            topTabSet.addTab(tTab);
          }
        });

    IButton removeButton = new IButton("Remove Tab");
    removeButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            topTabSet.removeTab(topTabSet.getTabs().length - 1);
          }
        });

    buttons.addMember(addButton);
    buttons.addMember(removeButton);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(15);
    vLayout.addMember(topTabSet);
    vLayout.addMember(buttons);
    vLayout.setHeight("auto");

    return vLayout;
  }
Exemplo n.º 4
0
  private void initGUI(final GUIInfo info) {
    // Prepare a value manager that will include all forms spanned in each
    // tab
    vm = new ValuesManager();

    // Create all the tabs each one for a specific setup step
    tabs = new TabSet();
    tabs.setWidth(500);
    tabs.setHeight(250);

    Tab registrationTab = setupRegistration(vm);
    Tab repositoryTab = setupRepository(vm);
    Tab databaseTab = setupDatabase(vm);
    Tab languageTab = setupLanguage(vm);
    Tab smtpTab = setupSmtp(vm);
    tabs.setTabs(registrationTab, repositoryTab, databaseTab, languageTab, smtpTab);

    // This is the button used to confirm each step
    submit = new IButton();
    submit.setTitle(I18N.message("next"));
    submit.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onSubmit(info);
          }
        });

    // Prepare the heading panel with Logo and Title
    // Prepare the logo image to be shown inside the login form
    Label header = new Label(I18N.message("setup"));
    header.setStyleName("setupHeader");
    header.setIcon(Util.brandUrl("logo.png"));
    header.setIconWidth(205);
    header.setIconHeight(40);
    header.setHeight(45);

    // Prepare a panel to layout setup components
    VLayout layout = new VLayout();
    layout.setHeight(500);
    layout.setWidth(400);
    layout.setMembersMargin(5);
    layout.addMember(header);
    layout.addMember(tabs);
    layout.addMember(submit);

    // Panel for horizontal centering
    VLayout vPanel = new VLayout();
    vPanel.setDefaultLayoutAlign(Alignment.CENTER);
    vPanel.setWidth100();
    vPanel.setHeight(300);
    vPanel.addMember(layout);

    RootPanel.get().add(vPanel);

    // Remove the loading frame
    RootPanel.getBodyElement().removeChild(RootPanel.get("loadingWrapper").getElement());
  }
Exemplo n.º 5
0
  /**
   * Constructor requires message text
   *
   * @param text
   */
  public ActionMessage(String text) {

    VLayout vLayout = new VLayout();
    vLayout.setShowEdges(false);

    vLayout.setWidth100();
    vLayout.setHeight100();

    vLayout.setMembersMargin(0);
    vLayout.setLayoutMargin(0);

    StringBuffer sb = new StringBuffer();

    sb.append(
        "<img style=\"margin:16px;margin-top:24px;margin-left:auto;margin-right:auto;display:block;\" ");
    sb.append("src=\"" + GuiStyles.LOADING_IMAGE + "\" width=\"64\" height=\"64\" />");

    sb.append(
        "<p style=\"font:normal 11px tahoma, arial, helvetica, sans-serif;color:"
            + GuiStyles.FONT_COLOR
            + ";text-align:center;\">"
            + text
            + "</p>");

    HTMLFlow flow = new HTMLFlow();
    flow.setContents(sb.toString());

    vLayout.addMember(flow);
    this.addItem(vLayout);

    this.setTitle(GUIGlobals.APP_TITLE);

    this.setShowCloseButton(false);
    this.setShowMinimizeButton(false);

    this.setBodyColor(GuiStyles.BG_COLOR);

    this.setWidth(240);
    this.setHeight(160);

    this.centerInPage();
    this.draw();
  }
Exemplo n.º 6
0
  private VLayout createDisplayLabel() {
    String message =
        "Search for value sets.  Select the value sets by checking the checkbox and then click Add to add them.";
    i_label = new Label("<b>" + message + "<b>");
    i_label.setWidth100();
    i_label.setHeight(30);
    i_label.setMargin(2);
    i_label.setValign(VerticalAlignment.CENTER);
    i_label.setBackgroundColor(BACKGROUND_COLOR);

    final VLayout vLayoutLayoutSpacers = new VLayout();
    vLayoutLayoutSpacers.setWidth100();
    vLayoutLayoutSpacers.setHeight(30);
    vLayoutLayoutSpacers.setBackgroundColor(BACKGROUND_COLOR);
    vLayoutLayoutSpacers.setLayoutMargin(6);
    vLayoutLayoutSpacers.setMembersMargin(6);

    vLayoutLayoutSpacers.addMember(i_label);

    return vLayoutLayoutSpacers;
  }
Exemplo n.º 7
0
  public Canvas getViewPanel() {

    VLayout layout = new VLayout();
    layout.setMembersMargin(10);

    final Canvas cubeBin = new Canvas("cubeBin");
    cubeBin.setTop(40);
    cubeBin.setWidth(400);
    cubeBin.setHeight(300);
    cubeBin.setShowEdges(true);

    IButton button = new IButton();
    button.setTitle("Create");
    button.setIcon("pieces/16/cube_blue.png");
    button.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            final Img img = new Img();
            img.setLeft(Random.nextInt(340));
            img.setTop(Random.nextInt(240));
            img.setWidth(48);
            img.setHeight(48);
            img.setParentElement(cubeBin);
            img.setSrc("pieces/48/cube_blue.png");
            img.addClickHandler(
                new ClickHandler() {
                  public void onClick(ClickEvent event) {
                    img.destroy();
                  }
                });
            img.draw();
          }
        });
    layout.addMember(button);
    layout.addMember(cubeBin);

    return layout;
  }
Exemplo n.º 8
0
  public Canvas getViewPanel() {

    VLayout layout = new VLayout();
    layout.setMembersMargin(10);

    final Img image = new Img("other/magnifier.png", 48, 48);
    image.setTop(125);
    image.setLeft(100);
    image.setAnimateTime(500); // milliseconds

    IButton zoomButton = new IButton();
    zoomButton.setTitle("Zoom");
    zoomButton.setLeft(40);
    zoomButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            image.animateRect(0, 50, 248, 248);
          }
        });

    IButton shrinkButton = new IButton();
    shrinkButton.setTitle("Shrink");
    shrinkButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            image.animateRect(100, 125, 48, 48);
          }
        });

    HLayout hLayout = new HLayout();
    hLayout.setMembersMargin(10);
    hLayout.addMember(zoomButton);
    hLayout.addMember(shrinkButton);
    layout.addMember(hLayout);

    layout.addChild(image);
    return layout;
  }
Exemplo n.º 9
0
  public Layout getWindowLayout() {
    setWidth(500);
    setHeight(500);
    setTitle("Register");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setAutoCenter(true);
    setDismissOnOutsideClick(true);
    setShowShadow(true);
    setShadowOffset(0);
    setShadowSoftness(10);

    addCloseClickHandler(
        new CloseClickHandler() {
          public void onCloseClick(CloseClientEvent event) {
            destroy();
          }
        });

    Img profileImg =
        new Img(
            member.getProfilePic(),
            100,
            ImageUtil.getScaledImageHeight(member.getProfilePic(), 100));
    profileImg.setImageType(ImageStyle.STRETCH);

    HeaderItem header = new HeaderItem();
    header.setDefaultValue("Registration");
    emailItem.setValue(member.getEmail());
    emailItem.setRequired(true);
    firstNameItem.setValue(member.getFirstname());
    firstNameItem.setRequired(true);
    lastNameItem.setValue(member.getLastname());
    lastNameItem.setRequired(true);
    AWSSecretItem.setValue(member.getAWSSecretKey());
    AWSAccessItem.setValue(member.getAWSAccessKey());

    form.setFields(header, emailItem, firstNameItem, lastNameItem, AWSSecretItem, AWSAccessItem);
    form.setAutoFocus(true);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);
    buttons.setAlign(Alignment.CENTER);

    IButton cancelButton = new IButton("Cancel");
    cancelButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            destroy();
            // com.google.gwt.user.client.Window.Location.assign(GWT.getHostPageBaseURL());
          }
        });
    saveButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            final LoginServiceAsync loginService = GWT.create(LoginService.class);
            loginService.memberExists(
                emailItem.getValueAsString(),
                new AsyncCallback<Boolean>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    SC.say("Could not check if member already exists.");
                  }

                  @Override
                  public void onSuccess(Boolean result) {
                    emailItem.setValidators(new MemberExistsValidator(result));
                    if (form.validate()) {
                      member.setEmail(emailItem.getValueAsString());
                      member.setFirstname(firstNameItem.getValueAsString());
                      member.setLastname(lastNameItem.getValueAsString());
                      member.setAWSSecretKey(AWSSecretItem.getValueAsString());
                      member.setAWSAccessKey(AWSAccessItem.getValueAsString());

                      loginService.registerMember(
                          member,
                          new AsyncCallback<Member>() {

                            @Override
                            public void onSuccess(Member result) {
                              if (member != null) {
                                destroy();
                                com.google.gwt.user.client.Window.Location.assign(
                                    GWT.getHostPageBaseURL());
                              } else SC.warn("Email address already in use!");
                            }

                            @Override
                            public void onFailure(Throwable caught) {
                              if (caught instanceof MemberExistsException)
                                SC.warn("Email address already in use!");
                              else SC.warn("Something went wrong!");
                            }
                          });
                    }
                  }
                });
          }
        });

    buttons.addMember(saveButton);
    buttons.addMember(cancelButton);

    VLayout windowLayout = new VLayout();
    windowLayout.setMargin(10);
    windowLayout.setMembersMargin(15);
    windowLayout.addMember(profileImg);
    windowLayout.addMember(form);
    windowLayout.addMember(buttons);

    return windowLayout;
  }
  public Canvas getViewPanel() {

    HStack hStack = new HStack();
    hStack.setWidth(300);
    hStack.setHeight(100);
    hStack.setShowEdges(true);
    hStack.setCanAcceptDrop(true);
    hStack.setAnimateMembers(true);
    hStack.setDropLineThickness(4);

    final Label focusLabel = new Label();
    focusLabel.setID("focusLabel");
    focusLabel.setAlign(Alignment.CENTER);
    focusLabel.setTop(150);
    focusLabel.setWidth(300);
    focusLabel.setHeight(50);

    final Img bluePawn = new Img();
    bluePawn.setID("bluePawn");
    bluePawn.setLayoutAlign(Alignment.CENTER);
    bluePawn.setWidth(48);
    bluePawn.setHeight(48);
    bluePawn.setCanFocus(true);
    bluePawn.setSrc("pieces/48/pawn_blue.png");
    bluePawn.setCanDragReposition(true);
    bluePawn.setCanDrop(true);
    bluePawn.setDragAppearance(DragAppearance.TARGET);
    bluePawn.addDrawHandler(
        new DrawHandler() {
          public void onDraw(DrawEvent event) {
            bluePawn.focus();
          }
        });
    bluePawn.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, bluePawn.getID(), event.getHasFocus());
          }
        });

    ComboBoxItem field1 = new ComboBoxItem();
    field1.setName("field1");
    field1.setValueMap("Option 1", "Option 2");

    DateItem field2 = new DateItem();
    field2.setName("field2");

    final DynamicForm simpleForm = new DynamicForm();
    simpleForm.setID("simpleForm");
    simpleForm.setLayoutAlign(Alignment.CENTER);
    simpleForm.setHeight(48);
    simpleForm.setFields(field1, field2);
    simpleForm.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, simpleForm.getID(), event.getHasFocus());
          }
        });

    final Img greenPawn = new Img();
    greenPawn.setID("greenPawn");
    greenPawn.setLayoutAlign(Alignment.CENTER);
    greenPawn.setWidth(48);
    greenPawn.setHeight(48);
    greenPawn.setCanFocus(true);
    greenPawn.setSrc("pieces/48/pawn_green.png");
    greenPawn.setCanDragReposition(true);
    greenPawn.setCanDrop(true);
    greenPawn.setDragAppearance(DragAppearance.TARGET);
    greenPawn.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, greenPawn.getID(), event.getHasFocus());
          }
        });

    hStack.addMember(bluePawn);
    hStack.addMember(simpleForm);
    hStack.addMember(greenPawn);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(10);
    vLayout.addMember(hStack);
    vLayout.addMember(focusLabel);

    return vLayout;
  }
Exemplo n.º 11
0
  public void onModuleLoad() {

    topTabSet = new TabSet();
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setWidth(1024);
    topTabSet.setHeight(768);
    topTabSet.setTabBarThickness(50);

    Tab tTab1 = new Tab("Menu", "assets/mainMenu.png");
    Img tImg1 = new Img("pieces/48/pawn_blue.png", 96, 96);

    topTabSet.addTab(tTab1);

    Tab lTab1 = new Tab();
    lTab1.setIcon("pieces/16/pawn_blue.png", 16);
    Img lImg1 = new Img("pieces/48/pawn_blue.png", 48, 48);
    lTab1.setPane(lImg1);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(15);
    vLayout.addMember(topTabSet);
    vLayout.addMember(buttons);
    // vLayout.addMember(leftTabSet);
    vLayout.setHeight("*");

    vLayout.draw();

    final HLayout hLayout = new HLayout();
    hLayout.setWidth100();
    hLayout.setHeight100();
    hLayout.setLayoutMargin(20);

    // tree menu
    TreeGrid tree = new TreeGrid();
    tree.setShowConnectors(true);
    tree.setShowResizeBar(true);

    Tree dataTree = new Tree();
    dataTree.setModelType(TreeModelType.CHILDREN);
    dataTree.setRoot(
        new TreeNode(
            "root",
            new TreeNode("Aluno"),
            new TreeNode("Funcionario"),
            new TreeNode("Contato"),
            new TreeNode("Veiculo"),
            new TreeNode("Disciplina")));

    tree.setData(dataTree);

    TreeGridField fieldTree = new TreeGridField("Navegacao");
    fieldTree.setCellFormatter(
        new CellFormatter() {
          public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
            return record.getAttribute("name");
          }
        });
    tree.setFields(fieldTree);

    // layout esquerda
    SectionStack leftSideLayout = new SectionStack();
    leftSideLayout.setWidth(200);
    leftSideLayout.setShowResizeBar(true);
    leftSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    leftSideLayout.setAnimateSections(true);

    leftSideLayout.setMembers(tree);

    // UIs
    final AlunoUI alunoUI = new AlunoUI();
    final FuncionarioUI funcionarioUI = new FuncionarioUI();
    final ContatoUI contatoUI = new ContatoUI();
    final VeiculoUI veiculoUI = new VeiculoUI();
    final DisciplinaUI disciplinaUI = new DisciplinaUI();

    // layout direita
    final SectionStack rightSideLayout = new SectionStack();
    rightSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    rightSideLayout.setAnimateSections(true);

    grid = alunoUI.getGrid();
    formBotoes = alunoUI.getFormBotoes();
    menuItens = new DynamicForm();
    menuItens.setWidth(100);
    menuItens.setAlign(Alignment.RIGHT);

    ButtonItem aluno = new ButtonItem("Aluno");
    aluno.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomAluno("Aluno");
          }
        });

    ButtonItem disc = new ButtonItem("Disciplina");
    disc.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomDisciplina("Disciplina");
          }
        });

    ButtonItem curso = new ButtonItem("Curso");
    curso.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomCurso("Curso");
          }
        });

    ButtonItem matric = new ButtonItem("Matricula");
    matric.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomMatricula("Matricula");
          }
        });

    menuItens.setFields(aluno, disc, curso, matric);

    rightSideLayout.setMembers(menuItens);
    rightSideLayout.setWidth(200);
    // seleciona tree
    tree.addNodeClickHandler(
        new NodeClickHandler() {
          public void onNodeClick(NodeClickEvent event) {
            String node = event.getNode().getAttribute("name");
            if (node.equals("Aluno")) {
              // rightSideLayout.removeMembers(formBotoes,grid);
              // Tab tab = new Tab(node);
              newTabCustomAluno(node);
            } else {
              if (node.equals("Disciplina")) {
                newTabCustomDisciplina(node);
              } else {
                if (node.equals("Curso")) {
                  //	newTabCustom(node);
                } else {
                  if (node.equals("Matricula")) {
                    //	newTabCustom(node);
                  } else {
                    if (node.equals("Disciplina")) {
                      rightSideLayout.removeMembers(formBotoes, grid);
                      grid = disciplinaUI.getGrid();
                      formBotoes = disciplinaUI.getFormBotoes();
                      rightSideLayout.setMembers(formBotoes, grid);
                    }
                  }
                }
              }
            }
          }
        });

    // hLayout

    hLayout.addMember(leftSideLayout);
    hLayout.addMember(rightSideLayout);
    hLayout.draw();

    tTab1.setPane(hLayout);
  }
Exemplo n.º 12
0
  public PCAPanel(DatasetInformation datasetInfo) {
    this.setWidth("400px");
    this.setHeight("150px");
    this.setTitle("Principal component analysis");
    this.setShowMinimizeButton(false);
    this.setIsModal(false);
    this.centerInPage();
    this.addCloseClickHandler(
        new CloseClickHandler() {
          @Override
          public void onCloseClick(CloseClickEvent event) {
            hide();
            destroy();
          }
        });

    VLayout vp = new VLayout();
    vp.setWidth100();
    vp.setHeight100();
    this.addItem(vp);

    HLayout hp1 = new HLayout();
    hp1.setWidth100();
    hp1.setHeight("20px");
    Label l1 = new Label("X AXES ");
    l1.setHeight("20px");
    l1.setWidth("100px");
    pcaI = new ListBox();
    pcaI.setWidth("200px");
    pcaI.setHeight("20px");
    pcaI.setTitle("X AXES");

    hp1.addMember(l1);
    hp1.addMember(pcaI);
    hp1.setMargin(5);

    vp.addMember(hp1);
    hp1.setAlign(Alignment.LEFT);

    HLayout hp2 = new HLayout();
    hp2.setWidth100();
    hp2.setHeight("20px");
    Label l2 = new Label("Y AXES ");
    l2.setHeight("20px");
    l2.setWidth("100px");

    pcaII = new ListBox();
    pcaII.setWidth("200px");
    pcaII.setHeight("20px");
    pcaII.setTitle("Y AXES");

    hp2.addMember(l2);
    hp2.addMember(pcaII);
    hp2.setMargin(5);

    vp.addMember(hp2);
    hp2.setAlign(Alignment.LEFT);

    if (datasetInfo != null) {
      for (String str : datasetInfo.getColsNames()) {
        pcaI.addItem(str);
        pcaII.addItem(str);
      }
      pcaI.setSelectedIndex(0);
      pcaII.setSelectedIndex(1);
    }
    okBtn = new IButton("Start Process");
    okBtn.setWidth("200px");
    okBtn.setAlign(Alignment.CENTER);
    okBtn.setShowRollOver(true);
    okBtn.setShowDown(true);
    okBtn.setTitleStyle("stretchTitle");

    HLayout btnLayout = new HLayout();
    btnLayout.setWidth100();
    btnLayout.setHeight("20px");
    btnLayout.addMember(okBtn);
    btnLayout.setAlign(Alignment.CENTER);

    vp.addMember(btnLayout);
    vp.setTop(20);
    vp.setMembersMargin(15);

    this.show();
  }
Exemplo n.º 13
0
  private void initEditWindow() {

    String strBookName = theBook.getBookName();

    this.setAutoSize(true);
    this.setTitle("《" + strBookName + "》" + "修改信息");
    this.setCanDragReposition(true);
    this.setCanDragResize(false);
    this.setAutoCenter(true);
    this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);

    VLayout vLayout;
    HLayout hLayout;
    HLayout buttonLayout;

    vLayout = new VLayout();
    vLayout.setWidth(WINDOW_WIDTH);
    vLayout.setHeight(WINDOW_HEIGHT);
    vLayout.setBorder("2px solid #7598C7");
    vLayout.setMargin(12);
    vLayout.setPadding(14);

    hLayout = new HLayout();
    hLayout.setWidth(WINDOW_WIDTH);

    // HLayout
    // ---------------------------------------------------------------------------------------
    strBookPicUrl = theBook.getBookPicUrl();
    imgVLayout = new VLayout();
    imgVLayout.setWidth(IMG_WIDTH);
    bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem.setPrefix("/images/upload/");

    uploadPicButton = new IButton("上传封面");
    uploadPicButton.setIcon("actions/plus.png");
    uploadPicButton.setWidth(IMG_WIDTH);

    imgVLayout.setMembers(bookPicUrlItem, uploadPicButton);
    imgVLayout.setMembersMargin(10);

    // Form
    // 1-----------------------------------------------------------------------------------------
    SLBookDS theDataSource = new SLBookDS();
    Record theRecord = theBook.toRecord();
    theDataSource.addData(theRecord);

    bookForm1 = new DynamicForm();
    bookForm1.setDataSource(theDataSource);
    bookForm1.setNumCols(4);
    bookForm1.setWidth("*");
    bookForm1.setColWidths(100, "*", 100, "*");
    bookForm1.setCellPadding(5);

    TextItem bookNameItem = new TextItem("bookName", "书名");
    bookNameItem.setColSpan(4);
    bookNameItem.setWidth("100%");
    bookNameItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookNameItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookAuthorItem = new TextItem("bookAuthor", "作者");
    bookAuthorItem.setColSpan(4);
    bookAuthorItem.setWidth("100%");
    bookAuthorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookAuthorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookISBNItem = new TextItem("bookISBN", "ISBN");
    bookISBNItem.setColSpan(4);
    bookISBNItem.setWidth("100%");
    bookISBNItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookISBNItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookISBNItem.setDisabled(true);

    TextItem bookPublisherItem = new TextItem("bookPublisher", "出版社");
    bookPublisherItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublisherItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    DateItem bookPublishDateItem = new DateItem("bookPublishDate", "出版日期");
    bookPublishDateItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublishDateItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookPublishDateItem.setUseTextField(true);

    SelectItem bookClassItem = new SelectItem("bookClass", "类别");
    bookClassItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookClassItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookClassItem.setValueMap(
        "计算机/网络", "小说/文学", "哲学/文化", "经济/管理", "政治/军事", "励志/成长", "儿童/育儿", "心理", "法律", "历史", "其他");
    bookClassItem.setDefaultToFirstOption(true);

    SelectItem bookLanguageItem = new SelectItem("bookLanguage", "语言");
    bookLanguageItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookLanguageItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookLanguageItem.setValueMap("中文", "英语", "法语", "德语", "日语", "俄语", "韩语");
    bookLanguageItem.setDefaultToFirstOption(true);

    TextItem bookContributorItem = new TextItem("bookContributor", "贡献者");
    bookContributorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookContributorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookPriceItem = new TextItem("bookPrice", "价格");
    bookPriceItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPriceItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookForm1.setFields(
        bookNameItem,
        bookAuthorItem,
        bookISBNItem,
        bookPublisherItem,
        bookPublishDateItem,
        bookClassItem,
        bookLanguageItem,
        bookContributorItem,
        bookPriceItem);

    bookForm1.selectRecord(theRecord);
    bookForm1.fetchData();

    // Form
    // 2-----------------------------------------------------------------------------------------
    bookForm2 = new DynamicForm();
    bookForm2.setDataSource(theDataSource);
    bookForm2.setNumCols(3);
    bookForm2.setWidth(WINDOW_WIDTH);
    bookForm2.setColWidths("*", "*", "*");
    bookForm2.setCellPadding(3);
    bookForm2.setCellBorder(1);
    bookForm2.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookTotalQuantityItemTitle = new StaticTextItem("bookTotalQuantityTitle", "");
    bookTotalQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookTotalQuantityItemTitle.setShowTitle(false);

    StaticTextItem bookInStoreQuantityitemTitle =
        new StaticTextItem("bookInStoreQuantityTitle", "");
    bookInStoreQuantityitemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookInStoreQuantityitemTitle.setShowTitle(false);

    StaticTextItem bookAvailableQuantityItemTitle =
        new StaticTextItem("bookAvailableQuantityTitle", "");
    bookAvailableQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookAvailableQuantityItemTitle.setShowTitle(false);

    TextItem bookTotalQuantityItem = new TextItem("bookTotalQuantity", "");
    bookTotalQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookTotalQuantityItem.setShowTitle(false);

    TextItem bookInStoreQuantityitem = new TextItem("bookInStoreQuantity", "");
    bookInStoreQuantityitem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookInStoreQuantityitem.setShowTitle(false);

    TextItem bookAvailableQuantityItem = new TextItem("bookAvailableQuantity", "");
    bookAvailableQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookAvailableQuantityItem.setShowTitle(false);

    bookForm2.setFields(
        bookTotalQuantityItemTitle,
        bookInStoreQuantityitemTitle,
        bookAvailableQuantityItemTitle,
        bookTotalQuantityItem,
        bookInStoreQuantityitem,
        bookAvailableQuantityItem);

    bookForm2.selectRecord(theRecord);
    bookForm2.fetchData();

    // Form
    // 3-----------------------------------------------------------------------------------------
    bookForm3 = new DynamicForm();
    bookForm3.setDataSource(theDataSource);
    bookForm3.setWidth(WINDOW_WIDTH);
    bookForm3.setCellPadding(3);
    // bookForm2.setNumCols(2);
    bookForm3.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookIntroItemTitle = new StaticTextItem("bookIntroTitle", "");
    bookIntroItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_text_title");
    bookIntroItemTitle.setShowTitle(false);

    TextAreaItem bookIntroItem = new TextAreaItem("bookIntro", "");
    bookIntroItem.setTextBoxStyle("alex_bookdisplaywindow_form_intro_content");
    bookIntroItem.setShowTitle(false);
    bookIntroItem.setColSpan(2);
    bookIntroItem.setWidth("100%");

    bookForm3.setFields(bookIntroItemTitle, bookIntroItem);

    bookForm3.selectRecord(theRecord);
    bookForm3.fetchData();

    // buttonLayout
    // --------------------------------------------------------------------------------------
    buttonLayout = new HLayout();
    submitButton = new IButton("提交修改");
    submitButton.setIcon("actions/approve.png");
    buttonLayout.setMembers(submitButton);
    buttonLayout.setAlign(Alignment.RIGHT);

    hLayout.setMembers(imgVLayout, bookForm1);
    vLayout.setMembers(hLayout, bookForm2, bookForm3, buttonLayout);
    vLayout.setMembersMargin(20);

    this.addItem(vLayout);

    bind();
  }
Exemplo n.º 14
0
  private void initNewWindow() {

    this.setAutoSize(true);
    this.setTitle("新书入库");
    this.setCanDragReposition(true);
    this.setCanDragResize(false);
    this.setAutoCenter(true);
    this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);

    VLayout vLayout;
    HLayout hLayout;
    HLayout buttonLayout;

    vLayout = new VLayout();
    vLayout.setWidth(WINDOW_WIDTH);
    vLayout.setHeight(WINDOW_HEIGHT);
    vLayout.setBorder("2px solid #7598C7");
    vLayout.setMargin(12);
    vLayout.setPadding(14);

    hLayout = new HLayout();
    hLayout.setWidth(WINDOW_WIDTH);

    // HLayout
    // ---------------------------------------------------------------------------------------
    imgVLayout = new VLayout();
    imgVLayout.setWidth(IMG_WIDTH);
    bookPicUrlItem = new Img("/images/upload/" + strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem.setPrefix("/images/upload/");

    uploadPicButton = new IButton("上传封面");
    uploadPicButton.setIcon("actions/plus.png");
    uploadPicButton.setWidth(IMG_WIDTH);

    imgVLayout.setMembers(bookPicUrlItem, uploadPicButton);
    imgVLayout.setMembersMargin(10);

    // Form
    // 1-----------------------------------------------------------------------------------------

    bookForm1 = new DynamicForm();
    bookForm1.setNumCols(4);
    bookForm1.setWidth("*");
    bookForm1.setColWidths(100, "*", 100, "*");
    bookForm1.setCellPadding(5);

    TextItem bookNameItem = new TextItem("bookName", "书名");
    bookNameItem.setColSpan(4);
    bookNameItem.setWidth("100%");
    bookNameItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookNameItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookAuthorItem = new TextItem("bookAuthor", "作者");
    bookAuthorItem.setColSpan(4);
    bookAuthorItem.setWidth("100%");
    bookAuthorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookAuthorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookISBNItem = new TextItem("bookISBN", "ISBN");
    bookISBNItem.setColSpan(4);
    bookISBNItem.setWidth("100%");
    bookISBNItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookISBNItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookISBNItem.setShowIcons(true);
    FormItemIcon fetchBookInfoBut = new FormItemIcon();
    fetchBookInfoBut.setSrc("/images/actions/approve.png");
    bookISBNItem.setIcons(fetchBookInfoBut);
    bookISBNItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              fetchDataFromDouban();
            }
          }
        });
    fetchBookInfoBut.addFormItemClickHandler(
        new FormItemClickHandler() {

          @Override
          public void onFormItemClick(FormItemIconClickEvent event) {
            fetchDataFromDouban();
          }
        });
    bookISBNItem.setIconPrompt("从豆瓣获取书籍信息");

    TextItem bookPublisherItem = new TextItem("bookPublisher", "出版社");
    bookPublisherItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublisherItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    DateItem bookPublishDateItem = new DateItem("bookPublishDate", "出版日期");
    bookPublishDateItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublishDateItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookPublishDateItem.setUseTextField(true);
    bookPublishDateItem.setDefaultChooserDate(new Date());

    SelectItem bookClassItem = new SelectItem("bookClass", "类别");
    bookClassItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookClassItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookClassItem.setValueMap(
        "计算机/网络", "小说/文学", "哲学/文化", "经济/管理", "政治/军事", "励志/成长", "儿童/育儿", "心理", "法律", "历史", "其他");
    bookClassItem.setDefaultToFirstOption(true);

    SelectItem bookLanguageItem = new SelectItem("bookLanguage", "语言");
    bookLanguageItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookLanguageItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookLanguageItem.setValueMap("中文", "英语", "法语", "德语", "日语", "俄语", "韩语");
    bookLanguageItem.setDefaultToFirstOption(true);

    TextItem bookContributorItem = new TextItem("bookContributor", "贡献者");
    bookContributorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookContributorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookPriceItem = new TextItem("bookPrice", "价格");
    bookPriceItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPriceItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookForm1.setFields(
        bookNameItem,
        bookAuthorItem,
        bookISBNItem,
        bookPublisherItem,
        bookPublishDateItem,
        bookClassItem,
        bookLanguageItem,
        bookContributorItem,
        bookPriceItem);

    // Form
    // 2-----------------------------------------------------------------------------------------
    bookForm2 = new DynamicForm();
    bookForm2.setNumCols(3);
    bookForm2.setWidth(WINDOW_WIDTH);
    bookForm2.setColWidths("*", "*", "*");
    bookForm2.setCellPadding(3);
    bookForm2.setCellBorder(1);
    bookForm2.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookTotalQuantityItemTitle = new StaticTextItem("bookTotalQuantityTitle", "");
    bookTotalQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookTotalQuantityItemTitle.setShowTitle(false);

    StaticTextItem bookInStoreQuantityitemTitle =
        new StaticTextItem("bookInStoreQuantityTitle", "");
    bookInStoreQuantityitemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookInStoreQuantityitemTitle.setShowTitle(false);

    StaticTextItem bookAvailableQuantityItemTitle =
        new StaticTextItem("bookAvailableQuantityTitle", "");
    bookAvailableQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookAvailableQuantityItemTitle.setShowTitle(false);

    TextItem bookTotalQuantityItem = new TextItem("bookTotalQuantity", "");
    bookTotalQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookTotalQuantityItem.setShowTitle(false);

    TextItem bookInStoreQuantityitem = new TextItem("bookInStoreQuantity", "");
    bookInStoreQuantityitem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookInStoreQuantityitem.setShowTitle(false);

    TextItem bookAvailableQuantityItem = new TextItem("bookAvailableQuantity", "");
    bookAvailableQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookAvailableQuantityItem.setShowTitle(false);

    bookForm2.setFields(
        bookTotalQuantityItemTitle,
        bookInStoreQuantityitemTitle,
        bookAvailableQuantityItemTitle,
        bookTotalQuantityItem,
        bookInStoreQuantityitem,
        bookAvailableQuantityItem);

    // Form
    // 3-----------------------------------------------------------------------------------------
    bookForm3 = new DynamicForm();
    bookForm3.setWidth(WINDOW_WIDTH);
    bookForm3.setCellPadding(3);
    // bookForm2.setNumCols(2);
    bookForm3.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookIntroItemTitle = new StaticTextItem("bookIntroTitle", "");
    bookIntroItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_text_title");
    bookIntroItemTitle.setShowTitle(false);

    TextAreaItem bookIntroItem = new TextAreaItem("bookIntro", "");
    bookIntroItem.setTextBoxStyle("alex_bookdisplaywindow_form_intro_content");
    bookIntroItem.setShowTitle(false);
    bookIntroItem.setColSpan(2);
    bookIntroItem.setWidth("100%");

    bookForm3.setFields(bookIntroItemTitle, bookIntroItem);

    // buttonLayout
    // --------------------------------------------------------------------------------------
    buttonLayout = new HLayout();
    newButton = new IButton("添加图书");
    newButton.setIcon("actions/approve.png");
    buttonLayout.setMembers(newButton);
    buttonLayout.setAlign(Alignment.RIGHT);

    hLayout.setMembers(imgVLayout, bookForm1);
    vLayout.setMembers(hLayout, bookForm2, bookForm3, buttonLayout);
    vLayout.setMembersMargin(20);

    bookForm1.setValue("bookPublishDate", new Date());
    bookForm1.setValue("bookClass", "计算机/网络");
    bookForm1.setValue("bookLanguage", "中文");
    bookForm1.setValue("bookPrice", "0.00");
    bookForm1.setValue("bookContributor", "公司采购");

    bookForm2.setValue("bookTotalQuantity", "1");
    bookForm2.setValue("bookInStoreQuantity", "1");
    bookForm2.setValue("bookAvailableQuantity", "1");

    bookForm2.setValue("bookTotalQuantityTitle", "总数");
    bookForm2.setValue("bookInStoreQuantityTitle", "库中数量");
    bookForm2.setValue("bookAvailableQuantityTitle", "可借数量");
    bookForm3.setValue("bookIntroTitle", "简介:");

    this.addItem(vLayout);

    bind();
  }