Package com.nexirius.framework.dataviewer

Examples of com.nexirius.framework.dataviewer.DataViewer


        map.register(MainModel.class, new SwingViewerCreator(MainViewer.class));
        map.register(MediaArrayModel.class, new MediaArrayLayout(), false);

        try {
            // create an editor for the main model
            DataViewer editor = getFactory().createViewer(mainModel, true);

            // access the Swing JComponents
            JComponent editorComponent = editor.getJComponent();

            // insert generated JComponents into the application window
            getMainPanel().setLayout(new BorderLayout());
            getMainPanel().add(editorComponent, BorderLayout.CENTER);
            getMainFrame().pack();
View Full Code Here


 
  public JComponent createJComponent(ViewerFactory factory) {
    setLayout(new BorderLayout());
   
    try {
      DataViewer v = factory.createDefaultViewer(attachmentListModel.getList());
      add(v.getJComponent(), BorderLayout.CENTER);
     
      setPreferredSize(new Dimension(600, 600));     
    } catch (Exception ex)
    {
      ex.printStackTrace();
View Full Code Here

        return mainPanel;
    }

    public JComponent createStandardButtonComponent(ViewerFactory factory)
            throws Exception {
        DataViewer popupViewer = factory.createViewer(getPopupModel(), true);

        this.setDataViewer(popupViewer);

        return popupViewer.getJComponent();
    }
View Full Code Here

    public JComponent createDialogButtonComponent(ViewerFactory factory)
            throws Exception {
        JPanel buttonPanel = new JPanel(new GridBagLayout());
        JComponent button = null;
        DataModelCommand command;
        DataViewer buttonViewer;
        DataModelCommandVector commandVector = clientMethods;
        GridBagConstraints buttonConstr = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 2, 0, 2), 0, 0);

        if (commandVector == null && popupDialogModel != null) {
            commandVector = popupDialogModel.getMethods();
        }

        if (commandVector != null) {

            for (command = commandVector.firstItem(); command != null; command = commandVector.nextItem()) {
                buttonViewer = factory.createDefaultEditor(command);
                button = buttonViewer.getJComponent();
                buttonPanel.add(button, buttonConstr);
                ++buttonConstr.gridx;

                if (command.isDefaultButton()) {
                    dialog.getRootPane().setDefaultButton((JButton) button);
View Full Code Here

    public void doLayout(DataViewer parent_viewer) {
        try {
            DataModel parent_model = parent_viewer.getDataModel();
            // look for the associated model
            Viewable model = parent_model.getViewableChild(getModelFieldName());
            DataViewer viewer = null;

            if (viewerCreator == null) {
                viewer = parent_viewer.getFactory().createViewer(model, parent_viewer.isEditor());
            } else {
                viewer = parent_viewer.getFactory().createViewer(viewerCreator, model);
            }

            // layout the associated model

            viewer.setLayout(layout);

            // create a JComponent from the associated viewer
            JComponent comp = viewer.getJComponent();

            parent_viewer.add(comp);

            if (createLabel) {
                createFieldName(parent_viewer.getFactory(), model.getFieldName(), comp);
            }

            // move and resize the JComponent
            defaultLayout(comp, parent_viewer.getFactory());

            viewer.updateUI();
        } catch (Exception ex) {
            ex.printStackTrace();
            // ignore
        }
    }
View Full Code Here

     * @param dm     The child data model which will be used to create an editor component.
     * @param layout the layout used to create the editor (or null)
     */
    public JComponent createFieldValue(DataModel dm, LayoutItem layout)
            throws Exception {
        DataViewer v = null;

        if (elementCreator == null) {
            v = getFactory().createDefaultEditor(dm);
            ;
        } else {
            v = elementCreator.createViewer(dm);
            v.setFactory(getFactory());
        }

        v.setLayout(layout);

        JComponent ret = v.getJComponent();

        ret.setName(dm.getFieldName());

        return ret;
    }
View Full Code Here

                    stepper.addUpdateListener(new StepperUpdateListener());
                    getModel().addDataModelListener(new ArraySelectionListener());

                    try {
                        DataViewer stepperViewer = getFactory().createDefaultEditor(stepper);
                        getStepperPanel().add(stepperViewer.getJComponent());
                    } catch (Exception ex) {
                        //FIX
                        ex.printStackTrace();
                    }
                }
View Full Code Here

    public JComponent createJComponent(ViewerFactory factory) {
        JPanel buttonPanel = new JPanel(new GridBagLayout());
        JComponent button = null;
        DataModelCommand command;
        DataViewer buttonViewer;
        DataModelCommandVector commandVector = popupModel.getMethods();
        GridBagConstraints buttonConstr = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 2, 0, 2), 0, 0);

        if (commandVector != null) {

            for (command = commandVector.firstItem(); command != null; command = commandVector.nextItem()) {
                try {
                    buttonViewer = factory.createDefaultEditor(command);
                    button = buttonViewer.getJComponent();
                    buttonPanel.add(button, buttonConstr);
                    ++buttonConstr.gridx;
                } catch (Exception e) {
                    e.printStackTrace();
                }
View Full Code Here

        try {

            if (comp == null) {
                if (layout == null) {
                    // create comp with default viewer
                    DataViewer viewer = getFactory().createDefaultEditor(model);

                    comp = viewer.getJComponent();

                    add(comp);
                } else {

                    layout.doLayout(this);
View Full Code Here

            return;
        }

        try {
            DataViewer viewer = parent_viewer.getFactory().createViewer(actModel, parent_viewer.isEditor());

            viewer.setLayout((LayoutItem) layoutTable.get(modelName));

            JComponent comp = viewer.getJComponent();

            parent_viewer.add(comp);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of com.nexirius.framework.dataviewer.DataViewer

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.