Ejemplo n.º 1
0
  public void findCabinets() throws DfException {
    // combo.setEnabled( false );
    treepanel.removeAll();
    treepanel.add(new JLabel("Loading..."));
    addWorkInProgress();
    treepanel.revalidate();
    treepanel.repaint();

    /*
     * IDfQuery query = con.createQuery(
     * "select object_name from dm_cabinet ORDER BY object_name" );
     * IDfCollection col = query.execute( con.getSession(),
     * IDfQuery.DF_READ_QUERY );
     *
     * combo.removeAllItems(); combo.addItem( "[All]" ); while ( col.next()
     * ) { IDfValue attrValue = col.getValue( "object_name" );
     * combo.addItem( "/" + attrValue.asString() ); } col.close();
     */

    treepanel.removeAll();
    treepanel.revalidate();
    treepanel.repaint();
    removeWorkInProgress();
    // combo.setEnabled( true );
    swingActionHotSelect();
  }
Ejemplo n.º 2
0
  private void actionHotSelect() {
    // combo.setEnabled( false );
    try {
      treepanel.removeAll();
      treepanel.add(new JLabel("Loading...", LUF.DOT_RED, JLabel.CENTER));
      addWorkInProgress();
      treepanel.revalidate();
      treepanel.repaint();
      // String folderName = (String)combo.getSelectedItem();
      IDfId folderId = null;
      /*
       * if ( !"[All]".equals( folderName ) ) { IDfFolder folder =
       * con.getSession().getFolderByPath( folderName ); if( folder ==
       * null ) {
       * System.out.println("Folder or cabinet does not exist in the Docbase!"
       * ); return; } folderId = folder.getObjectId(); }
       */

      tree =
          new ContentTree(con, folderId, timer, (ApiTypes) node.getSingleApi(ApiTypes.class), this);
      tree.setShowDocuments(showDocuments);
      treepanel.removeAll();
      removeWorkInProgress();
      treepanel.add(tree, BorderLayout.CENTER);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    // combo.setEnabled( true );
    treepanel.revalidate();
    treepanel.repaint();
  }
Ejemplo n.º 3
0
    public void stateChanged(ChangeEvent e) {
      JSpinner source = (JSpinner) e.getSource();
      if (source.getName().equals("Hour")) {
        calendar.set(Calendar.HOUR_OF_DAY, getSelectedHour());
        return;
      }
      if (source.getName().equals("Year")) {

        calendar.set(Calendar.YEAR, getSelectedYear());
        dayPanel.removeAll();
        this.flushWeekAndDayPanal(calendar);
        dayPanel.revalidate();
        dayPanel.updateUI();
        return;
      }
      if (source.getName().equals("Month")) {
        calendar.set(Calendar.MONTH, getSelectedMonth() - 1);

        dayPanel.removeAll();
        this.flushWeekAndDayPanal(calendar);
        dayPanel.revalidate();
        dayPanel.updateUI();
        return;
      }
    }
Ejemplo n.º 4
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == ctl) {
     this.menu();
   } else if (e.getSource() == exit) {
     exitPerform();
   } else if (e.getSource() == rank) {
     if (count != 0) {
       card.show(mainPanel, "four");
       rankPanel.setMemory(memory, count - 1);
       buttonPanel.removeAll();
       buttonPanel.setBounds(width - 200, height - 80, 190, 50);
       buttonPanel.add(exit);
       check = 4;
       count--;
     }
   } else if (e.getSource() == back) {
     if (secondPanel.clip != null) {
       secondPanel.clip.stop();
       System.out.printf("test");
     }
     check = 0;
     card.previous(mainPanel);
     buttonPanel.removeAll();
     ctl.setText("- Play -");
     buttonPanel.add(ctl);
     buttonPanel.add(rank);
     buttonPanel.add(exit);
     buttonPanel.setOpaque(false);
     buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100);
   }
 }
