Package kameleon.gui.language

Examples of kameleon.gui.language.SwitchLanguage


     * @throws   FileReadingException
     *       If a format icon could not be loaded
     */
    private void buildFileEntries(GridBagLayout gridbag)
        throws UnknownKeyException, FileReadingException {
      SwitchLanguage sl = SwitchLanguage.getInstance() ;
      GenerationModel gModel = MoreInformationFrame.this.model ;
      GridBagConstraints iconConstraints, titleConstraints,
        valueConstraint ;
     
      iconConstraints = new GridBagConstraints() ;
      iconConstraints.gridwidth  = 1 ;
      iconConstraints.gridheight = 3 ;
      iconConstraints.anchor = GridBagConstraints.CENTER ;
      iconConstraints.weightx = 0.0 ;
      iconConstraints.weighty = 1.0 ;
      iconConstraints.insets = new Insets(5, 5, 5, 5) ;
     
      titleConstraints = new GridBagConstraints() ;
      titleConstraints.gridwidth = 1 ;
      titleConstraints.anchor = GridBagConstraints.BASELINE_LEADING ;
      titleConstraints.weightx = 0.0 ;
      titleConstraints.weighty = 0.0 ;
      titleConstraints.insets = new Insets(5, 0, 0, 5) ;
     
      valueConstraint = new GridBagConstraints() ;
      valueConstraint.gridwidth = GridBagConstraints.REMAINDER ;
      valueConstraint.anchor = GridBagConstraints.BASELINE_LEADING ;
      valueConstraint.weightx = 1.0 ;
      valueConstraint.weighty = 0.0 ;
     
      FileInfo lastG = gModel.getSelectedFileInfo() ;
      String[] formatIds = lastG.getTargetFormatId() ;
      String[] targetPaths = lastG.getTargetPath() ;
      int nGeneratedFiles = lastG.getTargetPath().length ;
      for(int file=0; file<nGeneratedFiles; file++) {
        PlugInInfo genInfo = gModel.getGenerator(formatIds[file]) ;
        String iconName = String.format(COLOR_ICON, genInfo.getId()) ;
        String formatName = genInfo.getFormatName() ;

        JLabel formatTitle = new JLabel(sl.getText(FORMAT)) ;
        JLabel pathTitle = new JLabel(sl.getText(PATH)) ;
        JLabel icon = new JLabel(
            new ImageIcon(ImageUtility.getImageBytes(iconName))) ;
        icon.setToolTipText(formatName) ;
        JLabel formatNameLabel = new JLabel(formatName)
        JLabel path = new JLabel(targetPaths[file]) ;
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(ENTRY_FORMAT_EXPLANATION,
            this.model.getSelectedFileInfo().getPath())) ;
   
    this.add(label) ;
    gridbag.setConstraints(label, constraints) ;
  }// buildTitle(GridBagLayout)
View Full Code Here

   * @throws  UnknownKeyException
   *       if the key for the delete button text was not found
   */
  private void buildButton(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) ;
   
    this.validate = new JButton(sl.getText(VALIDATE)) ;
    this.validate.setEnabled(this.selectedAnalyzer != null) ;
    this.validate.addActionListener(new ValidateListener(this)) ;
   
    this.add(this.validate) ;
    gridbag.setConstraints(this.validate, constraints) ;
