Beispiel #1
0
 private void createAgentStatusTextItem() {
   agentStatusText = new StaticTextItem("agentStatus", MSG.view_remoteAgentInstall_agentStatus());
   agentStatusText.setDefaultValue(MSG.view_remoteAgentInstall_agentStatusDefault());
   agentStatusText.setRedrawOnChange(true);
   agentStatusText.setStartRow(true);
   agentStatusText.setEndRow(false);
 }
Beispiel #2
0
  /**
   * This is a static utility method that is package protected so the message center view and the
   * message bar can pop up a dialog showing a message's details.
   *
   * @param message the message whose details are to be shown
   */
  static void showDetails(Message message) {
    if (message == null) {
      return;
    }

    DynamicForm form = new LocatableDynamicForm("MessageCenterDetailsForm");
    form.setWrapItemTitles(false);
    form.setAlign(Alignment.LEFT);

    StaticTextItem title = new StaticTextItem("theMessage", MSG.common_title_message());
    title.setValue(message.conciseMessage);

    StaticTextItem severity =
        new StaticTextItem("severity", MSG.view_messageCenter_messageSeverity());
    FormItemIcon severityIcon = new FormItemIcon();
    severityIcon.setSrc(getSeverityIcon(message.severity));
    severity.setIcons(severityIcon);
    severity.setValue(message.severity.name());

    StaticTextItem date = new StaticTextItem("time", MSG.view_messageCenter_messageTime());
    date.setValue(
        TimestampCellFormatter.format(message.fired, TimestampCellFormatter.DATE_TIME_FORMAT_FULL));

    StaticTextItem detail = new StaticTextItem("detail", MSG.view_messageCenter_messageDetail());
    detail.setTitleVAlign(VerticalAlignment.TOP);
    detail.setValue(message.detailedMessage);

    form.setItems(title, severity, date, detail);

    final Window dialogWin = new LocatableWindow("MessageCenterDetailsWindow");
    dialogWin.setTitle(MSG.common_title_message());
    dialogWin.setWidth(600);
    dialogWin.setHeight(400);
    dialogWin.setIsModal(true);
    dialogWin.setShowModalMask(true);
    dialogWin.setCanDragResize(true);
    dialogWin.setShowMaximizeButton(true);
    dialogWin.setShowMinimizeButton(false);
    dialogWin.centerInPage();
    dialogWin.addItem(form);
    dialogWin.show();
    dialogWin.addCloseClickHandler(
        new CloseClickHandler() {
          @Override
          public void onCloseClick(CloseClientEvent event) {
            dialogWin.destroy();
          }
        });
  }
  private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) {
    result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result;
    addrComp = new AddressComponent(false, true, result.get("" + ClSelection.T_REGION));
    setStatuses();
    addrComp.getSiRegion().setTitle("Region");
    addrComp.getSiSubregion().setTitle("Sub Region");
    addrComp.getSiCity().setTitle("City");
    stDocCount.setTitleOrientation(TitleOrientation.LEFT);
    stDocCount.setRequired(true);
    FormItem[] items =
        new FormItem[] {
          diStart,
          diEnd,
          tiUserName,
          addrComp.getSiRegion(),
          addrComp.getSiSubregion(),
          addrComp.getSiCity(),
          iiZona,
          siDocStatus,
          iiCustomer,
          tiContent,
          tiDocId,
          tiCancelary,
          findItem,
          showStatusItem,
          bashConfirm,
          stDocCount
        };
    // if (showStatusItem != null) {
    // FormItem[] itemsTmp = new FormItem[items.length + 1];
    // for (int i = 0; i < items.length; i++) {
    // itemsTmp[i] = items[i];
    // }
    // itemsTmp[items.length] = showStatusItem;
    // items = itemsTmp;
    // }
    setFields(items);
    // showStatusItem.hide();
    // if (!DocFlow.hasPermition("CAN_SEE_STATUSES")) {
    // showStatusItem.hide();
    // }

  }
  private DynamicForm createSummaryForm() {

    DynamicForm form = new DynamicForm();
    form.setWidth100();
    form.setColWidths("20%", "40%", "40%");
    form.setNumCols(3);
    form.setAutoHeight();
    form.setWrapItemTitles(false);
    form.setExtraSpace(10);
    form.setIsGroup(true);
    form.setGroupTitle(MSG.common_title_summary());
    form.setPadding(5);

    CanvasItem actionItem = new CanvasItem("actions");
    actionItem.setColSpan(1);
    actionItem.setRowSpan(4);
    actionItem.setShowTitle(false);
    actionItem.setCanvas(getActionLayout());

    StaticTextItem versionItem = new StaticTextItem("version", MSG.common_title_version());
    versionItem.setValue(version.getVersion());

    StaticTextItem liveDeploymentsItem =
        new StaticTextItem("deployments", MSG.view_bundle_deployments());
    liveDeploymentsItem.setValue(version.getBundleDeployments().size());

    StaticTextItem filesItems = new StaticTextItem("files", MSG.view_bundle_files());
    filesItems.setValue(version.getBundleFiles().size());

    StaticTextItem descriptionItem =
        new StaticTextItem("description", MSG.common_title_description());
    descriptionItem.setValue(version.getDescription());

    form.setFields(versionItem, actionItem, liveDeploymentsItem, filesItems, descriptionItem);
    return form;
  }
