Wrapping a material-ui component in a library to re-use it in multiple other projects breaks styles - material-ui

The title already says it and we do have a working example. However, the library we have built does have it's own customTheme and uses styles to such an extent that we cannot just copy them to the projects importing the library.
Right now we do get the following error on multiple developer machines:
It looks like there are several instances of #material-ui/styles initialized in this application.
This may cause theme propagation issues, broken class names, specificity issues, and makes your application bigger without a good reason.
See https://material-ui.com/r/styles-instance-warning for more info.
Is there a best practice for creating Material-UI components in a library which can then be reimported into other projects with its styles and everything of course then inheriting colours etc. from the project the library is imported to.

Related

What is the difference between package and project in Eclipse?

I don't really understand what the point of having a package is. Every Class is kept in a different file, so what's the point of using different packages in a single project?
An Eclipse project has nothing to do with Java. It is a feature of Eclipse to organize and configure your different projects.
A Java package is a language feature of Java. You can use them to structure your project and control visibility between different classes. This becomes necessary even in relatively small projects, which already might have a few hundred classes. I suggest you look for a basic tutorial on what a Java package is and what it can do. To give you a headstart, here is what the official documentation has to say about the purpose of bundling related classes in a package:
You should bundle these classes and the interface in a package for several reasons, including the following:
You and other programmers can easily determine that these types are related.
You and other programmers know where to find types that can provide graphics-related functions.
The names of your types won't conflict with the type names in other packages because the package creates a new namespace.
You can allow types within the package to have unrestricted access to one another yet still restrict access for types outside the package.
Packages are useful for many things. For example, you could store a set of files that do a given task TASK in a package named task.
Packages are a way for developers to find easily and quickly a file, knowing what the role of the file is.
Whenever your project starts growing, packages are essential.
See this lesson for basic understanding of packages utility.

How can we develop custom themes in SAPUI5

i am working on theming concepts in SAPUI5 application.
I got to know that the theming can be done by using UI Theme Designer (which is a tool in SAP backend).
I got to know this from here.
Is it possible to develop a custom theme in SAPUI5 with out using Theme Designer.
There is a range of options, Theme Designer being the easiest and least flexible one, a completely written-from scratch CSS file the other extreme.
In between there are options like copying an existing theme, renaming it, and appending CSS parts that modify the existing appearance (this is also possible in Theme Designer!).
One main deciding factor is how different your theme should look from an existing one, and what your upgrade strategy is. Very different themes might be best created using the "base" theme as... well, base. But whenever you create lots of extra CSS you need to be aware that you have to adapt it to new UI5 releases. The Theme Designer does this automatically, as long as you don't add any custom CSS.
Before writing a theme from scratch or vastly modifying one, you should look at how large existing themes are and estimate whether you want and can develop and maintain such a thing on your own.
(Why are they so complex? 200 controls - and that's only the OpenUI5 subset - and many of them very powerful with different appearances and responsiveness, working across devices, and also appearing in right-to-left mode,... that's something no other framework offers, so of course the UI5 themes are larger than those of much smaller frameworks.)

Unit testing Eclipse's Editor logic in plugins : existing mocks/frameworks?

I'm working on a plugin which editor augments on the existing JDT (Java) editor
using aspects.
Now, Eclipse text editors that derive from AbstractTextEditor are
organized in clear components, following an MVC architecture. Those
components are then accessed through precise paths,
e.g. reconciliation. You can find one example of a custom reconciler and
the assumptions it can (and does) use on the behavior of the editor
here.
I'd like to write headless unit tests against those assumptions, that
would check that my weaving through aspects has not broken anything along
the way. For example, in the case of reconciliation, I would like to
open an editor, input some incorrect content (with respect to some
reconciliation strategy), wait for a while, and check that Problems are
indeed reported.
Note that which problems are reported, or how they would be signaled to
the user in a UI component doesn't concern me : I want
to test that my swapping a SourceViewer for a custom one through aspects
doesn't break editor logic, not my specific reconciliation strategy.
(In fact, I'd
probably mock it for that test. Moreover, the UI testing, being
presumably not runnable in a headless fashion, is beyond the scope of my
question.)
It seems this should be easy to do if the appropriate structures
existed. Do they ? Is there any test framework or mocks in sync with Eclipse's
architectural assumptions that would let me do what I have in mindĀ ? Those would have to reproduce workflow behavior of the existing Eclipse editor. Surely this would be among Eclipse's own unit tests, right ? ... though
I can't seem to find anything of the sort. Any ideasĀ ?
I have asked that same question on the eclipse core platform mailing-list, and got a great answer from Dani Megert giving me pointers to Eclipse's own test framework. The Junit plugin tests are released for download as part of the extended SDK, and browsing the git source lets you see there are already tests against the model or interacting with some of the Editor components.