Ejemplo n.º 5
0
  private void resetSemImEditor() {
    java.util.List<SemEstimator> semEstimators = wrapper.getMultipleResultList();

    if (semEstimators.size() == 1) {
      SemEstimator estimatedSem = semEstimators.get(0);
      SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem()));
      panel.removeAll();
      panel.add(editor, BorderLayout.CENTER);
      panel.revalidate();
      panel.repaint();

    } else {
      JTabbedPane tabs = new JTabbedPane();

      for (int i = 0; i < semEstimators.size(); i++) {
        SemEstimator estimatedSem = semEstimators.get(i);
        SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem()));
        JPanel _panel = new JPanel();
        _panel.setLayout(new BorderLayout());
        _panel.add(editor, BorderLayout.CENTER);
        tabs.addTab(estimatedSem.getDataSet().getName(), _panel);
      }

      panel.removeAll();
      panel.add(tabs);
      panel.validate();
    }
  }
Ejemplo n.º 6
0
    public void setFolderViewed(String folderViewed, String notesFile) {
      this.folderViewed = folderViewed;
      this.notesFile = notesFile;

      if (folderViewed == null || notesFile == null) {
        JLabel noLabel = new JLabel("No notes available at this level");
        notespane.setLayout(new BoxLayout(notespane, BoxLayout.PAGE_AXIS));
        notespane.removeAll();
        notespane.add(Box.createVerticalGlue());
        notespane.add(noLabel);
        notespane.add(Box.createVerticalGlue());
      } else {
        File folder = new File(this.folderViewed);
        File notes = new File(this.notesFile);

        notesLabel.setText(notes.getAbsolutePath());
        notespane.setLayout(new BorderLayout());
        notespane.removeAll();

        notespane.add(editor);
        if (notes.exists()) editor.open(notes);
        fileRepository.setFolder(folder);
      }
      notespane.invalidate();
      notespane.validate();
      this.repaint();
    }
 /**
  * Respond to selections within the left list.
  *
  * @throws InvocationTargetException
  * @throws InterruptedException
  */
 private void respondToListClick() {
   this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   enableOrDisableActions();
   int idx = archetypeList.getSelectedIndex();
   if (idx == -1 || idx >= listData.size()) {
     // no selection
     if (archetypeControl == null) {
       return;
     }
     archetypeControl.removeNameChangeListener(this);
     rightPanel.removeAll();
     archetypeControl = null;
     rightPanel.add(selectLeftLabel);
     rightPanel.repaint();
     return;
   }
   if (archetypeControl == null) {
     archetypeControl = new ArchetypeControl(listData.get(idx));
     setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     rightPanel.removeAll();
     rightPanel.add(archetypeControl, BorderLayout.CENTER);
     rightPanel.repaint();
     rightPanel.revalidate();
     setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
     archetypeControl.addNameChangeListener(this);
   } else {
     archetypeControl.setArchetype(listData.get(idx));
     archetypeControl.repaint();
   }
   this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
 }
Ejemplo n.º 8
0
  /**
   * This method sets the command selection panel depending on the command id.
   *
   * @param command id
   */
  private void setCommandPanel(int command) {

    if (command == -1) {
      commandPanel.removeAll();
      commandPanel.setBorder(null);
      this.setVisible(false);
      this.setVisible(true);
      return;
    }

    commandPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(guiText.getString("Command" + command)),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));
    commandPanel.removeAll();

    switch (command) {
      case 4: // getECSpecNames
      case 10: // getStandardVersion
      case 11: // getVendorVersion
        commandPanel.setLayout(new GridLayout(1, 1, 5, 0));
        break;

      case 2: // undefine
      case 3: // getECSpec
      case 7: // poll
      case 9: // getSubscribers
        commandPanel.setLayout(new GridLayout(5, 1, 5, 0));
        addECSpecNameComboBox(commandPanel);
        addSeparator(commandPanel);
        break;

      case 5: // subscribe
      case 6: // unsubscribe
        commandPanel.setLayout(new GridLayout(7, 1, 5, 0));
        addECSpecNameComboBox(commandPanel);
        addNotificationURIField(commandPanel);
        addSeparator(commandPanel);
        break;

      case 8: // immediate
        commandPanel.setLayout(new GridLayout(6, 1, 5, 0));
        addChooseFileField(commandPanel);
        addSeparator(commandPanel);
        break;

      case 1: // define
        commandPanel.setLayout(new GridLayout(8, 1, 5, 0));
        addECSpecNameComboBox(commandPanel);
        addChooseFileField(commandPanel);
        addSeparator(commandPanel);
        break;
    }

    addExecuteButton(commandPanel);

    this.setVisible(false);
    this.setVisible(true);
  }
