Ejemplo n.º 1
0
  private void jButtonModifyActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonModifyActionPerformed
    java.awt.Frame parent = Misc.frameFromComponent(this);
    StyleDialog cd = new StyleDialog(this, true);

    // Take the selected connection from the table...
    if (jTableParameters.getSelectedRow() < 0) return;
    Style irc = null;
    try {
      irc = (Style) jTableParameters.getModel().getValueAt(jTableParameters.getSelectedRow(), 0);
    } catch (Exception ex) {
      return;
    }

    if (irc == null) return;

    cd.setStyle(irc);
    cd.setVisible(true);

    if (cd.getDialogResult() == JOptionPane.OK_OPTION) {
      Style sub = cd.getStyle();
      // Now we have an old and a new object.
      // 1. Adjust table...
      try {
        jTableParameters.getModel().setValueAt(sub, jTableParameters.getSelectedRow(), 0);
      } catch (Exception ex) {
        return;
      }
    }
  } // GEN-LAST:event_jButtonModifyActionPerformed
Ejemplo n.º 2
0
 private void fontSizeNumberInputConfim() {
   String comboText = combo_font_size.getText();
   if (StyleCommonPropertyValue.matchesNumber(comboText)) {
     int num = Integer.valueOf(comboText);
     if (!combo_font_sizeUnit.getEnabled()) {
       combo_font_sizeUnit.setEnabled(true);
     }
     slider_font_size.setSelection(StyleCommonPropertyValue.SLIDER_SUBTRACTION_VALUE - num);
     String fontSizeValue =
         comboText + combo_font_sizeUnit.getItem(combo_font_sizeUnit.getSelectionIndex());
     styleDialog.setPropertyValue(pageName, "font-size", fontSizeValue);
     styleDialog.rePaintText("font-size", fontSizeValue, true);
   }
 }
Ejemplo n.º 3
0
 /** 设置text-decoration系列属性 */
 private void setTextDecoration(boolean painFlag) {
   StringBuffer sf = new StringBuffer();
   sf.append(underline);
   if (!"".equals(underline)) {
     sf.append(" ");
   }
   sf.append(overline);
   if (!"".equals(overline)) {
     sf.append(" ");
   }
   sf.append(line_through);
   if (!"".equals(line_through)) {
     sf.append(" ");
   }
   sf.append(blink);
   if (!"".equals(blink)) {
     sf.append(" ");
   }
   sf.append(none);
   styleDialog.setPropertyValue(pageName, "text-decoration", sf.toString());
   styleDialog.rePaintText("text-decoration", sf.toString(), painFlag);
 }
Ejemplo n.º 4
0
  public void initSelfDefaultValue() {
    boolean hashDefaultValue = false;
    if (styleValue == null || "".equals(styleValue)) {
      return;
    }
    if (StyleCommonPropertyValue.setComboValueIndex("font-family", combo_font_family, styleValue)) {
      hashDefaultValue = true;
    }
    if (StyleCommonPropertyValue.setComboValueIndexWithUnit(
        "font-size", combo_font_size, slider_font_size, combo_font_sizeUnit, styleValue)) {
      hashDefaultValue = true;
    }
    if (StyleCommonPropertyValue.setComboValueIndex("font-weight", combo_font_weight, styleValue)) {
      hashDefaultValue = true;
    }
    if (StyleCommonPropertyValue.setComboValueIndex("font-style", combo_font_style, styleValue)) {
      hashDefaultValue = true;
    }
    if (StyleCommonPropertyValue.setComboValueIndex(
        "font-variant", combo_font_variant, styleValue)) {
      hashDefaultValue = true;
    }
    if (StyleCommonPropertyValue.setComboValueIndex(
        "text-transform", combo_text_transform, styleValue)) {
      hashDefaultValue = true;
    }
    if (StyleCommonPropertyValue.setColorValue("color", text_color, composite_color, styleValue)) {
      hashDefaultValue = true;
    }
    String propertyName = "text-decoration";
    int textd_Index = styleValue.indexOf(propertyName);
    if (textd_Index != -1) {
      int lastSplitIndex = styleValue.lastIndexOf(";");
      String regex = "";
      if (lastSplitIndex > textd_Index) {
        regex = propertyName + StyleCommonPropertyValue.REGEX_PROPERTY_MIDDLE;
      } else {
        regex = propertyName + StyleCommonPropertyValue.REGEX_PROPERTY_END;
      }
      Pattern pattern = Pattern.compile(regex);
      Matcher matcher = pattern.matcher(styleValue);
      if (matcher.find()) {
        String bgPositionValue = matcher.group(1).trim();
        if (bgPositionValue.indexOf("none") != -1) {
          check_none.setSelection(true);
          none = "none";
          hashDefaultValue = true;
        } else {
          String[] bgPositionArray = bgPositionValue.split(" ");
          for (int i = 0; i < bgPositionArray.length; i++) {
            if (bgPositionArray[i].equals("underline")) {
              check_underline.setSelection(true);
              underline = "underline";
              hashDefaultValue = true;
            } else if (bgPositionArray[i].equals("overline")) {
              check_overline.setSelection(true);
              overline = "overline";
              hashDefaultValue = true;
            } else if (bgPositionArray[i].equals("line-through")) {
              check_line.setSelection(true);
              line_through = "line-through";
              hashDefaultValue = true;
            } else if (bgPositionArray[i].equals("blink")) {
              check_blink.setSelection(true);
              blink = "blink";
              hashDefaultValue = true;
            }
          }
        }
      }
    }

    if (!hashDefaultValue) {
      return;
    }
    styleDialog.updateKindListShow(pageName);
    // 在已经设置好的UI上取值绘制图案
    if (combo_font_family.getSelectionIndex() != -1) {
      styleDialog.rePaintText(
          "font-family", combo_font_family.getItem(combo_font_family.getSelectionIndex()), false);
    }
    if (!combo_font_size.getText().equals("")) {
      if (StyleCommonPropertyValue.matchesNumber(combo_font_size.getText())) {
        styleDialog.rePaintText(
            "font-size",
            combo_font_size.getText()
                + combo_font_sizeUnit.getItem(combo_font_sizeUnit.getSelectionIndex()),
            false);
      } else {
        styleDialog.rePaintText("font-size", combo_font_size.getText(), false);
      }
    }
    if (combo_font_weight.getSelectionIndex() != -1) {
      styleDialog.rePaintText("font-weight", combo_font_weight.getText(), false);
    }
    if (combo_font_style.getSelectionIndex() != -1) {
      styleDialog.rePaintText("font-style", combo_font_style.getText(), false);
    }
    if (combo_font_variant.getSelectionIndex() != -1) {
      styleDialog.rePaintText("font-variant", combo_font_variant.getText(), false);
    }
    if (combo_text_transform.getSelectionIndex() != -1) {
      styleDialog.rePaintText("text-transform", combo_text_transform.getText(), false);
    }
    if (!text_color.getText().equals("")) {
      styleDialog.rePaintText("color", text_color.getText(), false);
    }
    setTextDecoration(false);
  }
Ejemplo n.º 5
0
 private void jButtonNewActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonNewActionPerformed
   java.awt.Frame parent = Misc.frameFromComponent(this);
   StyleDialog cd = new StyleDialog(this, true);
   cd.setVisible(true);
 } // GEN-LAST:event_jButtonNewActionPerformed