Package kameleon.gui.language

Examples of kameleon.gui.language.SwitchLanguage


     * information about the error is shown.
     *
     * @param ke exception which caused the software to crash
     */
    protected void displayErrorMessage(KameleonException ke) {
        SwitchLanguage sl = SwitchLanguage.getInstance();
        String message = null;
        String title = null;

        // Build the title and message of the pop-up
        try {
            sl.getText(MAN_GUI_ERROR_MESSAGE_TITLE);
            if (this.debugMode) {
                message = sl.getText(MAIN_GUI_DETAILED_ERROR_MESSAGE,
                        ke.getClass(),
                        ke.getMessage(),
                        KameleonException.getStackTraceAsString(ke));
            } else {
                message = sl.getText(MAIN_GUI_ERROR_MESSAGE);
            }// if
        } catch (UnknownKeyException uke) {
            // Incorrect language file, switch to default
            try {
                sl.changeLang(DEFAULT_LANGUAGE);
                sl.getText(MAN_GUI_ERROR_MESSAGE_TITLE);
                if (this.debugMode) {
                    message = sl.getText(MAIN_GUI_ERROR_MESSAGE);
                } else {
                    message = sl.getText(MAIN_GUI_DETAILED_ERROR_MESSAGE,
                            ke.getClass(),
                            ke.getMessage(),
                            KameleonException.getStackTraceAsString(ke));
                }// if
            } catch (KameleonException ke2) {/*
 
View Full Code Here


   *
   * @throws   UnknownKeyException
   *       if an error occurred while building the text of this message
   */
  public String getMessage() throws UnknownKeyException {
    SwitchLanguage sl = SwitchLanguage.getInstance() ;
    return sl.getText(this.textKey, this.args) ;
  }// getMessage()
View Full Code Here

   *
   * @throws   UnknownKeyException
   *       if an error occurred while building the text of this message
   */
  public String getMessage() throws UnknownKeyException {
    SwitchLanguage sl = SwitchLanguage.getInstance() ;
    return sl.getText(this.textKey, this.args) ;
  }// getMessage()
View Full Code Here

         * - IOException
         * - UnsupportedFlavorException
         * - URISyntaxException
         * - MalformedURLException
         */
        SwitchLanguage sl = SwitchLanguage.getInstance() ;
        InformationMessage imsg = null ;
        try {
          imsg = new InformationMessage(
              State.INFORMATION,
              ADD_FILE_ERROR,
View Full Code Here

   *
   * @param  lang
   *       new language for the graphical interface
   */
  public void changeLanguage(GuiLanguage lang) {
    SwitchLanguage sl = SwitchLanguage.getInstance() ;
    if ((lang != null) && !sl.getCurrentLanguage().equals(lang)) {
      try {
        sl.changeLang(lang) ;
        this.notifyLanguageChange() ;
      } catch (KameleonException ke) {
        InformationMessage imsg = new InformationMessage(
            State.ERROR, LANGUAGE_CHANGE_ERROR,
            lang.getLanguage().getDisplayLanguage()) ;
View Full Code Here

   * @throws   UnknownKeyException
   *       if an error occurred while updating the text of this view
   */
  @Override
  public void reloadLanguage() throws UnknownKeyException {
    SwitchLanguage sl = SwitchLanguage.getInstance() ;
    TitledBorder border = (TitledBorder) this.getBorder() ;
    border.setTitle(sl.getText(GENERATION_TITLE_BORDER)) ;
    this.generate.setText(sl.getText(GENERATE_BUTTON)) ;
    if (this.emptyMessage != null) {
      this.emptyMessage.setText(sl.getText(NO_GENERATORS)) ;
    }// if
  }// reloadLanguage()
View Full Code Here

          sourceModel.getKnownGenerators() ;
     
      if (generators.isEmpty()) {
        JLabel info = new JLabel() ;
        try {
          SwitchLanguage sl = SwitchLanguage.getInstance() ;
          info.setText(sl.getText(NO_GENERATORS)) ;
        } catch (UnknownKeyException uke) {
          //TODO Handle exception
          sourceModel.displayDebugInformation(uke) ;
        }// try
        c = new GridBagConstraints() ;
View Full Code Here

   * @throws   UnknownKeyException
   *       if an error occurred while updating the text of this view
   */
  @Override
  public void reloadLanguage() throws UnknownKeyException {
    SwitchLanguage sl = SwitchLanguage.getInstance() ;
    GenerationMessage gMessage = (GenerationMessage) this.message ;
   
    this.convertingTitle.setText(sl.getText(CONVERTING)) ;
    State[] states = gMessage.getStates() ;
    int nRows = states.length ;
    for(int row=0; row < nRows; ++row) {
      this.toTitles[row].setText(sl.getText(TO)) ;
      this.progressIcons[row].setToolTipText(
          sl.getText(getTextKey(states[row]))) ;
    }// for
    this.fastGeneration.setText(sl.getText(REGENERATE)) ;
    this.messageLabel.setText(this.getMessageText()) ;
  }// reloadLanguage()
View Full Code Here

   *
   * @throws   UnknownKeyException
   *       if an error occurred while updating the text of this view
   */
  private String getMessageText() throws UnknownKeyException {
    SwitchLanguage sl = SwitchLanguage.getInstance() ;
    GenerationMessage gMessage = (GenerationMessage) this.message ;
    String textKey, filePath = null ;
    switch(gMessage.getState()) {
    case ANALYZING: {
      textKey = GENERATION_ANALYZING_START ;
      break ;
    }// case
    case GENERATING: {
      State[] states = gMessage.getStates() ;
      if (states[0].equals(State.WAITING)) {
        textKey = GENERATION_ANALYZING_SUCCESS ;
      } else {
        textKey = GENERATION_GENERATING ;
        int i = 0, nStates = states.length ;
        while((i < nStates) && (filePath == null)) {
          if (states[i].equals(State.CONVERTING)) {
            filePath = gMessage.getTargetPath()[i] ;
          }// if
          ++i ;
        }// while
      }// if
      break ;
    }// case
    case PARTIAL_SUCESS: {
      textKey = GENERATION_PARTIAL_SUCCESS ;
      break ;
    }// case
    case COMPLETE_SUCESS: {
      textKey = GENERATION_SUCCESS ;
      break ;
    }// clase
    default: {/* ERROR */
      textKey = GENERATION_ERROR ;
    }// default
    }// switch
   
    return sl.getText(textKey, filePath) ;
  }// getMessageText()
View Full Code Here

     * @throws  UnknownKeyException
     *       if the key for the explanation text was not found
     */
    private void buildTitle(GridBagLayout gridbag)
        throws UnknownKeyException {
      SwitchLanguage sl = SwitchLanguage.getInstance() ;
      GridBagConstraints constraints ;
     
      constraints = new GridBagConstraints() ;
      constraints.gridwidth = GridBagConstraints.REMAINDER ;
      constraints.anchor = GridBagConstraints.BASELINE ;
      constraints.weightx = 1.0 ;
      constraints.weighty = 0.0 ;
      constraints.insets = new Insets(5, 5, 5, 5) ;
     
      JLabel label = new JLabel(sl.getText(LAST_GENERATED)) ;
     
      this.add(label) ;
      gridbag.setConstraints(label, constraints) ;
    }// buildTitle(GridBagLayout)
View Full Code Here

TOP

Related Classes of kameleon.gui.language.SwitchLanguage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.