Beispiel #5
0
  private DynamicForm buildEditForm() {
    editForm = new LocatableDynamicForm(extendLocatorId("Editor"));
    editForm.setMargin(5);
    editForm.setAutoWidth();
    editForm.setNumCols(canEditName() ? 12 : 10);

    TextItem nameItem = null;
    if (dashboardContainer.supportsDashboardNameEdit()) {
      nameItem = new TextItem("name", MSG.common_title_dashboard_name());
      nameItem.setValue(storedDashboard.getName());
      nameItem.setLength(200);
      nameItem.setWrapTitle(false);
      nameItem.addBlurHandler(
          new BlurHandler() {
            public void onBlur(BlurEvent blurEvent) {
              FormItem nameItem = blurEvent.getItem();
              String name = (String) nameItem.getValue();
              String trimmedName = (name == null) ? "" : name.trim();
              if (dashboardContainer.isValidDashboardName(trimmedName)) {
                storedDashboard.setName(trimmedName);
                save();
                dashboardContainer.updateDashboardNames();
              } else {
                // TODO: i18n
                Message message =
                    new Message(
                        "There is already a dashboard named '"
                            + trimmedName
                            + "'. Please specify a name that is not already in use.",
                        Message.Severity.Error,
                        EnumSet.of(Message.Option.Transient));
                CoreGUI.getMessageCenter().notify(message);
                nameItem.setValue(storedDashboard.getName());
              }
            }
          });
    }

    final StaticTextItem numColItem = new StaticTextItem();
    numColItem.setTitle(MSG.common_title_columns());
    numColItem.setValue(storedDashboard.getColumns());

    ButtonItem addColumn = new ButtonItem("addColumn", MSG.common_title_add_column());
    addColumn.setAutoFit(true);
    addColumn.setStartRow(false);
    addColumn.setEndRow(false);

    final ButtonItem removeColumn =
        new ButtonItem("removeColumn", MSG.common_title_remove_column());
    removeColumn.setAutoFit(true);
    removeColumn.setStartRow(false);
    removeColumn.setEndRow(false);
    removeColumn.setDisabled(storedDashboard.getColumns() == 1);

    addColumn.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
          public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
            portalLayout.addMember(new PortalColumn());
            numColItem.setValue(storedDashboard.getColumns() + 1);
            storedDashboard.setColumns(storedDashboard.getColumns() + 1);
            removeColumn.setDisabled(storedDashboard.getColumns() == 1);
            save();
          }
        });

    removeColumn.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
          public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {

            Canvas[] columns = portalLayout.getMembers();
            int numColumns = columns.length;
            if (numColumns > 0) {
              PortalColumn lastColumn = (PortalColumn) columns[numColumns - 1];
              for (Canvas portletWindow : lastColumn.getMembers()) {
                storedDashboard.removePortlet(((PortletWindow) portletWindow).getStoredPortlet());
              }
              portalLayout.removeMember(lastColumn);
              numColItem.setValue(numColumns - 1);
              storedDashboard.setColumns(storedDashboard.getColumns() - 1);
              removeColumn.setDisabled(storedDashboard.getColumns() == 1);
              save();
            }
          }
        });

    // build the menu of valid portlets for this context, sorted by portlet name
    final Menu addPortletMenu = new LocatableMenu(editForm.extendLocatorId("PortletMenu"));
    LinkedHashMap<String, String> valueMap;

    switch (context.getType()) {
      case SubsystemView:
        valueMap = PortletFactory.getGlobalPortletMenuMap();
        break;

      case ResourceGroup:
        valueMap = processPortletNameMapForGroup(this.groupComposite);
        // In addition to the group-specific portlets, make the global portlets available
        valueMap.putAll(PortletFactory.getGlobalPortletMenuMap());
        break;

      case Resource:
        valueMap = processPortletNameMapForResource(this.resourceComposite);
        // In addition to the resource-specific portlets, make the global portlets available
        valueMap.putAll(PortletFactory.getGlobalPortletMenuMap());
        break;

      default:
        throw new IllegalStateException("Unsupported context [" + context + "]");
    }
    for (Iterator<String> i = valueMap.keySet().iterator(); i.hasNext(); ) {
      String portletKey = i.next();
      String portletName = valueMap.get(portletKey);
      MenuItem menuItem = new MenuItem(portletName);
      menuItem.setAttribute("portletKey", portletKey);
      addPortletMenu.addItem(menuItem);
    }

    addPortlet =
        new LocatableIMenuButton(
            editForm.extendLocatorId("AddPortlet"), MSG.common_title_add_portlet(), addPortletMenu);
    addPortlet.setIcon("[skin]/images/actions/add.png");
    addPortlet.setAutoFit(true);

    addPortletMenu.addItemClickHandler(
        new ItemClickHandler() {
          public void onItemClick(ItemClickEvent itemClickEvent) {
            String key = itemClickEvent.getItem().getAttribute("portletKey");
            String name = itemClickEvent.getItem().getTitle();
            addPortlet(key, name);
          }
        });

    CanvasItem addCanvas = new CanvasItem();
    addCanvas.setShowTitle(false);
    addCanvas.setCanvas(addPortlet);
    addCanvas.setStartRow(false);
    addCanvas.setEndRow(false);

    ColorButtonItem picker = new ColorButtonItem("colorButton", MSG.common_title_background());
    picker.setStartRow(false);
    picker.setEndRow(false);
    picker.setCurrentColor(
        storedDashboard.getConfiguration().getSimpleValue(Dashboard.CFG_BACKGROUND, "white"));
    picker.setColorSelectedHandler(
        new ColorSelectedHandler() {
          @Override
          public void onColorSelected(ColorSelectedEvent event) {
            String selectedColor = event.getColor();
            if (selectedColor != null) {
              setBackgroundColor(selectedColor);
              storedDashboard
                  .getConfiguration()
                  .put(new PropertySimple(Dashboard.CFG_BACKGROUND, selectedColor));
              save();
            }
          }
        });

    // refresh interval
    LocatableMenu refreshMenu = new LocatableMenu("AutoRefreshMenu");
    refreshMenu.setShowShadow(true);
    refreshMenu.setShadowDepth(10);
    refreshMenu.setAutoWidth();
    refreshMenu.setHeight(15);
    ClickHandler menuClick =
        new ClickHandler() {
          @Override
          public void onClick(MenuItemClickEvent event) {
            String selection = event.getItem().getTitle();
            refreshInterval = 0;
            if (selection != null) {
              if (selection.equals(STOP)) {
                refreshInterval = STOP_VALUE;
              } else if (selection.equals(REFRESH1)) {
                refreshInterval = REFRESH1_VALUE;
              } else if (selection.equals(REFRESH5)) {
                refreshInterval = REFRESH5_VALUE;
              } else if (selection.equals(REFRESH10)) {
                refreshInterval = REFRESH10_VALUE;
              } else { // unable to locate value disable refresh
                refreshInterval = STOP_VALUE; //
              }
              UserSessionManager.getUserPreferences()
                  .setPageRefreshInterval(refreshInterval, new UpdatePortletRefreshCallback());
            }
          }
        };

    String[] refreshIntervals = {STOP, REFRESH1, REFRESH5, REFRESH10};
    Integer[] refreshValues = {STOP_VALUE, REFRESH1_VALUE, REFRESH5_VALUE, REFRESH10_VALUE};
    refreshMenuMappings = new HashMap<Integer, String>();
    refreshMenuItems = new MenuItem[refreshIntervals.length];
    int retrievedRefreshInterval = REFRESH1_VALUE;
    if (null != UserSessionManager.getUserPreferences()) {
      retrievedRefreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
    }
    for (int i = 0; i < refreshIntervals.length; i++) {
      MenuItem item = new MenuItem(refreshIntervals[i], "");
      item.addClickHandler(menuClick);
      refreshMenuMappings.put(refreshValues[i], refreshIntervals[i]);
      if (retrievedRefreshInterval == refreshValues[i]) {
        item.setIcon(ImageManager.getAvailabilityIcon(true));
      }
      refreshMenuItems[i] = item;
    }

    refreshMenu.setItems(refreshMenuItems);
    refreshMenuButton =
        new LocatableIMenuButton(
            "AutoRefreshButton", MSG.common_title_change_refresh_time(), refreshMenu);
    refreshMenu.setAutoHeight();
    refreshMenuButton.getMenu().setItems(refreshMenuItems);
    refreshMenuButton.setWidth(140);
    refreshMenuButton.setShowTitle(true);
    refreshMenuButton.setTop(0);
    refreshMenuButton.setIconOrientation("left");

    CanvasItem refreshCanvas = new CanvasItem();
    refreshCanvas.setShowTitle(false);
    refreshCanvas.setCanvas(refreshMenuButton);
    refreshCanvas.setStartRow(false);
    refreshCanvas.setEndRow(false);

    if (null != nameItem) {
      editForm.setItems(
          nameItem, addCanvas, numColItem, addColumn, removeColumn, picker, refreshCanvas);
    } else {
      editForm.setItems(addCanvas, numColItem, addColumn, removeColumn, picker, refreshCanvas);
    }

    updateRefreshMenu();
    this.refreshMenuButton.markForRedraw();

    markForRedraw();

    // attempt to initialize
    editForm.markForRedraw();
    markForRedraw();

    return editForm;
  }