View Full Code Here

   *
   * @throws  UnknownKeyException
   *       if a key for a displayed text could not be found
   */
  protected void build() throws UnknownKeyException {
    final SwitchLanguage sl = SwitchLanguage.getInstance() ;

    this.setLayout(new BorderLayout()) ;
    this.setBorder(BorderFactory.createTitledBorder(
        sl.getText(LanguageConstants.HISTORY_TITLE_BORDER))) ;

    JPanel north = new JPanel() ;
    north.setLayout(new BoxLayout(north, BoxLayout.X_AXIS)) ;

    this.path = new JTextField(sl.getText(LanguageConstants.NO_FILE)) ;
    this.path.setFont(this.ITALIC) ;
    this.path.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)) ;
    north.add(this.path) ;

    this.browse = new JButton(
        sl.getText(LanguageConstants.BROWSE_BUTTON)) ;
    this.browse.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        int browseResult = HistoryView.this.fileChooser.
            showOpenDialog(HistoryView.this.container) ;
        if (browseResult == JFileChooser.APPROVE_OPTION) {
          HistoryView.this.model.addFile(
              HistoryView.this.fileChooser.getSelectedFile()) ;
        }// if
      }// actionPerformed(ActionEvent)
    }) ;
    north.add(this.browse) ;
    this.add(north, BorderLayout.NORTH) ;

    this.adapter = new RecentFiles(this.model.getRecentFileInfo()) ;
    this.recentFiles = new JList(this.adapter) ;
    this.recentFiles.addListSelectionListener(new FileSelectionListener()) ;
    this.recentFiles.setSelectionMode(ListSelectionModel.SINGLE_SELECTION) ;
    this.recentFiles.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent me) {
        // if right mouse button clicked (or me.isPopupTrigger())
        if (SwingUtilities.isRightMouseButton(me)
            && !HistoryView.this.recentFiles.isSelectionEmpty()
            && HistoryView.this.recentFiles.locationToIndex(me.getPoint())
            == HistoryView.this.recentFiles.getSelectedIndex()) {
          HistoryView.this.popupMenu.show(
              HistoryView.this.recentFiles, me.getX(), me.getY()) ;
        }// if
      }// mouseClicked(MouseEvent)
    }) ;
   
    JScrollPane scroll = new JScrollPane(this.recentFiles) ;
    scroll.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)) ;
    this.add(scroll, BorderLayout.CENTER) ;
   
    this.delete = new JMenuItem(sl.getText(LanguageConstants.DELETE_BUTTON)) ;
    this.delete.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        HistoryView.this.model.deleteCurrentSelection() ;
      }// actionPerformed(ActionEvent)
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(LanguageConstants.HISTORY_TITLE_BORDER)) ;
    this.browse.setText(sl.getText(LanguageConstants.BROWSE_BUTTON)) ;
    this.fileChooser.setApproveButtonText(sl.getText(LanguageConstants.ADD_FILE)) ;
    if (!this.model.fileIsSelected()) {
      this.path.setText(sl.getText(LanguageConstants.NO_FILE)) ;
    }/// if
    this.delete.setText(sl.getText(LanguageConstants.DELETE_BUTTON)) ;
  }// reloadLanguage()
View Full Code Here

   * @throws   KameleonException
   *       if an error occurred while updating the text of this view
   */
  @Override
  public void reloadLanguage() throws KameleonException {
    SwitchLanguage sl = SwitchLanguage.getInstance() ;
   
    TitledBorder border = (TitledBorder) this.getBorder() ;
    border.setTitle(sl.getText(MESSAGES_TITLE_BORDER)) ;
   
    for(ViewMessage message : this.messages) {
      message.reloadLanguage() ;
    }// for
  }// reloadLanguage()
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(DELETE_ANALYZER_EXPLANATION)) ;
   
    this.add(label) ;
    gridbag.setConstraints(label, constraints) ;
  }// buildTitle(GridBagLayout)
View Full Code Here

   * @throws  UnknownKeyException
   *       if the key for the delete button text was not found
   */
  private void buildButton(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) ;
   
    this.delete = new JButton(sl.getText(DELETE_BUTTON)) ;
    this.delete.setEnabled(false) ;
    this.delete.addActionListener(new DeleteListener(this)) ;
   
    this.add(this.delete) ;
    gridbag.setConstraints(this.delete, constraints) ;
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(DELETE_GENERATOR_EXPLANATION)) ;
   
    this.add(label) ;
    gridbag.setConstraints(label, constraints) ;
  }// buildTitle(GridBagLayout)
View Full Code Here

   * @throws  UnknownKeyException
   *       if the key for the delete button text was not found
   */
  private void buildButton(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) ;
   
    this.delete = new JButton(sl.getText(DELETE_BUTTON)) ;
    this.delete.setEnabled(false) ;
    this.delete.addActionListener(new DeleteListener(this)) ;
   
    this.add(this.delete) ;
    gridbag.setConstraints(this.delete, constraints) ;
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.