Example usage for javax.swing.table DefaultTableModel DefaultTableModel

List of usage examples for javax.swing.table DefaultTableModel DefaultTableModel

Introduction

In this page you can find the example usage for javax.swing.table DefaultTableModel DefaultTableModel.

Prototype

public DefaultTableModel() 

Source Link

Document

Constructs a default DefaultTableModel which is a table of zero columns and zero rows.

Usage

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.base.layout.TableLayoutIT.java

public void run(final ValidationSequence sequence, final OutputProcessorMetaData metaData)
        throws ResourceKeyCreationException, ContentProcessingException, ReportProcessingException {
    // Set up the process ..
    final PageFormatFactory fmFactory = PageFormatFactory.getInstance();
    final PageFormat pageFormat = new PageFormat();
    pageFormat.setPaper(fmFactory.createPaper((double) sequence.getPageWidth(), 1000));

    final SimplePageDefinition pageDefinition = new SimplePageDefinition(pageFormat);
    final ProcessingContext processingContext = new DefaultProcessingContext();
    final DebugExpressionRuntime runtime = new DebugExpressionRuntime(new DefaultTableModel(), 0,
            processingContext);/*from w w  w . ja v a 2 s  .c  om*/

    final TableDebugOutputProcessor outputProcessor = new TableDebugOutputProcessor(metaData);
    final TableDebugRenderer flowRenderer = new TableDebugRenderer(outputProcessor);
    final MasterReport report = new MasterReport();
    report.setPageDefinition(pageDefinition);
    DebugReportRunner.resolveStyle(report);
    flowRenderer.startReport(report, processingContext, new DefaultPerformanceMonitorContext());
    // execute .. (maybe it is not pretty, "... but it works")
    final ArrayList list = sequence.getContents();
    for (int i = 0; i < list.size(); i++) {
        final Object o = list.get(i);
        if (o instanceof SourceChunk) {
            final SourceChunk chunk = (SourceChunk) o;
            flowRenderer.startSection(Renderer.SectionType.NORMALFLOW);
            final Band band = chunk.getRootBand();
            DebugReportRunner.resolveStyle(band);
            flowRenderer.add(band, runtime);
            flowRenderer.endSection();
            flowRenderer.applyAutoCommit();
            if (Renderer.LayoutResult.LAYOUT_PAGEBREAK == flowRenderer.validatePages()) {
                flowRenderer.processPage(null, new Object(), true);
            } else {
                flowRenderer.processIncrementalUpdate(true);
            }
            flowRenderer.processIncrementalUpdate(true);
        }
    }
    flowRenderer.endReport();
    if (Renderer.LayoutResult.LAYOUT_PAGEBREAK == flowRenderer.validatePages()) {
        assertTrue(flowRenderer.processPage(null, new Object(), true));
    } else {
        fail();
    }

    flowRenderer.startReport(report, processingContext, new DefaultPerformanceMonitorContext());
    for (int i = 0; i < list.size(); i++) {
        final Object o = list.get(i);
        if (o instanceof SourceChunk) {
            final SourceChunk chunk = (SourceChunk) o;
            flowRenderer.startSection(Renderer.SectionType.NORMALFLOW);
            final Band band = chunk.getRootBand();
            DebugReportRunner.resolveStyle(band);
            flowRenderer.add(band, runtime);
            flowRenderer.endSection();
            flowRenderer.applyAutoCommit();
            if (Renderer.LayoutResult.LAYOUT_PAGEBREAK == flowRenderer.validatePages()) {
                flowRenderer.processPage(null, new Object(), true);
            } else {
                flowRenderer.processIncrementalUpdate(true);
            }
        } else if (o instanceof ResultTable) {
            // perform the layouting first.
            final ResultTable chunk = (ResultTable) o;
            outputProcessor.validate(chunk);
        }
    }
    flowRenderer.endReport();
    if (Renderer.LayoutResult.LAYOUT_PAGEBREAK == flowRenderer.validatePages()) {
        flowRenderer.processPage(null, new Object(), false);
    } else {
        fail();
    }

    logger.debug("All ok");
}