Beispiel #6
0
  private void buildInstallInfoCanvas(AgentInstallInfo info) {
    DynamicForm infoForm = new DynamicForm();
    infoForm.setMargin(20);
    infoForm.setWidth100();
    infoForm.setHeight100();

    HeaderItem infoHeader = new HeaderItem();
    infoHeader.setValue(MSG.view_remoteAgentInstall_installInfo());

    StaticTextItem version = new StaticTextItem("version", MSG.common_title_version());
    version.setValue(info.getVersion());

    StaticTextItem path = new StaticTextItem("path", MSG.common_title_path());
    path.setValue(info.getPath());

    StaticTextItem owner = new StaticTextItem("owner", MSG.common_title_owner());
    owner.setValue(info.getOwner());

    StaticTextItem config = new StaticTextItem("config", MSG.common_title_configuration());
    config.setValue(info.getConfigurationStartString());

    CanvasItem listCanvas = new CanvasItem();
    listCanvas.setShowTitle(false);
    listCanvas.setColSpan(2);

    VLayout listLayout = new VLayout(0);
    listLayout.setWidth100();
    listLayout.setHeight100();

    ListGrid listGrid =
        new ListGrid() {
          @Override
          protected Canvas getExpansionComponent(ListGridRecord record) {
            Canvas canvas = super.getExpansionComponent(record);
            canvas.setPadding(5);
            return canvas;
          }
        };
    listGrid.setWidth100();
    listGrid.setHeight100();
    listGrid.setCanExpandRecords(true);
    listGrid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
    listGrid.setDetailField("result");
    ListGridField step = new ListGridField("description", MSG.view_remoteAgentInstall_step());
    ListGridField result = new ListGridField("result", MSG.view_remoteAgentInstall_result());
    ListGridField resultCode =
        new ListGridField("resultCode", MSG.view_remoteAgentInstall_resultCode(), 90);
    ListGridField duration = new ListGridField("duration", MSG.common_title_duration(), 90);
    listGrid.setFields(step, result, resultCode, duration);
    listGrid.setData(getStepRecords(info));

    listLayout.addMember(listGrid);
    listCanvas.setCanvas(listLayout);

    // Replace the current info with just the install steps
    for (Canvas canvas : this.getChildren()) {
      canvas.markForDestroy();
    }

    createAgentStatusTextItem();
    infoForm.setFields(infoHeader, version, path, owner, config, agentStatusText, listCanvas);

    addMember(infoForm);

    this.setMembersMargin(1);
    this.markForRedraw();
  }
