-
Notifications
You must be signed in to change notification settings - Fork 10
Changes for discussion #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| @Outlet | ||
| private JMenuItem saveItem; | ||
| // --- UI Components (Injected by Sierra) --- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current convention is to declare outlets as follows, although obviously either will work.
Initializing the value to null avoids a warning in Intellij.
| @Outlet | ||
| private JSplitPane splitPane; | ||
|
|
||
| @Outlet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This outlet is not needed when the editor pane is declared in markup - see below.
| * business logic. | ||
| */ | ||
| public class MainFrame extends JFrame { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you plan to serialize the frame instance, this declaration isn't strictly necessary.
| private JLabel filePathLabel; // The <label> for the file path | ||
|
|
||
| // --- Manually Created Components --- | ||
| private RSyntaxTextArea editorPane; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to markup.
| private RSyntaxTextArea editorPane; | ||
|
|
||
| public MainFrame() { | ||
| super("Sierra UI Previewer"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - this is not needed.
| public class SierraPreviewerApp { | ||
|
|
||
| public static void main(String[] args) { | ||
| FlatLightLaf.setup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the recommended way to initialize FlatLaf.
| // --- Manually Created Components --- | ||
| private RSyntaxTextArea editorPane; | ||
| @Outlet | ||
| private RSyntaxTextArea editorPane; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing Sierra code uses spaces rather than tabs.
| setAutoActivationRules(true, "< "); | ||
| } | ||
|
|
||
| private void loadTags() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor simplification that avoids unnecessary local declarations.
| <label name="filePathLabel" text="" padding="4, 6, 4, 6"/> | ||
| <split-pane name="splitPane" resizeWeight="0.5" weight="1"> | ||
| <scroll-pane weight="1"> | ||
| <syntax-text-area name="editorPane" columns="80" rows="25" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare editor in markup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that this will make it seem like "syntax-text-area" is part of the standard distribution, which it is not. So maybe this is not a good idea after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah agree - only valid widgets should be in the xml - even if they are placeholders to be replaced at runtime
| codeFoldingEnabled="true" | ||
| antiAliasingEnabled="true"/> | ||
| </scroll-pane> | ||
| <column-panel name="previewPanel" padding="5, 5, 5, 5" weight="1"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop placeholder label that didn't seem to be visible in UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah at one point I had it showing and then somehow messed it up
| // Map to store the final resolved attributes for each tag | ||
| // TagName -> {AttributeName -> Description/ValueDefinitionString} | ||
| private final Map<String, Map<String, String>> elementAttributeDefinitions = new HashMap<>(); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace is trimmed.
lawson89
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greg - I am good with all these changes!
No description provided.