Ejemplo n.º 9
0
 @Override
 void refresh() {
   info.removeAll();
   view.removeAll();
   Eve.removeAll();
   this.drawScreen();
   Eve.revalidate();
   Eve.repaint();
 }
Ejemplo n.º 10
0
 /** <code>removeAllBoxes</code> clears out the GUI panel's */
 private void removeAllBoxes() {
   tempBonusWidgets.clear();
   modifiersPanel.removeAll();
   eqSetPanel.removeAll();
   for (JRadioButton button : eqSetWidgets.values()) {
     eqSets.remove(button);
   }
   eqSetWidgets.clear();
 }
Ejemplo n.º 11
0
 @Override
 void refresh() {
   team.name = name.getText();
   south.removeAll();
   players.removeAll();
   Eve.removeAll();
   drawScreen(team);
   Eve.revalidate();
   Eve.repaint();
 }
Ejemplo n.º 12
0
 /**
  * Update changing components.
  *
  * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
  */
 @Override
 public void paintComponent(Graphics g) {
   money.setText(String.valueOf(player.getMoney()));
   record.setText(String.valueOf(bestScore));
   dealerPanel.removeAll();
   playerPanel.removeAll();
   for (Card dealerCard : dealer.getCards()) dealerPanel.add(dealerCard);
   for (Card playerCard : player.getCards()) playerPanel.add(playerCard);
   revalidate();
 }
Ejemplo n.º 13
0
  void showCurrentRoll() {
    attackerText.setText(attackerDesc() + " " + battlePhaseDesc());

    diceBox.setVisible(false);

    hitBox.removeAll();
    hitBox.setVisible(false);
    missBox.removeAll();
    missBox.setVisible(false);

    if (strikerDesc().equals("")) {
      diceBoxTitledBorder.setTitle("Attack results");
    } else {
      diceBoxTitledBorder.setTitle(
          "("
              + currentEntry
              + " of "
              + (diceResults.size() - 1)
              + ") "
              + strikerDesc()
              + " attacks "
              + targetDesc()
              + " (target number is "
              + targetNumber()
              + ")");
    }

    if (numDice() > 0) {
      dice = new Chit[numDice()];

      for (int i = 0; i < numDice(); i++) {
        String imageName = getDieImageName(rolls().get(i));
        if (imageName != null) {
          dice[i] = Chit.newDiceChit(2 * Scale.get(), imageName);
          if (averageMiss() > i) {
            missBox.add(dice[i]);
          } else {
            hitBox.add(dice[i]);
          }
        }
      }

      if (averageMiss() < numDice()) {
        hitBox.setVisible(true);
      }
      if (averageMiss() > 0) {
        missBox.setVisible(true);
      }
    } else {
      dice = null;
    }

    diceBox.invalidate();
    diceBox.setVisible(true);
  }
Ejemplo n.º 14
0
 /** Presune obraz figury z pozice inx0 na pozici inx1. */
 public void moveFig(int inx0, int inx1) {
   JPanel panel0, panel1;
   panel0 = (JPanel) figurePan.getComponent(inx0);
   panel1 = (JPanel) figurePan.getComponent(inx1);
   Component c = panel0.getComponent(0);
   panel0.removeAll();
   panel1.removeAll();
   panel1.add(c);
   panel0.revalidate();
   panel1.revalidate();
 }