Beispiel #7
0
 private void setAgentStatusText(String msg) {
   if (agentStatusText != null) {
     agentStatusText.setValue(msg);
   }
 }
  private void prepareDetailsSection(SectionStack stack, ServerPlugin plugin) {
    DynamicForm form = new DynamicForm();
    form.setMargin(10);
    form.setWidth100();
    form.setWrapItemTitles(false);
    form.setNumCols(4);

    StaticTextItem nameItem = new StaticTextItem("name", MSG.common_title_name());
    nameItem.setValue(plugin.getName());

    StaticTextItem displayNameItem =
        new StaticTextItem("displayName", MSG.common_title_display_name());
    displayNameItem.setValue(plugin.getDisplayName());

    StaticTextItem versionItem = new StaticTextItem("version", MSG.common_title_version());
    versionItem.setValue(plugin.getVersion());

    StaticTextItem md5Item = new StaticTextItem("MD5", "MD5");
    md5Item.setValue(plugin.getMD5());

    StaticTextItem pathItem = new StaticTextItem("path", MSG.common_title_path());
    pathItem.setValue(plugin.getPath());

    StaticTextItem ampsItem =
        new StaticTextItem("ampsVersion", "AMPS " + MSG.common_title_version());
    ampsItem.setValue(plugin.getAmpsVersion());

    StaticTextItem descItem = new StaticTextItem("desc", MSG.common_title_description());
    descItem.setValue(plugin.getDescription());

    StaticTextItem mtimeItem = new StaticTextItem("mtime", MSG.common_title_lastUpdated());
    mtimeItem.setValue(
        TimestampCellFormatter.format(
            Long.valueOf(plugin.getMtime()), TimestampCellFormatter.DATE_TIME_FORMAT_MEDIUM));

    StaticTextItem kindItem = new StaticTextItem("kind", MSG.common_title_kind());
    switch (plugin.getDeployment()) {
      case AGENT:
        kindItem.setValue(MSG.view_admin_plugins_agent());
        break;
      case SERVER:
        kindItem.setValue(MSG.view_admin_plugins_server());
        break;
    }

    CanvasItem enabledItem = new CanvasItem("enabled", MSG.common_title_enabled());
    Img img = new Img(ImageManager.getAvailabilityIcon(plugin.isEnabled()), 16, 16);
    enabledItem.setCanvas(img);

    StaticTextItem typeItem = new StaticTextItem("type", MSG.common_title_type());
    typeItem.setValue(plugin.getType());

    form.setItems(
        displayNameItem,
        nameItem,
        versionItem,
        ampsItem,
        md5Item,
        kindItem,
        descItem,
        pathItem,
        mtimeItem,
        enabledItem,
        typeItem);

    SectionStackSection section = new SectionStackSection(MSG.common_title_details());
    section.setExpanded(true);
    section.setItems(form);

    detailsSection = section;
    ++initSectionCount;

    return;
  }
  public SmsQueueWindow(final Integer smsInfoId, String sms, String name) {
    setTitle(TicketMaster.constants.sms_numbers());
    setWidth(600);
    setHeight(500);
    setIsModal(true);
    setShowModalMask(true);
    setShowMaximizeButton(true);
    setShowMinimizeButton(false);
    setShowCloseButton(true);
    setAutoDraw(true);
    centerInPage();

    VLayout vLayout = new VLayout();
    vLayout.setWidth100();
    vLayout.setHeight100();
    form = new DynamicForm();
    form.setPadding(15);
    form.setWidth100();
    form.setNumCols(2);
    smsField = new StaticTextItem("sms", TicketMaster.constants.sms_sms());
    smsField.setValue(sms);
    smsField.setTitleVAlign(VerticalAlignment.TOP);

    StaticTextItem nameField = new StaticTextItem("name", TicketMaster.constants.name());
    nameField.setValue(name);
    form.setFields(nameField, smsField);

    Criteria c = new Criteria();
    c.setAttribute("timestamp", new Date().getTime());
    c.setAttribute("sms_info_id", smsInfoId);

    grid = new ListGrid();
    grid.setWidth100();
    grid.setHeight100();
    grid.setDataSource(DataSource.get("SMSBroadcastDS"));
    grid.setFetchOperation("getNumbers");
    grid.setCriteria(c);
    grid.setAutoFetchData(true);
    ListGridField sendDateField =
        new ListGridField("send_date", TicketMaster.constants.sms_sendDate(), 120);
    sendDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    ListGridField deliveryDateField =
        new ListGridField("delivery_date", TicketMaster.constants.sms_deliveryDate(), 120);
    deliveryDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    grid.setFields(
        new ListGridField("id", "ID", 60),
        new ListGridField("phone_number", TicketMaster.constants.sms_number()),
        new ListGridField("state", TicketMaster.constants.sms_state()),
        sendDateField,
        deliveryDateField);

    IButton exportBtn = new IButton(TicketMaster.constants.sms_export());
    exportBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            com.google.gwt.user.client.Window.open(
                "./SMSBroadcast/ExportNumbers?sms_info_id=" + smsInfoId, "_self", "");
          }
        });
    exportBtn.setIcon("excel.gif");

    HLayout bbar = new HLayout();
    bbar.setAlign(Alignment.RIGHT);
    bbar.setMembersMargin(5);
    bbar.setPadding(5);
    bbar.addMembers(exportBtn);
    vLayout.addMembers(form, grid, bbar);

    addItem(vLayout);
  }