From source file:org.pentaho.reporting.engine.classic.core.states.CascadingDataFactory.java

protected TableModel handleFallThrough(final String query) throws ReportDataFactoryException {
    final Configuration configuration = ClassicEngineBoot.getInstance().getGlobalConfig();
    if ("warn".equals(configuration
            .getConfigProperty("org.pentaho.reporting.engine.classic.core.states.NullDataSourceHandling"))) {
        logger.warn("Deprecated behavior: None of the data-factories was able to handle the query '" + query
                + "'. " + "Returning empty tablemodel instead of failing hard.");
        logger.warn("Be aware that the default for this setting will change in version 0.8.11. "
                + "To avoid this warning, make sure that all data-sources are properly configured and "
                + "that no report references illegal queries.");
        return new DefaultTableModel();
    } else {//w  w  w  . j a v  a2 s  .c  o m
        throw new ReportDataFactoryException("None of the data-factories was able to handle this query.");
    }
}

From source file:org.pentaho.reporting.engine.classic.core.SubReportIT.java

public void testXmlSubReport() throws Exception {
    final URL url = getClass().getResource("subreport-test-master.xml");
    assertNotNull(url);/*  w w w  .j  a  v  a  2s.  c  om*/
    final ResourceManager resourceManager = new ResourceManager();
    final Resource directly = resourceManager.createDirectly(url, MasterReport.class);
    final MasterReport resource = (MasterReport) directly.getResource();

    final TableDataFactory tableDataFactory = new TableDataFactory();
    tableDataFactory.addTable("fruit", createFruitTableModel());
    tableDataFactory.addTable("color", createColorTableModel());
    tableDataFactory.addTable("default", new DefaultTableModel());
    resource.setDataFactory(tableDataFactory);
    DebugReportRunner.executeAll(resource);
}

From source file:org.pentaho.reporting.engine.classic.core.testsupport.DebugReportRunner.java

public static LogicalPageBox layoutSingleBand(final MasterReport originalReport, final Band reportHeader,
        final FontStorage fontRegistry, final boolean expectPageBreak, final boolean designTime)
        throws ReportProcessingException, ContentProcessingException {
    final ReportStateKey stateKey = new ReportStateKey();

    final DebugOutputProcessorMetaData metaData = new DebugOutputProcessorMetaData(fontRegistry);
    metaData.setDesignTime(designTime);//from  w w  w . ja v a2 s  .  c om

    final MasterReport report = originalReport.derive(true);
    resolveStyle(report);
    resolveStyle(reportHeader);

    metaData.initialize(wrapForCompatibility(report));

    final ProcessingContext processingContext = new DefaultProcessingContext(report, metaData);
    final DebugExpressionRuntime runtime = new DebugExpressionRuntime(new DefaultTableModel(), 0,
            processingContext);

    final DebugRenderer debugLayoutSystem = new DebugRenderer(metaData);
    debugLayoutSystem.setStateKey(stateKey);
    debugLayoutSystem.startReport(report, processingContext, new DefaultPerformanceMonitorContext());
    debugLayoutSystem.startSection(Renderer.SectionType.NORMALFLOW);
    debugLayoutSystem.add(reportHeader, runtime);
    debugLayoutSystem.endSection();
    if (expectPageBreak) {
        debugLayoutSystem.endReport();
        final Renderer.LayoutResult result = debugLayoutSystem.validatePages();
        Assert.assertEquals(Renderer.LayoutResult.LAYOUT_PAGEBREAK, result);
    } else {
        debugLayoutSystem.validatePages();
    }
    return debugLayoutSystem.getPageBox();
}

From source file:org.quackbot.gui.InfoPlugins.java