Ejemplo n.º 15
0
 @Override
 void refresh() {
   teamDraft.removeAll();
   teams.removeAll();
   players.removeAll();
   teamsInner.removeAll();
   playersInner.removeAll();
   Eve.removeAll();
   this.drawScreen();
   Eve.revalidate();
   Eve.repaint();
 }
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == rdoDaily) {
      panelOptionDetail.setLayout(new FlowLayout(FlowLayout.LEFT));
      panelOptionDetail.removeAll();
      panelOptionDetail.add(dailyPanel);
      panelOptionDetail.repaint();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").close();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").open();
    }
    if (e.getSource() == rdoWeekly) {
      panelOptionDetail.setLayout(new FlowLayout(FlowLayout.LEFT));
      panelOptionDetail.removeAll();
      panelOptionDetail.add(weeklyPanel);
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").close();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").open();
    }
    if (e.getSource() == rdoMonthly) {
      panelOptionDetail.setLayout(new FlowLayout(FlowLayout.LEFT));
      panelOptionDetail.removeAll();
      panelOptionDetail.add(monthlyPanel);
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").close();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").open();
    }
    if (e.getSource() == rdoYearly) {
      panelOptionDetail.setLayout(new FlowLayout(FlowLayout.LEFT));
      panelOptionDetail.removeAll();
      panelOptionDetail.add(yearlyPanel);
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").close();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").open();
    }
    if (e.getSource() == btnOk) {
      if (chkEnableOption.isSelected()) {
        if (rdoDaily.isSelected()) {
          int dailyId = Integer.parseInt(dailyPanel.getSprEvery().getValue().toString());
          int weeklyId = 0;
          int monthlyId = 0;
          int yearlyId = 0;
          saleOffOptionLookup = new SaleOffOptionLookup();
          saleOffOptionLookup.setDailyID(dailyId);
          saleOffOptionLookup.setIsDaily(true);
          saleOffOptionLookup.setIsMonthly(false);
          saleOffOptionLookup.setIsWeekly(false);
          saleOffOptionLookup.setWeeklyID(weeklyId);
          saleOffOptionLookup.setMonthlyID(monthlyId);
          saleOffOptionLookup.setYearlyID(yearlyId);

          content.set(Collections.singleton(saleOffOptionLookup), null);
        }
      }
    }
  }
 public void clearSlot(TabSlot slot) {
   switch (slot) {
     case ATTACHMENTS:
       attachments.removeAll();
       break;
     case SUBSCRIBERS:
       subscribers.removeAll();
       break;
     case LINKS:
       links.removeAll();
       break;
     default:
       assert false;
   }
 }
Ejemplo n.º 18
0
  public void listeBoisson(JPanel onglet2) {
    // TODO Auto-generated method stub

    Object[][] donneesType = null;
    donneesType = mc.listTypeProduitBoisson();
    Object[][] donnees = null;
    donnees = mc.listProduitBoison();
    onglet2.removeAll();

    JButton[] tab_button = new JButton[donneesType.length];
    for (int i = 0; i < donneesType.length; i++) {
      tab_button[i] = new JButton();
      tab_button[i].setName((String) donneesType[i][0]);
      tab_button[i].setPreferredSize(dim);
      tab_button[i].setEnabled(false);
      tab_button[i].setIcon(new ImageIcon("images/" + (String) donneesType[i][0] + " nd.jpg"));

      // Ajout des boutons sur le panel et ajout des listener
      onglet2.add(tab_button[i]);
      for (int j = 0; j < donnees.length; j++) {
        if (donneesType[i][0].equals(donnees[j][0])) {
          // changer est mettre nouvelle image
          tab_button[i].addActionListener(new AjoutProduitVente());
          tab_button[i].setEnabled(true);
          tab_button[i].setIcon(new ImageIcon("images/" + (String) donneesType[i][0] + ".jpg"));
          // System.out.println("PASSER");
        }
      }
    }
  }
