-
-
Notifications
You must be signed in to change notification settings - Fork 96
Table creation wizard #907
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
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 love it, because I really want this feature. However, the wizard is extremely limited, like mixed content is not supported and a bit more (see the list below). It looks nice though.
Rename menu item toThere is no insert, oops. I'd add a separator underneath the start action and then "Table Creation Wizard" or "Insert Table..."Table
. You're inserting a table, not a table creation wizard.- It is not obvious how to insert new rows.
- You cannot make the table row-oriënted (or both).
- There is no cell merging.
- You have no control over border styles.
- By forcing a column type you restrict the user too much in my opinion. I'd go for mixed LaTeX content everywhere.
A (not so nice to use) but great illustration is tablesgenerator.com. The suggested changes might be a bit much. We should probably think of a requirement list for the wizard before adding anything, really.
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 think this is a great addition! Adding to @RubenSchellekens' comments:
- Add icon for the action (paging @RubenSchellekens)
- I think users need to have a choice in bordering (and whether to use the booktabs package)
- Add option to insert table caption either above or below the table itself
// Enclose with $ if the type of this column is math. | ||
val index = row.indexOf(it) | ||
val encloseWith = if (columnTypes[index] == ColumnType.MATH_COLUMN) "$" else "" | ||
encloseWith + it.toString() + encloseWith |
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 get an NPE here when I attempt to create a table as follows: two columns (text and numbers) with a single empty row.
Stacktrace
java.lang.NullPointerException
at nl.rubensten.texifyidea.action.tablewizard.LatexTableWizardAction$convertTableToLatex$1$processTableContent$$inlined$with$lambda$1$1.invoke(LatexTableWizardAction.kt:85)
at nl.rubensten.texifyidea.action.tablewizard.LatexTableWizardAction$convertTableToLatex$1$processTableContent$$inlined$with$lambda$1$1.invoke(LatexTableWizardAction.kt:22)
at kotlin.text.StringsKt__StringBuilderKt.appendElement(StringBuilder.kt:58)
at kotlin.collections.CollectionsKt___CollectionsKt.joinTo(_Collections.kt:2291)
at kotlin.collections.CollectionsKt___CollectionsKt.joinToString(_Collections.kt:2308)
at kotlin.collections.CollectionsKt___CollectionsKt.joinToString$defa ult(_Collections.kt:2307)
at nl.rubensten.texifyidea.action.tablewizard.LatexTableWizardAction$convertTableToLatex$1$processTableContent$$inlined$with$lambda$1.invoke(LatexTableWizardAction.kt:77)
at nl.rubensten.texifyidea.action.tablewizard.LatexTableWizardAction$convertTableToLatex$1$processTableContent$$inlined$with$lambda$1.invoke(LatexTableWizardAction.kt:22)
at kotlin.text.StringsKt__StringBuilderKt.appendElement(StringBuilder.kt:58)
at kotlin.collections.CollectionsKt___CollectionsKt.joinTo(_Collections.kt:2291)
at kotlin.collections.CollectionsKt___CollectionsKt.joinToString(_Collections.kt:2308)
at kotlin.collections.CollectionsKt___CollectionsKt.joinToString$default(_Collections.kt:2307)
at nl.rubensten.texifyidea.action.tablewizard.LatexTableWizardAction$convertTableToLatex$1.invoke(LatexTableWizardAction.kt:76)
at nl.rubensten.texifyidea.action.tablewizard.LatexTableWizardAction.convertTableToLatex(LatexTableWizardAction.kt:101)
at nl.rubensten.texifyidea.action.tablewizard.LatexTableWizardAction.convertTableToLatex$default(LatexTableWizardAction.kt:62)
at nl.rubensten.texifyidea.action.tablewizard.LatexTableWizardAction.actionPerformed(LatexTableWizardAction.kt:39)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:260)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:277)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:292)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:283)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:107)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:282)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:121)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:111)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:524)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:35)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:546)
at java.awt.Component.processMouseEvent(Component.java:6550)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
at java.awt.Component.processEvent(Component.java:6315)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4899)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4721)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4721)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:739)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:747)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:692)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:391)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
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 should be fixed now. When adding a column it would set all cells in the new column to null (instead of the empty string).
src/nl/rubensten/texifyidea/action/tablewizard/LatexTableWizardAction.kt
Outdated
Show resolved
Hide resolved
* @param title of the column. | ||
* @param typedColumnIndex is the column type of the column. | ||
*/ | ||
private val addColumnFun = fun(title: String, typedColumnIndex: Int, _: Int) { |
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.
Could be a method? Or am I missing something obvious here why it should be a property?
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 an anonymous function that is passed to the TableCreationEditColumnDialog
, it's the function that gets invoked when clicking OK.
} | ||
|
||
if (show() == DialogWrapper.OK_EXIT_CODE) { | ||
onOkFunction(columnNameField.text, columnTypeComboBox.selectedIndex, editingColumn) |
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 would prefer returning ColumnType.values()[columnTypeComboBox.selectedIndex]
here directly such that the index (which means nothing) is not used later on, and the column type is directly available.
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.
Yes, that makes more sense! Don't know why I didn't do that...
Please resolve merge conflicts |
# Conflicts: # src/nl/hannahsten/texifyidea/action/insert/InsertTable.kt # src/nl/hannahsten/texifyidea/action/tablewizard/LatexTableWizardAction.kt # src/nl/hannahsten/texifyidea/action/tablewizard/TableInformation.kt # src/nl/hannahsten/texifyidea/lang/Package.kt # src/nl/hannahsten/texifyidea/ui/tablecreationdialog/ColumnType.kt # src/nl/hannahsten/texifyidea/ui/tablecreationdialog/TableCreationDialogWrapper.kt # src/nl/hannahsten/texifyidea/ui/tablecreationdialog/TableCreationEditColumnDialog.kt # src/nl/hannahsten/texifyidea/ui/tablecreationdialog/TableCreationTableModel.kt
Adds a menu option
Edit
>Latex
>Table Creation Wizard
to display a table creation wizard (#154). The created table will be inserted at the location of the cursor (like the insert section actions).To do:
$$