public void initializeFromStyle(final ElementStyleSheet styleSheet) {
    final ElementAlignment halign =
        (ElementAlignment) styleSheet.getStyleProperty(ElementStyleKeys.ALIGNMENT);
    if (ElementAlignment.LEFT.equals(halign)) {
      leftAlignButton.setSelected(true);
    } else if (ElementAlignment.CENTER.equals(halign)) {
      centerAlignButton.setSelected(true);
    } else {
      rightAlignButton.setSelected(true);
    }

    final ElementAlignment valign =
        (ElementAlignment) styleSheet.getStyleProperty(ElementStyleKeys.VALIGNMENT);
    if (ElementAlignment.BOTTOM.equals(valign)) {
      bottomAlignButton.setSelected(true);
    } else if (ElementAlignment.MIDDLE.equals(valign)) {
      middleAlignButton.setSelected(true);
    } else {
      topAlignButton.setSelected(true);
    }

    wrapTextCheckbox.setSelected(
        TextWrap.WRAP.equals(styleSheet.getStyleProperty(TextStyleKeys.TEXT_WRAP)));
    lineHeightField.setText(
        BorderPropertiesPane.printLength(
            (Number) styleSheet.getStyleProperty(TextStyleKeys.LINEHEIGHT)));

    textAlignModel.setSelectedKey(
        styleSheet.getStyleProperty(TextStyleKeys.VERTICAL_TEXT_ALIGNMENT));
    whitespaceModel.setSelectedKey(styleSheet.getStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE));
  }
  public void commitValues(final ElementStyleSheet styleSheet) {
    if (centerAlignButton.isSelected()) {
      styleSheet.setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.CENTER);
    } else if (rightAlignButton.isSelected()) {
      styleSheet.setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.RIGHT);
    } else {
      styleSheet.setStyleProperty(ElementStyleKeys.ALIGNMENT, ElementAlignment.LEFT);
    }

    if (middleAlignButton.isSelected()) {
      styleSheet.setStyleProperty(ElementStyleKeys.VALIGNMENT, ElementAlignment.MIDDLE);
    } else if (bottomAlignButton.isSelected()) {
      styleSheet.setStyleProperty(ElementStyleKeys.VALIGNMENT, ElementAlignment.BOTTOM);
    } else {
      styleSheet.setStyleProperty(ElementStyleKeys.VALIGNMENT, ElementAlignment.TOP);
    }

    styleSheet.setStyleProperty(
        TextStyleKeys.VERTICAL_TEXT_ALIGNMENT, textAlignModel.getSelectedKey());
    styleSheet.setStyleProperty(
        TextStyleKeys.LINEHEIGHT, BorderPropertiesPane.parseLength(lineHeightField.getText()));
    if (wrapTextCheckbox.isSelected()) {
      styleSheet.setStyleProperty(TextStyleKeys.TEXT_WRAP, TextWrap.WRAP);
    } else {
      styleSheet.setStyleProperty(TextStyleKeys.TEXT_WRAP, TextWrap.NONE);
    }

    styleSheet.setStyleProperty(
        TextStyleKeys.WHITE_SPACE_COLLAPSE, whitespaceModel.getSelectedKey());
  }
 private KeyedComboBoxModel<String, String> createExportTypeModel() {
   final KeyedComboBoxModel<String, String> keyedComboBoxModel =
       new KeyedComboBoxModel<String, String>();
   keyedComboBoxModel.add(null, null);
   keyedComboBoxModel.add(
       PdfPageableModule.PDF_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.PDF"));
   keyedComboBoxModel.add(
       HtmlTableModule.TABLE_HTML_STREAM_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.HTMLStream"));
   keyedComboBoxModel.add(
       ExcelTableModule.EXCEL_FLOW_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.XLS"));
   keyedComboBoxModel.add(
       ExcelTableModule.XLSX_FLOW_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.XLSX"));
   keyedComboBoxModel.add(
       CSVTableModule.TABLE_CSV_STREAM_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.CSV"));
   keyedComboBoxModel.add(
       RTFTableModule.TABLE_RTF_FLOW_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.RTF"));
   keyedComboBoxModel.add(
       PlainTextPageableModule.PLAINTEXT_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.TEXT"));
   keyedComboBoxModel.add(
       HtmlTableModule.TABLE_HTML_PAGE_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.HTMLPage"));
   return keyedComboBoxModel;
 }
 private KeyedComboBoxModel createWhitspaceModel() {
   final KeyedComboBoxModel model = new KeyedComboBoxModel();
   model.add(
       WhitespaceCollapse.COLLAPSE,
       Messages.getString("ParagraphPropertiesPane.CollapseWhitespaces"));
   model.add(
       WhitespaceCollapse.DISCARD,
       Messages.getString("ParagraphPropertiesPane.DiscardAllWhitespaces"));
   model.add(
       WhitespaceCollapse.PRESERVE,
       Messages.getString("ParagraphPropertiesPane.PreserveAllWhitespaces"));
   model.add(
       WhitespaceCollapse.PRESERVE_BREAKS,
       Messages.getString("ParagraphPropertiesPane.PreserveBreaks"));
   return model;
 }
 private KeyedComboBoxModel createTextAlignmentModel() {
   final KeyedComboBoxModel model = new KeyedComboBoxModel();
   model.add(VerticalTextAlign.TOP, Messages.getString("ParagraphPropertiesPane.Top"));
   model.add(VerticalTextAlign.CENTRAL, Messages.getString("ParagraphPropertiesPane.Central"));
   model.add(VerticalTextAlign.MIDDLE, Messages.getString("ParagraphPropertiesPane.Middle"));
   model.add(VerticalTextAlign.BASELINE, Messages.getString("ParagraphPropertiesPane.Baseline"));
   model.add(
       VerticalTextAlign.USE_SCRIPT, Messages.getString("ParagraphPropertiesPane.UseScript"));
   model.add(VerticalTextAlign.TEXT_TOP, Messages.getString("ParagraphPropertiesPane.TextTop"));
   model.add(
       VerticalTextAlign.TEXT_BOTTOM, Messages.getString("ParagraphPropertiesPane.TextBottom"));
   model.add(VerticalTextAlign.SUB, Messages.getString("ParagraphPropertiesPane.Subscript"));
   model.add(VerticalTextAlign.SUPER, Messages.getString("ParagraphPropertiesPane.Superscript"));
   model.add(VerticalTextAlign.BOTTOM, Messages.getString("ParagraphPropertiesPane.Bottom"));
   return model;
 }
 public String getExportType() {
   return exportFormatModel.getSelectedKey();
 }
 public void setExportType(final String exportType) {
   exportFormatModel.setSelectedKey(exportType);
 }