Beispiel #10
0
  private DynamicForm getServerDetails() {
    final DynamicForm form = new LocatableDynamicForm(extendLocatorId("serverDetails"));
    form.setWidth100();
    form.setExtraSpace(15);
    form.setIsGroup(true);
    form.setGroupTitle(MSG.view_admin_systemSettings_serverDetails());

    final StaticTextItem productName = new StaticTextItem("productname", MSG.common_title_name());
    final StaticTextItem productVersion =
        new StaticTextItem("productversion", MSG.common_title_version());
    final StaticTextItem productBuildNumber =
        new StaticTextItem(
            "productbuild", MSG.view_admin_systemSettings_serverDetails_buildNumber());

    final StaticTextItem serverTimezone =
        new StaticTextItem("timezone", MSG.view_admin_systemSettings_serverDetails_tz());
    final StaticTextItem serverTime =
        new StaticTextItem("localtime", MSG.view_admin_systemSettings_serverDetails_time());
    final StaticTextItem serverInstallDir =
        new StaticTextItem("installdir", MSG.view_admin_systemSettings_serverDetails_installDir());
    final StaticTextItem dbUrl =
        new StaticTextItem("dbUrl", MSG.view_admin_systemSettings_serverDetails_dbUrl());
    final StaticTextItem dbProductName =
        new StaticTextItem("dbProductName", MSG.view_admin_systemSettings_serverDetails_dbName());
    final StaticTextItem dbProductVersion =
        new StaticTextItem(
            "dbProductVersion", MSG.view_admin_systemSettings_serverDetails_dbVersion());
    final StaticTextItem dbDriverName =
        new StaticTextItem(
            "dbDriverName", MSG.view_admin_systemSettings_serverDetails_dbDriverName());
    final StaticTextItem dbDriverVersion =
        new StaticTextItem(
            "dbDriverVersion", MSG.view_admin_systemSettings_serverDetails_dbDriverVersion());
    final StaticTextItem currentMeasRawTable =
        new StaticTextItem(
            "currentMeasRawTable", MSG.view_admin_systemSettings_serverDetails_currentTable());
    final StaticTextItem nextMeasTableRotation =
        new StaticTextItem(
            "nextMeasTableRotation", MSG.view_admin_systemSettings_serverDetails_nextRotation());

    productName.setWrapTitle(false);
    productVersion.setWrapTitle(false);
    productBuildNumber.setWrapTitle(false);
    serverTimezone.setWrapTitle(false);
    serverTime.setWrapTitle(false);
    serverInstallDir.setWrapTitle(false);
    dbUrl.setWrapTitle(false);
    dbProductName.setWrapTitle(false);
    dbProductVersion.setWrapTitle(false);
    dbDriverName.setWrapTitle(false);
    dbDriverVersion.setWrapTitle(false);
    currentMeasRawTable.setWrapTitle(false);
    nextMeasTableRotation.setWrapTitle(false);

    form.setItems(
        productName,
        productVersion,
        productBuildNumber,
        serverTimezone,
        serverTime,
        serverInstallDir,
        dbUrl,
        dbProductName,
        dbProductVersion,
        dbDriverName,
        dbDriverVersion,
        currentMeasRawTable,
        nextMeasTableRotation);

    GWTServiceLookup.getSystemService()
        .getServerDetails(
            new AsyncCallback<ServerDetails>() {

              @Override
              public void onSuccess(ServerDetails result) {
                ProductInfo productInfo = result.getProductInfo();
                form.setValue(productName.getName(), productInfo.getName());
                form.setValue(productVersion.getName(), productInfo.getVersion());
                form.setValue(productBuildNumber.getName(), productInfo.getBuildNumber());

                Map<Detail, String> details = result.getDetails();
                form.setValue(
                    serverTimezone.getName(), details.get(ServerDetails.Detail.SERVER_TIMEZONE));
                form.setValue(
                    serverTime.getName(), details.get(ServerDetails.Detail.SERVER_LOCAL_TIME));
                form.setValue(
                    serverInstallDir.getName(),
                    details.get(ServerDetails.Detail.SERVER_INSTALL_DIR));
                form.setValue(
                    dbUrl.getName(), details.get(ServerDetails.Detail.DATABASE_CONNECTION_URL));
                form.setValue(
                    dbProductName.getName(),
                    details.get(ServerDetails.Detail.DATABASE_PRODUCT_NAME));
                form.setValue(
                    dbProductVersion.getName(),
                    details.get(ServerDetails.Detail.DATABASE_PRODUCT_VERSION));
                form.setValue(
                    dbDriverName.getName(), details.get(ServerDetails.Detail.DATABASE_DRIVER_NAME));
                form.setValue(
                    dbDriverVersion.getName(),
                    details.get(ServerDetails.Detail.DATABASE_DRIVER_VERSION));
                form.setValue(
                    currentMeasRawTable.getName(),
                    details.get(ServerDetails.Detail.CURRENT_MEASUREMENT_TABLE));
                form.setValue(
                    nextMeasTableRotation.getName(),
                    details.get(ServerDetails.Detail.NEXT_MEASUREMENT_TABLE_ROTATION));
              }

              @Override
              public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler()
                    .handleError(MSG.view_admin_systemSettings_cannotLoadServerDetails(), caught);
              }
            });

    return form;
  }
  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();
  }
  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();
  }