public InfoPlugins(final Controller controller) {
    super();/* ww  w. j a va  2s  . c  o m*/
    setBorder(BorderFactory.createTitledBorder("Active plugins"));

    //Configure the table model
    pluginTableModel = new DefaultTableModel() {
        @Override
        public Class getColumnClass(int c) {
            return getValueAt(0, c).getClass();
        }
    };
    pluginTableModel.addColumn("Name");
    pluginTableModel.addColumn("Type");
    pluginTableModel.addColumn("Enabled");
    pluginTableModel.addColumn("Admin Only");
    pluginTableModel.addColumn("Required");
    pluginTableModel.addColumn("Optional");
    pluginTableModel.addColumn("Help");

    //Toggle command enabled status when changed on the table
    pluginTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (e.getType() != TableModelEvent.UPDATE)
                return;
            TableModel model = ((TableModel) e.getSource());
            String plugin = StringUtils
                    .trimToNull((String) ((TableModel) e.getSource()).getValueAt(e.getFirstRow(), 0));
            Command command = controller.getHookManager().getCommand(plugin);
            if (command != null) {
                command.setEnabled((Boolean) model.getValueAt(e.getFirstRow(), 1));
                log.debug((command.isEnabled() ? "Enabled" : "Disabled") + " command " + command.getName());
            }
        }
    });

    //Configure the table
    pluginTable = new JTable(pluginTableModel) {
        @Override
        public String getToolTipText(MouseEvent e) {
            Point p = e.getPoint();
            int rowIndex = pluginTable.rowAtPoint(p);
            int colIndex = pluginTable.columnAtPoint(p);
            if ((colIndex == 0 || colIndex == 5 || colIndex == 6) && getValueAt(rowIndex, colIndex) != null)
                return getValueAt(rowIndex, colIndex).toString();
            return "";
        }
    };
    pluginTable.setRowSelectionAllowed(false);
    pluginTable.setColumnSelectionAllowed(false);
    pluginTable.setCellSelectionEnabled(false);
    pluginTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    //Configure the default column widths
    TableColumnModel columnModel = pluginTable.getColumnModel();
    columnModel.getColumn(0).setPreferredWidth(120);
    columnModel.getColumn(1).setPreferredWidth(50);
    columnModel.getColumn(2).setPreferredWidth(75);
    columnModel.getColumn(3).setPreferredWidth(50);
    columnModel.getColumn(4).setPreferredWidth(40);
    columnModel.getColumn(5).setPreferredWidth(520);

    //Add the table to the scroll pane
    add(pluginTable);

    //Get notified of hook changes
    controller.getHookManager().addHook(new QListener("QBGuiPluginPanel") {
        @Override
        public void onHookLoad(HookLoadEvent event) {
            //TODO: Inform user about exception
            if (event.getException() != null)
                return;
            QListener hook = event.getHook();
            if (hook instanceof Command) {
                Command command = (Command) hook;
                pluginTableModel.addRow(
                        new Object[] { command.getName(), "Command", command.isEnabled(), command.isAdmin(),
                                command.getRequiredParams(), command.getOptionalParams(), command.getHelp() });
            } else {
                pluginTableModel.addRow(new Object[] { hook.getName(), "Hook", null, null, null, null, null });
            }
        }

        @Override
        public void onHookLoadStart(HookLoadStartEvent event) {
            pluginTableModel.setRowCount(0);
        }
    });
}

From source file:org.ut.biolab.medsavant.client.patient.AddPatientsForm.java

private void createTable() throws RemoteException, SQLException {
    scrollPane.getViewport().setBackground(Color.white);

    DefaultTableModel model = new DefaultTableModel() {
        @Override//from  ww w  . j  ava2 s . com
        public boolean isCellEditable(int row, int col) {
            return col != 0;
        }
    };
    model.addColumn("Short Name");
    model.addColumn("Value");

    CustomField[] fields = null;
    try {
        fields = MedSavantClient.PatientManager.getPatientFields(LoginController.getSessionID(),
                ProjectController.getInstance().getCurrentProjectID());
    } catch (SessionExpiredException ex) {
        MedSavantExceptionHandler.handleSessionExpiredException(ex);
    }
    for (int i = 1; i < fields.length; i++) { //skip patient id
        model.addRow(new Object[] { fields[i], "" });
    }

    table.setModel(model);

    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            setTip();
        }
    });

    table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
}

