public void init() { SELECT_logBuffer.removeAllItems(); for (SizeType st : SizeType.values()) { SELECT_logBuffer.addItem(st.getName()); } SELECT_charset.removeAllItems(); for (CharsetType ct : CharsetType.values()) { SELECT_charset.addItem(ct.getName()); } loadData(this.settingConfig); bindListeners(); checkSeek(); generateSeekInfo(); }
private SettingConfig generateSetting() { SettingConfig s = new SettingConfig(); s.dir = TEXT_dir.getText(); s.logBuffer = SizeType.get((String) SELECT_logBuffer.getSelectedItem()).getSize(); try { s.delay = Integer.parseInt((String) SELECT_delay.getSelectedItem()); if (s.delay < 100) s.delay = 100; } catch (Exception e) { } s.seek = CHK_seek.isSelected(); if (s.seek) { try { s.seekType = SeekType.get((String) SELECT_seekType.getSelectedItem()); } catch (Exception e) { } try { s.seekPos = Long.parseLong(TEXT_seekPos.getText()); } catch (Exception e) { } } s.charset = CharsetType.get((String) SELECT_charset.getSelectedItem()); try { s.overflowNum = Integer.parseInt(TEXT_limit.getText()); } catch (Exception e) { } s.showLineNumber = CHK_showLineNumber.isSelected(); s.softWrap = CHK_softWrap.isSelected(); return s; }
public void loadData(SettingConfig settingConfig) { TEXT_dir.setText(settingConfig.dir); try { SELECT_logBuffer.setSelectedItem(SizeType.get(settingConfig.logBuffer).getName()); } catch (Exception e) { } try { SELECT_delay.setSelectedItem(settingConfig.delay + ""); } catch (Exception e) { } CHK_seek.setSelected(settingConfig.seek); CHK_showLineNumber.setSelected(settingConfig.showLineNumber); CHK_softWrap.setSelected(settingConfig.softWrap); TEXT_seekPos.setText(settingConfig.seekPos + ""); try { SELECT_seekType.setSelectedItem(settingConfig.seekType.name()); } catch (Exception e) { } try { SELECT_charset.setSelectedItem(settingConfig.charset.getName()); } catch (Exception e) { } TEXT_limit.setText(settingConfig.overflowNum + ""); checkSeek(); }
public boolean isModified(Settings settings) { SettingConfig configSaved = settings.getSettingConfig(); return (!TEXT_dir.getText().equals(configSaved.dir) && configSaved.dir != null) || (configSaved.dir == null && !TEXT_dir.getText().equals("")) || !(SizeType.get((String) SELECT_logBuffer.getSelectedItem()).getSize() == configSaved.logBuffer) || !(SELECT_delay.getSelectedItem()).equals(configSaved.delay + "") || !(SELECT_charset.getSelectedItem()).equals(configSaved.charset.getName() + "") || !(CHK_seek.isSelected() == configSaved.seek) || !(CHK_showLineNumber.isSelected() == configSaved.showLineNumber) || !(CHK_softWrap.isSelected() == configSaved.softWrap) || !(SELECT_seekType.getSelectedItem().equals(configSaved.seekType.name())) || !(TEXT_seekPos.getText().equals(configSaved.seekPos + "")) || !(TEXT_limit.getText().equals(configSaved.overflowNum + "")); }