Ejemplo n.º 19
0
  /** Update the tree to display only a specific root. */
  public void update(EntityLibrary root) throws IllegalActionException {
    if (isDebugging) {
      log.debug("update(" + root.getName() + " " + root.getClass().getName() + ")");
    }
    this.removeAll();

    trimmedLibrary = new VisibleTreeModel(root);

    AnnotatedPTree rTree = new AnnotatedPTree(trimmedLibrary, this);
    MouseListener mListener = new LibraryPopupListener(rTree);
    rTree.setMouseListener(mListener);
    if (treeSingleSelectionlistener != null) {
      rTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
      rTree.addTreeSelectionListener(treeSingleSelectionlistener);
    }
    rTree.initAnotatedPTree();
    resultsTree = rTree;

    JScrollPane newpane = new JScrollPane(resultsTree);
    newpane.setPreferredSize(new Dimension(200, 200));
    this.add(newpane, BorderLayout.CENTER);

    // add the search results counter stuff
    resultCounterPane = new JPanel();
    resultCounterPane.setBackground(TabManager.BGCOLOR);
    resultCounterPane.setLayout(new BorderLayout());
    resultCounterLabel = new JLabel("");
    resultCounterPane.removeAll();
    resultCounterPane.add(resultCounterLabel, BorderLayout.CENTER);
    this.add(resultCounterPane, BorderLayout.SOUTH);

    this.repaint();
    this.validate();
  }
Ejemplo n.º 20
0
  public void dispose() {
    myNodeEditor.dispose();
    myNodeEditor = null;

    myComponent.removeAll();
    myComponent = null;
  }
  /*
   * Update radio button names in the same order as the table
   */
  private void updateControlPanel() {
    schedule.removeAll();
    noneButton.setName(""); // Name holds schedule id for the selected radio button
    noneButton.setSelected(true);
    commentTextArea.setText(""); // no text for the noneButton
    enableButtons(false);
    schedule.add(noneButton);
    schGroup.add(noneButton);

    for (int i = trainsScheduleModel.getFixedColumn();
        i < trainsScheduleModel.getColumnCount();
        i++) {
      log.debug("Column name: {}", trainsScheduleTable.getColumnName(i));
      TrainSchedule ts =
          trainScheduleManager.getScheduleByName(trainsScheduleTable.getColumnName(i));
      if (ts != null) {
        JRadioButton b = new JRadioButton();
        b.setText(ts.getName());
        b.setName(ts.getId());
        schedule.add(b);
        schGroup.add(b);
        addRadioButtonAction(b);
        if (b.getName().equals(trainManager.getTrainScheduleActiveId())) {
          b.setSelected(true);
          enableButtons(true);
          // update comment field
          commentTextArea.setText(ts.getComment());
        }
      }
    }
    schedule.revalidate();
  }
  private void viewReport() throws Exception {
    Date fromDate = fromDatePicker.getDate();
    Date toDate = toDatePicker.getDate();

    if (fromDate.after(toDate)) {
      POSMessageDialog.showError(
          BackOfficeWindow.getInstance(),
          com.floreantpos.POSConstants.FROM_DATE_CANNOT_BE_GREATER_THAN_TO_DATE_);
      return;
    }

    fromDate = DateUtil.startOfDay(fromDate);
    toDate = DateUtil.endOfDay(toDate);

    ReportService reportService = new ReportService();
    MenuUsageReport report = reportService.getMenuUsageReport(fromDate, toDate);

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("reportTitle", "========= LAPORAN PENJUALAN PER MENU ==========");
    map.put("fromDate", ReportService.formatShortDate(fromDate));
    map.put("toDate", ReportService.formatShortDate(toDate));
    map.put("reportTime", ReportService.formatFullDate(new Date()));

    JasperReport jasperReport =
        (JasperReport)
            JRLoader.loadObject(
                getClass().getResource("/com/floreantpos/ui/report/menu_usage_report.jasper"));
    JasperPrint jasperPrint =
        JasperFillManager.fillReport(
            jasperReport, map, new JRTableModelDataSource(report.getTableModel()));
    JRViewer viewer = new JRViewer(jasperPrint);
    reportContainer.removeAll();
    reportContainer.add(viewer);
    reportContainer.revalidate();
  }