From source file:org.ut.biolab.medsavant.client.project.ProjectWizard.java

private AbstractWizardPage getPatientFieldsPage() {

    //setup page/*w  w w.  j av  a2  s.  co m*/
    final DefaultWizardPage page = new DefaultWizardPage(PAGENAME_PATIENTS) {
        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
        }
    };

    page.addText("Add relevant fields for patients. ");

    JScrollPane scrollpane = new JScrollPane();
    scrollpane.setPreferredSize(new Dimension(300, 250));
    scrollpane.getViewport().setBackground(Color.white);

    final JTable table = new JTable() {
        @Override
        public Class<?> getColumnClass(int column) {
            if (column == 2) {
                return Boolean.class;
            } else {
                return String.class;
            }
        }
    };

    patientFormatModel = new DefaultTableModel() {
        @Override
        public boolean isCellEditable(int row, int col) {
            return row >= 8;
        }
    };

    patientFormatModel.addColumn("Name");
    patientFormatModel.addColumn("Type");
    patientFormatModel.addColumn("Filterable");
    patientFormatModel.addColumn("Alias");
    patientFormatModel.addColumn("Description");

    patientFormatModel.addRow(new Object[] { FAMILY_ID.getColumnName(), FAMILY_ID.getTypeString(), true,
            FAMILY_ID.getAlias(), "" });
    patientFormatModel.addRow(new Object[] { HOSPITAL_ID.getColumnName(), HOSPITAL_ID.getTypeString(), true,
            HOSPITAL_ID.getAlias(), "" });
    patientFormatModel.addRow(
            new Object[] { IDBIOMOM.getColumnName(), IDBIOMOM.getTypeString(), true, IDBIOMOM.getAlias(), "" });
    patientFormatModel.addRow(
            new Object[] { IDBIODAD.getColumnName(), IDBIODAD.getTypeString(), true, IDBIODAD.getAlias(), "" });
    patientFormatModel.addRow(
            new Object[] { GENDER.getColumnName(), GENDER.getTypeString(), true, GENDER.getAlias(), "" });
    patientFormatModel.addRow(
            new Object[] { AFFECTED.getColumnName(), AFFECTED.getTypeString(), true, AFFECTED.getAlias(), "" });
    patientFormatModel.addRow(
            new Object[] { DNA_IDS.getColumnName(), DNA_IDS.getTypeString(), true, DNA_IDS.getAlias(), "" });
    patientFormatModel.addRow(
            new Object[] { BAM_URL.getColumnName(), BAM_URL.getTypeString(), true, BAM_URL.getAlias(), "" });
    patientFormatModel.addRow(new Object[] { PHENOTYPES.getColumnName(), PHENOTYPES.getTypeString(), true,
            PHENOTYPES.getAlias(), "" });

    if (modify) {
        for (CustomField f : customFields) {
            patientFormatModel.addRow(new Object[] { f.getColumnName(), f.getTypeString(), f.isFilterable(),
                    f.getAlias(), f.getDescription() });
        }
    }

    table.setModel(patientFormatModel);
    table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    scrollpane.getViewport().add(table);
    page.addComponent(scrollpane);

    JButton addFieldButton = new JButton("Add Field");
    addFieldButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            patientFormatModel.addRow(new Object[5]);
            table.setModel(patientFormatModel);
        }
    });
    page.addComponent(addFieldButton);

    JButton removeFieldButton = new JButton("Remove Field");
    removeFieldButton.setEnabled(false);
    removeFieldButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            int row = table.getSelectedRow();
            // Minus one because patient_id isn't in the table.
            if (row >= BasicPatientColumns.REQUIRED_PATIENT_FIELDS.length - 1) {
                patientFormatModel.removeRow(row);
            }
            table.setModel(patientFormatModel);
        }
    });
    table.getSelectionModel().addListSelectionListener(
            new RemovalEnabler(BasicPatientColumns.REQUIRED_PATIENT_FIELDS.length - 1, removeFieldButton));
    page.addComponent(removeFieldButton);

    return page;
}

