Skip to content

Commit

Permalink
Merge pull request #32 from eBay/smuthkur/mobpay/26455
Browse files Browse the repository at this point in the history
[MOBPAY-26455] - Adjusting Mock check and validation window to size of Validations/Mocks instead of entire screen width
  • Loading branch information
yarg0007 authored May 5, 2023
2 parents 454d4d6 + 5994f37 commit 3bf6455
Showing 1 changed file with 25 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,48 +1,32 @@
package com.ebay.tool.thinmodelgen.gui.menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.filechooser.FileFilter;

import com.ebay.tool.thinmodelgen.gui.MainWindow;
import com.ebay.tool.thinmodelgen.gui.TMGuiConstants;
import com.ebay.tool.thinmodelgen.gui.file.recents.RecentFileManager;
import com.ebay.tool.thinmodelgen.gui.file.recents.RecentFileManagerObserver;
import com.ebay.tool.thinmodelgen.gui.menu.export.DeveloperMockExport;
import com.ebay.tool.thinmodelgen.gui.menu.export.ExportConstants;
import com.ebay.tool.thinmodelgen.gui.menu.export.ThinModelExport;
import com.ebay.tool.thinmodelgen.gui.menu.filemodel.FileModel;
import com.ebay.tool.thinmodelgen.gui.menu.filemodel.FileOperationHandler;
import com.ebay.tool.thinmodelgen.gui.menu.filemodel.NodeModel;
import com.ebay.tool.thinmodelgen.gui.menu.filemodel.TMFileSingleton;
import com.ebay.tool.thinmodelgen.gui.menu.filemodel.ValidationSetModel;
import com.ebay.tool.thinmodelgen.gui.menu.filemodel.*;
import com.ebay.tool.thinmodelgen.jsonschema.parser.SchemaParserPayload;
import com.ebay.tool.thinmodelgen.utility.MethodNameChecker;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;

@SuppressWarnings("serial")
public class TMBuilderMenu extends JMenuBar implements ActionListener, RecentFileManagerObserver {

Expand Down Expand Up @@ -385,11 +369,12 @@ private void doReviewValidationSet(String validationSetName) {
String message = new ThinModelExport().getValidationStatementsForValidationSet(setModel);
message = message.replaceAll("\t", "").trim();

JTextArea textArea = new JTextArea(25, 125);
textArea.setText(message);
textArea.setEditable(false);
JTextPane validationTextArea = new JTextPane();
validationTextArea.setText(message);
validationTextArea.setEditable(false);
validationTextArea.setPreferredSize(new Dimension(validationTextArea.getPreferredSize().width, validationTextArea.getPreferredSize().height));

JScrollPane scrollPane = new JScrollPane(textArea);
JScrollPane scrollPane = new JScrollPane(validationTextArea);
JOptionPane.showMessageDialog(MainWindow.getInstance(), scrollPane, String.format("Review Validation Set Output - %s", validationSetName), JOptionPane.INFORMATION_MESSAGE);

} catch (Exception e) {
Expand Down Expand Up @@ -425,11 +410,12 @@ private void doReviewMock(String validationSetName) {

String json = new DeveloperMockExport().getJsonFromValidationSet(coreValidationSet, setModel);

JTextArea textArea = new JTextArea(25, 125);
textArea.setText(json);
textArea.setEditable(false);
JTextPane validationMock = new JTextPane();
validationMock.setText(json);
validationMock.setEditable(false);
validationMock.setPreferredSize(new Dimension(validationMock.getPreferredSize().width, validationMock.getPreferredSize().height));

JScrollPane scrollPane = new JScrollPane(textArea);
JScrollPane scrollPane = new JScrollPane(validationMock);
JOptionPane.showMessageDialog(MainWindow.getInstance(), scrollPane, String.format("Review Validation Set Output - %s", validationSetName), JOptionPane.INFORMATION_MESSAGE);

} catch (Exception e) {
Expand Down

0 comments on commit 3bf6455

Please sign in to comment.