@Override
 public Object getValue(int row, int column) {
   if (column == 0) {
     switch (row) {
       case 0:
         return Inter.getLocText("Hgap");
       case 1:
         return Inter.getLocText("Vgap");
       case 2:
         return Inter.getLocText("Edit-Row_Count");
       case 3:
         return Inter.getLocText("Edit-Column_Count");
       default:
         return null;
     }
   } else {
     switch (row) {
       case 0:
         return layout.getHgap();
       case 1:
         return layout.getVgap();
       case 2:
         return layout.getRows();
       case 3:
         return layout.getColumns();
       default:
         return null;
     }
   }
 }
Example #2
0
  private static FRFont getCurrentLocaleFont() {
    FRFont guiFRFont;
    Locale defaultLocale = Locale.getDefault();

    if (isDisplaySimSun(defaultLocale)) {
      guiFRFont = getNamedFont("SimSun");
    } else if (isDisplayDialog(defaultLocale)) {
      guiFRFont = getNamedFont("Dialog");
    } else {
      guiFRFont = getNamedFont("Tahoma");
    }

    // 先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整.
    Locale designerLocale = FRContext.getLocale();
    String file = Inter.getLocText("FR-Designer_File");
    char displayChar = file.charAt(0);
    if (!guiFRFont.canDisplay(displayChar)) {
      // 如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
      // 默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog)
      guiFRFont = getNamedFont("SimSun");
      if (!guiFRFont.canDisplay(displayChar)) {
        // 比如想在中文或英文系统里用韩文设计器
        guiFRFont = getNamedFont("Dialog");
        if (!guiFRFont.canDisplay(displayChar)) {
          FRContext.getLogger().error(Inter.getLocText("FR-Base_SimSun_Not_Found"));
        }
      }
    }

    return guiFRFont;
  }
  private void initComponents() {
    this.setLayout(FRGUIPaneFactory.createBorderLayout());
    JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
    contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
    JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
    attr.add(
        horizontalCheck =
            new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible")));
    attr.add(
        verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible")));
    contentPane.add(attr);
    double p = TableLayout.PREFERRED;
    double f = TableLayout.FILL;
    double[] rowSize = {p, TableLayout.PREFERRED};
    double[] columnSize = {p, f};

    java.awt.Component[][] coms = {
      {new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField()},
      {
        new UILabel(Inter.getLocText("Parameter") + ":"),
        parameterViewPane = new ReportletParameterViewPane()
      }
    };
    parameterViewPane.setPreferredSize(new Dimension(400, 256));
    JPanel centerPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize);
    contentPane.add(centerPane);
    this.add(contentPane, BorderLayout.CENTER);
  }
Example #4
0
 /**
  * 动作
  *
  * @param e 事件
  */
 public void actionPerformed(ActionEvent e) {
   DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
   Env selectedEnv = envManager.getEnv(this.getName());
   try {
     if (selectedEnv instanceof RemoteEnv && !((RemoteEnv) selectedEnv).testServerConnection()) {
       JOptionPane.showMessageDialog(
           DesignerContext.getDesignerFrame(),
           Inter.getLocText(new String[] {"M-SwitchWorkspace", "Failed"}));
       return;
     }
     String remoteVersion = selectedEnv.getDesignerVersion();
     if (StringUtils.isBlank(remoteVersion)
         || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) {
       String infor = Inter.getLocText("Server-version-tip");
       String moreInfo = Inter.getLocText("Server-version-tip-moreInfo");
       FRLogger.getLogger().log(Level.WARNING, infor);
       new InformationWarnPane(infor, moreInfo, Inter.getLocText("Tooltips")).show();
       return;
     }
     SignIn.signIn(selectedEnv);
     LicUtils.resetBytes();
     HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
     fireDSChanged();
   } catch (Exception em) {
     FRContext.getLogger().error(em.getMessage(), em);
     JOptionPane.showMessageDialog(
         DesignerContext.getDesignerFrame(),
         Inter.getLocText(new String[] {"M-SwitchWorkspace", "Failed"}));
     TemplatePane.getInstance().editItems();
   }
 }
  public PatternBackgroundQuickPane() {
    this.setLayout(new BorderLayout(0, 4));

    JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
    this.add(contentPane, BorderLayout.NORTH);
    contentPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5));

    JPanel typePane2 = new JPanel();
    contentPane.add(typePane2);
    typePane2.setLayout(new GridLayout(0, 8, 1, 1));
    typePane2.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    ButtonGroup patternButtonGroup = new ButtonGroup();
    patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT];
    for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) {
      patternButtonArray[i] = new PatternButton(i);
      patternButtonGroup.add(patternButtonArray[i]);
      typePane2.add(patternButtonArray[i]);
    }

    JPanel colorPane = new JPanel(new GridLayout(0, 2));
    foregroundColorPane = new ColorSelectBox(70);
    backgroundColorPane = new ColorSelectBox(70);
    foregroundColorPane.setSelectObject(Color.lightGray);
    backgroundColorPane.setSelectObject(Color.black);

    colorPane.add(
        this.createLabelColorPane(Inter.getLocText("Foreground") + ":", foregroundColorPane));
    colorPane.add(
        this.createLabelColorPane(Inter.getLocText("Background") + ":", backgroundColorPane));
    this.add(colorPane, BorderLayout.CENTER);
    foregroundColorPane.addSelectChangeListener(colorChangeListener);
    backgroundColorPane.addSelectChangeListener(colorChangeListener);
  }