From source file:org.ut.biolab.medsavant.client.project.ProjectWizard.java

private AbstractWizardPage getVCFFieldsPage() {

    //setup page//from www  .j ava  2 s.  c  om
    final DefaultWizardPage page = new DefaultWizardPage(PAGENAME_VCF) {
        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
        }
    };

    page.addText("Add extra fields to parse from INFO text in VCF files. ");

    JScrollPane scrollpane = new JScrollPane();
    scrollpane.setPreferredSize(new Dimension(300, 250));
    scrollpane.getViewport().setBackground(Color.white);

    final JTable table = new JTable() {
        @Override
        public Class<?> getColumnClass(int column) {
            if (column == 2) {
                return Boolean.class;
            } else {
                return String.class;
            }
        }
    };

    variantFormatModel = new DefaultTableModel();

    variantFormatModel.addColumn("Key");
    variantFormatModel.addColumn("Type");
    variantFormatModel.addColumn("Filterable");
    variantFormatModel.addColumn("Alias");
    variantFormatModel.addColumn("Description");

    if (modify) {
        try {
            int firstRef = manager.getReferenceIDsForProject(LoginController.getSessionID(), projectID)[0];
            CustomField[] fields = manager.getCustomVariantFields(LoginController.getSessionID(), projectID,
                    firstRef,
                    manager.getNewestUpdateID(LoginController.getSessionID(), projectID, firstRef, false));
            for (CustomField f : fields) {
                //casing of f.getColumnName should match database.
                variantFormatModel.addRow(new Object[] { f.getColumnName(), f.getTypeString(), f.isFilterable(),
                        f.getAlias(), f.getDescription() });
            }
        } catch (Exception ex) {
            LOG.error("Error getting reference IDs for project.", ex);
        }
    } else {
        variantFormatModel
                .addRow(new Object[] { AA.getColumnName(), AA.getTypeString(), true, AA.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { AC.getColumnName(), AC.getTypeString(), true, AC.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { AF.getColumnName(), AF.getTypeString(), true, AF.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { AN.getColumnName(), AN.getTypeString(), true, AN.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { BQ.getColumnName(), BQ.getTypeString(), true, BQ.getAlias(), "" });
        variantFormatModel.addRow(
                new Object[] { CIGAR.getColumnName(), CIGAR.getTypeString(), true, CIGAR.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { DB.getColumnName(), DB.getTypeString(), true, DB.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { DP.getColumnName(), DP.getTypeString(), true, DP.getAlias(), "" });
        //variantFormatModel.addRow(new Object[]{END.getColumnName(), END.getTypeString(), true, END.getAlias(), ""});
        variantFormatModel
                .addRow(new Object[] { H2.getColumnName(), H2.getTypeString(), true, H2.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { MQ.getColumnName(), MQ.getTypeString(), true, MQ.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { MQ0.getColumnName(), MQ0.getTypeString(), true, MQ0.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { NS.getColumnName(), NS.getTypeString(), true, NS.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { SB.getColumnName(), SB.getTypeString(), true, SB.getAlias(), "" });
        variantFormatModel.addRow(new Object[] { SOMATIC.getColumnName(), SOMATIC.getTypeString(), true,
                SOMATIC.getAlias(), "" });
        variantFormatModel.addRow(new Object[] { VALIDATED.getColumnName(), VALIDATED.getTypeString(), true,
                VALIDATED.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { JANNOVAR_EFFECT.getColumnName(), JANNOVAR_EFFECT.getTypeString(),
                        JANNOVAR_EFFECT.isFilterable(), JANNOVAR_EFFECT.getAlias(), "" });
        variantFormatModel
                .addRow(new Object[] { JANNOVAR_SYMBOL.getColumnName(), JANNOVAR_SYMBOL.getTypeString(),
                        JANNOVAR_SYMBOL.isFilterable(), JANNOVAR_SYMBOL.getAlias(), "" });
        variantFormatModel.addRow(new Object[] { FORMAT.getColumnName(), FORMAT.getTypeString(),
                FORMAT.isFilterable(), FORMAT.getAlias(), "" });
        variantFormatModel.addRow(new Object[] { SAMPLE_INFO.getColumnName(), SAMPLE_INFO.getTypeString(),
                SAMPLE_INFO.isFilterable(), SAMPLE_INFO.getAlias(), "" });
    }

    table.setModel(variantFormatModel);
    table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    scrollpane.getViewport().add(table);
    page.addComponent(scrollpane);

    table.addKeyListener(new KeyListener() {
        @Override
        public void keyTyped(KeyEvent e) {
            variantFieldsChanged = true;
        }

        @Override
        public void keyPressed(KeyEvent e) {
            variantFieldsChanged = true;
        }

        @Override
        public void keyReleased(KeyEvent e) {
            variantFieldsChanged = true;
        }
    });

    JButton addFieldButton = new JButton("Add Field");
    addFieldButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            variantFormatModel.addRow(new Object[2]);
            table.setModel(variantFormatModel);
            variantFieldsChanged = true;
        }
    });
    page.addComponent(addFieldButton);

    JButton removeFieldButton = new JButton("Remove Field");
    removeFieldButton.setEnabled(false);
    removeFieldButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            int row = table.getSelectedRow();
            if (row >= 0) {
                variantFormatModel.removeRow(row);
                table.setModel(variantFormatModel);
                variantFieldsChanged = true;
            }
        }
    });
    table.getSelectionModel().addListSelectionListener(new RemovalEnabler(0, removeFieldButton));
    page.addComponent(removeFieldButton);

    return page;
}

From source file:org.wings.STable.java

/**
 * Returns a default table model object.
 * Subclasses can override this method to return a different table model objects
 *
 * @return the default table model object
 * @see javax.swing.table.DefaultTableModel
 *///from w w w.ja  v a 2s. c  o m
protected TableModel createDefaultDataModel() {
    return new DefaultTableModel();
}

From source file:ru.apertum.qsystem.client.forms.FReception.java

/**
 * ??  ?  ?  ? ? ./*  www  . ja v a 2  s.com*/
 */
private void preRegChange(boolean force) {
    if (!force && (comboBoxServices == null || comboBoxServices.getSelectedItem() == null
            || (calPrereg.getDate().equals(preDate) && comboBoxServices.getSelectedItem().equals(preService))
            || !((QService) comboBoxServices.getSelectedItem()).isLeaf())) {
        tablePreReg.setModel(new DefaultTableModel());
        return;
    }
    preDate = calPrereg.getDate();
    labelPreDate.setText(Uses.format_dd_MMMM_yyyy.format(preDate));
    preService = (QService) comboBoxServices.getSelectedItem();

    calPrereg.setMinSelectableDate(new Date());
    if (preService.getAdvanceLimitPeriod() != 0) {
        final GregorianCalendar gc = new GregorianCalendar();
        gc.add(GregorianCalendar.DAY_OF_YEAR, preService.getAdvanceLimitPeriod());
        calPrereg.setMaxSelectableDate(gc.getTime());
    }

    final RpcGetGridOfDay.GridDayAndParams greed = NetCommander.getPreGridOfDay(netProperty, preService.getId(),
            preDate, -1);
    tablePreReg.setModel(new PreTableModel(greed));
    tablePreReg.getColumnModel().getColumn(0).setMaxWidth(50);
    tablePreReg.getColumnModel().getColumn(1).setMaxWidth(110);
}