Ejemplo n.º 23
0
  public void addLayer(Layer layer, boolean showOnButtonList, String icon) {
    if (layer instanceof MapViewerLayer) {
      minZoom = Math.max(((MapViewerLayer) layer).getMinZoomLevel(), getMinZoom());
      maxZoom = Math.min(((MapViewerLayer) layer).getMaxZoomLevel(), getMaxZoom());
      if (zoomFactor > maxZoom || zoomFactor < minZoom) {
        zoomFactor = (maxZoom + minZoom) / 2;
      }
      zoomTo(center, zoom2Scale(zoomFactor));
    }
    if (showOnButtonList) {
      JToggleButton b = new JToggleButton(layer.name, LogicConstants.getIcon(icon), layer.visible);
      // b.setVerticalTextPosition(SwingConstants.BOTTOM);
      // b.setHorizontalTextPosition(SwingConstants.CENTER);
      b.setActionCommand(layer.name);
      b.addActionListener(layerControlListener);
      layerControls.add(b);
      layerControlPanel.removeAll();
      layerControlPanel.add(Box.createHorizontalStrut(10));
      for (JToggleButton bt : layerControls) {
        layerControlPanel.add(bt);
        layerControlPanel.add(Box.createHorizontalGlue());
      }
      layerControlPanel.updateUI();
    }

    super.addLayer(layer);
  }
 void update(String group) {
   myTitleLabel.setText(
       "<html><body><h2 style=\"text-align:left;\">" + group + "</h2></body></html>");
   myContentPanel.removeAll();
   List<IdSet> idSets = PluginGroups.getInstance().getSets(group);
   for (final IdSet set : idSets) {
     final JCheckBox checkBox =
         new JCheckBox(set.getTitle(), PluginGroups.getInstance().isIdSetAllEnabled(set));
     checkBox.setModel(
         new JToggleButton.ToggleButtonModel() {
           @Override
           public boolean isSelected() {
             return PluginGroups.getInstance().isIdSetAllEnabled(set);
           }
         });
     checkBox.addActionListener(
         new ActionListener() {
           @Override
           public void actionPerformed(ActionEvent e) {
             PluginGroups.getInstance().setIdSetEnabled(set, !checkBox.isSelected());
             CustomizePluginsStepPanel.this.repaint();
           }
         });
     myContentPanel.add(checkBox);
   }
 }
Ejemplo n.º 25
0
 private void showPanel(JPanel p) {
   setUpUnitLists();
   mainPanel.removeAll();
   mainPanel.add(p);
   mainFrame.repaint();
   mainFrame.revalidate();
 }
