protected static boolean confirmOpenLinks(final Program program, final int size) { if (size <= 1) { return true; } int value = JOptionPane.showConfirmDialog( program.getMainWindow().getFrame(), GuiShared.get().openLinks(size), GuiShared.get().openLinksTitle(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); return (value == JOptionPane.OK_OPTION); }
public IndustryJobsTab(final Program program) { super(program, TabsJobs.get().industry(), Images.TOOL_INDUSTRY_JOBS.getIcon(), true); ListenerClass listener = new ListenerClass(); // Table Format tableFormat = new EnumTableFormatAdaptor<IndustryJobTableFormat, MyIndustryJob>( IndustryJobTableFormat.class); // Backend eventList = program.getProfileData().getIndustryJobsEventList(); // Sorting (per column) eventList.getReadWriteLock().readLock().lock(); SortedList<MyIndustryJob> sortedList = new SortedList<MyIndustryJob>(eventList); eventList.getReadWriteLock().readLock().unlock(); // Filter eventList.getReadWriteLock().readLock().lock(); filterList = new FilterList<MyIndustryJob>(sortedList); eventList.getReadWriteLock().readLock().unlock(); filterList.addListEventListener(listener); // Table Model tableModel = EventModels.createTableModel(filterList, tableFormat); // Table jTable = new JAutoColumnTable(program, tableModel); jTable.setCellSelectionEnabled(true); PaddingTableCellRenderer.install(jTable, 1); // Sorting TableComparatorChooser.install( jTable, sortedList, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat); // Selection Model selectionModel = EventModels.createSelectionModel(filterList); selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE); jTable.setSelectionModel(selectionModel); // Listeners installTable(jTable, NAME); // Scroll JScrollPane jTableScroll = new JScrollPane(jTable); // Table Filter Map<String, List<Filter>> defaultFilters = new HashMap<String, List<Filter>>(); List<Filter> filter; filter = new ArrayList<Filter>(); filter.add( new Filter( LogicType.AND, IndustryJobTableFormat.STATE, CompareType.EQUALS_NOT, IndustryJobState.STATE_DELIVERED.toString())); defaultFilters.put(TabsJobs.get().active(), filter); filter = new ArrayList<Filter>(); filter.add( new Filter( LogicType.AND, IndustryJobTableFormat.STATE, CompareType.EQUALS, IndustryJobState.STATE_DELIVERED.toString())); defaultFilters.put(TabsJobs.get().completed(), filter); filterControl = new IndustryJobsFilterControl( program.getMainWindow().getFrame(), tableFormat, sortedList, filterList, Settings.get().getTableFilters(NAME), defaultFilters); // Menu installMenu(program, new JobsTableMenu(), jTable, MyIndustryJob.class); jInventionSuccess = StatusPanel.createLabel( TabsJobs.get().inventionSuccess(), Images.JOBS_INVENTION_SUCCESS.getIcon()); this.addStatusbarLabel(jInventionSuccess); jManufactureOutputValue = StatusPanel.createLabel( TabsJobs.get().manufactureJobsValue(), Images.TOOL_VALUES.getIcon()); this.addStatusbarLabel(jManufactureOutputValue); layout.setHorizontalGroup( layout .createParallelGroup() .addComponent(filterControl.getPanel()) .addComponent(jTableScroll, 700, 700, Short.MAX_VALUE)); layout.setVerticalGroup( layout .createSequentialGroup() .addComponent(filterControl.getPanel()) .addComponent(jTableScroll, 100, 400, Short.MAX_VALUE)); }