public void actionPerformed(final ActionEvent e) { final ReportSelectionModel selectionModel1 = getSelectionModel(); if (selectionModel1 == null) { return; } final Element[] visualElements = selectionModel1.getSelectedVisualElements(); if (visualElements.length == 0) { return; } final EditableStyleSheet styleSheet = EditableStyleSheet.create(visualElements); final Map<StyleKey, Expression> styleExpressions; if (visualElements.length != 1) { styleExpressions = null; } else { styleExpressions = visualElements[0].getStyleExpressions(); } final Component parent = getReportDesignerContext().getParent(); final Window window = LibSwingUtil.getWindowAncestor(parent); final ElementFormatDialog dialog = createDialog(window); final ElementFormatUndoEntry.EditResult result = dialog.performEdit(getReportDesignerContext(), styleSheet, styleExpressions); if (result == null) { return; } final ElementFormatUndoEntry undoEntry = result.process(visualElements); getActiveContext() .getUndo() .addChange(ActionMessages.getString("ElementFormatAction.UndoName"), undoEntry); }
public static void main(String[] args) { ClassicEngineBoot.getInstance().start(); DrillDownProfileEditor editor = new DrillDownProfileEditor(); editor.pack(); LibSwingUtil.centerFrameOnScreen(editor); editor.setVisible(true); }
/** * Creates the progress dialog that monitors the export process. * * @return the progress monitor dialog. */ protected ReportProgressDialog createProgressDialog() { final ReportProgressDialog progressDialog = super.createProgressDialog(); progressDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); progressDialog.setMessage( resources.getString("excel-export.progressdialog.message")); // $NON-NLS-1$ progressDialog.pack(); LibSwingUtil.positionFrameRandomly(progressDialog); return progressDialog; }
public static void main(final String[] args) { ClassicEngineBoot.getInstance().start(); final SimpleBarcodesXMLDemo XMLDemoHandler = new SimpleBarcodesXMLDemo(); final SimpleDemoFrame frame = new SimpleDemoFrame(XMLDemoHandler); frame.init(); frame.pack(); LibSwingUtil.centerFrameOnScreen(frame); frame.setVisible(true); }
public static void main(String[] args) { ClassicEngineBoot.getInstance().start(); final DefaultDemoSelector demoSelector = createDemoInfo(); final LayoutDemo frame = new LayoutDemo(demoSelector); frame.pack(); LibSwingUtil.centerFrameOnScreen(frame); frame.setVisible(true); }
public void run() { try { final ReportDesignerFrame frame = new ReportDesignerFrame(); ReportDesigner.reportDesignerFrame = frame; frame.pack(); final Rectangle bounds = WorkspaceSettings.getInstance().getBounds(); if (bounds == null || LibSwingUtil.safeRestoreWindow(frame, bounds) == false) { LibSwingUtil.centerFrameOnScreen(frame); frame.setExtendedState(Frame.MAXIMIZED_BOTH); } frame.initWindowLocations(files); frame.setVisible(true); } catch (Exception t) { if (splashScreen != null) { splashScreen.dispose(); } UncaughtExceptionsModel.getInstance().addException(t); final ExceptionDialog dialog = new ExceptionDialog(); dialog.setModal(true); dialog.showDialog(); System.exit(-1); } }
/** Invoked when an action occurs. */ public void actionPerformed(final ActionEvent e) { final Window window = LibSwingUtil.getWindowAncestor(DrillDownParameterTable.this); final SystemParameterDialog dialog; if (window instanceof Dialog) { dialog = new SystemParameterDialog((Dialog) window, parameterTableModel, reportDesignerContext); } else if (window instanceof Frame) { dialog = new SystemParameterDialog((Frame) window, parameterTableModel, reportDesignerContext); } else { dialog = new SystemParameterDialog(parameterTableModel, reportDesignerContext); } dialog.showAdvancedEditor(); dialog.dispose(); }
public void actionPerformed(final ActionEvent e) { final ReportRenderContext activeContext = getActiveContext(); if (activeContext == null) { return; } final ReportDesignerContext context = getReportDesignerContext(); final Component parent = context.getParent(); final Window window = LibSwingUtil.getWindowAncestor(parent); final RowBandingDialog dialog; if (window instanceof JDialog) { dialog = new RowBandingDialog((JDialog) window); } else if (window instanceof JFrame) { dialog = new RowBandingDialog((JFrame) window); } else { dialog = new RowBandingDialog(); } final RowBandingFunction function = findRowbandingFunction(activeContext); final AbstractReportDefinition report = activeContext.getReportDefinition(); if (function == null) { final RowBandingFunction newFunction = new RowBandingFunction(); if (dialog.performEdit(newFunction)) { report.getExpressions().add(newFunction); activeContext .getUndo() .addChange( ActionMessages.getString("EditRowBandingAction.Text"), new ExpressionAddedUndoEntry(report.getExpressions().size() - 1, newFunction)); report.notifyNodeChildAdded(function); } } else { final RowBandingFunction instance = (RowBandingFunction) function.getInstance(); if (dialog.performEdit(instance)) { final ExpressionCollection expressionCollection = report.getExpressions(); final int idx = expressionCollection.indexOf(function); expressionCollection.set(idx, instance); activeContext .getUndo() .addChange( ActionMessages.getString("EditRowBandingAction.Text"), new ExpressionEditUndoEntry(idx, function, instance)); report.fireModelLayoutChanged(report, ReportModelEvent.NODE_PROPERTIES_CHANGED, instance); } } }
public void attemptPreview() { try { final MasterReport report = handler.createReport(); final PreviewDialog frame = new PreviewDialog(report); frame.setToolbarFloatable(true); frame.setReportController(new DemoReportController()); frame.pack(); LibSwingUtil.positionFrameRandomly(frame); frame.setVisible(true); frame.requestFocus(); } catch (ReportDefinitionException e) { logger.error("Unable to create the report; report definition contained errors.", e); AbstractDemoFrame.showExceptionDialog( handler.getPresentationComponent(), "report.definitionfailure", e); } }
/** Invoked when an action occurs. */ public void actionPerformed(final ActionEvent e) { final Window window = LibSwingUtil.getWindowAncestor(carrierPanel); final Object selectedItem = expressionEditor.getSelectedItem(); if (selectedItem instanceof StructureFunction) { final ExpressionPropertiesDialog optionPane; if (window instanceof JFrame) { optionPane = new ExpressionPropertiesDialog((JFrame) window); } else if (window instanceof JDialog) { optionPane = new ExpressionPropertiesDialog((JDialog) window); } else { optionPane = new ExpressionPropertiesDialog(); } final StructureFunction structureFunction = (StructureFunction) selectedItem; final StructureFunction expression = (StructureFunction) optionPane.editExpression(structureFunction, designerContext); if (expression != selectedItem) { expressionEditor.setSelectedItem(expression); } fireEditingStopped(); } else if (selectedItem instanceof ExpressionMetaData) { try { final ExpressionMetaData emd = (ExpressionMetaData) selectedItem; final Expression expression = (Expression) emd.getExpressionType().newInstance(); final ExpressionPropertiesDialog optionPane; if (window instanceof JFrame) { optionPane = new ExpressionPropertiesDialog((JFrame) window); } else if (window instanceof JDialog) { optionPane = new ExpressionPropertiesDialog((JDialog) window); } else { optionPane = new ExpressionPropertiesDialog(); } final Expression resultexpression = optionPane.editExpression(expression, designerContext); if (resultexpression != expression) { expressionEditor.setSelectedItem(resultexpression); } fireEditingStopped(); } catch (Throwable e1) { UncaughtExceptionsModel.getInstance().addException(e1); } } }
/** Invoked when an action occurs. */ public void actionPerformed(final ActionEvent e) { final ReportDocumentContext activeContext = getActiveContext(); if (activeContext == null) { return; } final ReportDesignerContext context = getReportDesignerContext(); final Component parent = context.getView().getParent(); final Window window = LibSwingUtil.getWindowAncestor(parent); final DocumentMetaDataDialog dialog; if (window instanceof JDialog) { dialog = new DocumentMetaDataDialog((JDialog) window); } else if (window instanceof JFrame) { dialog = new DocumentMetaDataDialog((JFrame) window); } else { dialog = new DocumentMetaDataDialog(); } try { final MasterReport report = activeContext.getContextRoot(); final DocumentBundle bundle = report.getBundle(); final DocumentMetaData oldMetaData = (DocumentMetaData) bundle.getMetaData().clone(); final DocumentMetaData result = dialog.performEdit( oldMetaData, report.getResourceManager(), report.getDefinitionSource()); if (result == null) { return; } final MetaDataEditUndoEntry undoEntry = new MetaDataEditUndoEntry(oldMetaData, result); undoEntry.redo(activeContext); activeContext .getUndo() .addChange(ActionMessages.getString("EditReportPropertiesAction.Text"), undoEntry); } catch (CloneNotSupportedException cne) { // should not happen UncaughtExceptionsModel.getInstance().addException(cne); } }
public void run() { final ReportDocumentContext context = dragContext.getRenderContext(); if (rootband) { final int result = JOptionPane.showOptionDialog( dragContext.getRepresentationContainer(), Messages.getString( "CrosstabReportElementDragHandler.BandedOrInlineSubreportQuestion"), Messages.getString("CrosstabReportElementDragHandler.InsertSubreport"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new String[] { Messages.getString("CrosstabReportElementDragHandler.Inline"), Messages.getString("CrosstabReportElementDragHandler.Banded"), Messages.getString("CrosstabReportElementDragHandler.Cancel") }, Messages.getString("CrosstabReportElementDragHandler.Inline")); if (result == JOptionPane.CLOSED_OPTION || result == 2) { return; } if (result == 0) { final UndoManager undo = context.getUndo(); undo.addChange( Messages.getString("CrosstabReportElementDragHandler.UndoEntry"), new ElementEditUndoEntry( parent.getObjectID(), parent.getElementCount(), null, subReport)); parent.addElement(subReport); } else { final AbstractRootLevelBand arb = (AbstractRootLevelBand) parent; final UndoManager undo = context.getUndo(); undo.addChange( Messages.getString("CrosstabReportElementDragHandler.UndoEntry"), new BandedSubreportEditUndoEntry( parent.getObjectID(), arb.getSubReportCount(), null, subReport)); arb.addSubReport(subReport); } } else { final UndoManager undo = context.getUndo(); undo.addChange( Messages.getString("CrosstabReportElementDragHandler.UndoEntry"), new ElementEditUndoEntry( parent.getObjectID(), parent.getElementCount(), null, subReport)); parent.addElement(subReport); } final ReportDesignerContext designerContext = dragContext.getDesignerContext(); final Window window = LibSwingUtil.getWindowAncestor(designerContext.getView().getParent()); final AbstractReportDefinition reportDefinition = designerContext.getActiveContext().getReportDefinition(); try { // Create the new subreport tab - this is where the contents of the Crosstab // dialog will go. Zoom the crosstab canvas to 150% as crosstab has a lot of elements to // display subReport.setDataFactory(reportDefinition.getDataFactory()); subReport .getReportDefinition() .setAttribute(ReportDesignerBoot.DESIGNER_NAMESPACE, ReportDesignerBoot.ZOOM, 1.5f); final ResourceBundleFactory rbf = subReport.getResourceBundleFactory(); subReport.setResourceBundleFactory(rbf); final int idx = designerContext.addSubReport(designerContext.getActiveContext(), subReport); designerContext.setActiveDocument(designerContext.getReportRenderContext(idx)); } catch (ReportDataFactoryException e) { UncaughtExceptionsModel.getInstance().addException(e); } // Prompt user to either create or use an existing data-source. final SubReportDataSourceDialog crosstabDataSourceDialog; if (window instanceof Dialog) { crosstabDataSourceDialog = new SubReportDataSourceDialog((Dialog) window); } else if (window instanceof Frame) { crosstabDataSourceDialog = new SubReportDataSourceDialog((Frame) window); } else { crosstabDataSourceDialog = new SubReportDataSourceDialog(); } // User has prompted to select a data-source. Get the selected query final String queryName = crosstabDataSourceDialog.performSelection(designerContext); if (queryName != null) { subReport.setQuery(queryName); // Invoke Crosstab dialog final InsertCrosstabGroupAction crosstabAction = new InsertCrosstabGroupAction(); crosstabAction.setReportDesignerContext(designerContext); crosstabAction.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "")); } dragContext .getRenderContext() .getSelectionModel() .setSelectedElements(new Object[] {subReport}); }