Ejemplo n.º 26
0
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   cellPanel.removeAll();
   TableCellUtilities.setToRowBackground(cellPanel, table, row);
   cellLabel.setForeground(table.getForeground());
   cellLabel.setFont(table.getFont());
   if (row == levels.getSize() - 1) {
     cellLabel.setText(value.toString());
     cellPanel.add(cellLabel);
     cellPanel.add(Box.createHorizontalGlue());
     cellPanel.add(removeLevelButton);
   } else if (row == levels.getSize()) {
     cellLabel.setText("Add Level");
     cellPanel.add(Box.createHorizontalGlue());
     cellPanel.add(cellLabel);
     cellPanel.add(Box.createHorizontalStrut(3));
     addLevelButton.setEnabled(classComboBox.getSelectedItem() != null);
     cellPanel.add(addLevelButton);
   } else {
     cellLabel.setText(value.toString());
     cellPanel.add(cellLabel);
   }
   return cellPanel;
 }
 @Override
 public void go(JPanel menuLeft) {
   menuLeft.removeAll();
   menuLeft.add(display.getPanel());
   menuLeft.revalidate();
   menuLeft.repaint();
 }
  private void updateEditorText() {
    disposeNonTextEditor();

    final PsiElement elt = myElements[myIndex].getNavigationElement();
    Project project = elt.getProject();
    PsiFile psiFile = getContainingFile(elt);
    final VirtualFile vFile = psiFile.getVirtualFile();
    if (vFile == null) return;
    final FileEditorProvider[] providers =
        FileEditorProviderManager.getInstance().getProviders(project, vFile);
    for (FileEditorProvider provider : providers) {
      if (provider instanceof TextEditorProvider) {
        updateTextElement(elt);
        myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY);
        break;
      } else if (provider.accept(project, vFile)) {
        myCurrentNonTextEditorProvider = provider;
        myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile);
        myBinaryPanel.removeAll();
        myBinaryPanel.add(myNonTextEditor.getComponent());
        myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY);
        break;
      }
    }
  }
  /**
   * Show the specified wizard page
   *
   * @param index
   */
  private void showPage(Integer index, Direction dir) {
    AbstractWizardPanel page;
    try {
      page = pages.get(index);
    } catch (Exception e) {
      log.error("Error setting wizard page to index: " + index);
      e.printStackTrace();
      return;
    }

    // Check to see if page should be ignored
    if (isIgnoredPageClass(page)) {
      if (dir.equals(Direction.FORWARD)) {
        index++;
      } else {
        index--;
      }

      showPage(index, dir);
      return;
    }

    pagePanel.removeAll();
    pagePanel.add(page);
    lblTitle.setText(page.getTitle());
    txtInstructions.setText(page.getInstructions());
    currPageIndex = index;
    autoEnableNavButtons();

    page.initialViewTasks();

    pagePanel.repaint();
  }
Ejemplo n.º 30
0
 /**
  * Restore opened settings node if still there.
  *
  * @param oldProps properties inserted in the old model
  * @param selPath path to the node selected in the old model
  */
 private void restoreInsertedProperties(HashMap<String, Property[]> oldProps, TreePath selPath) {
   DefaultTreeModel newModel = levelTrees.get(permissionLvl);
   // Create properties panel for every properties panel existing in the old model
   updateUsedPanels(oldProps, newModel);
   final JPanel holderPropertiesPanel = (JPanel) splitPane.getRightComponent();
   holderPropertiesPanel.removeAll();
   if (selPath != null) {
     // returns node from previous model
     DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) selPath.getLastPathComponent();
     if (selectedNode.getUserObject() instanceof ClassPropertiesInfo) {
       // find selected class by name
       ClassPropertiesInfo selectedClassInfo = (ClassPropertiesInfo) selectedNode.getUserObject();
       String selectedClassInfoName = selectedClassInfo.getName();
       // see if it's still visible
       DefaultMutableTreeNode classNode;
       ClassPropertiesInfo classInfo;
       DefaultMutableTreeNode root = (DefaultMutableTreeNode) newModel.getRoot();
       int classCount = newModel.getChildCount(root);
       for (int c = 0; c < classCount; c++) {
         classNode = (DefaultMutableTreeNode) newModel.getChild(root, c);
         classInfo = (ClassPropertiesInfo) classNode.getUserObject();
         if (classInfo.getName().equalsIgnoreCase(selectedClassInfoName)) {
           tree.setSelectionPath(new TreePath(classNode.getPath()));
           c = classCount;
         }
       }
     }
   }
   holderPropertiesPanel.repaint();
 }