Eclipse product: Export multiple versions of a product which has slight variations

This is a relatively open ended question so I wouldn't just mind being pointed in the right direction.
I have a product that uses the Eclipse workbench to allow users to program in a custom language. For this product, I will also have some minor UI and internal changes for a lighter version to be exported. For example, a full version of the product contains some extra views and menus, and behaves slightly differently (like when creating a new file) where as the ligher version does not contain a lot of view and has a couple of different more simplified ones.
I do not want to make a copy of my workspace and then have 2 separate workspaces for a full version and a lighter version as that will be difficult to maintain in the long run especially when there are changes in code relevant to both. I want to be able to export both, full and light versions of a product from a common workspace.
How can I go about this? Or where can I start looking?
The product is a collection of features and uses the Eclipse workbench as its base application.
I would like to clarify that I am asking how I could hide a view for the full or light version, as an example. I know in C#, we have options like #if. I have seen a lot of questions which refer to having 2 different versions of the same code, but nothing about how they could have 2 different versions of the same code.
You want the Eclipse RCP book it really fully explains how to do this. And to do it you need a solid understanding of the concepts of Eclipse plugin, feature, product, fragment and a few other things.
Essentially you can segment your application in to multiple plugins (have a base plugin for example, and then another that provides additional functionality). Then you organize those plugins into features that are the collection of the functionality to be installed. The notion of a "product" in Eclipse has to do with the branding, so you would probably have two products, a lite and a full one. The products could have a branding plugin (where the product is actually declared).
This should get you started.

Use ClientBundle in a large Enterprise Application?

We're building a large enterprise application (dozens of modules) with GWT and need to decide whether to use ClientBundle or not. I was curious what pros/cons the StackOverflow GWT community view as deal makers and deal breakers for such a use case.
As far as we see it currently:
Pros
All images/css files that take up server resources to download are eliminated
Client loads faster because of the above (i.e. inlined image urls)
CSS names are obfuscated, so namespace collisions are eliminated
CSS is automatically optimized / verified
Unused CSS classes are eliminated (above)
Java reference to class names are replaced with refactorable css interfaces
UiBinder reference to class names are replaced with refactorable css interfaces
No more big "main.css" fails as resources are module bundle specific
Cons
For maintenance CSS becomes either unreadable in obfuscated mode, or extremely verbose in debug mode
More steps needed for basic CSS work (like adding class)
All devs must know Java,CSS,HTML nuances
CSS3 and other at-rules (i.e. #font-face) are not supported by GWT natively
Increased compilation times
Thanks!
I have been using client bundle heavily in m-gwt.
One thing that was bothering me was styling for devices that did not have dev mode. So styling could mean recompiling the complete app.
Mostly all CSS3 Rules can be used in ClientBundle by using the literal function, so that should be okay. It gets a little tricker with #media queries. You can inject the css as a simple textresource as a workaround, but its kind of ugly.
When you are talking about several gwt modules, consider using multiple clientbundles so you can still use split points to keep the download file size under control (Depending on how big your .js files get)
I have used clientbundles in several big gwt apps and for me compile time checking and refactoring support beats the little quirks that are still in client bundles.
Just two additional notes:
There is a utility available in GWT which allows to automatically create the interfaces for your CSSResources
It's true that debugging styles can be a little bit cumbersome because of the obfuscated names. I had good success by using Firebug to change styles in dev-mode directly in the browser and when I am satisfied I change them in my GWT app.