Example #6
0
  /** execute method之后,取返回的inputstream */
  private static ByteArrayInputStream execute4InputStream(HttpClient client) throws Exception {
    int statusCode = client.getResponseCode();
    if (statusCode != HttpURLConnection.HTTP_OK) {
      throw new EnvException("Method failed: " + statusCode);
    }
    InputStream in = client.getResponseStream();
    if (in == null) {
      return null;
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
      Utils.copyBinaryTo(in, out);

      // 看一下传过来的byte[]是不是DesignProcessor.INVALID,如果是的话,就抛Exception
      byte[] bytes = out.toByteArray();
      // carl:格式一致传中文
      String message = new String(bytes, EncodeConstants.ENCODING_UTF_8);
      if (ComparatorUtils.equals(message, RemoteDeziConstants.NO_SUCH_RESOURCE)) {
        return null;
      } else if (ComparatorUtils.equals(message, RemoteDeziConstants.INVALID_USER)) {
        throw new EnvException(RemoteDeziConstants.INVALID_USER);
      } else if (ComparatorUtils.equals(message, RemoteDeziConstants.FILE_LOCKED)) {
        JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_file-is-locked"));
        return null;
      } else if (message.startsWith(RemoteDeziConstants.RUNTIME_ERROR_PREFIX)) {
      }
      return new ByteArrayInputStream(bytes);
    } finally {
      in.close();
      out.close();
      client.release();
    }
  }
Example #7
0
 @Override
 public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
   return (CRPropertyDescriptor[])
       ArrayUtils.addAll(
           super.supportedDescriptor(),
           new CRPropertyDescriptor[] {
             new CRPropertyDescriptor("singleFile", this.data.getClass())
                 .setI18NName(Inter.getLocText("SINGLE_FILE_UPLOAD"))
                 .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
             new CRPropertyDescriptor("accept", this.data.getClass())
                 .setI18NName(Inter.getLocText("File-Allow_Upload_Files"))
                 .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
             new CRPropertyDescriptor("maxSize", this.data.getClass())
                 .setI18NName(Inter.getLocText("File-File_Size_Limit"))
                 .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
           });
 }
 @Override
 public String getGroupName() {
   return Inter.getLocText("GridLayout");
 }
 /**
  * 获取分页冻结的标题(表单中不需要写分页二字)
  *
  * @return 分页冻结的标题
  * @date 2014-11-14-下午1:32:08
  */
 protected String getPageFrozenTitle() {
   return Inter.getLocText("FR-Engine_Frozen") + ":";
 }
 @Override
 public String title4PopupWindow() {
   return Inter.getLocText("Background-Pattern");
 }