Package com.santiagolizardo.beobachter.beans

Examples of com.santiagolizardo.beobachter.beans.LogType


    logTypes.setRenderer(new LogTypeListRenderer());
    logTypes.setToolTipText(Translator.tr("Log type"));
    logTypes.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent ev) {
        LogType logType = (LogType) logTypes.getSelectedItem();
        logWindow.loadLogType(logType);
      }
    });
    logTypes.setSelectedItem(logType);
View Full Code Here


          } catch (Exception e) {
            DialogFactory.showErrorMessage(mainWindow, e.getMessage());
            return;
          }

          mainWindow.getActionFactory().getOpenAction().openFile(filePath, new LogType(
              "Default"));
        }
      });
      add(item);
    }
View Full Code Here

          } catch (Exception e) {
            DialogFactory.showErrorMessage(mainWindow, e.getMessage());
            return;
          }

          mainWindow.getActionFactory().getOpenAction().openFile(filePath, new LogType(
              "Default"));
        }
      });
      add(item);
    }
View Full Code Here

      chooser.setSelectedFile(lastSelected);
      chooser.setMultiSelectionEnabled(true);
      int resp = chooser.showOpenDialog(mainWindow);
      if (resp == JFileChooser.APPROVE_OPTION) {
        File[] files = chooser.getSelectedFiles();
        LogType logType = new LogType("Default");

        List<File> unreadableFiles = new ArrayList<>();

        for (File file : files) {
View Full Code Here

  private static final long serialVersionUID = 6231566595982380949L;

  @Override
  public Component getListCellRendererComponent(JList<?> list, Object value,
      int index, boolean isSelected, boolean cellHasFocus) {
    LogType logType = (LogType) value;
    return super.getListCellRendererComponent(list, logType.getName(), index,
        isSelected, cellHasFocus);
  }
View Full Code Here

        editionPanel.setEnabled(!isEmpty);
        if (isEmpty) {
          btnRename.setEnabled(false);
          btnRemove.setEnabled(false);
        } else {
          LogType logType = (LogType) lstTypes.getSelectedValue();
          LogTypeManager logTypes = LogTypeManager.getInstance();
          logType = logTypes.loadFromFile(logType
              .getName());

          editionPanel.setLogType(logType);
          btnRename.setEnabled(true);
          btnRemove.setEnabled(true);
        }
      }
    });

    scrollTypes = new JScrollPane(lstTypes);

    btnAdd = new JButton(Translator.tr("Add"));
    btnAdd.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        String name = JOptionPane.showInputDialog(getParent(),
            Translator.tr("Enter the name of the new log type"));
        if (name == null) {
          return;
        }
        name = name.trim();
        if (name.length() == 0) {
          DialogFactory.showErrorMessage(null,
              Translator.tr("Invalid log type name"));
          return;
        }
        LogType logType = new LogType(name);
        try {
          LogTypeManager logTypes = LogTypeManager.getInstance();
          logTypes.saveToFile(logType);

          updateLogTypes();
        } catch (IOException ee) {
          logger.warning(ee.getMessage());
        }
      }
    });

    btnRename = new JButton(Translator.tr("Rename"));
    btnRename.setEnabled(false);
    btnRename.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent ev) {
        LogType selected = (LogType) lstTypes.getSelectedValue();
        String newName = JOptionPane.showInputDialog(getParent(),
            tr("Enter the new name of the log type:"),
            selected.getName());
        if (newName == null) {
          return;
        }
        newName = newName.trim();
        if (newName.length() > 0 && !newName.equals(selected.getName())) {
          LogTypeManager logTypes = LogTypeManager.getInstance();
          logTypes.rename(selected, newName);

          updateLogTypes();
        }
      }
    });

    btnRemove = new JButton(Translator.tr("Remove"));
    btnRemove.setEnabled(false);
    btnRemove.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent ev) {
        if (DialogFactory.showQuestionDialog(getParent(), Translator
            .tr("Are you sure you want to delete the selected log type?"))) {
          LogType selected = (LogType) lstTypes.getSelectedValue();
          LogTypeManager logTypes = LogTypeManager.getInstance();
          if (!logTypes.remove(selected)) {
            DialogFactory.showErrorMessage(getParent(),
                Translator.tr("Unable to delete the log type"));
          }
View Full Code Here

    Session session = list.getSelectedValue();
    for (String fileName : session.getFileNames()) {
      mainWindow.getRecentFiles().remove(fileName);
      mainWindow.getRecentFiles().add(fileName);
      mainWindow.getActionFactory().getOpenAction().openFile(fileName, new LogType("Default"));
    }
    recentsMenu.refresh();

    mainWindow.getDesktop().setWindowsOnCascade();
View Full Code Here

TOP

Related Classes of com.santiagolizardo.beobachter.beans.LogType

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.